예제 #1
0
  @Test
  public void testGetLastNotifyOperation_withNullTarget() {
    String json =
        "{ \"head\" : {}, \"operations\" : ["
            + "[ \"notify\", \"w3\", \"foo\", {} ],"
            + "[ \"notify\", \"w4\", \"foo\", {} ]," // <---
            + "[ \"notify\", \"w5\", \"bar\", {} ]"
            + "] }";
    ClientMessage message = new ClientMessage(JsonObject.readFrom(json));

    NotifyOperation operation = message.getLastNotifyOperationFor(null, "foo");

    assertEquals("w4", operation.getTarget());
  }
예제 #2
0
  @Test
  public void testGetLastNotifyOperation() {
    String json =
        "{ \"head\" : {}, \"operations\" : ["
            + "[ \"notify\", \"w3\", \"foo\", { \"count\" : 1 } ],"
            + "[ \"notify\", \"w3\", \"bar\", { \"count\" : 2 } ],"
            + "[ \"notify\", \"w3\", \"foo\", { \"count\" : 3 } ]," // <---
            + "[ \"notify\", \"w3\", \"bar\", { \"count\" : 4 } ],"
            + "[ \"notify\", \"w4\", \"foo\", { \"count\" : 5 } ],"
            + "[ \"notify\", \"w4\", \"bar\", { \"count\" : 6 } ]"
            + "] }";
    ClientMessage message = new ClientMessage(JsonObject.readFrom(json));

    NotifyOperation operation = message.getLastNotifyOperationFor("w3", "foo");

    assertEquals(3, operation.getProperties().get("count").asInt());
  }