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());
}
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) {
}
}
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");
}
}
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());
}
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;
}
Aggregations