public void testScheduleRefreshHandlerAllModules() throws Exception {
    // Tests both the CloudFoundryServerBehaviour refresh handler as well as
    // the test harness refresh listener
    String prefix = "testScheduleRefreshHandlerAllModules";
    createWebApplicationProject();

    CloudFoundryApplicationModule appModule = deployAndWaitForDeploymentEvent(prefix);

    // Test the server-wide refresh of all modules without specifying a
    // selected module.
    ModulesRefreshListener refreshListener =
        ModulesRefreshListener.getListener(
            null, cloudServer, CloudServerEvent.EVENT_SERVER_REFRESHED);
    cloudServer.getBehaviour().getRefreshHandler().scheduleRefreshAll();

    assertModuleRefreshedAndDispose(refreshListener, CloudServerEvent.EVENT_SERVER_REFRESHED);

    refreshListener =
        ModulesRefreshListener.getListener(
            null, cloudServer, CloudServerEvent.EVENT_SERVER_REFRESHED);

    cloudServer.getBehaviour().getRefreshHandler().scheduleRefreshAll(null);

    assertModuleRefreshedAndDispose(refreshListener, CloudServerEvent.EVENT_SERVER_REFRESHED);

    refreshListener =
        ModulesRefreshListener.getListener(
            null, cloudServer, CloudServerEvent.EVENT_SERVER_REFRESHED);

    cloudServer.getBehaviour().getRefreshHandler().scheduleRefreshAll(appModule.getLocalModule());

    assertModuleRefreshedAndDispose(refreshListener, CloudServerEvent.EVENT_SERVER_REFRESHED);
  }
  public void testScheduleRefreshHandlerAllModuleInstances() throws Exception {

    String prefix = "testScheduleRefreshHandlerAllModuleInstances";
    createWebApplicationProject();

    CloudFoundryApplicationModule appModule = deployAndWaitForDeploymentEvent(prefix);

    // Test the server-wide refresh of all modules including refreshing
    // instances of a selected module
    ModulesRefreshListener refreshListener =
        ModulesRefreshListener.getListener(
            null, cloudServer, CloudServerEvent.EVENT_SERVER_REFRESHED);

    cloudServer.getBehaviour().getRefreshHandler().scheduleRefreshAll(appModule.getLocalModule());

    assertModuleRefreshedAndDispose(refreshListener, CloudServerEvent.EVENT_SERVER_REFRESHED);
  }
  public void testScheduleRefreshHandlerRefreshApplication() throws Exception {
    // Tests both the CloudFoundryServerBehaviour refresh handler as well as
    // the test harness refresh listener
    String prefix = "testScheduleRefreshHandlerRefreshApplication";
    createWebApplicationProject();

    CloudFoundryApplicationModule appModule = deployAndWaitForDeploymentEvent(prefix);

    // Test the server-wide refresh of all modules therefore do not pass the
    // app name
    ModulesRefreshListener refreshListener =
        ModulesRefreshListener.getListener(
            appModule.getDeployedApplicationName(),
            cloudServer,
            CloudServerEvent.EVENT_APPLICATION_REFRESHED);

    cloudServer
        .getBehaviour()
        .getRefreshHandler()
        .schedulesRefreshApplication(appModule.getLocalModule());

    assertModuleRefreshedAndDispose(refreshListener, CloudServerEvent.EVENT_APPLICATION_REFRESHED);
  }