use of com.adaptris.util.KeyValuePair in project interlok by adaptris.
the class MessageMetricsInterceptorByMetadataTest method testInterceptor_MatchByRegexp.
@Test
public void testInterceptor_MatchByRegexp() throws Exception {
interceptor.setMetadataElement(new KeyValuePair("messageType", "ORD.*"));
LifecycleHelper.init(interceptor);
LifecycleHelper.start(interceptor);
AdaptrisMessage message = createMessage(true);
assertEquals(0, interceptor.getStats().size());
submitMessage(message);
assertEquals(1, interceptor.getStats().size());
assertEquals(1, ((MessageStatistic) interceptor.getStats().get(0)).getTotalMessageCount());
}
use of com.adaptris.util.KeyValuePair in project interlok by adaptris.
the class JdbcXPathParameterTest method testSetNamespaceContext.
@Test
public void testSetNamespaceContext() {
JdbcXPathParameter parameter = new JdbcXPathParameter();
assertNull(parameter.getNamespaceContext());
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("hello", "world"));
parameter.setNamespaceContext(kvps);
assertEquals(kvps, parameter.getNamespaceContext());
parameter.setNamespaceContext(null);
assertNull(parameter.getNamespaceContext());
}
use of com.adaptris.util.KeyValuePair 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.util.KeyValuePair 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.util.KeyValuePair in project interlok by adaptris.
the class JndiPtpProducerTest method createJndiVendorImpExample.
static JmsConnection createJndiVendorImpExample(StandardJndiImplementation jndi, JmsConnection c) {
jndi.setJndiName("MyConnectionFactory");
KeyValuePairSet kvps = jndi.getJndiParams();
// jndi.getJndiParams().addKeyValuePair(
// new KeyValuePair(Context.INITIAL_CONTEXT_FACTORY,
// "com.sun.jndi.fscontext.RefFSContextFactory"));
kvps.addKeyValuePair(new KeyValuePair(Context.SECURITY_PRINCIPAL, "Administrator"));
kvps.addKeyValuePair(new KeyValuePair(Context.SECURITY_CREDENTIALS, "Administrator"));
kvps.addKeyValuePair(new KeyValuePair("com.sonicsw.jndi.mfcontext.domain", "Domain1"));
kvps.addKeyValuePair(new KeyValuePair(Context.INITIAL_CONTEXT_FACTORY, "com.sonicsw.jndi.mfcontext.MFContextFactory"));
jndi.getJndiParams().addKeyValuePair(new KeyValuePair(Context.PROVIDER_URL, "tcp://localhost:2506"));
c.setVendorImplementation(jndi);
c.setClientId(null);
c.setConnectionErrorHandler(new JmsConnectionErrorHandler());
return c;
}
Aggregations