Package org.apache.hadoop.cli.util

Examples of org.apache.hadoop.cli.util.CLITestData


  private void displayResults() {
    LOG.info("Detailed results:");
    LOG.info("----------------------------------\n");
   
    for (int i = 0; i < testsFromConfigFile.size(); i++) {
      CLITestData td = testsFromConfigFile.get(i);
     
      boolean testResult = td.getTestResult();
     
      // Display the details only if there is a failure
      if (!testResult) {
        LOG.info("-------------------------------------------");
        LOG.info("                    Test ID: [" + (i + 1) + "]");
        LOG.info("           Test Description: [" + td.getTestDesc() + "]");
        LOG.info("");

        ArrayList<String> testCommands = td.getTestCommands();
        for (int j = 0; j < testCommands.size(); j++) {
          LOG.info("              Test Commands: [" +
              expandCommand((String) testCommands.get(j)) + "]");
        }

        LOG.info("");
        ArrayList<String> cleanupCommands = td.getCleanupCommands();
        for (int j = 0; j < cleanupCommands.size(); j++) {
          LOG.info("           Cleanup Commands: [" +
              expandCommand((String) cleanupCommands.get(j)) + "]");
        }

        LOG.info("");
        ArrayList<ComparatorData> compdata = td.getComparatorData();
        for (int j = 0; j < compdata.size(); j++) {
          boolean resultBoolean = compdata.get(j).getTestResult();
          LOG.info("                 Comparator: [" +
              compdata.get(j).getComparatorType() + "]");
          LOG.info("         Comparision result:   [" +
              (resultBoolean ? "pass" : "fail") + "]");
          LOG.info("            Expected output:   [" +
              compdata.get(j).getExpectedOutput() + "]");
          LOG.info("              Actual output:   [" +
              compdata.get(j).getActualOutput() + "]");
        }
        LOG.info("");
      }
    }
   
    LOG.info("Summary results:");
    LOG.info("----------------------------------\n");
   
    boolean overallResults = true;
    int totalPass = 0;
    int totalFail = 0;
    int totalComparators = 0;
    for (int i = 0; i < testsFromConfigFile.size(); i++) {
      CLITestData td = testsFromConfigFile.get(i);
      totalComparators +=
        testsFromConfigFile.get(i).getComparatorData().size();
      boolean resultBoolean = td.getTestResult();
      if (resultBoolean) {
        totalPass ++;
      } else {
        totalFail ++;
      }
View Full Code Here


    LOG.info("TestAll");
   
    // Run the tests defined in the testConf.xml config file.
    for (int index = 0; index < testsFromConfigFile.size(); index++) {
     
      CLITestData testdata = (CLITestData) testsFromConfigFile.get(index);
  
      // Execute the test commands
      ArrayList<String> testCommands = testdata.getTestCommands();
      for (int i = 0; i < testCommands.size(); i++) {
        CommandExecutor.executeFSCommand(testCommands.get(i),
            namenode);
      }
     
      boolean overallTCResult = true;
      // Run comparators
      ArrayList<ComparatorData> compdata = testdata.getComparatorData();
      for (int i = 0; i < compdata.size(); i++) {
        final String comptype = compdata.get(i).getComparatorType();
       
        boolean compareOutput = false;
       
        if (! comptype.equalsIgnoreCase("none")) {
          compareOutput = compareTestOutput(compdata.get(i));
          overallTCResult &= compareOutput;
        }
       
        compdata.get(i).setExitCode(CommandExecutor.getLastExitCode());
        compdata.get(i).setActualOutput(
          CommandExecutor.getLastCommandOutput());
        compdata.get(i).setTestResult(compareOutput);
      }
      testdata.setTestResult(overallTCResult);
     
      // Execute the cleanup commands
      ArrayList<String> cleanupCommands = testdata.getCleanupCommands();
      for (int i = 0; i < cleanupCommands.size(); i++) {
        CommandExecutor.executeFSCommand(cleanupCommands.get(i),
            namenode);
      }
    }
View Full Code Here

    public void startElement(String uri,
        String localName,
        String qName,
        Attributes attributes) throws SAXException {
      if (qName.equals("test")) {
        td = new CLITestData();
      } else if (qName.equals("test-commands")) {
        testCommands = new ArrayList<String>();
      } else if (qName.equals("cleanup-commands")) {
        cleanupCommands = new ArrayList<String>();
      } else if (qName.equals("comparators")) {
View Full Code Here

  private void displayResults() {
    LOG.info("Detailed results:");
    LOG.info("----------------------------------\n");
   
    for (int i = 0; i < testsFromConfigFile.size(); i++) {
      CLITestData td = testsFromConfigFile.get(i);
     
      boolean testResult = td.getTestResult();
     
      // Display the details only if there is a failure
      if (!testResult) {
        LOG.info("-------------------------------------------");
        LOG.info("                    Test ID: [" + (i + 1) + "]");
        LOG.info("           Test Description: [" + td.getTestDesc() + "]");
        LOG.info("");

        ArrayList<TestCmd> testCommands = td.getTestCommands();
        for (TestCmd cmd : testCommands) {
          LOG.info("              Test Commands: [" +
                   expandCommand(cmd.getCmd()) + "]");
        }

        LOG.info("");
        ArrayList<TestCmd> cleanupCommands = td.getCleanupCommands();
        for (TestCmd cmd : cleanupCommands) {
          LOG.info("           Cleanup Commands: [" +
                   expandCommand(cmd.getCmd()) + "]");
        }

        LOG.info("");
        ArrayList<ComparatorData> compdata = td.getComparatorData();
        for (ComparatorData cd : compdata) {
          boolean resultBoolean = cd.getTestResult();
          LOG.info("                 Comparator: [" +
                   cd.getComparatorType() + "]");
          LOG.info("         Comparision result:   [" +
                   (resultBoolean ? "pass" : "fail") + "]");
          LOG.info("            Expected output:   [" +
                   cd.getExpectedOutput() + "]");
          LOG.info("              Actual output:   [" +
                   cd.getActualOutput() + "]");
        }
        LOG.info("");
      }
    }
   
    LOG.info("Summary results:");
    LOG.info("----------------------------------\n");
   
    boolean overallResults = true;
    int totalPass = 0;
    int totalFail = 0;
    int totalComparators = 0;
    for (int i = 0; i < testsFromConfigFile.size(); i++) {
      CLITestData td = testsFromConfigFile.get(i);
      totalComparators +=
        testsFromConfigFile.get(i).getComparatorData().size();
      boolean resultBoolean = td.getTestResult();
      if (resultBoolean) {
        totalPass ++;
      } else {
        totalFail ++;
      }
View Full Code Here

      testsFromConfigFile.size() > 0);
    LOG.info("TestAll");
    // Run the tests defined in the testConf.xml config file.
    for (int index = 0; index < testsFromConfigFile.size(); index++) {
     
      CLITestData testdata = (CLITestData) testsFromConfigFile.get(index);
  
      // Execute the test commands
      ArrayList<TestCmd> testCommands = testdata.getTestCommands();
      Result cmdResult = null;
      for (TestCmd cmd : testCommands) {
      try {
        cmdResult = execute(cmd);
      } catch (Exception e) {
        fail(StringUtils.stringifyException(e));
      }
      }
     
      boolean overallTCResult = true;
      // Run comparators
      ArrayList<ComparatorData> compdata = testdata.getComparatorData();
      for (ComparatorData cd : compdata) {
        final String comptype = cd.getComparatorType();
       
        boolean compareOutput = false;
       
        if (! comptype.equalsIgnoreCase("none")) {
          compareOutput = compareTestOutput(cd, cmdResult);
          overallTCResult &= compareOutput;
        }
       
        cd.setExitCode(cmdResult.getExitCode());
        cd.setActualOutput(cmdResult.getCommandOutput());
        cd.setTestResult(compareOutput);
      }
      testdata.setTestResult(overallTCResult);
     
      // Execute the cleanup commands
      ArrayList<TestCmd> cleanupCommands = testdata.getCleanupCommands();
      for (TestCmd cmd : cleanupCommands) {
      try {
        execute(cmd);
      } catch (Exception e) {
        fail(StringUtils.stringifyException(e));
View Full Code Here

    public void startElement(String uri,
        String localName,
        String qName,
        Attributes attributes) throws SAXException {
      if (qName.equals("test")) {
        td = new CLITestData();
      } else if (qName.equals("test-commands")) {
        testCommands = new ArrayList<TestCmd>();
      } else if (qName.equals("cleanup-commands")) {
        cleanupCommands = new ArrayList<TestCmd>();
      } else if (qName.equals("comparators")) {
View Full Code Here

  private void displayResults() {
    LOG.info("Detailed results:");
    LOG.info("----------------------------------\n");
   
    for (int i = 0; i < testsFromConfigFile.size(); i++) {
      CLITestData td = testsFromConfigFile.get(i);
     
      boolean testResult = td.getTestResult();
     
      // Display the details only if there is a failure
      if (!testResult) {
        LOG.info("-------------------------------------------");
        LOG.info("                    Test ID: [" + (i + 1) + "]");
        LOG.info("           Test Description: [" + td.getTestDesc() + "]");
        LOG.info("");

        ArrayList<TestCmd> testCommands = td.getTestCommands();
        for (TestCmd cmd : testCommands) {
          LOG.info("              Test Commands: [" +
                   expandCommand(cmd.getCmd()) + "]");
        }

        LOG.info("");
        ArrayList<TestCmd> cleanupCommands = td.getCleanupCommands();
        for (TestCmd cmd : cleanupCommands) {
          LOG.info("           Cleanup Commands: [" +
                   expandCommand(cmd.getCmd()) + "]");
        }

        LOG.info("");
        ArrayList<ComparatorData> compdata = td.getComparatorData();
        for (ComparatorData cd : compdata) {
          boolean resultBoolean = cd.getTestResult();
          LOG.info("                 Comparator: [" +
                   cd.getComparatorType() + "]");
          LOG.info("         Comparision result:   [" +
                   (resultBoolean ? "pass" : "fail") + "]");
          LOG.info("            Expected output:   [" +
                   cd.getExpectedOutput() + "]");
          LOG.info("              Actual output:   [" +
                   cd.getActualOutput() + "]");
        }
        LOG.info("");
      }
    }
   
    LOG.info("Summary results:");
    LOG.info("----------------------------------\n");
   
    boolean overallResults = true;
    int totalPass = 0;
    int totalFail = 0;
    int totalComparators = 0;
    for (int i = 0; i < testsFromConfigFile.size(); i++) {
      CLITestData td = testsFromConfigFile.get(i);
      totalComparators +=
        testsFromConfigFile.get(i).getComparatorData().size();
      boolean resultBoolean = td.getTestResult();
      if (resultBoolean) {
        totalPass ++;
      } else {
        totalFail ++;
      }
View Full Code Here

    LOG.info("TestAll");
   
    // Run the tests defined in the testConf.xml config file.
    for (int index = 0; index < testsFromConfigFile.size(); index++) {
     
      CLITestData testdata = (CLITestData) testsFromConfigFile.get(index);
  
      // Execute the test commands
      ArrayList<TestCmd> testCommands = testdata.getTestCommands();
      for (TestCmd cmd : testCommands) {
      try {
        CommandExecutor.executeCommand(cmd, namenode, jobtracker);
      } catch (Exception e) {
        fail(StringUtils.stringifyException(e));
      }
      }
     
      boolean overallTCResult = true;
      // Run comparators
      ArrayList<ComparatorData> compdata = testdata.getComparatorData();
      for (ComparatorData cd : compdata) {
        final String comptype = cd.getComparatorType();
       
        boolean compareOutput = false;
       
        if (! comptype.equalsIgnoreCase("none")) {
          compareOutput = compareTestOutput(cd);
          overallTCResult &= compareOutput;
        }
       
        cd.setExitCode(CommandExecutor.getLastExitCode());
        cd.setActualOutput(CommandExecutor.getLastCommandOutput());
        cd.setTestResult(compareOutput);
      }
      testdata.setTestResult(overallTCResult);
     
      // Execute the cleanup commands
      ArrayList<TestCmd> cleanupCommands = testdata.getCleanupCommands();
      for (TestCmd cmd : cleanupCommands) {
      try {
        CommandExecutor.executeCommand(cmd, namenode, jobtracker);
      } catch (Exception e) {
        fail(StringUtils.stringifyException(e));
View Full Code Here

    public void startElement(String uri,
        String localName,
        String qName,
        Attributes attributes) throws SAXException {
      if (qName.equals("test")) {
        td = new CLITestData();
      } else if (qName.equals("test-commands")) {
        testCommands = new ArrayList<TestCmd>();
      } else if (qName.equals("cleanup-commands")) {
        cleanupCommands = new ArrayList<TestCmd>();
      } else if (qName.equals("comparators")) {
View Full Code Here

    LOG.info("TestAll");
   
    // Run the tests defined in the testConf.xml config file.
    for (int index = 0; index < testsFromConfigFile.size(); index++) {
     
      CLITestData testdata = (CLITestData) testsFromConfigFile.get(index);
  
      // Execute the test commands
      ArrayList<String> testCommands = testdata.getTestCommands();
      for (int i = 0; i < testCommands.size(); i++) {
        CommandExecutor.executeFSCommand(testCommands.get(i),
            namenode);
      }
     
      boolean overallTCResult = true;
      // Run comparators
      ArrayList<ComparatorData> compdata = testdata.getComparatorData();
      for (int i = 0; i < compdata.size(); i++) {
        final String comptype = compdata.get(i).getComparatorType();
       
        boolean compareOutput = false;
       
        if (! comptype.equalsIgnoreCase("none")) {
          compareOutput = compareTestOutput(compdata.get(i));
          overallTCResult &= compareOutput;
        }
       
        compdata.get(i).setExitCode(CommandExecutor.getLastExitCode());
        compdata.get(i).setActualOutput(
          CommandExecutor.getLastCommandOutput());
        compdata.get(i).setTestResult(compareOutput);
      }
      testdata.setTestResult(overallTCResult);
     
      // Execute the cleanup commands
      ArrayList<String> cleanupCommands = testdata.getCleanupCommands();
      for (int i = 0; i < cleanupCommands.size(); i++) {
        CommandExecutor.executeFSCommand(cleanupCommands.get(i),
            namenode);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.cli.util.CLITestData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.