Search in sources :

Example 16 with Navajo

use of com.dexels.navajo.document.Navajo in project navajo by Dexels.

the class StandardFunctionsTest method testEvaluateExpression.

@Test
public void testEvaluateExpression() {
    DispatcherFactory.createDispatcher(new TestDispatcher(new TestNavajoConfig()));
    FunctionInterface fi = fff.getInstance(cl, "EvaluateExpression");
    fi.reset();
    Navajo doc = createTestNavajo();
    Header h = NavajoFactory.getInstance().createHeader(doc, "aap", "noot", "mies", -1);
    doc.addHeader(h);
    fi.setInMessage(doc);
    fi.insertStringOperand("true");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
}
Also used : TestNavajoConfig(com.dexels.navajo.server.test.TestNavajoConfig) FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Header(com.dexels.navajo.document.Header) TestDispatcher(com.dexels.navajo.server.test.TestDispatcher) Navajo(com.dexels.navajo.document.Navajo) Test(org.junit.Test)

Example 17 with Navajo

use of com.dexels.navajo.document.Navajo in project navajo by Dexels.

the class StandardFunctionsTest method testGetLogoImage.

@Test
public void testGetLogoImage() {
    FunctionInterface fi = fff.getInstance(cl, "GetLogoImage");
    Navajo doc = createTestNavajo();
    fi.setInMessage(doc);
    fi.reset();
    fi.insertStringOperand("Logo");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(Binary.class, o.getClass());
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Navajo(com.dexels.navajo.document.Navajo) Test(org.junit.Test)

Example 18 with Navajo

use of com.dexels.navajo.document.Navajo in project navajo by Dexels.

the class StandardFunctionsTest method testGetProperty.

@Test
public void testGetProperty() {
    FunctionInterface fi = fff.getInstance(cl, "GetProperty");
    fi.reset();
    Navajo doc = createTestNavajo();
    fi.setInMessage(doc);
    fi.insertMessageOperand(doc.getMessage("Single"));
    fi.insertStringOperand("Selectie");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertTrue(Property.class.isInstance(o));
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Navajo(com.dexels.navajo.document.Navajo) Property(com.dexels.navajo.document.Property) Test(org.junit.Test)

Example 19 with Navajo

use of com.dexels.navajo.document.Navajo in project navajo by Dexels.

the class StandardFunctionsTest method testNavajoRequestToString.

@Test
public void testNavajoRequestToString() {
    FunctionInterface fi = fff.getInstance(cl, "NavajoRequestToString");
    fi.reset();
    Navajo n = createTestNavajo();
    fi.setInMessage(n);
    Object o = fi.evaluate();
    assertTrue(((String) o).indexOf("Aap") != -1);
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Navajo(com.dexels.navajo.document.Navajo) CapString(com.dexels.navajo.functions.CapString) Test(org.junit.Test)

Example 20 with Navajo

use of com.dexels.navajo.document.Navajo in project navajo by Dexels.

the class StandardFunctionsTest method testGetMessage.

@Test
public void testGetMessage() {
    FunctionInterface fi = fff.getInstance(cl, "GetMessage");
    fi.reset();
    Navajo doc = createTestNavajo();
    fi.setInMessage(doc);
    fi.insertMessageOperand(doc.getMessage("Aap"));
    fi.insertIntegerOperand(0);
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Navajo(com.dexels.navajo.document.Navajo) Test(org.junit.Test)

Aggregations

Navajo (com.dexels.navajo.document.Navajo)258 Message (com.dexels.navajo.document.Message)131 Test (org.junit.Test)109 Property (com.dexels.navajo.document.Property)86 NavajoException (com.dexels.navajo.document.NavajoException)31 Access (com.dexels.navajo.script.api.Access)30 IOException (java.io.IOException)28 StringWriter (java.io.StringWriter)27 TMLExpressionException (com.dexels.navajo.expression.api.TMLExpressionException)26 FunctionInterface (com.dexels.navajo.expression.api.FunctionInterface)25 ImmutableMessage (com.dexels.immutable.api.ImmutableMessage)22 Selection (com.dexels.navajo.document.Selection)22 Header (com.dexels.navajo.document.Header)20 Operand (com.dexels.navajo.document.Operand)20 InputStream (java.io.InputStream)17 UserException (com.dexels.navajo.script.api.UserException)16 Optional (java.util.Optional)16 FatalException (com.dexels.navajo.script.api.FatalException)14 SystemException (com.dexels.navajo.script.api.SystemException)14 ContextExpression (com.dexels.navajo.expression.api.ContextExpression)13