This commit is contained in:
Martyn Taylor 2017-04-03 14:28:02 +01:00
commit 5adce230a3
4 changed files with 38 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<!-- The web server is only bound to loalhost by default --> <!-- The web server is only bound to loalhost by default -->
<web bind="${web.protocol}://${http.host}:${http.port}" path="web"${extra.web.attributes}> <web bind="${web.protocol}://${http.host}:${http.port}" path="web"${extra.web.attributes}>
<app url="jolokia" war="jolokia-war-1.3.5.war"/> <app url="jolokia" war="jolokia.war"/>
</web> </web>

View File

@ -139,6 +139,7 @@
</includes> </includes>
<outputDirectory>web</outputDirectory> <outputDirectory>web</outputDirectory>
<unpack>false</unpack> <unpack>false</unpack>
<outputFileNameMapping>jolokia.war</outputFileNameMapping>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
<fileSets> <fileSets>

View File

@ -402,7 +402,7 @@ public class AMQPMessage extends RefCountMessage {
if (section instanceof Properties) { if (section instanceof Properties) {
_properties = (Properties) section; _properties = (Properties) section;
if (_properties.getAbsoluteExpiryTime() != null) { if (_properties.getAbsoluteExpiryTime() != null && _properties.getAbsoluteExpiryTime().getTime() > 0) {
this.expiration = _properties.getAbsoluteExpiryTime().getTime(); this.expiration = _properties.getAbsoluteExpiryTime().getTime();
} }

View File

@ -124,6 +124,41 @@ public class AmqpExpiredMessageTest extends AmqpClientTestSupport {
connection.close(); connection.close();
} }
@Test(timeout = 60000)
public void testSendMessageThatIsExpiredUsingTTLWhenAbsoluteIsZero() throws Exception {
AmqpClient client = createAmqpClient();
AmqpConnection connection = addConnection(client.connect());
AmqpSession session = connection.createSession();
AmqpSender sender = session.createSender(getTestName());
// Get the Queue View early to avoid racing the delivery.
final Queue queueView = getProxyToQueue(getTestName());
assertNotNull(queueView);
AmqpMessage message = new AmqpMessage();
message.setAbsoluteExpiryTime(0);
// AET should override any TTL set
message.setTimeToLive(1000);
message.setText("Test-Message");
sender.send(message);
sender.close();
assertEquals(1, queueView.getMessageCount());
Thread.sleep(1000);
// Now try and get the message
AmqpReceiver receiver = session.createReceiver(getTestName());
receiver.flow(1);
AmqpMessage received = receiver.receive(1, TimeUnit.SECONDS);
assertNull(received);
assertEquals(1, queueView.getMessagesExpired());
connection.close();
}
@Test(timeout = 60000) @Test(timeout = 60000)
public void testSendMessageThatIsNotExpiredUsingAbsoluteTimeWithElspsedTTL() throws Exception { public void testSendMessageThatIsNotExpiredUsingAbsoluteTimeWithElspsedTTL() throws Exception {
AmqpClient client = createAmqpClient(); AmqpClient client = createAmqpClient();