Search in sources :

Example 1 with IsNull

use of com.adaptris.core.services.conditional.operator.IsNull in project interlok by adaptris.

the class DoWhileTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    ConditionMetadata condition = new ConditionMetadata();
    condition.setMetadataKey("key1");
    condition.setOperator(new NotNull());
    ConditionMetadata condition2 = new ConditionMetadata();
    condition2.setMetadataKey("key2");
    condition2.setOperator(new IsNull());
    ConditionOr conditionOr = new ConditionOr();
    conditionOr.getConditions().add(condition);
    conditionOr.getConditions().add(condition2);
    ThenService thenSrvc = new ThenService();
    thenSrvc.setService(new LogMessageService());
    doWhile.setCondition(conditionOr);
    doWhile.setThen(thenSrvc);
    DoWhile doWhile = new DoWhile();
    doWhile.setCondition(conditionOr);
    doWhile.setThen(thenSrvc);
    return doWhile;
}
Also used : ConditionOr(com.adaptris.core.services.conditional.conditions.ConditionOr) LogMessageService(com.adaptris.core.services.LogMessageService) ConditionMetadata(com.adaptris.core.services.conditional.conditions.ConditionMetadata) IsNull(com.adaptris.core.services.conditional.operator.IsNull) NotNull(com.adaptris.core.services.conditional.operator.NotNull)

Example 2 with IsNull

use of com.adaptris.core.services.conditional.operator.IsNull in project interlok by adaptris.

the class WhileTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    ConditionMetadata condition = new ConditionMetadata();
    condition.setMetadataKey("key1");
    condition.setOperator(new NotNull());
    ConditionMetadata condition2 = new ConditionMetadata();
    condition2.setMetadataKey("key2");
    condition2.setOperator(new IsNull());
    ConditionOr conditionOr = new ConditionOr();
    conditionOr.getConditions().add(condition);
    conditionOr.getConditions().add(condition2);
    ThenService thenSrvc = new ThenService();
    thenSrvc.setService(new LogMessageService());
    logicalExpression.setCondition(conditionOr);
    logicalExpression.setThen(thenSrvc);
    // We init and start the service in the setup, lets stop it.
    try {
        StopMe(logicalExpression);
    } catch (Exception e) {
    }
    return logicalExpression;
}
Also used : ConditionOr(com.adaptris.core.services.conditional.conditions.ConditionOr) LogMessageService(com.adaptris.core.services.LogMessageService) ConditionMetadata(com.adaptris.core.services.conditional.conditions.ConditionMetadata) IsNull(com.adaptris.core.services.conditional.operator.IsNull) NotNull(com.adaptris.core.services.conditional.operator.NotNull) ServiceException(com.adaptris.core.ServiceException) CoreException(com.adaptris.core.CoreException)

Example 3 with IsNull

use of com.adaptris.core.services.conditional.operator.IsNull in project interlok by adaptris.

the class ConditionMetadataTest method testMetadataDoesNotExist.

@Test
public void testMetadataDoesNotExist() throws Exception {
    condition.setMetadataKey("key1");
    condition.setOperator(new IsNull());
    assertTrue(condition.evaluate(message));
}
Also used : IsNull(com.adaptris.core.services.conditional.operator.IsNull) Test(org.junit.Test)

Example 4 with IsNull

use of com.adaptris.core.services.conditional.operator.IsNull in project interlok by adaptris.

the class ConditionPayloadTest method testPayloadDoesNotExist.

@Test
public void testPayloadDoesNotExist() throws Exception {
    condition.setOperator(new IsNull());
    assertTrue(condition.evaluate(message));
}
Also used : IsNull(com.adaptris.core.services.conditional.operator.IsNull) Test(org.junit.Test)

Example 5 with IsNull

use of com.adaptris.core.services.conditional.operator.IsNull in project interlok by adaptris.

the class IsNullTest method setUp.

@Before
public void setUp() throws Exception {
    operator = new IsNull();
    message = DefaultMessageFactory.getDefaultInstance().newMessage();
}
Also used : IsNull(com.adaptris.core.services.conditional.operator.IsNull) Before(org.junit.Before)

Aggregations

IsNull (com.adaptris.core.services.conditional.operator.IsNull)5 LogMessageService (com.adaptris.core.services.LogMessageService)2 ConditionMetadata (com.adaptris.core.services.conditional.conditions.ConditionMetadata)2 ConditionOr (com.adaptris.core.services.conditional.conditions.ConditionOr)2 NotNull (com.adaptris.core.services.conditional.operator.NotNull)2 Test (org.junit.Test)2 CoreException (com.adaptris.core.CoreException)1 ServiceException (com.adaptris.core.ServiceException)1 Before (org.junit.Before)1