Search in sources :

Example 16 with MetadataCollection

use of com.adaptris.core.MetadataCollection in project interlok by adaptris.

the class RemoveAllMetadataFilterTest method testFilterCollection.

@Test
public void testFilterCollection() throws Exception {
    RemoveAllMetadataFilter filter = new RemoveAllMetadataFilter();
    MetadataCollection c = filter.filter(new MetadataCollection(createMessage().getMetadata()));
    assertEquals(0, c.size());
}
Also used : MetadataCollection(com.adaptris.core.MetadataCollection) Test(org.junit.Test)

Example 17 with MetadataCollection

use of com.adaptris.core.MetadataCollection in project interlok by adaptris.

the class MappedKeyMetadataFilterTest method testFilterNoReplacement.

@Test
public void testFilterNoReplacement() {
    MappedKeyMetadataFilter filterer = new MappedKeyMetadataFilter("key", "");
    AdaptrisMessage message = newMessage();
    MetadataCollection resultingCollection = filterer.filter(message);
    assertEquals(message.getMetadata().size(), resultingCollection.size());
    assertTrue(message.getMessageHeaders().containsKey("key1"));
    assertFalse(resultingCollection.containsKey("key1"));
    assertFalse(message.getMessageHeaders().containsKey("1"));
    assertTrue(resultingCollection.containsKey("1"));
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) MetadataCollection(com.adaptris.core.MetadataCollection) Test(org.junit.Test)

Example 18 with MetadataCollection

use of com.adaptris.core.MetadataCollection in project interlok by adaptris.

the class MetadataRegexKeyFilterTest method testMultipleExcludes.

@Test
public void testMultipleExcludes() {
    filterer.withExcludePatterns("key", "Jill");
    MetadataCollection resultingCollection = filterer.filter(message);
    assertEquals(1, resultingCollection.size());
    assertTrue(resultingCollection.containsKey("someRandomKey"));
}
Also used : MetadataCollection(com.adaptris.core.MetadataCollection) Test(org.junit.Test)

Example 19 with MetadataCollection

use of com.adaptris.core.MetadataCollection in project interlok by adaptris.

the class MetadataRegexKeyFilterTest method testIncludesOnly2Keys.

@Test
public void testIncludesOnly2Keys() {
    filterer.addIncludePattern("Jill");
    MetadataCollection resultingCollection = filterer.filter(message);
    assertEquals(2, resultingCollection.size());
}
Also used : MetadataCollection(com.adaptris.core.MetadataCollection) Test(org.junit.Test)

Example 20 with MetadataCollection

use of com.adaptris.core.MetadataCollection in project interlok by adaptris.

the class MetadataRegexKeyFilterTest method testIncludesOnly1.

@Test
public void testIncludesOnly1() {
    filterer.addIncludePattern("key1");
    MetadataCollection resultingCollection = filterer.filter(message);
    assertEquals(1, resultingCollection.size());
}
Also used : MetadataCollection(com.adaptris.core.MetadataCollection) Test(org.junit.Test)

Aggregations

MetadataCollection (com.adaptris.core.MetadataCollection)66 Test (org.junit.Test)43 MetadataElement (com.adaptris.core.MetadataElement)18 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)12 KeyValuePair (com.adaptris.util.KeyValuePair)4 Message (javax.jms.Message)4 Session (javax.jms.Session)4 MultiPartOutput (com.adaptris.util.text.mime.MultiPartOutput)3 InternetHeaders (javax.mail.internet.InternetHeaders)2 MimeBodyPart (javax.mail.internet.MimeBodyPart)2 Event (com.adaptris.core.Event)1 AdapterCloseEvent (com.adaptris.core.event.AdapterCloseEvent)1 MetadataFilterImpl (com.adaptris.core.metadata.MetadataFilterImpl)1 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Properties (java.util.Properties)1 JMSException (javax.jms.JMSException)1