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);
}
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);
}
}
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.
}
}
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);
}
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) {
}
}
Aggregations