Search in sources :

Example 6 with MetadataCollection

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

the class DiscardEmptyValuesFilterTest method testFilterCollection.

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

Example 7 with MetadataCollection

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

the class DiscardEmptyValuesFilterTest method testFilterMessage.

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

Example 8 with MetadataCollection

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

the class DiscardValuesTooLongFilterTest method testFilterSet.

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

Example 9 with MetadataCollection

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

the class DiscardValuesTooLongFilterTest method testFilterMessage.

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

Example 10 with MetadataCollection

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

the class OrderedItemMetadataFilterTest method testFilter.

@Test
public void testFilter() {
    OrderedItemMetadataFilter filter = new OrderedItemMetadataFilter();
    filter.setMetadataKeys(Arrays.asList("key1", "key2", "key3"));
    AdaptrisMessage message = AdaptrisMessageFactory.getDefaultInstance().newMessage();
    message.addMetadata("Key1", "value1");
    message.addMetadata("key3", "value3");
    MetadataCollection collection = filter.filter(message);
    assertEquals(3, collection.size());
    assertEquals("key1", collection.get(0).getKey());
    assertEquals("", collection.get(0).getValue());
    assertEquals("key2", collection.get(1).getKey());
    assertEquals("", collection.get(1).getValue());
    assertEquals("key3", collection.get(2).getKey());
    assertEquals("value3", collection.get(2).getValue());
}
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