use of com.adaptris.util.KeyValuePairList in project interlok by adaptris.
the class AddExtendedLoggingContextTest method testUseDefaultKeysReplace.
@Test
public void testUseDefaultKeysReplace() throws Exception {
AddExtendedLoggingContext srv = new AddExtendedLoggingContext().withUseDefaultKeys(true).withValuesToSet(new KeyValuePairList(Collections.singletonMap(CoreConstants.MESSAGE_UNIQUE_ID_KEY, "somethingElse")));
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
msg.addObjectHeader(CoreConstants.MESSAGE_UNIQUE_ID_KEY, "unique");
execute(srv, msg);
assertEquals("somethingElse", MDC.get(CoreConstants.MESSAGE_UNIQUE_ID_KEY));
}
use of com.adaptris.util.KeyValuePairList in project interlok by adaptris.
the class MultiPayloadXmlTransformServiceTest method testResolvableExpressionParameter_XSLTOutput.
@Test
public void testResolvableExpressionParameter_XSLTOutput() throws Exception {
MultiPayloadAdaptrisMessage message = MessageHelper.createMultiPayloadMessage(PAYLOAD_ID_SOURCE, PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
message.addPayload("somePayload", "World".getBytes());
MultiPayloadXmlTransformService service = createBaseExample();
ResolvableExpressionParameter params = new ResolvableExpressionParameter();
KeyValuePairList exprns = new KeyValuePairList();
exprns.add(new KeyValuePair("world", "%payload{id:somePayload}"));
params.setExpressions(exprns);
service.setTransformParameter(params);
execute(service, message);
assertEquals(PROPERTIES.getProperty(KEY_XML_TEST_OUTPUT) + "World", message.getContent(PAYLOAD_ID_OUTPUT));
}
use of com.adaptris.util.KeyValuePairList in project interlok by adaptris.
the class ResolvableExpressionParameterTest method setUp.
@Before
public void setUp() throws Exception {
message = createMessage();
message.setContent(CONTENT, "UTF-8");
expressions = new KeyValuePairList();
expressions.add(new KeyValuePair("beer", CONTENT));
existing = new HashMap<>();
existing.put("key", "value");
}
use of com.adaptris.util.KeyValuePairList in project interlok by adaptris.
the class MapMetadataServiceTest method testReplacement_Resolved.
@Test
public void testReplacement_Resolved() throws Exception {
MapMetadataService service = createService();
KeyValuePairList kvps = new KeyValuePairList();
kvps.addKeyValuePair(new KeyValuePair(BASIC_MATCH_VALUE, "%message{ResolvedKey}"));
service.setMetadataKeyMap(kvps);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("zzzzzzzz");
msg.addMetadata(METADATA_KEY, BASIC_MATCH_VALUE);
msg.addMetadata("ResolvedKey", BASIC_NEW_VALUE);
execute(service, msg);
assertTrue(msg.getMetadataValue(METADATA_KEY).equals(BASIC_NEW_VALUE));
}
use of com.adaptris.util.KeyValuePairList in project interlok by adaptris.
the class MapMetadataServiceTest method createService.
private MapMetadataService createService() {
KeyValuePairList kvps = new KeyValuePairList();
kvps.addKeyValuePair(new KeyValuePair(BASIC_MATCH_VALUE, BASIC_NEW_VALUE));
kvps.addKeyValuePair(new KeyValuePair(UNMATCHED_REGXP, BASIC_NEW_VALUE));
kvps.addKeyValuePair(new KeyValuePair(UNMATCHED_REGXP, "{1}"));
kvps.addKeyValuePair(new KeyValuePair(REGEXP, REGEX_MATCH_GROUP));
MapMetadataService service = new MapMetadataService();
service.setMetadataKeyMap(kvps);
service.setMetadataKey(METADATA_KEY);
return service;
}
Aggregations