コード例 #1
0
  /**
   * Disabled becuase of CLOUDIFY-737
   *
   * @throws IOException
   * @throws InterruptedException
   */
  @Test(timeOut = DEFAULT_TEST_TIMEOUT, enabled = false)
  public void testIncreaseIsNegetive() throws IOException, InterruptedException {

    replaceInServiceFile("instancesIncrease 1", "instancesIncrease -1");

    super.install();

    // get new login page

    LoginPage loginPage = getLoginPage();

    MainNavigation mainNav = loginPage.login();

    DashboardTab dashboardTab = mainNav.switchToDashboard();

    AlertsPanel alertsPanel = dashboardTab.getDashboardSubPanel().switchToAlertsPanel();

    final InternalProcessingUnit pu =
        (InternalProcessingUnit)
            admin
                .getProcessingUnits()
                .waitFor(
                    DEFAULT_APPLICATION_NAME + "." + SERVICE_NAME,
                    OPERATION_TIMEOUT,
                    TimeUnit.MILLISECONDS);

    repetitiveAssertNumberOfInstances(pu, 2);

    setStatistics(pu, 2, 100);

    alertsPanel.waitForAlerts(AlertStatus.RAISED, "Automatic Scaling Alert", 1);
  }
コード例 #2
0
  @Test(timeOut = DEFAULT_TEST_TIMEOUT, enabled = true)
  public void tomcatRecipeTest() throws InterruptedException, IOException {

    // get new login page
    LoginPage loginPage = getLoginPage();

    MainNavigation mainNav = loginPage.login();

    DashboardTab dashboardTab = mainNav.switchToDashboard();

    final InfrastructureServicesGrid infrastructureServicesGrid =
        dashboardTab.getServicesGrid().getInfrastructureGrid();

    RepetitiveConditionProvider condition =
        new RepetitiveConditionProvider() {

          @Override
          public boolean getCondition() {
            return ((infrastructureServicesGrid.getESMInst().getCount() == 1)
                && (infrastructureServicesGrid.getESMInst().getIcon().equals(Icon.OK)));
          }
        };
    AssertUtils.repetitiveAssertTrue("No esm in showing in the dashboard", condition, waitingTime);

    ServicesGrid servicesGrid = dashboardTab.getServicesGrid();

    ApplicationsMenuPanel appMenu = servicesGrid.getApplicationsMenuPanel();

    appMenu.selectApplication(MANAGEMENT_APPLICATION_NAME);

    final ApplicationServicesGrid applicationServicesGrid =
        servicesGrid.getApplicationServicesGrid();

    condition =
        new RepetitiveConditionProvider() {
          @Override
          public boolean getCondition() {
            return applicationServicesGrid.getWebModule().getCount() == 2;
          }
        };
    AssertUtils.repetitiveAssertTrue(null, condition, waitingTime);

    appMenu.selectApplication(DEFAULT_APPLICATION_NAME);

    condition =
        new RepetitiveConditionProvider() {
          @Override
          public boolean getCondition() {
            return applicationServicesGrid.getAppServerModule().getCount() == 1;
          }
        };
    AssertUtils.repetitiveAssertTrue(
        "web server module - expected: 1, actual: "
            + applicationServicesGrid.getAppServerModule().getCount(),
        condition,
        waitingTime);

    TopologyTab topologyTab = mainNav.switchToTopology();

    final ApplicationMap appMap = topologyTab.getApplicationMap();

    topologyTab.selectApplication(MANAGEMENT_APPLICATION_NAME);

    ApplicationNode restful = appMap.getApplicationNode("rest");

    assertTrue(restful != null);
    assertTrue(restful.getStatus().equals(DeploymentStatus.INTACT));

    ApplicationNode webui = appMap.getApplicationNode("webui");

    assertTrue(webui != null);
    assertTrue(webui.getStatus().equals(DeploymentStatus.INTACT));

    topologyTab.selectApplication(DEFAULT_APPLICATION_NAME);

    condition =
        new RepetitiveConditionProvider() {

          @Override
          public boolean getCondition() {
            ApplicationNode simple = appMap.getApplicationNode(DEFAULT_TOMCAT_SERVICE_NAME);
            return simple != null;
          }
        };
    AssertUtils.repetitiveAssertTrue(
        "could not find tomcat application node after 10 seconds", condition, 10 * 1000);

    final ApplicationNode tomcatNode = appMap.getApplicationNode(DEFAULT_TOMCAT_SERVICE_NAME);

    takeScreenShot(this.getClass(), "tomcatRecipeTest", "topology");

    condition =
        new RepetitiveConditionProvider() {

          @Override
          public boolean getCondition() {
            return tomcatNode.getStatus().equals(DeploymentStatus.INTACT);
          }
        };
    repetitiveAssertTrueWithScreenshot(
        "tomcat service is displayed as "
            + appMap.getApplicationNode(DEFAULT_TOMCAT_SERVICE_NAME).getStatus()
            + "even though it is installed",
        condition,
        this.getClass(),
        "tomcatRecipeTest",
        "tomcat-service");

    HealthPanel healthPanel = topologyTab.getTopologySubPanel().switchToHealthPanel();

    takeScreenShot(this.getClass(), "tomcatRecipeTest", "topology-healthpanel");

    assertTrue(
        "Process Cpu Usage " + METRICS_ASSERTION_SUFFIX,
        healthPanel.getMetric(PROCESS_CPU_USAGE) != null);
    assertTrue(
        "Total Process Virtual Memory" + METRICS_ASSERTION_SUFFIX,
        healthPanel.getMetric(TOTAL_PROCESS_VIRTUAL_MEMORY) != null);
    assertTrue(
        "Num Of Active Threads" + METRICS_ASSERTION_SUFFIX,
        healthPanel.getMetric(NUM_OF_ACTIVE_THREADS) != null);
    assertTrue(
        "Current Http Threads Busy" + METRICS_ASSERTION_SUFFIX,
        healthPanel.getMetric(CURRENT_HTTP_THREADS_BUSY) != null);
    assertTrue(
        "Request Backlog" + METRICS_ASSERTION_SUFFIX,
        healthPanel.getMetric(REQUEST_BACKLOG) != null);
    assertTrue(
        "Active Sessions" + METRICS_ASSERTION_SUFFIX,
        healthPanel.getMetric(ACTIVE_SESSIONS) != null);

    ServicesTab servicesTab = mainNav.switchToServices();

    uninstallService("tomcat", true);
  }