Search in sources :

Example 6 with ServiceException

use of com.adaptris.core.ServiceException in project interlok by adaptris.

the class VerifyIdentityServiceTest method testDefaultService.

@Test
public void testDefaultService() throws Exception {
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
    msg.addMetadata(USER, getName() + ThreadLocalRandom.current().nextInt());
    msg.addMetadata(PASSWORD, getName() + ThreadLocalRandom.current().nextInt());
    msg.addMetadata(ROLE, getName() + ThreadLocalRandom.current().nextInt());
    VerifyIdentityService service = new VerifyIdentityService();
    try {
        execute(service, msg);
        fail();
    } catch (ServiceException expected) {
    }
}
Also used : ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 7 with ServiceException

use of com.adaptris.core.ServiceException in project interlok by adaptris.

the class EncryptionServiceCase method testRoundTripWithBadMetadata.

@Test
public void testRoundTripWithBadMetadata() throws Exception {
    String url = createKeystore();
    CoreSecurityService input = create();
    applyConfigForTests(input, url);
    input.setRemotePartner(null);
    input.setRemotePartnerMetadataKey("MyRemotePartner");
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(EXAMPLE_MSG);
    msg.addMetadata(CoreConstants.SECURITY_REMOTE_PARTNER, PROPERTIES.getProperty(SECURITY_ALIAS));
    try {
        execute(input, msg);
        fail("Expected Exception from doService");
    } catch (ServiceException e) {
        ;
    }
}
Also used : ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 8 with ServiceException

use of com.adaptris.core.ServiceException in project interlok by adaptris.

the class GunzipServiceTest method testUnZipWithInvalidZip.

@Test
public void testUnZipWithInvalidZip() throws Exception {
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(LINE);
    try {
        execute(new GunzipService(), msg);
        fail("Gunzip on [" + LINE + "] succeeded");
    } catch (ServiceException expected) {
        ;
    }
}
Also used : ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 9 with ServiceException

use of com.adaptris.core.ServiceException in project interlok by adaptris.

the class GzipServiceTest method testZipServiceFailure.

@Test
public void testZipServiceFailure() throws Exception {
    AdaptrisMessage msg = new DefectiveMessageFactory().newMessage(LINE, "UTF-8");
    try {
        execute(new GzipService(), msg);
        fail();
    } catch (ServiceException expected) {
        ;
    }
}
Also used : DefectiveMessageFactory(com.adaptris.core.stubs.DefectiveMessageFactory) ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 10 with ServiceException

use of com.adaptris.core.ServiceException in project interlok by adaptris.

the class InputOutputServiceTest method testService_BrokenInput.

@Test
public void testService_BrokenInput() throws Exception {
    AdaptrisMessage msg = new DefectiveMessageFactory(DefectiveMessageFactory.WhenToBreak.INPUT).newMessage("hello world");
    try {
        execute(new InputOutputService(), msg);
        fail();
    } catch (ServiceException expected) {
    }
}
Also used : DefectiveMessageFactory(com.adaptris.core.stubs.DefectiveMessageFactory) ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Aggregations

ServiceException (com.adaptris.core.ServiceException)236 Test (org.junit.Test)172 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)161 CoreException (com.adaptris.core.CoreException)45 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)26 StandaloneProducer (com.adaptris.core.StandaloneProducer)18 MetadataElement (com.adaptris.core.MetadataElement)17 ValidationStage (com.adaptris.transform.validate.ValidationStage)16 Cache (com.adaptris.core.cache.Cache)15 DefectiveMessageFactory (com.adaptris.core.stubs.DefectiveMessageFactory)13 TimeInterval (com.adaptris.util.TimeInterval)13 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)11 Connection (java.sql.Connection)10 File (java.io.File)9 IOException (java.io.IOException)9 OutputStream (java.io.OutputStream)9 SQLException (java.sql.SQLException)9 InputStream (java.io.InputStream)8 Document (org.w3c.dom.Document)8 Channel (com.adaptris.core.Channel)7