private void assertUsageListenerCalledWhenApplicationStarted() {
    app = TestApplication.Factory.newManagedInstanceForTests(mgmt);
    app.start(ImmutableList.<Location>of());

    Asserts.succeedsEventually(
        new Runnable() {
          @Override
          public void run() {
            List<List<?>> events =
                RecordingStaticUsageListener.getInstance().getApplicationEvents();
            assertTrue(events.size() > 0, "events=" + events); // expect some events
          }
        });
  }
예제 #2
0
  @BeforeMethod(alwaysRun = true)
  public void setUp() throws Exception {
    jmxObjectName = new ObjectName(objectName);

    // Create an entity and configure it with the above JMX service
    app = TestApplication.Factory.newManagedInstanceForTests();
    entity =
        app.createAndManageChild(EntitySpec.create(TestEntity.class).impl(TestEntityWithJmx.class));
    app.start(ImmutableList.of(new SimulatedLocation()));

    jmxHelper = new JmxHelper(entity);

    jmxService = new JmxService(entity);
  }