use of com.adaptris.util.KeyValuePair in project interlok by adaptris.
the class ConfiguredRequestHeadersTest method testAddHeaders.
@Test
public void testAddHeaders() throws Exception {
Channel c = null;
HttpURLConnection urlC = null;
try {
c = HttpHelper.createAndStartChannel();
URL url = new URL(HttpHelper.createProduceDestination(c));
urlC = (HttpURLConnection) url.openConnection();
String name = testName.getMethodName();
ConfiguredRequestHeaders headers = new ConfiguredRequestHeaders();
headers.getHeaders().add(new KeyValuePair(name, name));
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("");
msg.addMetadata(name, name);
urlC = headers.addHeaders(msg, urlC);
assertTrue(contains(urlC, name, name));
} finally {
HttpHelper.stopChannelAndRelease(c);
}
}
use of com.adaptris.util.KeyValuePair in project interlok by adaptris.
the class SftpExampleHelper method createPerHostConfigRepo.
public static PerHostConfigBuilder createPerHostConfigRepo() {
PerHostConfigBuilder inline = new PerHostConfigBuilder();
HostConfig a = new HostConfig("my.host.com", null, -1, new KeyValuePair("StrictHostKeyChecking", "yes"), new KeyValuePair(SftpClient.SSH_PREFERRED_AUTHENTICATIONS, SftpClient.NO_KERBEROS_AUTH));
HostConfig b = new HostConfig("another.host.com", null, -1, new KeyValuePair("StrictHostKeyChecking", "no"), new KeyValuePair(SftpClient.SSH_PREFERRED_AUTHENTICATIONS, SftpClient.NO_KERBEROS_AUTH));
inline.getHosts().add(a);
inline.getHosts().add(b);
return inline;
}
use of com.adaptris.util.KeyValuePair in project interlok by adaptris.
the class InlineConfigRepositoryBuilder method config.
protected KeyValuePairSet config() {
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("compression.s2c", "zlib,none"));
kvps.add(new KeyValuePair("compression.c2s", "zlib,none"));
kvps.add(new KeyValuePair("StrictHostKeyChecking", BooleanUtils.toStringYesNo(strictHostChecking)));
kvps.add(new KeyValuePair(SftpClient.SSH_PREFERRED_AUTHENTICATIONS, SftpClient.NO_KERBEROS_AUTH));
return kvps;
}
use of com.adaptris.util.KeyValuePair in project interlok by adaptris.
the class HttpConnection method createConfig.
protected HttpConfiguration createConfig() throws Exception {
HttpConfiguration cfg = new HttpConfiguration();
for (KeyValuePair kvp : getHttpConfiguration().getKeyValuePairs()) {
boolean matched = false;
for (HttpConfigurationProperty sp : HttpConfigurationProperty.values()) {
if (kvp.getKey().equalsIgnoreCase(sp.toString())) {
sp.applyProperty(cfg, kvp.getValue());
matched = true;
break;
}
}
if (!matched) {
if (!SimpleBeanUtil.callSetter(cfg, "set" + kvp.getKey(), kvp.getValue())) {
log.trace("Ignoring unsupported Property {}", kvp.getKey());
}
}
}
return cfg;
}
use of com.adaptris.util.KeyValuePair in project interlok by adaptris.
the class JndiPasProducerCase method testProduceAndConsume_ExtraConfig.
@Test
public void testProduceAndConsume_ExtraConfig() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
SimpleFactoryConfiguration sfc = new SimpleFactoryConfiguration();
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("ClientID", "testProduceAndConsume_ExtraConfig"));
kvps.add(new KeyValuePair("UseCompression", "true"));
sfc.setProperties(kvps);
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
sendVendorImp.setExtraFactoryConfiguration(sfc);
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));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
Aggregations