Search in sources :

Example 41 with CoreException

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

the class EncodingServiceTest method testInit.

@Test
public void testInit() throws Exception {
    EncodingService service = new EncodingService();
    try {
        LifecycleHelper.init(service);
        fail();
    } catch (CoreException expected) {
    }
    service.setEncoder(new MockEncoder());
    LifecycleHelper.init(service);
    service = new EncodingService(new MockEncoder());
    LifecycleHelper.init(service);
}
Also used : MockEncoder(com.adaptris.core.stubs.MockEncoder) CoreException(com.adaptris.core.CoreException) Test(org.junit.Test)

Example 42 with CoreException

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

the class MockEncoder method writeMessage.

public void writeMessage(AdaptrisMessage msg, OutputStream target) throws CoreException {
    try {
        target.write(msg.getPayload());
        target.flush();
    } catch (Exception e) {
        throw new CoreException("Could not encode the AdaptrisMessage object", e);
    }
}
Also used : CoreException(com.adaptris.core.CoreException) CoreException(com.adaptris.core.CoreException)

Example 43 with CoreException

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

the class JndiHelperTest method testUnbindUnboundTransactionManager.

@Test
public void testUnbindUnboundTransactionManager() throws Exception {
    TransactionManager transactionManager = new DummyTransactionManager(getName());
    try {
        JndiHelper.unbind(transactionManager, false);
        fail();
    } catch (CoreException expected) {
    // not previously bound, so should error.
    }
}
Also used : DummyTransactionManager(com.adaptris.core.transaction.DummyTransactionManager) CoreException(com.adaptris.core.CoreException) DummyTransactionManager(com.adaptris.core.transaction.DummyTransactionManager) TransactionManager(com.adaptris.core.transaction.TransactionManager) Test(org.junit.Test)

Example 44 with CoreException

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

the class JndiHelperTest method testBindTransactionManager_AlreadyBound.

@Test
public void testBindTransactionManager_AlreadyBound() throws Exception {
    TransactionManager transactionManager = new DummyTransactionManager(getName());
    InitialContext initialContext = new InitialContext(env);
    JndiHelper.bind(initialContext, transactionManager, false);
    try {
        JndiHelper.bind(initialContext, transactionManager, true);
        fail();
    } catch (CoreException expected) {
        ;
    }
    try {
        JndiHelper.bind(initialContext, transactionManager, false);
        fail();
    } catch (CoreException expected) {
        ;
    }
    JndiHelper.unbindQuietly(initialContext, transactionManager, false);
}
Also used : DummyTransactionManager(com.adaptris.core.transaction.DummyTransactionManager) CoreException(com.adaptris.core.CoreException) DummyTransactionManager(com.adaptris.core.transaction.DummyTransactionManager) TransactionManager(com.adaptris.core.transaction.TransactionManager) InitialContext(javax.naming.InitialContext) Test(org.junit.Test)

Example 45 with CoreException

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

the class JndiHelperTest method testUnbindCollection_Debug.

@Test
public void testUnbindCollection_Debug() throws Exception {
    NullConnection connection = new NullConnection();
    connection.setUniqueId(getName());
    ArrayList<AdaptrisConnection> connectionList = new ArrayList<AdaptrisConnection>();
    connectionList.add(connection);
    InitialContext initialContext = new InitialContext(env);
    JndiHelper.bind(connectionList);
    JndiHelper.unbind(connectionList, true);
    try {
        JndiHelper.unbind(connectionList, true);
        fail();
    } catch (CoreException expected) {
    }
}
Also used : CoreException(com.adaptris.core.CoreException) AdaptrisConnection(com.adaptris.core.AdaptrisConnection) ArrayList(java.util.ArrayList) NullConnection(com.adaptris.core.NullConnection) InitialContext(javax.naming.InitialContext) 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