use of com.adaptris.core.AdaptrisConnection in project interlok by adaptris.
the class JndiHelperTest method testBindCollection.
@Test
public void testBindCollection() throws Exception {
NullConnection connection = new NullConnection();
connection.setUniqueId(getName());
ArrayList<AdaptrisConnection> connectionList = new ArrayList<AdaptrisConnection>();
connectionList.add(connection);
InitialContext initialContext = new InitialContext(env);
try {
JndiHelper.bind(connectionList);
NullConnection lookedup = (NullConnection) initialContext.lookup("adapter:comp/env/" + getName());
assertNotNull(lookedup);
assertTrue(lookedup instanceof NullConnection);
assertEquals(getName(), lookedup.getUniqueId());
} finally {
JndiHelper.unbindQuietly(initialContext, connectionList, true);
}
}
use of com.adaptris.core.AdaptrisConnection 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) {
}
}
use of com.adaptris.core.AdaptrisConnection in project interlok by adaptris.
the class JndiHelperTest method testBindCollection_Debug.
@Test
public void testBindCollection_Debug() throws Exception {
NullConnection connection = new NullConnection();
connection.setUniqueId(getName());
ArrayList<AdaptrisConnection> connectionList = new ArrayList<AdaptrisConnection>();
connectionList.add(connection);
InitialContext initialContext = new InitialContext(env);
try {
JndiHelper.bind(connectionList, true);
NullConnection lookedup = (NullConnection) initialContext.lookup("adapter:comp/env/" + getName());
assertNotNull(lookedup);
assertTrue(lookedup instanceof NullConnection);
assertEquals(getName(), lookedup.getUniqueId());
} finally {
JndiHelper.unbindQuietly(initialContext, connectionList, true);
}
}
use of com.adaptris.core.AdaptrisConnection in project interlok by adaptris.
the class JndiHelperTest method testUnbindCollection_WithContext.
@Test
public void testUnbindCollection_WithContext() 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(initialContext, connectionList, true);
JndiHelper.unbind(initialContext, connectionList, true);
try {
JndiHelper.unbind(initialContext, connectionList, true);
fail();
} catch (CoreException expected) {
}
}
use of com.adaptris.core.AdaptrisConnection in project interlok by adaptris.
the class AdapterManager method addAndBindSharedConnection.
@Override
public boolean addAndBindSharedConnection(String xmlString) throws CoreException, IllegalStateException {
ensureState(StartedState.getInstance(), InitialisedState.getInstance(), StoppedState.getInstance());
AdaptrisConnection comp = (AdaptrisConnection) DefaultMarshaller.getDefaultMarshaller().unmarshal(xmlString);
boolean result = getWrappedComponent().getSharedComponents().addConnection(comp);
if (result) {
getWrappedComponent().getSharedComponents().bindJNDI(comp.getUniqueId());
marshalAndSendNotification();
}
return result;
}
Aggregations