assertNotNull(testListener.getId());
}
@Test
public void testAppenderWithProps() throws InterruptedException {
TestListener testListener = (TestListener) applicationContext.getBean("testListener", 4);
listenerContainer.setMessageListener(testListener);
listenerContainer.start();
String propertyName = "someproperty";
String propertyValue = "property.value";
MDC.put(propertyName, propertyValue);
log.debug("This is a DEBUG message with properties");
log.info("This is an INFO message with properties");
log.warn("This is a WARN message with properties");
log.error("This is an ERROR message with properties", new RuntimeException("Test exception"));
MDC.remove(propertyName);
assertTrue(testListener.getLatch().await(5, TimeUnit.SECONDS));
MessageProperties messageProperties = testListener.getMessageProperties();
assertNotNull(messageProperties);
assertNotNull(messageProperties.getHeaders().get(propertyName));
assertEquals(propertyValue, messageProperties.getHeaders().get(propertyName));
Object location = messageProperties.getHeaders().get("location");
assertNotNull(location);