Search in sources :

Example 1 with NotInListContentValidation

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

the class ListContentValidationTest method testNotInListContentValidation_SetListEntries.

@Test
public void testNotInListContentValidation_SetListEntries() {
    NotInListContentValidation cv = new NotInListContentValidation(entry2, entry1);
    cv.setListEntries(new ArrayList<String>(Arrays.asList(entry1, entry2)));
    assertEquals(2, cv.getListEntries().size());
    assertEquals(new ArrayList<String>(Arrays.asList(entry1, entry2)), cv.getListEntries());
}
Also used : NotInListContentValidation(com.adaptris.transform.validate.NotInListContentValidation) Test(org.junit.Test)

Example 2 with NotInListContentValidation

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

the class XmlRuleValidatorTest method testNotInListContentValidation_DataInList.

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

Example 3 with NotInListContentValidation

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

the class XmlRuleValidatorTest method testNotInListContentValidation_DataNotInList.

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

Example 4 with NotInListContentValidation

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

the class ListContentValidationTest method testNotInListContentValidation_AddListEntry.

@Test
public void testNotInListContentValidation_AddListEntry() {
    NotInListContentValidation cv = new NotInListContentValidation();
    assertNotNull(cv.getListEntries());
    assertEquals(0, cv.getListEntries().size());
    cv.addListEntry(entry1);
    cv.addListEntry(entry2);
    assertEquals(2, cv.getListEntries().size());
    assertEquals(new ArrayList<String>(Arrays.asList(entry1, entry2)), cv.getListEntries());
}
Also used : NotInListContentValidation(com.adaptris.transform.validate.NotInListContentValidation) Test(org.junit.Test)

Example 5 with NotInListContentValidation

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

the class XmlRuleValidatorTest method createSample.

static XmlRuleValidator createSample() {
    XmlRuleValidator validator = new XmlRuleValidator();
    ValidationStage stage1 = new ValidationStage(XPATH_ITERATION_CHILDREN_OF_CRONOS, XPATH_CHILDREN_OF_RHEA, new NotNullContentValidation(), new SimpleListContentValidation(CHILDREN_OF_RHEA));
    validator.addValidationStage(stage1);
    ValidationStage stage2 = new ValidationStage(XPATH_ITERATION_CHILDREN_OF_ZEUS, XPATH_CHILDREN_OF_HERA, new NotNullContentValidation(), new SimpleListContentValidation(CHILDREN_OF_HERA));
    validator.addValidationStage(stage2);
    ValidationStage stage3 = new ValidationStage(XPATH_ITERATION_CHILDREN_OF_ZEUS, XPATH_CHILDREN_OF_LETO, new NotNullContentValidation(), new NotInListContentValidation(CHILDREN_OF_HERA));
    validator.addValidationStage(stage3);
    return validator;
}
Also used : NotNullContentValidation(com.adaptris.transform.validate.NotNullContentValidation) SimpleListContentValidation(com.adaptris.transform.validate.SimpleListContentValidation) NotInListContentValidation(com.adaptris.transform.validate.NotInListContentValidation) ValidationStage(com.adaptris.transform.validate.ValidationStage)

Aggregations

NotInListContentValidation (com.adaptris.transform.validate.NotInListContentValidation)5 Test (org.junit.Test)4 ValidationStage (com.adaptris.transform.validate.ValidationStage)3 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)2 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)2 ServiceException (com.adaptris.core.ServiceException)2 NotNullContentValidation (com.adaptris.transform.validate.NotNullContentValidation)1 SimpleListContentValidation (com.adaptris.transform.validate.SimpleListContentValidation)1