本文整理匯總了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
}
}
}
}