本文整理汇总了Java中com.orientechnologies.orient.core.metadata.function.OFunction类的典型用法代码示例。如果您正苦于以下问题:Java OFunction类的具体用法?Java OFunction怎么用?Java OFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OFunction类属于com.orientechnologies.orient.core.metadata.function包,在下文中一共展示了OFunction类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOFunctions
import com.orientechnologies.orient.core.metadata.function.OFunction; //导入依赖的package包/类
@Test
public void testOFunctions() throws Exception
{
ODatabaseDocument db = wicket.getTester().getDatabase();
ODocument doc = new ODocument(OFunction.CLASS_NAME);
doc.field("name", "testResurection");
doc.field("language", "JavaScript");
doc.field("idempotent", true);
doc.save();
ORID orid = doc.getIdentity();
for(int i=0;i<10;i++)
{
db = wicket.getTester().getDatabase();
String signature = "signature"+RANDOM.nextLong();
boolean isGoodCall = (i+1)%3 != 0;
db.begin();
doc = orid.getRecord();
String code = isGoodCall?"return \""+signature+"\";":"return nosuchvar;";
doc.field("code", code);
doc.save();
db.commit();
db.close();
if(isGoodCall)
{
String result;
for(int j=0; j<3;j++)
{
result = wicket.getTester().executeUrl("orientdb/function/db/testResurection", "GET", null);
assertContains(signature, result);
}
}
else
{
try
{
wicket.getTester().executeUrl("orientdb/function/db/testResurection", "GET", null);
assertFalse("We should be there, because function should have 400 response", true);
} catch (Exception e)
{
//NOP
}
}
}
}