use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class MetadataRegexKeyFilterTest method testExcludes5Keys.
@Test
public void testExcludes5Keys() {
filterer.addExcludePattern("key");
MetadataCollection resultingCollection = filterer.filter(message);
assertEquals(3, resultingCollection.size());
assertTrue(resultingCollection.containsKey("someRandomKey"));
assertTrue(resultingCollection.containsKey("JackAndJill"));
assertTrue(resultingCollection.containsKey("JillAndJack"));
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class MetadataRegexKeyFilterTest method testNoIncludesOrExcludes.
@Test
public void testNoIncludesOrExcludes() {
MetadataCollection resultingCollection = filterer.filter(message);
assertEquals(message.getMetadata().size(), resultingCollection.size());
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class CreateQueryStringFromMetadataTest method testService_WithException.
@Test
public void testService_WithException() throws Exception {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
CreateQueryStringFromMetadata service = createService().withMetadataFilter(new MetadataFilterImpl() {
@Override
public MetadataCollection filter(MetadataCollection original) {
throw new RuntimeException();
}
});
try {
execute(service, msg);
fail();
} catch (Exception expected) {
}
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class MetadataHelperTest method testToSet.
@Test
public void testToSet() {
Set<MetadataElement> elements = new HashSet<>();
elements.add(new MetadataElement("test", "value"));
MetadataCollection c = new MetadataCollection(elements);
assertEquals(elements, c.toSet());
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class MetadataRequestHeaders method addHeaders.
@Override
public HttpURLConnection addHeaders(AdaptrisMessage msg, HttpURLConnection target) {
MetadataCollection metadataSubset = getFilter().filter(msg);
for (MetadataElement me : metadataSubset) {
String value = unfold(me.getValue());
log.trace("Adding Request Property [{}: {}]", me.getKey(), value);
target.addRequestProperty(me.getKey(), value);
}
return target;
}
Aggregations