Search in sources :

Example 1 with IsNullContentValidation

use of com.adaptris.transform.validate.IsNullContentValidation in project interlok by adaptris.

the class XmlRuleValidatorTest method testIsNullContentValidation_DataNotNull.

@Test
public void testIsNullContentValidation_DataNotNull() throws Exception {
    XmlRuleValidator validator = new XmlRuleValidator();
    validator.addValidationStage(new ValidationStage(XPATH_ITERATION_CHILDREN_OF_ZEUS, XPATH_CHILD_NAME, new IsNullContentValidation()));
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage(XML_FAMILY_TREE);
    XmlValidationService service = new XmlValidationService(validator);
    try {
        ExampleServiceCase.execute(service, msg);
        fail("RuleValidationService sucess when expecting failure");
    } catch (ServiceException e) {
    }
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) IsNullContentValidation(com.adaptris.transform.validate.IsNullContentValidation) ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) ValidationStage(com.adaptris.transform.validate.ValidationStage) Test(org.junit.Test)

Example 2 with IsNullContentValidation

use of com.adaptris.transform.validate.IsNullContentValidation in project interlok by adaptris.

the class XmlRuleValidatorTest method testIsNullContentValidation_DataIsNull.

@Test
public void testIsNullContentValidation_DataIsNull() throws Exception {
    XmlRuleValidator validator = new XmlRuleValidator();
    // Hades had no children; poor god.
    ValidationStage vs = new ValidationStage(XPATH_ITERATION_CHILDREN_OF_HADES, XPATH_CHILD_NAME, new IsNullContentValidation());
    validator.addValidationStage(vs);
    AdaptrisMessage msg = new DefaultMessageFactory().newMessage(XML_FAMILY_TREE);
    XmlValidationService service = new XmlValidationService(validator);
    try {
        ExampleServiceCase.execute(service, msg);
    } catch (ServiceException e) {
        fail("RuleValidationService failure when expecting success");
    }
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) IsNullContentValidation(com.adaptris.transform.validate.IsNullContentValidation) ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) ValidationStage(com.adaptris.transform.validate.ValidationStage) Test(org.junit.Test)

Aggregations

AdaptrisMessage (com.adaptris.core.AdaptrisMessage)2 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)2 ServiceException (com.adaptris.core.ServiceException)2 IsNullContentValidation (com.adaptris.transform.validate.IsNullContentValidation)2 ValidationStage (com.adaptris.transform.validate.ValidationStage)2 Test (org.junit.Test)2