use of com.adaptris.core.metadata.RemoveAllMetadataFilter in project interlok by adaptris.
the class MessageTypeTranslatorCase method testMoveMetadataJmsMessageToAdaptrisMessage_RemoveAllFilter.
@Test
public void testMoveMetadataJmsMessageToAdaptrisMessage_RemoveAllFilter() throws Exception {
MessageTypeTranslatorImp trans = createTranslator();
trans.setMetadataFilter(new RemoveAllMetadataFilter());
try {
Session session = activeMqBroker.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE);
Message jmsMsg = createMessage(session);
addProperties(jmsMsg);
start(trans, session);
AdaptrisMessage msg = trans.translate(jmsMsg);
assertFalse(msg.containsKey(INTEGER_METADATA));
assertFalse(msg.containsKey(STRING_METADATA));
assertFalse(msg.containsKey(BOOLEAN_METADATA));
} finally {
stop(trans);
}
}
use of com.adaptris.core.metadata.RemoveAllMetadataFilter in project interlok by adaptris.
the class HttpProducer method init.
@Override
public void init() throws CoreException {
try {
if (getUserName() != null && getPassword() != null) {
authString = buildBasicRfc2617(getUserName(), Password.decode(ExternalResolver.resolve(getPassword())));
passwordAuth = new PasswordAuthentication(userName, Password.decode(ExternalResolver.resolve(getPassword())).toCharArray());
}
if (sendMetadataAsHeaders()) {
if (getSendMetadataRegexp() == null && getMetadataFilter() instanceof RemoveAllMetadataFilter) {
log.warn("No Metadata Regular expression configured, ignoring sendMetadataAsHeaders=true");
setSendMetadataAsHeaders(Boolean.FALSE);
} else {
if (getSendMetadataRegexp() != null && getMetadataFilter() instanceof RemoveAllMetadataFilter) {
log.trace("Overriding metadata-filter with filter based on {}", getSendMetadataRegexp());
RegexMetadataFilter filter = new RegexMetadataFilter();
filter.addIncludePattern(getSendMetadataRegexp());
setMetadataFilter(filter);
}
}
}
} catch (Exception e) {
throw new CoreException(e);
}
}
use of com.adaptris.core.metadata.RemoveAllMetadataFilter in project interlok by adaptris.
the class BytesMessageTranslatorTest method testMoveMetadataJmsMessageToAdaptrisMessage_RemoveAllFilter.
@Override
@Test
public void testMoveMetadataJmsMessageToAdaptrisMessage_RemoveAllFilter() throws Exception {
MessageTypeTranslatorImp trans = createTranslator();
trans.setMetadataFilter(new RemoveAllMetadataFilter());
try {
Session session = activeMqBroker.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE);
BytesMessage jmsMsg = createMessage(session);
addProperties(jmsMsg);
start(trans, session);
// We aren't actually producing the message, so we have to
// switch to read-only mode.
jmsMsg.reset();
AdaptrisMessage msg = trans.translate(jmsMsg);
assertFalse(msg.containsKey(INTEGER_METADATA));
assertFalse(msg.containsKey(STRING_METADATA));
assertFalse(msg.containsKey(BOOLEAN_METADATA));
} finally {
stop(trans);
}
}
use of com.adaptris.core.metadata.RemoveAllMetadataFilter in project interlok by adaptris.
the class MessageTypeTranslatorCase method testMoveMetadata_AdaptrisMessageToJmsMessage_RemoveAll.
@Test
public void testMoveMetadata_AdaptrisMessageToJmsMessage_RemoveAll() throws Exception {
MessageTypeTranslatorImp trans = createTranslator().withMetadataFilter(new RemoveAllMetadataFilter());
try {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
addMetadata(msg);
Session session = activeMqBroker.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE);
start(trans, session);
Message jmsMsg = trans.translate(msg);
assertNull(jmsMsg.getStringProperty(STRING_METADATA));
assertNull(jmsMsg.getStringProperty(BOOLEAN_METADATA));
assertNull(jmsMsg.getStringProperty(INTEGER_METADATA));
} finally {
stop(trans);
}
}
Aggregations