use of com.adaptris.core.ServiceException in project interlok by adaptris.
the class ValidateMetadataServiceTest method testNoRequirements.
@Test
public void testNoRequirements() throws Exception {
ValidateMetadataService service = new ValidateMetadataService();
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("asdfghjk");
msg.addMetadata("key", "val");
try {
execute(service, msg);
} catch (ServiceException e) {
fail();
}
}
use of com.adaptris.core.ServiceException in project interlok by adaptris.
the class ValidateMetadataServiceTest method testOneRequirementMet.
@Test
public void testOneRequirementMet() throws Exception {
ValidateMetadataService service = new ValidateMetadataService(Arrays.asList(new String[] { "key" }));
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("asdfghjk");
msg.addMetadata("key", "val");
try {
execute(service, msg);
} catch (ServiceException e) {
fail();
}
}
use of com.adaptris.core.ServiceException in project interlok by adaptris.
the class ValidateMetadataServiceTest method testtwoRequirementsOnePresent.
@Test
public void testtwoRequirementsOnePresent() throws Exception {
ValidateMetadataService service = new ValidateMetadataService(Arrays.asList(new String[] { "key", "key2" }));
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("asdfghjk");
msg.addMetadata("key", "val");
try {
execute(service, msg);
fail();
} catch (ServiceException e) {
// expected
}
}
use of com.adaptris.core.ServiceException in project interlok by adaptris.
the class PayloadHashingServiceTest method testServiceException.
@Test
public void testServiceException() throws Exception {
PayloadHashingService service = new PayloadHashingService(SHA256, METADATA_KEY);
AdaptrisMessage msg = new DefectiveMessageFactory().newMessage(PAYLOAD);
try {
execute(service, msg);
fail();
} catch (ServiceException e) {
;
}
}
use of com.adaptris.core.ServiceException in project interlok by adaptris.
the class XpathMetadataServiceTest method testDoService_DocType_DefaultBehaviour.
@Test
public void testDoService_DocType_DefaultBehaviour() throws CoreException {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_WITH_DOCTYPE);
// Default document factory should disable doctyps.
XpathMetadataService service = new XpathMetadataService();
// Shouldn't matter what the query actually is.
service.setXpathQueries(new ArrayList<XpathQuery>(Arrays.asList(new ConfiguredXpathQuery("source", "//source-id"), new ConfiguredXpathQuery("destination", "//destination-id"))));
try {
execute(service, msg);
fail();
} catch (ServiceException expected) {
assertTrue(expected.getMessage().contains("DOCTYPE is disallowed"));
}
}
Aggregations