use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class TestProperty method testCopy.
@Test
public void testCopy() {
Navajo n = NavajoFactory.getInstance().createNavajo();
Selection s1 = NavajoFactory.getInstance().createSelection(n, "aap", "aap", "0");
Selection s2 = NavajoFactory.getInstance().createSelection(n, "noot", "noot", "1");
Property p = NavajoFactory.getInstance().createProperty(n, "Selectie", "+", "", "out");
p.addSelection(s1);
p.addSelection(s2);
Message m = NavajoFactory.getInstance().createMessage(n, "Soep");
n.addMessage(m);
m.addProperty(p);
Navajo n2 = NavajoFactory.getInstance().createNavajo();
p.copy(n2);
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class TestProperty method tesSetAnyValue.
@Test
public void tesSetAnyValue() {
Navajo n = NavajoFactory.getInstance().createNavajo();
Property p1 = NavajoFactory.getInstance().createProperty(n, "Aap", "", "", "");
// String
p1.setAnyValue("Apenoot");
assertEquals("string", p1.getType());
assertEquals("Apenoot", p1.getValue());
assertTrue(p1.getTypedValue().equals("Apenoot"));
// Integer
p1.setAnyValue(Integer.valueOf(50));
assertEquals("integer", p1.getType());
assertEquals("50", p1.getValue());
assertTrue(p1.getTypedValue().equals(Integer.valueOf(50)));
// Double
p1.setAnyValue(Double.valueOf(50));
assertEquals("float", p1.getType());
assertEquals("50.0", p1.getValue());
assertTrue(p1.getTypedValue().equals(Double.valueOf(50)));
// Float
p1.setAnyValue(Float.valueOf(50));
assertEquals("float", p1.getType());
assertEquals("50.0", p1.getValue());
assertTrue(p1.getTypedValue().equals(Double.valueOf(50)));
// Date
Date d = new java.util.Date();
p1.setAnyValue(d);
String expectedFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS").format(d);
assertEquals("date", p1.getType());
assertEquals(expectedFormat, p1.getValue());
assertTrue(p1.getTypedValue().equals(d));
// Long
p1.setAnyValue(Long.valueOf(10));
assertEquals("long", p1.getType());
assertEquals("10", p1.getValue());
assertTrue(p1.getTypedValue().equals(Long.valueOf(10)));
// Boolean
p1.setAnyValue(Boolean.TRUE);
assertEquals("boolean", p1.getType());
assertEquals("true", p1.getValue());
assertTrue(p1.getTypedValue().equals(Boolean.TRUE));
// Binary
Binary b = new Binary("Mooie array".getBytes());
p1.setAnyValue(b);
assertEquals("binary", p1.getType());
Binary b1 = (Binary) p1.getTypedValue();
String expected = new String(b1.getData());
assertEquals("Mooie array", expected);
// Money
p1.setAnyValue(new Money(5000));
assertEquals("money", p1.getType());
assertEquals("5000.00", p1.getValue());
assertTrue(p1.getTypedValue().equals(new Money(5000)));
// ClockTime
Date d1 = new java.util.Date();
ClockTime ct = new ClockTime(d1);
String expectedFormat2 = ct.toString();
p1.setAnyValue(ct);
assertEquals("clocktime", p1.getType());
assertEquals(expectedFormat2, p1.getValue());
assertTrue(p1.getTypedValue().equals(new ClockTime(d1)));
// StopwatchTime
Date d2 = new java.util.Date();
String format = new SimpleDateFormat("HH:mm:ss:SSS").format(d2);
StopwatchTime swt = new StopwatchTime(format);
p1.setAnyValue(swt);
assertEquals("stopwatchtime", p1.getType());
logger.info("FORM: {} val: {}", format, p1.getValue());
assertEquals(format, p1.getValue());
assertTrue(p1.getTypedValue().equals(new StopwatchTime(format)));
// Percentage
Percentage p = new Percentage(50);
p1.setAnyValue(p);
assertEquals("percentage", p1.getType());
assertEquals("50.0", p1.getValue());
assertTrue(p1.getTypedValue().equals(new Percentage(50)));
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class PerformanceTest method testSearchClub.
@Test
public void testSearchClub() throws ClientException {
int count = 5;
for (int i = 0; i < count; i++) {
Navajo init = client.doSimpleSend(null, "club/InitSearchClub");
init.getProperty("ClubSearch/ClubName").setAnyValue(randomString(3));
Navajo process = client.doSimpleSend(init, "club/ProcessSearchClub");
process.write(System.out);
}
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class ScriptTestCase method setUp.
@Before
protected void setUp() throws Exception {
if (skipAllTests) {
return;
}
Navajo input = null;
input = acquireInput();
if (input == null) {
String inputName = getInputName();
if (inputName == null) {
input = NavajoFactory.getInstance().createNavajo();
} else {
System.err.println("Input found: " + inputName);
input = ScriptTestContext.getInstance().getInput(inputName);
}
}
prepareInput(input);
String scriptName = getScriptName();
Navajo result = ScriptTestContext.getInstance().getScriptResult(scriptName);
if (result == null) {
result = ScriptTestContext.getInstance().callService(scriptName, input);
}
}
use of com.dexels.navajo.document.Navajo in project navajo by Dexels.
the class RDShapeImport method storeBinaryShapeRecord.
private void storeBinaryShapeRecord(String shapeId, File recordFile) {
try {
Binary data = new Binary(recordFile);
Navajo pms = NavajoClientFactory.getClient().doSimpleSend(null, "geospatial/InitInsertCBSPolyPoint");
Message params = pms.getMessage("Parameters");
if (params != null) {
params.getProperty("ShapeId").setValue(shapeId);
params.getProperty("ShapeData").setValue(data);
NavajoClientFactory.getClient().doSimpleSend(params.getRootDoc(), "geospatial/ProcessInsertCBSPolyPoint");
}
} catch (Exception e) {
logger.error("Error: ", e);
}
}
Aggregations