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);
}
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);
}
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);
}
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);
}
}
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);
}
}
Aggregations