Search in sources :

Example 1 with TestLogger

use of org.apache.hive.ptest.api.server.TestLogger in project hive by apache.

the class JIRAService method main.

public static void main(String[] args) throws Exception {
    CommandLine cmd = null;
    try {
        cmd = parseCommandLine(args);
    } catch (ParseException e) {
        System.out.println("Error parsing command arguments: " + e.getMessage());
        System.exit(1);
    }
    // If null is returned, then help message was displayed in parseCommandLine method
    if (cmd == null) {
        System.exit(0);
    }
    Map<String, Object> jsonValues = parseJsonFile(cmd.getOptionValue(OPT_FILE_LONG));
    Map<String, String> context = Maps.newHashMap();
    context.put(FIELD_JIRA_URL, (String) jsonValues.get(FIELD_JIRA_URL));
    context.put(FIELD_JIRA_USER, cmd.getOptionValue(OPT_USER_LONG));
    context.put(FIELD_JIRA_PASS, cmd.getOptionValue(OPT_PASS_LONG));
    context.put(FIELD_LOGS_URL, (String) jsonValues.get(FIELD_LOGS_URL));
    context.put(FIELD_REPO, (String) jsonValues.get(FIELD_REPO));
    context.put(FIELD_REPO_NAME, (String) jsonValues.get(FIELD_REPO_NAME));
    context.put(FIELD_REPO_TYPE, (String) jsonValues.get(FIELD_REPO_TYPE));
    context.put(FIELD_REPO_BRANCH, (String) jsonValues.get(FIELD_REPO_BRANCH));
    context.put(FIELD_JENKINS_URL, (String) jsonValues.get(FIELD_JENKINS_URL));
    TestLogger logger = new TestLogger(System.err, TestLogger.LEVEL.TRACE);
    TestConfiguration configuration = new TestConfiguration(new Context(context), logger);
    configuration.setJiraName((String) jsonValues.get(FIELD_JIRA_NAME));
    configuration.setPatch((String) jsonValues.get(FIELD_PATCH_URL));
    JIRAService service = new JIRAService(logger, configuration, (String) jsonValues.get(FIELD_BUILD_TAG));
    List<String> messages = (List) jsonValues.get(FIELD_MESSAGES);
    SortedSet<String> failedTests = (SortedSet) jsonValues.get(FIELD_FAILED_TESTS);
    boolean error = (Integer) jsonValues.get(FIELD_BUILD_STATUS) == 0 ? false : true;
    service.postComment(error, (Integer) jsonValues.get(FIELD_NUM_TESTS_EXECUTED), failedTests, messages);
}
Also used : Context(org.apache.hive.ptest.execution.conf.Context) ClientContext(org.apache.http.client.protocol.ClientContext) ExecutionContext(org.apache.http.protocol.ExecutionContext) BasicHttpContext(org.apache.http.protocol.BasicHttpContext) HttpContext(org.apache.http.protocol.HttpContext) TestConfiguration(org.apache.hive.ptest.execution.conf.TestConfiguration) TestLogger(org.apache.hive.ptest.api.server.TestLogger)

Example 2 with TestLogger

use of org.apache.hive.ptest.api.server.TestLogger in project hive by apache.

the class AbstractTestPhase method initialize.

public void initialize(String name) throws Exception {
    baseDir = createBaseDir(name);
    logDir = Dirs.create(new File(baseDir, "logs"));
    scratchDir = Dirs.create(new File(baseDir, "scratch"));
    succeededLogDir = Dirs.create(new File(logDir, "succeeded"));
    failedLogDir = Dirs.create(new File(logDir, "failed"));
    executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(2));
    executionContext = mock(ExecutionContext.class);
    hostExecutorBuilder = mock(HostExecutorBuilder.class);
    localCommandFactory = new MockLocalCommandFactory(LOG);
    localCommand = mock(LocalCommand.class);
    localCommandFactory.setInstance(localCommand);
    sshCommandExecutor = spy(new MockSSHCommandExecutor(LOG));
    rsyncCommandExecutor = spy(new MockRSyncCommandExecutor(LOG));
    logger = new TestLogger(System.err, TestLogger.LEVEL.TRACE);
    templateDefaults = ImmutableMap.<String, String>builder().put("localDir", LOCAL_DIR).put("workingDir", WORKING_DIR).put("instanceName", INSTANCE_NAME).put("branch", BRANCH).put("logDir", logDir.getAbsolutePath()).put("repository", REPOSITORY).put("repositoryName", REPOSITORY_NAME).build();
    host = new Host(HOST, USER, new String[] { LOCAL_DIR }, 2);
}
Also used : ExecutionContext(org.apache.hive.ptest.execution.context.ExecutionContext) Host(org.apache.hive.ptest.execution.conf.Host) File(java.io.File) TestLogger(org.apache.hive.ptest.api.server.TestLogger)

Aggregations

TestLogger (org.apache.hive.ptest.api.server.TestLogger)2 File (java.io.File)1 Context (org.apache.hive.ptest.execution.conf.Context)1 Host (org.apache.hive.ptest.execution.conf.Host)1 TestConfiguration (org.apache.hive.ptest.execution.conf.TestConfiguration)1 ExecutionContext (org.apache.hive.ptest.execution.context.ExecutionContext)1 ClientContext (org.apache.http.client.protocol.ClientContext)1 BasicHttpContext (org.apache.http.protocol.BasicHttpContext)1 ExecutionContext (org.apache.http.protocol.ExecutionContext)1 HttpContext (org.apache.http.protocol.HttpContext)1