Ejemplo n.º 1
0
  @Test
  public void testCanCustomizeRebind() throws Exception {
    MyEntity2 origE =
        origApp.createAndManageChild(
            EntitySpec.create(MyEntity2.class).configure("myfield", "myval"));

    newApp = rebind();

    MyEntity2 newE =
        (MyEntity2) Iterables.find(newApp.getChildren(), Predicates.instanceOf(MyEntity2.class));
    assertEquals(newE.getMyfield(), "myval");
    Assert.assertEquals(newE, origE);
  }
Ejemplo n.º 2
0
  @Test
  public void testRebindsSubscriptions() throws Exception {
    MyEntity2 origE =
        origApp.createAndManageChild(
            EntitySpec.create(MyEntity2.class).configure("subscribe", true));

    newApp = rebind();
    MyEntity2 newE =
        (MyEntity2) Iterables.find(newApp.getChildren(), Predicates.instanceOf(MyEntity2.class));

    newApp.setAttribute(TestApplication.MY_ATTRIBUTE, "mysensorval");
    Asserts.eventually(
        Suppliers.ofInstance(newE.getEvents()),
        Predicates.<List<String>>equalTo(ImmutableList.of("mysensorval")));
    Assert.assertEquals(newE, origE);
  }