use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class ServerAsyncRunner method run.
/**
* Main thread
*/
@Override
public void run() {
try {
prevTime = System.currentTimeMillis();
while (isIterating()) {
if (kill) {
logger.warn("Kill called in ServerAsyncRunner...");
myResult.getHeader().setCallBackInterrupt("kill");
setIterating(false);
}
if (myPollingInterval > 0) {
myNavajo.removeHeader();
myNavajo.addHeader(myResult.getHeader());
Navajo temp = doSimpleSend(myNavajo, myMethod);
if (temp.getMessage("ConditionErrors") != null) {
logger.warn("Had ConditionErrors in Asyncsend.. ");
killServerAsyncSend();
} else {
poll(temp);
}
}
}
} catch (ClientException ex) {
logger.debug("oooops");
myListener.handleException(ex);
return;
}
if (myListener != null) {
myListener.handleException(new ClientException(-1, -1, "Operation aborted"));
}
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class SerializationUtilTest method testRemove3.
@Test
public void testRemove3() {
Navajo n = NavajoFactory.getInstance().createNavajo();
Message m = NavajoFactory.getInstance().createMessage(n, "TestMessage");
n.addMessage(m);
String name = SerializationUtil.serializeNavajo(n, "TestNavajo");
Assert.assertEquals(true, SerializationUtil.existsNavajo("TestNavajo"));
SerializationUtil.removeNavajo("Apenoot");
Assert.assertEquals(false, SerializationUtil.existsNavajo("Apenoot"));
SerializationUtil.removeNavajo(name);
Assert.assertEquals(false, SerializationUtil.existsNavajo("TestNavajo"));
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class DomainObjectMapperTest method testStoreWithMultipleSelectionProperty.
@Test
public void testStoreWithMultipleSelectionProperty() throws Exception {
// The other way around, with an input Navajo with property that does
// have an associated attribute.
Navajo doc = NavajoFactory.getInstance().createNavajo();
Message m = NavajoFactory.getInstance().createMessage(doc, "MyMessage");
doc.addMessage(m);
Property p1 = NavajoFactory.getInstance().createProperty(doc, "Id", "string", "hello", 0, "", "in");
Property p2 = NavajoFactory.getInstance().createProperty(doc, "Selection", "+", "", "in");
m.addProperty(p1);
m.addProperty(p2);
// Add selections...
Selection s1 = NavajoFactory.getInstance().createSelection(doc, "aap", "AAP", true);
Selection s2 = NavajoFactory.getInstance().createSelection(doc, "noot", "NOOT", true);
Selection s3 = NavajoFactory.getInstance().createSelection(doc, "mies", "MIES", false);
p2.addSelection(s1);
p2.addSelection(s2);
p2.addSelection(s3);
Access a = new Access();
a.setInDoc(doc);
DomainObjectMapper dom2 = new DomainObjectMapper();
dom2.setCurrentMessageName("MyMessage");
dom2.load(a);
dom2.setObjectName("com.dexels.navajo.mapping.bean.Relation");
boolean exception = false;
try {
dom2.store();
} catch (Exception e) {
exception = true;
}
// Multiple cardinality is not yet supported, hence exception.
assertTrue(exception);
// Object o = dom2.getMyObject();
// assertNotNull(o);
// assertEquals(Relation.class, o.getClass());
// assertEquals("hello", ((Relation) o).getId());
// assertEquals("NOOT", ((Relation) o).getSelection());
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class DomainObjectMapperTest method testSetInputProperties.
@Test
public void testSetInputProperties() throws Exception {
TestPOJO tp = new TestPOJO();
tp.setName("hallo");
DomainObjectMapper dom = new DomainObjectMapper(tp);
Access a = new Access();
Navajo doc = NavajoFactory.getInstance().createNavajo();
a.setOutputDoc(doc);
Message m = NavajoFactory.getInstance().createMessage(doc, "Test");
doc.addMessage(m);
a.setCurrentOutMessage(m);
dom.load(a);
dom.setInputProperties("name;birthdate");
dom.store();
assertNotNull(doc.getProperty("/Test/Name"));
assertEquals("in", doc.getProperty("/Test/Name").getDirection());
assertEquals("hallo", doc.getProperty("/Test/Name").getValue());
assertNotNull(doc.getProperty("/Test/Something"));
assertEquals("out", doc.getProperty("/Test/Something").getDirection());
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class DomainObjectMapperTest method testStoreWithSelectionProperty.
@Test
public void testStoreWithSelectionProperty() throws Exception {
// The other way around, with an input Navajo with property that does
// have an associated attribute.
Navajo doc = NavajoFactory.getInstance().createNavajo();
Message m = NavajoFactory.getInstance().createMessage(doc, "MyMessage");
doc.addMessage(m);
Property p1 = NavajoFactory.getInstance().createProperty(doc, "Id", "string", "hello", 0, "", "in");
Property p2 = NavajoFactory.getInstance().createProperty(doc, "Selection", "1", "", "in");
m.addProperty(p1);
m.addProperty(p2);
// Add selections...
Selection s1 = NavajoFactory.getInstance().createSelection(doc, "aap", "AAP", false);
Selection s2 = NavajoFactory.getInstance().createSelection(doc, "noot", "NOOT", true);
p2.addSelection(s1);
p2.addSelection(s2);
Access a = new Access();
a.setInDoc(doc);
DomainObjectMapper dom2 = new DomainObjectMapper();
dom2.setCurrentMessageName("MyMessage");
dom2.load(a);
dom2.setObjectName("com.dexels.navajo.mapping.bean.Relation");
dom2.store();
Object o = dom2.getMyObject();
assertNotNull(o);
assertEquals(Relation.class, o.getClass());
assertEquals("hello", ((Relation) o).getId());
assertEquals("NOOT", ((Relation) o).getSelection());
}
Aggregations