use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JmsConnectionErrorHandlerTest method testComparatorWith2IdenticalJNDIConnections.
@Test
public void testComparatorWith2IdenticalJNDIConnections() throws Exception {
JmsConnectionErrorHandler connectionErrorHandler1 = new JmsConnectionErrorHandler();
JmsConnectionErrorHandler connectionErrorHandler2 = new JmsConnectionErrorHandler();
JmsConnection connection1 = new JmsConnection();
JmsConnection connection2 = new JmsConnection();
KeyValuePairSet keyValuePairSet = new KeyValuePairSet();
KeyValuePair keyVPInitial = new KeyValuePair();
keyVPInitial.setKey("java.naming.factory.initial");
keyVPInitial.setValue("com.sonicsw.jndi.mfcontext.MFContextFactory");
KeyValuePair keyVPCred = new KeyValuePair();
keyVPCred.setKey("java.naming.security.credentials");
keyVPCred.setValue("Administrator");
KeyValuePair keyVPDomain = new KeyValuePair();
keyVPDomain.setKey("com.sonicsw.jndi.mfcontext.domain");
keyVPDomain.setValue("Domain1");
KeyValuePair keyVPUrl = new KeyValuePair();
keyVPUrl.setKey("java.naming.provider.url");
keyVPUrl.setValue("tcp://localhost:2506");
KeyValuePair keyVPPrinciple = new KeyValuePair();
keyVPPrinciple.setKey("java.naming.security.principal");
keyVPPrinciple.setValue("Administrator");
keyValuePairSet.add(keyVPInitial);
keyValuePairSet.add(keyVPCred);
keyValuePairSet.add(keyVPCred);
keyValuePairSet.add(keyVPInitial);
StandardJndiImplementation jndiVendor1 = new StandardJndiImplementation();
jndiVendor1.setJndiParams(keyValuePairSet);
StandardJndiImplementation jndiVendor2 = new StandardJndiImplementation();
jndiVendor2.setJndiParams(keyValuePairSet);
connection1.setVendorImplementation(jndiVendor1);
connection2.setVendorImplementation(jndiVendor2);
connectionErrorHandler1.registerConnection(connection1);
connectionErrorHandler2.registerConnection(connection2);
assertFalse(connectionErrorHandler1.allowedInConjunctionWith(connectionErrorHandler2));
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JmsConnectionErrorHandlerTest method testComparatorWith2DifferemtJNDIConnections.
@Test
public void testComparatorWith2DifferemtJNDIConnections() throws Exception {
JmsConnectionErrorHandler connectionErrorHandler1 = new JmsConnectionErrorHandler();
JmsConnectionErrorHandler connectionErrorHandler2 = new JmsConnectionErrorHandler();
JmsConnection connection1 = new JmsConnection();
JmsConnection connection2 = new JmsConnection();
KeyValuePairSet keyValuePairSet1 = new KeyValuePairSet();
KeyValuePair keyVPInitial = new KeyValuePair();
keyVPInitial.setKey("java.naming.factory.initial");
keyVPInitial.setValue("com.sonicsw.jndi.mfcontext.MFContextFactory");
KeyValuePair keyVPCred = new KeyValuePair();
keyVPCred.setKey("java.naming.security.credentials");
keyVPCred.setValue("Administrator");
KeyValuePair keyVPDomain = new KeyValuePair();
keyVPDomain.setKey("com.sonicsw.jndi.mfcontext.domain");
keyVPDomain.setValue("Domain1");
KeyValuePair keyVPUrl = new KeyValuePair();
keyVPUrl.setKey("java.naming.provider.url");
keyVPUrl.setValue("tcp://localhost:2506");
KeyValuePair keyVPPrinciple = new KeyValuePair();
keyVPPrinciple.setKey("java.naming.security.principal");
keyVPPrinciple.setValue("Administrator");
keyValuePairSet1.add(keyVPInitial);
keyValuePairSet1.add(keyVPCred);
keyValuePairSet1.add(keyVPCred);
keyValuePairSet1.add(keyVPInitial);
KeyValuePairSet keyValuePairSet2 = new KeyValuePairSet(keyValuePairSet1);
keyValuePairSet2.addKeyValuePair(new KeyValuePair("java.naming.provider.url", "tcp://localhost:2507"));
StandardJndiImplementation jndiVendor1 = new StandardJndiImplementation();
jndiVendor1.setJndiParams(keyValuePairSet1);
StandardJndiImplementation jndiVendor2 = new StandardJndiImplementation();
jndiVendor2.setJndiParams(keyValuePairSet2);
connection1.setVendorImplementation(jndiVendor1);
connection2.setVendorImplementation(jndiVendor2);
connectionErrorHandler1.registerConnection(connection1);
connectionErrorHandler2.registerConnection(connection2);
assertTrue(connectionErrorHandler1.allowedInConjunctionWith(connectionErrorHandler2));
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JmsTransactedWorkflowTest method configure.
static JmsConnection configure(JmsConnection c) {
StandardJndiImplementation jndi = new StandardJndiImplementation();
jndi.setJndiName("JNDI_Name_For_Connection_Factory");
c.setVendorImplementation(jndi);
return c;
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class DestinationCacheJndiPasProducerTest method testProduceAndConsumeWithCache.
@Test
public void testProduceAndConsumeWithCache() throws Exception {
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPasConnection(recvVendorImp, false, queueName, topicName), new PasConsumer().withTopic(topicName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPasConnection(sendVendorImp, false, queueName, topicName), new PasProducer().withTopic(topicName));
try {
start(standaloneConsumer);
start(standaloneProducer);
standaloneProducer.doService(createMessage(null));
standaloneProducer.doService(createMessage(null));
waitForMessages(jms, 2);
assertMessages(jms, 2);
} finally {
stop(standaloneProducer);
stop(standaloneConsumer);
}
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class ActiveJmsConnectionErrorHandlerTest method testConnectionErrorHandlerWhileConnectionIsClosed.
@Test
public void testConnectionErrorHandlerWhileConnectionIsClosed() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
JmsConnection jmsCon = activeMqBroker.getJndiPasConnection(new StandardJndiImplementation(), false, queueName, topicName);
jmsCon.setConnectionAttempts(null);
MockChannel channel = createChannel(activeMqBroker, jmsCon, topicName);
try {
ActiveJmsConnectionErrorHandler handler = new ActiveJmsConnectionErrorHandler();
handler.setCheckInterval(new TimeInterval(100L, TimeUnit.MILLISECONDS));
handler.setAdditionalLogging(Boolean.TRUE);
channel.getConsumeConnection().setConnectionErrorHandler(handler);
channel.requestStart();
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
channel.requestClose();
activeMqBroker.stop();
activeMqBroker.start();
assertEquals(ClosedState.getInstance(), channel.retrieveComponentState());
} finally {
channel.requestClose();
}
}
Aggregations