Search in sources :

Example 61 with KeyValuePair

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

Example 62 with KeyValuePair

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

Example 63 with KeyValuePair

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

Example 64 with KeyValuePair

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;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) HttpConfiguration(org.eclipse.jetty.server.HttpConfiguration)

Example 65 with KeyValuePair

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);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) PasConsumer(com.adaptris.core.jms.PasConsumer) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) SimpleFactoryConfiguration(com.adaptris.core.jms.jndi.SimpleFactoryConfiguration) PasProducer(com.adaptris.core.jms.PasProducer) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) 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