use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class MetadataConverterCase method testSetProperty.
@Test
public void testSetProperty() throws Exception {
MetadataConverter mc = createConverter();
Session session = activeMqBroker.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE);
MetadataCollection metadataCollection = new MetadataCollection();
metadataCollection.add(new MetadataElement(HEADER, getStringValue()));
Message jmsMsg = session.createMessage();
mc.moveMetadata(metadataCollection, jmsMsg);
assertEquals(getStringValue(), jmsMsg.getStringProperty(HEADER));
assertValue(jmsMsg);
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class ConvertingMetadataConverterCase method testConvertFailure_Strict.
@Test
public void testConvertFailure_Strict() throws Exception {
MetadataConverter mc = createConverter();
mc.setStrictConversion(true);
try {
Session session = activeMqBroker.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE);
MetadataCollection metadataCollection = new MetadataCollection();
metadataCollection.add(new MetadataElement(HEADER, testName.getMethodName()));
Message jmsMsg = session.createMessage();
mc.moveMetadata(metadataCollection, jmsMsg);
fail();
} catch (JMSException expected) {
}
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class ConvertingMetadataConverterCase method testConvertFailure.
@Test
public void testConvertFailure() throws Exception {
MetadataConverter mc = createConverter();
Session session = activeMqBroker.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE);
MetadataCollection metadataCollection = new MetadataCollection();
metadataCollection.add(new MetadataElement(HEADER, testName.getMethodName()));
Message jmsMsg = session.createMessage();
mc.moveMetadata(metadataCollection, jmsMsg);
assertEquals(testName.getMethodName(), jmsMsg.getStringProperty(HEADER));
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class CompositeMetadataFilterTest method testFilter.
@Test
public void testFilter() {
CompositeMetadataFilter filterer = new CompositeMetadataFilter(new NoOpMetadataFilter(), new RegexMetadataFilter());
AdaptrisMessage message = newMessage();
MetadataCollection resultingCollection = filterer.filter(message);
assertEquals(message.getMetadata().size(), resultingCollection.size());
}
use of com.adaptris.core.MetadataCollection in project interlok by adaptris.
the class DiscardEmptyValuesFilterTest method testFilterSet.
@Test
public void testFilterSet() throws Exception {
DiscardEmptyValuesFilter filter = new DiscardEmptyValuesFilter();
MetadataCollection c = filter.filter(createMessage().getMetadata());
assertEquals(3, c.size());
}
Aggregations