Search in sources :

Example 11 with KeyValuePairSet

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

the class VerifyIdentityServiceTest method testMetadataVerification.

@Test
public void testMetadataVerification() throws Exception {
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
    msg.addMetadata(USER, "user");
    msg.addMetadata(PASSWORD, "password");
    msg.addMetadata("dbUser", "user");
    msg.addMetadata("dbPassword", "password");
    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);
    execute(service, msg);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Example 12 with KeyValuePairSet

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

the class XpathCacheValueTranslatorTest method createTranslator.

private XpathCacheValueTranslator createTranslator() {
    XpathCacheValueTranslator translator = new XpathCacheValueTranslator();
    KeyValuePairSet set = new KeyValuePairSet();
    set.add(new KeyValuePair("test", "uri:test"));
    translator.setNamespaceContext(set);
    translator.setXpath("/test:root/test:element[@id='one']");
    return translator;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Example 13 with KeyValuePairSet

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

the class JdbcServiceExample method applyDefaultConfig.

public static DatabaseConnection applyDefaultConfig(DatabaseConnection connection) {
    connection.setConnectionAttempts(2);
    connection.setUsername("my_db_username");
    connection.setPassword("plain or encoded password");
    connection.setConnectionRetryInterval(new TimeInterval(3L, "SECONDS"));
    KeyValuePairSet connectionProps = new KeyValuePairSet();
    connectionProps.add(new KeyValuePair("dontTrackOpenResources", "true"));
    connectionProps.add(new KeyValuePair("autoReconnect", "true"));
    connection.setConnectionProperties(connectionProps);
    return connection;
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Example 14 with KeyValuePairSet

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

the class JdbcMapInsertTest method testService_InvalidConversion.

@Test
public void testService_InvalidConversion() throws Exception {
    createDatabase();
    KeyValuePairSet mappings = new KeyValuePairSet();
    mappings.add(new KeyValuePair("dob", "com.adaptris.does.not.Exist"));
    mappings.add(new KeyValuePair("firstname", "java.lang.String"));
    // mappings.add(new KeyValuePair("lastname", "Date"));
    InsertProperties service = configureForTests(createService());
    service.setFieldMappings(mappings);
    AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(CONTENT);
    ExampleServiceCase.execute(service, msg);
    doAssert(1);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) Test(org.junit.Test)

Example 15 with KeyValuePairSet

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

the class JdbcQueryServiceCaseXmlResults method testSetNamespaceContext.

@Test
public void testSetNamespaceContext() throws Exception {
    JdbcDataQueryService service = new JdbcDataQueryService();
    assertNull(service.getNamespaceContext());
    KeyValuePairSet kvps = new KeyValuePairSet();
    kvps.add(new KeyValuePair("hello", "world"));
    service.setNamespaceContext(kvps);
    assertEquals(kvps, service.getNamespaceContext());
    service.setNamespaceContext(null);
    assertNull(service.getNamespaceContext());
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) 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