예제 #1
0
파일: EventTest.java 프로젝트: enonic/xp
  @Test
  public void testDataValues() {
    final Event testEvent =
        Event.create("type")
            .distributed(true)
            .value("int1", 1)
            .value("long1", 10L)
            .value("bool1", false)
            .value("obj1", this.createTestEvent())
            .build();

    assertTrue(testEvent.hasValue("int1"));
    assertTrue(testEvent.hasValue("long1"));
    assertTrue(testEvent.hasValue("bool1"));
    assertTrue(testEvent.hasValue("obj1"));
    assertTrue(testEvent.getValue("int1").get() instanceof Integer);
    assertTrue(testEvent.getValue("long1").get() instanceof Long);
    assertTrue(testEvent.getValue("bool1").get() instanceof Boolean);
    assertTrue(testEvent.getValue("obj1").get() instanceof String);
  }
예제 #2
0
파일: EventTest.java 프로젝트: enonic/xp
  @Test
  public void testBuilder() {
    final Event event = this.createTestEvent();

    assertEquals("type", event.getType());
    assertEquals(true, event.isDistributed());
    assertNotNull(event.getData());
    assertTrue(event.hasValue("key1"));
    assertTrue(event.hasValue("key2"));
    assertEquals("val1", event.getValue("key1").get());
    assertEquals("val2", event.getValue("key2").get());
  }