All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.cli.reporters.CLIIssueTrackerUpdater Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package net.serenitybdd.cli.reporters;

import net.serenitybdd.model.SerenitySystemProperties;
import net.thucydides.model.reports.JiraUpdaterService;

import java.io.IOException;
import java.nio.file.Path;
import java.util.ServiceLoader;

import static net.thucydides.model.ThucydidesSystemProperty.SERENITY_JIRA_WORKFLOW;
import static net.thucydides.model.ThucydidesSystemProperty.SERENITY_JIRA_WORKFLOW_ACTIVE;

public class CLIIssueTrackerUpdater implements CLIReportGenerator  {
    public CLIIssueTrackerUpdater(String jiraWorkflow, String jiraWorkflowActive) {
        if(jiraWorkflow != null) {
            SerenitySystemProperties.getProperties().setValue(SERENITY_JIRA_WORKFLOW, jiraWorkflow);
        }
        if(jiraWorkflowActive != null) {
            SerenitySystemProperties.getProperties().setValue(SERENITY_JIRA_WORKFLOW_ACTIVE, jiraWorkflowActive);
        }
    }

    @Override
    public void generateReportsFrom(Path sourceDirectory) throws IOException {
        Iterable jiraUpdaterServices = ServiceLoader.load(JiraUpdaterService.class);
        for(JiraUpdaterService jiraUpdaterService: jiraUpdaterServices) {
            jiraUpdaterService.updateJiraForTestResultsFrom(sourceDirectory.toAbsolutePath().toString());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy