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());
}
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());
}
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;
}
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;
}
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) {
}
}
Aggregations