Example #1
0
  @Test(dependsOnMethods = {"exportToHDFS"})
  @Parameters({"HDFS_HOST", "biginsightsHomeUsername", "biginsightsHomePassword"})
  public void checkExportedFile(
      String HDFS_HOST, String biginsightsHomeUsername, String biginsightsHomePassword)
      throws InterruptedException, IOException, JSONException {

    // knoxhost=Common.assignPOMValues("BIknoxHost",knoxhost);
    HDFS_HOST = Common.assignPOMValues("BIhdfsHost", HDFS_HOST);
    biginsightsHomeUsername =
        Common.assignPOMValues("BIvaluePackUsername", biginsightsHomeUsername);
    biginsightsHomePassword =
        Common.assignPOMValues("BIvaluePackPassword", biginsightsHomePassword);
    //		check whether the exported file is as expected
    String[] masterFilePath = {
      localFolderForData + "ExpectedExportDataCSV.csv",
      localFolderForData + "ExpectedExportDataJsonArray.json",
      localFolderForData + "ExpectedExportDataJsonObj.json",
      localFolderForData + "ExpectedExportDataTSV.tsv"
    };
    String[] hdfsFilePath = {
      "/tmp/exported/CSV.csv",
      "/tmp/exported/JsonArray.json",
      "/tmp/exported/JsonObject.json",
      "/tmp/exported/TSV.tsv"
    };

    BigsheetsUtil.compareFiles(
        hdfsFilePath[0],
        HDFS_HOST,
        masterFilePath[0],
        "http",
        biginsightsHomeUsername,
        biginsightsHomePassword);
    BigsheetsUtil.compareJsonArrayFiles(
        hdfsFilePath[1],
        HDFS_HOST,
        masterFilePath[1],
        "http",
        biginsightsHomeUsername,
        biginsightsHomePassword);
    BigsheetsUtil.compareJsonObjectFiles(
        hdfsFilePath[2],
        HDFS_HOST,
        masterFilePath[2],
        "http",
        biginsightsHomeUsername,
        biginsightsHomePassword);
    BigsheetsUtil.compareDelimitedFiles(
        hdfsFilePath[3],
        HDFS_HOST,
        masterFilePath[3],
        "http",
        biginsightsHomeUsername,
        biginsightsHomePassword,
        "\t");
  }
Example #2
0
  @Test
  @Parameters({"masterSheetName", "web_ui_framework_installed"})
  public static void isMasterWorkBookPresent(
      String masterSheetName, String web_ui_framework_installed) throws InterruptedException {

    System.out.println(
        "-----------------------------------------------------------------------------------------------");
    System.out.println(
        "PRE-REQ CHECK BEFORE TESTING THE EXPORT WORKBOOK FUNCTIONALITY, IN PROGRESS");
    System.out.println("");
    System.out.println(
        "-----------------------------------------------------------------------------------------------");
    System.out.println("");

    // Thread.sleep(10000);
    web_ui_framework_installed =
        Common.assignPOMValues("BIwebuiframeworkInstalled", web_ui_framework_installed);

    masterSheetName = Common.assignPOMValues("BImasterSheetName", masterSheetName);
    System.out.println("The specified masterWB to search for is " + masterSheetName);

    Thread.sleep(1000);
    if (web_ui_framework_installed.equalsIgnoreCase("installed")) {
      System.out.println("In here");
      driver.switchTo().frame("component-iframe-bigsheets");
    } else {
      // Boolean
      // isDisplayedValue=driver.findElements(By.xpath("//*[@id='widget_searchBox']/div[1]/input[@type='text'][@value='Χ ']")).size()>0;

      Boolean isDisplayedValue =
          driver.findElements(By.xpath("//div[contains(@class,'m2HasValue')]")).size() > 0;
      System.out.println("Search Box has value " + isDisplayedValue);

      if (isDisplayedValue == true) {

        WebElementHelper.findAndClickByXpath(
            driver,
            "//*[@id='widget_searchBox']/div[1]/input[@type='text'][@value='Χ ']",
            60,
            "Filter value");
      }
    }

    Boolean isDisplayed = driver.findElements(By.linkText(masterSheetName)).size() > 0;

    if (isDisplayed == false) {
      System.out.println("In here false");
      System.out.println("Please create the Master WB before proceeding with the Edit");
    }
    Assert.assertEquals(isDisplayed, new Boolean(true));
    WebElementHelper.clickByLinkText(driver, masterSheetName);
  }
