use of com.adaptris.core.ServiceException 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");
}
}
use of com.adaptris.core.ServiceException 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.core.ServiceException 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.core.ServiceException in project interlok by adaptris.
the class XmlTransformServiceTest method testXSLT_FatalError.
@Test
public void testXSLT_FatalError() throws Exception {
AdaptrisMessage m1 = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
XmlTransformService service = new XmlTransformService();
service.setUrl(PROPERTIES.getProperty(KEY_XML_TEST_FATAL_TRANSFORM_URL));
try {
execute(service, m1);
fail("Exception expected but none thrown");
} catch (ServiceException expected) {
assertExceptionCause(expected, TransformerException.class, UncheckedXPathException.class);
}
}
use of com.adaptris.core.ServiceException in project interlok by adaptris.
the class XmlTransformServiceTest method testObtainUrlWithNoMetadataValueNoUrl.
@Test
public void testObtainUrlWithNoMetadataValueNoUrl() throws Exception {
AdaptrisMessage msg = new DefaultMessageFactory().newMessage();
XmlTransformService service = new XmlTransformService();
try {
service.setMetadataKey("key");
service.setAllowOverride(true);
LifecycleHelper.init(service);
try {
service.obtainUrlToUse(msg);
} catch (ServiceException expected) {
}
} finally {
LifecycleHelper.close(service);
}
}
Aggregations