Search in sources :

Example 31 with CoreException

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

the class AppendinglMessageAggregatorTest method testJoin_WithException.

@Test
public void testJoin_WithException() {
    AppendingMessageAggregator aggr = createAggregatorForTests();
    AdaptrisMessage original = new DefectiveMessageFactory(EnumSet.of(WhenToBreak.INPUT, WhenToBreak.OUTPUT)).newMessage("Goodbye");
    AdaptrisMessage splitMsg1 = AdaptrisMessageFactory.getDefaultInstance().newMessage(" Cruel ");
    AdaptrisMessage splitMsg2 = AdaptrisMessageFactory.getDefaultInstance().newMessage("World");
    try {
        aggr.joinMessage(original, Arrays.asList(new AdaptrisMessage[] { splitMsg1, splitMsg2 }));
        fail();
    } catch (CoreException expected) {
    }
}
Also used : DefectiveMessageFactory(com.adaptris.core.stubs.DefectiveMessageFactory) CoreException(com.adaptris.core.CoreException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 32 with CoreException

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

the class JdbcQueryServiceCaseXmlResults method testDoService_IllegalXmlCharacters.

@Test
public void testDoService_IllegalXmlCharacters() throws Exception {
    createDatabase();
    List<AdapterTypeVersion> dbItems = generateWithIllegalXmlChars(10);
    AdapterTypeVersion entry = dbItems.get(0);
    populateDatabase(dbItems, false);
    JdbcDataQueryService s = createXmlService();
    XmlPayloadTranslatorImpl translator = createPayloadTranslator();
    translator.setStripIllegalXmlChars(false);
    s.setResultSetTranslator(translator);
    AdaptrisMessage msg = createMessage(entry);
    execute(s, msg);
    logMessage(getName(), msg);
    try {
        XmlHelper.createXmlUtils(msg, null);
        fail();
    } catch (CoreException e) {
    }
}
Also used : CoreException(com.adaptris.core.CoreException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 33 with CoreException

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

the class SplittingXmlPayloadTranslatorTest method testDoService_IllegalXmlCharacters.

@Override
public void testDoService_IllegalXmlCharacters() throws Exception {
    createDatabase();
    List<AdapterTypeVersion> dbItems = generateWithIllegalXmlChars(10);
    AdapterTypeVersion entry = dbItems.get(0);
    populateDatabase(dbItems, false);
    JdbcDataQueryService s = createXmlService();
    XmlPayloadTranslatorImpl translator = createPayloadTranslator();
    translator.setStripIllegalXmlChars(false);
    s.setResultSetTranslator(translator);
    AdaptrisMessage msg = createMessage(entry);
    execute(s, msg);
    AdaptrisMessage outputMessage = producer.getMessages().get(0);
    logMessage(getName(), outputMessage);
    try {
        XmlHelper.createXmlUtils(outputMessage, null);
        fail();
    } catch (CoreException e) {
    }
}
Also used : CoreException(com.adaptris.core.CoreException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage)

Example 34 with CoreException

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

the class AdvancedMessageSplitterServiceTest method testInit.

@Override
public void testInit() throws Exception {
    AdvancedMessageSplitterService service = createForTests();
    try {
        service.init();
        fail();
    } catch (CoreException expected) {
    }
    service.setSplitter(new LineCountSplitter());
    service.setService(new ServiceList());
    service.init();
    assertNotNull(service.wrappedServices());
    assertEquals(1, service.wrappedServices().length);
}
Also used : CoreException(com.adaptris.core.CoreException) ServiceList(com.adaptris.core.ServiceList)

Example 35 with CoreException

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

the class MultiItemConfiguredXpathQueryTest method testResolveXpath_EmptyResults_NotAllowed.

@Test
public void testResolveXpath_EmptyResults_NotAllowed() throws Exception {
    MultiItemConfiguredXpathQuery query = init(create(), "//@MissingAttribute");
    Document doc = XmlHelper.createDocument(XML);
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML);
    try {
        MetadataElement result = query.resolveXpath(doc, new XPath(), query.createXpathQuery(msg));
        fail();
    } catch (CoreException expected) {
    }
}
Also used : XPath(com.adaptris.util.text.xml.XPath) CoreException(com.adaptris.core.CoreException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) MetadataElement(com.adaptris.core.MetadataElement) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

CoreException (com.adaptris.core.CoreException)186 Test (org.junit.Test)110 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)44 Adapter (com.adaptris.core.Adapter)32 ObjectName (javax.management.ObjectName)29 Channel (com.adaptris.core.Channel)27 ArrayList (java.util.ArrayList)24 IOException (java.io.IOException)20 File (java.io.File)19 ServiceException (com.adaptris.core.ServiceException)14 TimeInterval (com.adaptris.util.TimeInterval)13 Document (org.w3c.dom.Document)12 MalformedObjectNameException (javax.management.MalformedObjectNameException)11 AdaptrisMarshaller (com.adaptris.core.AdaptrisMarshaller)10 StandardWorkflow (com.adaptris.core.StandardWorkflow)9 URLString (com.adaptris.util.URLString)9 TimeoutException (java.util.concurrent.TimeoutException)9 PoolingWorkflow (com.adaptris.core.PoolingWorkflow)8 Workflow (com.adaptris.core.Workflow)8 XPath (com.adaptris.util.text.xml.XPath)8