Search in sources :

Example 56 with MetadataCollection

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

the class MetadataRegexKeyFilterTest method testMultipleIncludes.

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

Example 57 with MetadataCollection

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

the class NoOpMetadataFilterTest method testFilterSet.

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

Example 58 with MetadataCollection

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

the class NoOpMetadataFilterTest method testFilterCollection.

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

Example 59 with MetadataCollection

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

the class NoOpMetadataFilterTest method testFilterMessage.

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

Example 60 with MetadataCollection

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

the class PasswordEncodeMetadatafilterTest method testFilter.

@Test
public void testFilter() throws Exception {
    PasswordEncodeMetadataFilter filter = new PasswordEncodeMetadataFilter().withStyle(Password.PORTABLE_PASSWORD).withPatterns("^.*password.*$");
    AdaptrisMessage msg = createMessage();
    MetadataCollection filtered = filter.filter(msg);
    assertEquals(3, filtered.size());
    // Changes not reflected in the underlying message.
    assertEquals("password1", msg.getMetadataValue("passwordKey1"));
    assertEquals("password2", msg.getMetadataValue("passwordKey2"));
    assertEquals("value1", msg.getMetadataValue("key1"));
    assertPasswords(filtered);
}
Also used : AdaptrisMessage(com.adaptris.core.AdaptrisMessage) 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