Search in sources :

Example 56 with KeyValuePairSet

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

the class SerializableAdaptrisMessageTest method testSetMetadata.

@Test
public void testSetMetadata() throws Exception {
    SerializableAdaptrisMessage message = new SerializableAdaptrisMessage();
    KeyValuePairSet kvps = new KeyValuePairSet();
    kvps.addKeyValuePair(new KeyValuePair(KEY1, VALUE1));
    kvps.addKeyValuePair(new KeyValuePair(KEY2, VALUE2));
    kvps.addKeyValuePair(new KeyValuePair(KEY3, VALUE3));
    message.setMetadata(kvps);
    assertEquals(3, message.getMetadata().size());
    assertTrue(message.getMessageHeaders().containsKey(KEY1));
    assertTrue(message.getMessageHeaders().containsKey(KEY2));
    assertTrue(message.getMessageHeaders().containsKey(KEY3));
    assertFalse(message.getMessageHeaders().containsKey(KEY4));
    message.setMetadata((KeyValuePairSet) null);
    assertEquals(0, message.getMetadata().size());
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Example 57 with KeyValuePairSet

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

the class InsertNodeTest method testSetNamespaceContext.

@Test
public void testSetNamespaceContext() {
    InsertNode obj = new InsertNode();
    assertNull(obj.getNamespaceContext());
    KeyValuePairSet kvps = new KeyValuePairSet();
    kvps.add(new KeyValuePair("hello", "world"));
    obj.setNamespaceContext(kvps);
    assertEquals(kvps, obj.getNamespaceContext());
    obj.setNamespaceContext(null);
    assertNull(obj.getNamespaceContext());
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Example 58 with KeyValuePairSet

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

the class FtpRecursiveConsumerTest method create.

private FtpConnection create(FakeFtpServer server) {
    FtpConnection consumeConnection = new FtpConnection();
    consumeConnection.setDefaultControlPort(server.getServerControlPort());
    consumeConnection.setDefaultPassword(DEFAULT_PASSWORD);
    consumeConnection.setDefaultUserName(DEFAULT_USERNAME);
    consumeConnection.setCacheConnection(true);
    consumeConnection.setAdditionalDebug(true);
    KeyValuePairSet settings = new KeyValuePairSet();
    settings.add(new KeyValuePair(ClientSettings.FTP.RemoteVerificationEnabled.name(), "false"));
    consumeConnection.setAdditionalSettings(settings);
    return consumeConnection;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Example 59 with KeyValuePairSet

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

the class VerifyIdentityServiceTest method testMetadataVerification_Fails.

@Test
public void testMetadataVerification_Fails() throws Exception {
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
    msg.addMetadata(USER, "user");
    msg.addMetadata(PASSWORD, "password");
    msg.addMetadata("dbUser", "user");
    msg.addMetadata("dbPassword", "NotThePassword");
    MetadataIdentityVerifier verifier = new MetadataIdentityVerifier(new KeyValuePairSet(Arrays.asList(new KeyValuePair[] { new KeyValuePair(USER, "dbUser"), new KeyValuePair(PASSWORD, "dbPassword") })));
    MetadataIdentityBuilder builder = new MetadataIdentityBuilder(MetadataSource.Standard, new ArrayList<String>(Arrays.asList(USER, PASSWORD)));
    VerifyIdentityService service = new VerifyIdentityService(builder, verifier);
    try {
        execute(service, msg);
        fail();
    } catch (ServiceException expected) {
    }
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) ServiceException(com.adaptris.core.ServiceException) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Example 60 with KeyValuePairSet

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

the class JndiImplementationCase method testSetJndiParams.

@Test
public void testSetJndiParams() throws Exception {
    BaseJndiImplementation jv = createVendorImplementation();
    KeyValuePairSet set = new KeyValuePairSet();
    jv.setJndiParams(set);
    assertEquals(set, jv.getJndiParams());
    try {
        jv.setJndiParams(null);
        fail();
    } catch (IllegalArgumentException expected) {
    }
    assertEquals(set, jv.getJndiParams());
}
Also used : BaseJndiImplementation(com.adaptris.core.jms.jndi.BaseJndiImplementation) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Aggregations

KeyValuePairSet (com.adaptris.util.KeyValuePairSet)62 KeyValuePair (com.adaptris.util.KeyValuePair)54 Test (org.junit.Test)30 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)5 StandardJndiImplementation (com.adaptris.core.jms.jndi.StandardJndiImplementation)5 TimeInterval (com.adaptris.util.TimeInterval)4 SimpleFactoryConfiguration (com.adaptris.core.jms.jndi.SimpleFactoryConfiguration)3 Connection (java.sql.Connection)3 ArrayList (java.util.ArrayList)3 CoreException (com.adaptris.core.CoreException)2 ServiceException (com.adaptris.core.ServiceException)2 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)2 StandaloneProducer (com.adaptris.core.StandaloneProducer)2 Execution (com.adaptris.core.common.Execution)2 MetadataDataInputParameter (com.adaptris.core.common.MetadataDataInputParameter)2 StringPayloadDataInputParameter (com.adaptris.core.common.StringPayloadDataInputParameter)2 JdbcConnection (com.adaptris.core.jdbc.JdbcConnection)2 JunitBootstrapProperties (com.adaptris.core.stubs.JunitBootstrapProperties)2 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)2 ComboPooledDataSource (com.mchange.v2.c3p0.ComboPooledDataSource)2