Search in sources :

Example 6 with KeyValuePair

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());
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 7 with KeyValuePair

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());
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Example 8 with KeyValuePair

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));
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Example 9 with KeyValuePair

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));
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Example 10 with KeyValuePair

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;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Aggregations

KeyValuePair (com.adaptris.util.KeyValuePair)143 Test (org.junit.Test)79 KeyValuePairSet (com.adaptris.util.KeyValuePairSet)55 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)26 KeyValuePairList (com.adaptris.util.KeyValuePairList)12 StandardJndiImplementation (com.adaptris.core.jms.jndi.StandardJndiImplementation)11 StandaloneProducer (com.adaptris.core.StandaloneProducer)10 Channel (com.adaptris.core.Channel)9 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)9 TimeInterval (com.adaptris.util.TimeInterval)9 ServiceException (com.adaptris.core.ServiceException)7 JmsConnection (com.adaptris.core.jms.JmsConnection)6 ArrayList (java.util.ArrayList)6 CoreException (com.adaptris.core.CoreException)5 StandardWorkflow (com.adaptris.core.StandardWorkflow)5 PasProducer (com.adaptris.core.jms.PasProducer)5 MetadataCollection (com.adaptris.core.MetadataCollection)4 MetadataElement (com.adaptris.core.MetadataElement)4 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)4 StandaloneRequestor (com.adaptris.core.StandaloneRequestor)3