Search in sources :

Example 71 with KeyValuePair

use of com.adaptris.util.KeyValuePair in project interlok by adaptris.

the class SimpleFactoryConfigurationTest method testApplyTopicConnectionFactory_NonInteger.

@Test
public void testApplyTopicConnectionFactory_NonInteger() throws Exception {
    SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_INT_VALUE, "fred"));
    DummyConnectionFactory mycf = new DummyConnectionFactory();
    extras.applyConfiguration(mycf);
    doBaseAssertions(mycf);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) Test(org.junit.Test)

Example 72 with KeyValuePair

use of com.adaptris.util.KeyValuePair in project interlok by adaptris.

the class SimpleFactoryConfigurationTest method testApplyTopicConnectionFactory_Object.

@Test
public void testApplyTopicConnectionFactory_Object() throws Exception {
    SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_OBJECT_VALUE, "fred"));
    DummyConnectionFactory mycf = new DummyConnectionFactory();
    extras.applyConfiguration(mycf);
    doBaseAssertions(mycf);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) Test(org.junit.Test)

Example 73 with KeyValuePair

use of com.adaptris.util.KeyValuePair in project interlok by adaptris.

the class SimpleFactoryConfigurationTest method testApplyTopicConnectionFactory_NonLong.

@Test
public void testApplyTopicConnectionFactory_NonLong() throws Exception {
    SimpleFactoryConfiguration extras = create(new KeyValuePair(SOME_LONG_VALUE, "fred"));
    DummyConnectionFactory mycf = new DummyConnectionFactory();
    extras.applyConfiguration(mycf);
    doBaseAssertions(mycf);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) Test(org.junit.Test)

Example 74 with KeyValuePair

use of com.adaptris.util.KeyValuePair in project interlok by adaptris.

the class JmxConnectionTest method testRemoteJMX_WithAuthentication_AndEnv.

@Test
public void testRemoteJMX_WithAuthentication_AndEnv() throws Exception {
    Integer port = PortManager.nextUnusedPort(56789);
    JmxRemoteComponent jmxr = new JmxRemoteComponent();
    JmxConnection conn = new JmxConnection();
    conn.getJmxProperties().add(new KeyValuePair(JMX_REMOTE_PROFILES, SASL_PLAIN));
    try {
        jmxr.init(createProperties(port, DEFAULT_USERNAME_PASSWORD, DEFAULT_USERNAME_PASSWORD));
        jmxr.start();
        conn.setJmxServiceUrl(JMXMP_PREFIX + port);
        conn.setUsername(DEFAULT_USERNAME_PASSWORD);
        conn.setPassword(DEFAULT_USERNAME_PASSWORD);
        conn.setConnectionRetryInterval(new TimeInterval(2L, TimeUnit.SECONDS));
        conn.setAdditionalDebug(true);
        conn.setConnectionAttempts(5);
        LifecycleHelper.prepare(conn);
        LifecycleHelper.init(conn);
        assertNotNull(conn.mbeanServerConnection());
    } finally {
        LifecycleHelper.stopAndClose(conn);
        PortManager.release(port);
        destroy(jmxr);
    }
}
Also used : JmxRemoteComponent(com.adaptris.core.management.jmx.JmxRemoteComponent) KeyValuePair(com.adaptris.util.KeyValuePair) TimeInterval(com.adaptris.util.TimeInterval) Test(org.junit.Test)

Example 75 with KeyValuePair

use of com.adaptris.util.KeyValuePair in project interlok by adaptris.

the class DestinationCacheJndiPtpProducerTest method testProduceWithCacheExceeded.

@Test
public void testProduceWithCacheExceeded() throws Exception {
    DestinationCachingJndiVendorImpl jv = new DestinationCachingJndiVendorImpl(2);
    String queueName = testName.getMethodName() + "_queue";
    String topicName = testName.getMethodName() + "_topic";
    StandaloneProducer sp1 = new StandaloneProducer(activeMqBroker.getJndiPtpConnection(jv, false, queueName, topicName), new PtpProducer().withQueue("%message{testProduceWithCacheExceeded}"));
    jv.setUseJndiForQueues(true);
    jv.getJndiParams().addKeyValuePair(new KeyValuePair("queue.testProduceWithCacheExceeded1", "testProduceWithCacheExceeded1"));
    jv.getJndiParams().addKeyValuePair(new KeyValuePair("queue.testProduceWithCacheExceeded2", "testProduceWithCacheExceeded2"));
    try {
        start(sp1);
        AdaptrisMessage m1 = createMessage(null);
        m1.addMetadata("testProduceWithCacheExceeded", queueName);
        AdaptrisMessage m2 = createMessage(null);
        m2.addMetadata("testProduceWithCacheExceeded", "testProduceWithCacheExceeded2");
        AdaptrisMessage m3 = createMessage(null);
        m3.addMetadata("testProduceWithCacheExceeded", "testProduceWithCacheExceeded1");
        sp1.doService(m1);
        sp1.doService(m2);
        // This 2nd produce will expire get(QUEUE) on a LRU
        sp1.doService(m2);
        // basis.
        sp1.doService(m3);
        assertEquals(2, jv.queueCacheSize());
        assertFalse(jv.queueCache().containsKey(queueName));
        assertTrue(jv.queueCache().containsKey("testProduceWithCacheExceeded1"));
        assertTrue(jv.queueCache().containsKey("testProduceWithCacheExceeded2"));
    } finally {
        stop(sp1);
    }
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) PtpProducer(com.adaptris.core.jms.PtpProducer) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

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