@Test
  public void testReleasesLocationOnStopAfterRebinding() throws Exception {
    origE = app.createAndManageChild(EntitySpec.create(MyService.class));

    MyProvisioningLocation origLoc =
        mgmt.getLocationManager()
            .createLocation(
                LocationSpec.create(MyProvisioningLocation.class).displayName("mylocname"));
    app.start(ImmutableList.of(origLoc));
    assertEquals(origLoc.inUseCount.get(), 1);

    newApp = (TestApplication) rebind();
    MyProvisioningLocation newLoc =
        (MyProvisioningLocation) Iterables.getOnlyElement(newApp.getLocations());
    assertEquals(newLoc.inUseCount.get(), 1);

    newApp.stop();
    assertEquals(newLoc.inUseCount.get(), 0);
  }
예제 #2
0
 @AfterMethod
 public void tearDown() throws Exception {
   app.stop();
 }