arquillian-testsuite fixed whitespaces

This commit is contained in:
vramik 2015-10-27 11:43:49 +01:00
parent f45e0aa387
commit 2fd7e5b355
3 changed files with 42 additions and 42 deletions

View file

@ -22,17 +22,17 @@ public class JBossJiraParser {
private static final String JBOSS_TRACKER_REST_URL = "https://issues.jboss.org/rest/api/latest/issue/";
public static boolean isIssueClosed(String issueId) {
Status issueStatus;
try {
issueStatus = getIssueStatus(issueId);
} catch(Exception e) {
issueStatus = Status.CLOSED; //let the test run in case there is no connection
}
Status issueStatus;
try {
issueStatus = getIssueStatus(issueId);
} catch (Exception e) {
issueStatus = Status.CLOSED; //let the test run in case there is no connection
}
return issueStatus == Status.CLOSED || issueStatus == Status.RESOLVED;
}
private static Status getIssueStatus(String issueId) throws Exception {
Client client = ClientBuilder.newClient();
Client client = ClientBuilder.newClient();
WebTarget target = client.target(JBOSS_TRACKER_REST_URL);
String json = target.path(issueId).request().accept(MediaType.APPLICATION_JSON_TYPE).get(String.class);
JsonObject jsonObject = new Gson().fromJson(json, JsonElement.class).getAsJsonObject();

View file

@ -24,5 +24,5 @@ import java.lang.annotation.Target;
public @interface Jira {
String value();
boolean enabled() default true;
boolean enabled() default true;
}

View file

@ -19,43 +19,43 @@ import static org.keycloak.testsuite.arquillian.jira.JBossJiraParser.isIssueClos
*/
public class JiraTestExecutionDecider implements TestExecutionDecider {
private static Map<String, Boolean> cache = new HashMap<String, Boolean>();
private static Map<String, Boolean> cache = new HashMap<>();
@Override
public ExecutionDecision decide(Method method) {
Jira jiraAnnotation = method.getAnnotation(Jira.class);
if (jiraAnnotation != null && jiraAnnotation.enabled()) {
boolean executeTest = true;
String[] issueIds = getIssuesId(jiraAnnotation.value());
for (String issueId : issueIds) {
if (cache.containsKey(issueId)) {
executeTest = cache.get(issueId);
} else {
if (isIssueClosed(issueId)) {
cache.put(issueId, true);
} else {
executeTest = false;
cache.put(issueId, false);
}
}
}
@Override
public ExecutionDecision decide(Method method) {
Jira jiraAnnotation = method.getAnnotation(Jira.class);
if (jiraAnnotation != null && jiraAnnotation.enabled()) {
boolean executeTest = true;
String[] issueIds = getIssuesId(jiraAnnotation.value());
for (String issueId : issueIds) {
if (cache.containsKey(issueId)) {
executeTest = cache.get(issueId);
} else {
if (isIssueClosed(issueId)) {
cache.put(issueId, true);
} else {
executeTest = false;
cache.put(issueId, false);
}
}
}
if (executeTest) {
return ExecutionDecision.execute();
} else {
return ExecutionDecision.dontExecute("Issue is still opened, therefore skipping the test " + method.getName());
}
}
return ExecutionDecision.execute();
}
if (executeTest) {
return ExecutionDecision.execute();
} else {
return ExecutionDecision.dontExecute("Issue is still opened, therefore skipping the test " + method.getName());
}
}
return ExecutionDecision.execute();
}
private String[] getIssuesId(String value) {
return value.replaceAll("\\s+", "").split(",");
}
private String[] getIssuesId(String value) {
return value.replaceAll("\\s+", "").split(",");
}
@Override
public int precedence() {
return 0;
}
@Override
public int precedence() {
return 0;
}
}