Search in sources :

Example 1 with Context

use of org.apache.hive.ptest.execution.conf.Context 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)

Aggregations

TestLogger (org.apache.hive.ptest.api.server.TestLogger)1 Context (org.apache.hive.ptest.execution.conf.Context)1 TestConfiguration (org.apache.hive.ptest.execution.conf.TestConfiguration)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