Search in sources :

Example 6 with ConditionFunction

use of com.adaptris.core.services.conditional.conditions.ConditionFunction in project interlok by adaptris.

the class ConditionFunctionTest method testDefinition.

@Test
public void testDefinition() throws Exception {
    ConditionFunction condition = new ConditionFunction();
    assertNull(condition.getDefinition());
    condition.setDefinition("function evaluateScript(message) { return true;}");
    assertEquals("function evaluateScript(message) { return true;}", condition.getDefinition());
}
Also used : ConditionFunction(com.adaptris.core.services.conditional.conditions.ConditionFunction) Test(org.junit.Test)

Example 7 with ConditionFunction

use of com.adaptris.core.services.conditional.conditions.ConditionFunction in project interlok by adaptris.

the class ConditionFunctionTest method testScriptCondition_True.

@Test
public void testScriptCondition_True() throws Exception {
    ConditionFunction condition = new ConditionFunction("function evaluateScript(message) { return true;}");
    try {
        LifecycleHelper.initAndStart(condition);
        assertTrue(condition.evaluate(createMessage()));
    } finally {
        LifecycleHelper.stopAndClose(condition);
    }
}
Also used : ConditionFunction(com.adaptris.core.services.conditional.conditions.ConditionFunction) Test(org.junit.Test)

Aggregations

ConditionFunction (com.adaptris.core.services.conditional.conditions.ConditionFunction)7 Test (org.junit.Test)6 LogMessageService (com.adaptris.core.services.LogMessageService)1 ConditionAnd (com.adaptris.core.services.conditional.conditions.ConditionAnd)1 ConditionExpression (com.adaptris.core.services.conditional.conditions.ConditionExpression)1 ConditionMetadata (com.adaptris.core.services.conditional.conditions.ConditionMetadata)1 ConditionOr (com.adaptris.core.services.conditional.conditions.ConditionOr)1 Equals (com.adaptris.core.services.conditional.operator.Equals)1 NotNull (com.adaptris.core.services.conditional.operator.NotNull)1