use of com.adaptris.transform.validate.SimpleListContentValidation in project interlok by adaptris.
the class XmlRuleValidatorTest method testMultipleContentValidation.
@Test
public void testMultipleContentValidation() throws Exception {
XmlRuleValidator validator = new XmlRuleValidator();
ValidationStage vs = new ValidationStage(XPATH_ITERATION_CHILDREN_OF_ZEUS, XPATH_CHILDREN_OF_HERA, new SimpleListContentValidation(CHILDREN_OF_HERA), new NotNullContentValidation());
validator.addValidationStage(vs);
ValidationStage vs2 = new ValidationStage(XPATH_ITERATION_CHILDREN_OF_CRONOS, XPATH_CHILDREN_OF_RHEA, new SimpleListContentValidation(CHILDREN_OF_RHEA), new NotNullContentValidation());
validator.addValidationStage(vs2);
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");
}
}
use of com.adaptris.transform.validate.SimpleListContentValidation in project interlok by adaptris.
the class XmlRuleValidatorTest method testListContentValidation_DataInList.
@Test
public void testListContentValidation_DataInList() throws Exception {
XmlRuleValidator validator = new XmlRuleValidator();
validator.setXmlDocumentFactoryConfig(DocumentBuilderFactoryBuilder.newInstance());
validator.setValidationStages(Arrays.asList(new ValidationStage[] { new ValidationStage(XPATH_ITERATION_CHILDREN_OF_ZEUS, XPATH_CHILDREN_OF_HERA, new SimpleListContentValidation(CHILDREN_OF_HERA)) }));
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");
}
}
use of com.adaptris.transform.validate.SimpleListContentValidation in project interlok by adaptris.
the class XmlRuleValidatorTest method testListContentValidation_WithNamespace.
@Test
public void testListContentValidation_WithNamespace() throws Exception {
XmlRuleValidator validator = new XmlRuleValidator();
validator.setNamespaceContext(createNamespaceHolder());
ValidationStage vs = new ValidationStage(XPATH_NS_ITERATION_TITAN_NAMES, XPATH_NS_TITAN_NAME, new SimpleListContentValidation(THE_TWELVE_TITANS), new NotNullContentValidation());
validator.addValidationStage(vs);
AdaptrisMessage msg = new DefaultMessageFactory().newMessage(XML_WITH_NAMESEPACE);
XmlValidationService service = new XmlValidationService(validator);
try {
ExampleServiceCase.execute(service, msg);
} catch (ServiceException e) {
fail("RuleValidationService failure when expecting success");
}
}
use of com.adaptris.transform.validate.SimpleListContentValidation in project interlok by adaptris.
the class XmlRuleValidatorTest method testListContentValidation_WithNamespaceDataNotInList.
@Test
public void testListContentValidation_WithNamespaceDataNotInList() throws Exception {
XmlRuleValidator validator = new XmlRuleValidator();
validator.setNamespaceContext(createNamespaceHolder());
ValidationStage vs = new ValidationStage(XPATH_NS_ITERATION_OLYMPIAN_NAMES, XPATH_NS_OLYMPIAN_NAME, new SimpleListContentValidation(THE_TWELVE_TITANS), new NotNullContentValidation());
validator.addValidationStage(vs);
AdaptrisMessage msg = new DefaultMessageFactory().newMessage(XML_WITH_NAMESEPACE);
XmlValidationService service = new XmlValidationService(validator);
try {
ExampleServiceCase.execute(service, msg);
fail("RuleValidationService success when expecting exception");
} catch (ServiceException e) {
// expected
;
}
}
use of com.adaptris.transform.validate.SimpleListContentValidation in project interlok by adaptris.
the class XmlRuleValidatorTest method testListContentValidation_DataNotInList.
@Test
public void testListContentValidation_DataNotInList() throws Exception {
XmlRuleValidator validator = new XmlRuleValidator();
validator.addValidationStage(new ValidationStage(XPATH_ITERATION_CHILDREN_OF_ZEUS, XPATH_CHILDREN_OF_DEMETER, new SimpleListContentValidation(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 exception");
} catch (ServiceException e) {
// expected
;
}
}
Aggregations