Search in sources :

Example 21 with KeyValuePairSet

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

the class XPathServiceTest method testPayloadSimpleValueXPathIntoPayloadWithHeaderNamespaces.

@Test
public void testPayloadSimpleValueXPathIntoPayloadWithHeaderNamespaces() throws Exception {
    message.setContent(sampleXmlWithHeaderNamespaces, message.getContentEncoding());
    message.addMetadata("sourceXpathMetadataKey", "//some:some/random/xml/n1:node1/text()");
    MetadataDataInputParameter metadataDataDestination1 = new MetadataDataInputParameter("sourceXpathMetadataKey");
    Execution execution = new Execution(metadataDataDestination1, new StringPayloadDataOutputParameter());
    List<Execution> executions = new ArrayList<>();
    executions.add(execution);
    // Add the namespace mappings
    KeyValuePairSet namespaceMappings = new KeyValuePairSet();
    namespaceMappings.addKeyValuePair(new KeyValuePair("some", "http://adaptris.com/xml/some"));
    namespaceMappings.addKeyValuePair(new KeyValuePair("n1", "http://adaptris.com/xml/n1"));
    namespaceMappings.addKeyValuePair(new KeyValuePair("n2", "http://adaptris.com/xml/n2"));
    namespaceMappings.addKeyValuePair(new KeyValuePair("n3", "http://adaptris.com/xml/n3"));
    service.setNamespaceContext(namespaceMappings);
    service.setXmlSource(new StringPayloadDataInputParameter());
    service.setExecutions(executions);
    execute(service, message);
    assertEquals("value1", message.getContent());
}
Also used : StringPayloadDataInputParameter(com.adaptris.core.common.StringPayloadDataInputParameter) Execution(com.adaptris.core.common.Execution) MetadataDataInputParameter(com.adaptris.core.common.MetadataDataInputParameter) KeyValuePair(com.adaptris.util.KeyValuePair) ArrayList(java.util.ArrayList) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) StringPayloadDataOutputParameter(com.adaptris.core.common.StringPayloadDataOutputParameter) Test(org.junit.Test)

Example 22 with KeyValuePairSet

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

the class XpathSplitterTest method testSetNamespaceContext.

@Test
public void testSetNamespaceContext() throws Exception {
    XpathMessageSplitter obj = new XpathMessageSplitter();
    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) XpathMetadataServiceTest(com.adaptris.core.services.metadata.XpathMetadataServiceTest)

Example 23 with KeyValuePairSet

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

the class XmlRuleValidatorTest method createNamespaceHolder.

static KeyValuePairSet createNamespaceHolder() {
    KeyValuePairSet result = new KeyValuePairSet();
    result.add(new KeyValuePair("titan", "http://www.adaptris.com/titans"));
    result.add(new KeyValuePair("olympian", "http://www.adaptris.com/olympians"));
    return result;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Example 24 with KeyValuePairSet

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

the class DocumentBuilderFactoryBuilderTest method createNamespaceEntries.

public static KeyValuePairSet createNamespaceEntries() {
    KeyValuePairSet result = new KeyValuePairSet();
    result.add(new KeyValuePair("xsd", "http://www.w3.org/2001/XMLSchema"));
    result.add(new KeyValuePair("xs", "http://www.w3.org/2001/XMLSchema"));
    return result;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Example 25 with KeyValuePairSet

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

the class ConfigPreProcessorsTest method testProcessURL.

@Test
public void testProcessURL() throws Exception {
    ConfigPreProcessors p = new ConfigPreProcessors(new DummyConfigurationPreProcessor(new KeyValuePairSet()), new DummyConfigurationPreProcessor(new KeyValuePairSet()));
    URL onClasspath = this.getClass().getClassLoader().getResource("xstream-standalone.xml");
    assertNotNull(p.process(onClasspath));
    try {
        p.process(new URL("file:///./does/not/exist"));
        fail();
    } catch (CoreException expected) {
    }
}
Also used : CoreException(com.adaptris.core.CoreException) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) URL(java.net.URL) 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