Skip to content

Commit

Permalink
adding EnqueuedTimeUtc to BrokerProperties and BrokeredMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
collinsauve committed Apr 29, 2015
1 parent 97b4f2a commit c68ccf8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public class BrokerProperties {
@JsonProperty("LockLocation")
private String lockLocation;

@JsonProperty("EnqueuedTimeUtc")
private Date enqueuedTimeUtc;

@JsonIgnore
public Integer getDeliveryCount() {
return deliveryCount;
Expand Down Expand Up @@ -210,4 +213,13 @@ public void setLockLocation(String lockLocation) {
this.lockLocation = lockLocation;
}

@JsonIgnore
public Date getEnqueuedTimeUtc() {
return enqueuedTimeUtc;
}

public void setEnqueuedTimeUtc(Date enqueuedTimeUtc) {
this.enqueuedTimeUtc = enqueuedTimeUtc;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -489,4 +489,14 @@ public String getMessageLocation() {
public String getLockLocation() {
return brokerProperties.getLockLocation();
}

/**
* Returns the enqueued date/time.
*
* @return A <code>Date</code> object that represents the date/time of the
* message in UTC format.
*/
public Date getEnqueuedTimeUtc() {
return brokerProperties.getEnqueuedTimeUtc();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ public class BrokerPropertiesMapperTest {
+ "\"ScheduledEnqueueTimeUtc\": \" Sun, 06 Nov 1994 08:49:37 GMT\","
+ "\"ReplyToSessionId\": \"reptosesid\","
+ "\"MessageLocation\": \"mesloc\","
+ "\"LockLocation\": \"locloc\"" + "}";
+ "\"LockLocation\": \"locloc\""
+ "\"EnqueuedTimeUtc\": \" Wed, 29 Apr 2015 16:48:16 GMT\"" + "}";

private static Date schedTimeUtc, lockedUntilUtc;
private static Date schedTimeUtc, lockedUntilUtc, enqueuedTimeUtc;

@BeforeClass
public static void setup() {
Expand All @@ -58,6 +59,9 @@ public static void setup() {
calendar2.set(2011, 9, 14, 12, 34, 56);
lockedUntilUtc = calendar2.getTime();

Calendar calendar3 = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
calendar3.set(2016, 3, 29, 16, 48, 16);
enqueuedTimeUtc = calendar3.getTime();
}

@Test
Expand Down Expand Up @@ -107,6 +111,8 @@ public void deserializingAllPossibleValues() {
- lockedUntilUtc.getTime();
long schedTimeDelta = properties.getScheduledEnqueueTimeUtc().getTime()
- schedTimeUtc.getTime();
long enqTimeDelta = properties.getEnqueuedTimeUtc().getTime()
- enqueuedTimeUtc.getTime();

assertEquals("corid", properties.getCorrelationId());
assertEquals("sesid", properties.getSessionId());
Expand All @@ -123,6 +129,7 @@ public void deserializingAllPossibleValues() {
assertEquals("reptosesid", properties.getReplyToSessionId());
assertEquals("mesloc", properties.getMessageLocation());
assertEquals("locloc", properties.getLockLocation());
assertTrue(Math.abs(enqTimeDelta) < 2000);
}

@Test
Expand Down

0 comments on commit c68ccf8

Please sign in to comment.