Search in sources :

Example 1 with NoOpMetadataFilter

use of com.adaptris.core.metadata.NoOpMetadataFilter in project interlok by adaptris.

the class MetadataConverterCase method testMetadataFilter.

@Test
public void testMetadataFilter() throws Exception {
    MetadataConverter mc = createConverter();
    assertTrue(mc.getMetadataFilter() instanceof NoOpMetadataFilter);
    mc.setMetadataFilter(new RegexMetadataFilter());
    assertTrue(mc.getMetadataFilter() instanceof RegexMetadataFilter);
}
Also used : RegexMetadataFilter(com.adaptris.core.metadata.RegexMetadataFilter) NoOpMetadataFilter(com.adaptris.core.metadata.NoOpMetadataFilter) Test(org.junit.Test)

Example 2 with NoOpMetadataFilter

use of com.adaptris.core.metadata.NoOpMetadataFilter in project interlok by adaptris.

the class MessageTypeTranslatorCase method testRoundTrip.

@Test
public void testRoundTrip() throws Exception {
    MessageTypeTranslatorImp translator = createTranslator().withMoveJmsHeaders(true).withMetadataFilter(new NoOpMetadataFilter()).withReportAllErrors(true);
    StandaloneProducer p1 = createProducer(translator);
    StandaloneProducer p2 = roundTrip(p1);
    BaseCase.assertRoundtripEquality(p1, p2);
}
Also used : NoOpMetadataFilter(com.adaptris.core.metadata.NoOpMetadataFilter) MessageTypeTranslatorImp(com.adaptris.core.jms.MessageTypeTranslatorImp) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 3 with NoOpMetadataFilter

use of com.adaptris.core.metadata.NoOpMetadataFilter in project interlok by adaptris.

the class MimeAggregatorCase method testJoinMessage_PartHeaderFilter.

@Test
public void testJoinMessage_PartHeaderFilter() throws Exception {
    MimeAggregator aggr = createAggregatorForTests().withPartHeaderFilter(new NoOpMetadataFilter());
    AdaptrisMessage original = AdaptrisMessageFactory.getDefaultInstance().newMessage("<envelope/>", null, new HashSet<>(Arrays.asList(new MetadataElement("X-Interlok-Test", "ZZLC-original"))));
    AdaptrisMessage s1 = AdaptrisMessageFactory.getDefaultInstance().newMessage("<document>hello</document>", null, new HashSet<>(Arrays.asList(new MetadataElement("X-Interlok-Test", "ZZLC-split1"))));
    AdaptrisMessage s2 = AdaptrisMessageFactory.getDefaultInstance().newMessage("<document>world</document>", null, new HashSet<>(Arrays.asList(new MetadataElement("X-Interlok-Test", "ZZLC-split2"))));
    aggr.joinMessage(original, Arrays.asList(s1, s2));
    String payload = original.getContent();
    assertTrue(payload.contains("ZZLC-split1"));
    assertTrue(payload.contains("ZZLC-split2"));
}
Also used : NoOpMetadataFilter(com.adaptris.core.metadata.NoOpMetadataFilter) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) MetadataElement(com.adaptris.core.MetadataElement) Test(org.junit.Test)

Example 4 with NoOpMetadataFilter

use of com.adaptris.core.metadata.NoOpMetadataFilter in project interlok by adaptris.

the class MimeAggregatorCase method testJoinMessage_MimeHeaderFilter.

@Test
public void testJoinMessage_MimeHeaderFilter() throws Exception {
    MimeAggregator aggr = createAggregatorForTests().withMimeHeaderFilter(new NoOpMetadataFilter());
    AdaptrisMessage original = AdaptrisMessageFactory.getDefaultInstance().newMessage("<envelope/>", null, new HashSet<>(Arrays.asList(new MetadataElement("X-Interlok-Test", "ZZLC-original"))));
    AdaptrisMessage s1 = AdaptrisMessageFactory.getDefaultInstance().newMessage("<document>hello</document>", null, new HashSet<>(Arrays.asList(new MetadataElement("X-Interlok-Test", "ZZLC-split1"))));
    AdaptrisMessage s2 = AdaptrisMessageFactory.getDefaultInstance().newMessage("<document>world</document>", null, new HashSet<>(Arrays.asList(new MetadataElement("X-Interlok-Test", "ZZLC-split2"))));
    aggr.joinMessage(original, Arrays.asList(s1, s2));
    String payload = original.getContent();
    assertTrue(payload.contains("ZZLC-original"));
    assertFalse(payload.contains("ZZLC-split1"));
    assertFalse(payload.contains("ZZLC-split2"));
}
Also used : NoOpMetadataFilter(com.adaptris.core.metadata.NoOpMetadataFilter) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) MetadataElement(com.adaptris.core.MetadataElement) Test(org.junit.Test)

Example 5 with NoOpMetadataFilter

use of com.adaptris.core.metadata.NoOpMetadataFilter in project interlok by adaptris.

the class MetadataRequestHeadersTest method testFilter.

@Test
public void testFilter() throws Exception {
    MetadataRequestHeaders headers = new MetadataRequestHeaders();
    assertNull(headers.getFilter());
    headers.setFilter(new NoOpMetadataFilter());
    assertEquals(NoOpMetadataFilter.class, headers.getFilter().getClass());
    try {
        headers.setFilter(null);
        fail();
    } catch (IllegalArgumentException expected) {
    }
    assertEquals(NoOpMetadataFilter.class, headers.getFilter().getClass());
}
Also used : NoOpMetadataFilter(com.adaptris.core.metadata.NoOpMetadataFilter) Test(org.junit.Test)

Aggregations

NoOpMetadataFilter (com.adaptris.core.metadata.NoOpMetadataFilter)5 Test (org.junit.Test)5 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)2 MetadataElement (com.adaptris.core.MetadataElement)2 StandaloneProducer (com.adaptris.core.StandaloneProducer)1 MessageTypeTranslatorImp (com.adaptris.core.jms.MessageTypeTranslatorImp)1 RegexMetadataFilter (com.adaptris.core.metadata.RegexMetadataFilter)1