Example #3
0
  @Test
  @Parameters({"username", "password"})
  /**
   * *
   *
   * <p>Logs Into Ambari console
   */
  public void logIn(String username, String password) throws InterruptedException {
    username = Common.assignPOMValues("BIusername", username);
    password = Common.assignPOMValues("BIpassword", password);

    WebElementHelper.findAndTypeByXpath(
        driver, username, "//input[contains(@class, 'login-user-name')]", 30, "Username");
    WebElementHelper.findAndTypeByXpath(
        driver, password, "//input[contains(@class, 'login-user-password')]", 30, "Password");
    WebElementHelper.findAndClickByXpath(
        driver, "//button[contains(@class, 'login-btn')]", 30, "Sign in");
    Thread.sleep(2000);
  }
  @Test
  @Parameters({"ambarihost", "username", "password"})
  public void getBlueprints(String ambarihost, String username, String password) {

    ambarihost = Common.assignPOMValues("BIambarihost", ambarihost);
    username = Common.assignPOMValues("BIusername", username);
    password = Common.assignPOMValues("BIpassword", password);

    String response =
        RestAssured.given()
            .keystore("data/certs/BigInsights.jks", "passw0rd")
            .header("X-Requested-By:", "ambari")
            .auth()
            .preemptive()
            .basic(username, password)
            .get(AmbariUtil.getAmbariHostURL(ambarihost) + "/api/v1/blueprints")
            .asString();

    System.out.println(response);
  }
Example #5
0
 @BeforeClass
 @Parameters({"browser", "hostname"})
 /**
  * *
  *
  * <p>open browser and login to the site
  */
 public void openBrowser(String browser, String ambarihost)
     throws InterruptedException, IOException {
   ambarihost = Common.assignPOMValues("BIambarihost", ambarihost);
   driver =
       WebDriverHelper.instantiateDriver(driver, browser, AmbariUtil.getAmbariHostURL(ambarihost));
 }
Example #6
0
  @BeforeClass
  @Parameters({
    "browser",
    "knoxhost",
    "knoxPort",
    "biginsightsHomeUsername",
    "biginsightsHomePassword",
    "web_ui_framework_installed"
  })
  public void setup(
      String browser,
      String knoxhost,
      String knoxPort,
      String biginsightsHomeUsername,
      String biginsightsHomePassword,
      String web_ui_framework_installed)
      throws InterruptedException, IOException {

    browser = Common.assignPOMValues("BIbrowser", browser);
    knoxhost = Common.assignPOMValues("BIknoxHost", knoxhost);
    knoxPort = Common.assignPOMValues("BIknoxPort", knoxPort);
    biginsightsHomeUsername =
        Common.assignPOMValues("BIvaluePackUsername", biginsightsHomeUsername);
    biginsightsHomePassword =
        Common.assignPOMValues("BIvaluePackPassword", biginsightsHomePassword);
    web_ui_framework_installed =
        Common.assignPOMValues("BIwebuiframeworkInstalled", web_ui_framework_installed);

    System.out.println(knoxhost);
    System.out.println(knoxPort);
    System.out.println(browser);
    System.out.println(biginsightsHomeUsername);
    System.out.println(biginsightsHomePassword);
    System.out.println(web_ui_framework_installed);

    if (web_ui_framework_installed.equalsIgnoreCase("installed")) {

      url =
          WebDriverHelper.generateValuePacksWebURL(
              knoxhost, knoxPort, biginsightsHomeUsername, biginsightsHomePassword, "bigsheets");
      driver = WebDriverHelper.instantiateDriver(driver, browser, url);
      Thread.sleep(1000);
      WebElementHelper.findAndClickByXpath(
          driver,
          "//div[@ng-hide='isPreviewing']/div/div/div/div[1]/div",
          60,
          "BigSheets Launch Banner");

    } else {

      url =
          "https://"
              + biginsightsHomeUsername
              + ":"
              + biginsightsHomePassword
              + "@"
              + knoxhost
              + ":"
              + knoxPort
              + "/gateway/default/bigsheets/client/home";
      System.out.println(url);
      driver = WebDriverHelper.instantiateDriver(driver, browser, url);
      Thread.sleep(1000);
    }
  }