Search in sources :

Example 26 with KeyValuePair

use of com.adaptris.util.KeyValuePair 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 27 with KeyValuePair

use of com.adaptris.util.KeyValuePair 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)

Example 28 with KeyValuePair

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

the class CopyMetadataServiceTest method testBug2101_SameSourceKeyMultipleDestinationKeys.

@Test
public void testBug2101_SameSourceKeyMultipleDestinationKeys() throws Exception {
    CopyMetadataService service = createService();
    service.getMetadataKeys().add(new KeyValuePair(KEY_TO_BE_COPIED, NEW_KEY_2));
    service.getMetadataKeys().add(new KeyValuePair(KEY_TO_BE_COPIED, NEW_KEY_3));
    service.getMetadataKeys().add(new KeyValuePair(KEY_TO_BE_COPIED, NEW_KEY_4));
    AdaptrisMessage msg = createMessage();
    execute(service, msg);
    assertTrue(msg.getMetadataValue(KEY_TO_BE_COPIED).equals(METADATA_VALUE));
    assertTrue(NEW_KEY_1 + " must exist as metadata", msg.containsKey(NEW_KEY_1));
    assertTrue(NEW_KEY_2 + " must exist as metadata", msg.containsKey(NEW_KEY_2));
    assertTrue(NEW_KEY_3 + " must exist as metadata", msg.containsKey(NEW_KEY_3));
    assertTrue(NEW_KEY_4 + " must exist as metadata", msg.containsKey(NEW_KEY_4));
    assertEquals(METADATA_VALUE, msg.getMetadataValue(NEW_KEY_1));
    assertEquals(METADATA_VALUE, msg.getMetadataValue(NEW_KEY_2));
    assertEquals(METADATA_VALUE, msg.getMetadataValue(NEW_KEY_3));
    assertEquals(METADATA_VALUE, msg.getMetadataValue(NEW_KEY_4));
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Test(org.junit.Test)

Example 29 with KeyValuePair

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

the class XpathMetadataServiceTest method createContextEntries.

public static KeyValuePairSet createContextEntries() {
    KeyValuePairSet contextEntries = new KeyValuePairSet();
    contextEntries.add(new KeyValuePair("svrl", "http://purl.oclc.org/dsdl/svrl"));
    contextEntries.add(new KeyValuePair("xsd", "http://www.w3.org/2001/XMLSchema"));
    contextEntries.add(new KeyValuePair("xs", "http://www.w3.org/2001/XMLSchema"));
    contextEntries.add(new KeyValuePair("sch", "http://www.ascc.net/xml/schematron"));
    contextEntries.add(new KeyValuePair("iso", "http://purl.oclc.org/dsdl/schematron"));
    contextEntries.add(new KeyValuePair("dp", "http://www.dpawson.co.uk/ns#"));
    return contextEntries;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Example 30 with KeyValuePair

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

the class XpathMetadataServiceTest method testSetNamespaceContext.

@Test
public void testSetNamespaceContext() {
    XpathMetadataService obj = new XpathMetadataService();
    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)

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