Skip to content

Commit

Permalink
fix: change result status to String
Browse files Browse the repository at this point in the history
  • Loading branch information
albanf committed Jun 25, 2021
1 parent ec9703d commit 40768c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import com.google.common.net.UrlEscapers;
import com.synopsys.protecode.sc.jenkins.ProtecodeSc.Status;
import com.synopsys.protecode.sc.jenkins.exceptions.ApiAuthenticationException;
import com.synopsys.protecode.sc.jenkins.exceptions.ApiException;
import org.glassfish.jersey.client.ClientConfig;
Expand Down Expand Up @@ -289,14 +288,11 @@ public PollResult poll(String productId) {
+ response.getMeta().getCode());
return new PollResult(true, false);
}
Status responseStatus = response.getResults().getStatus();
String responseStatus = response.getResults().getStatus();
response.setArtifactName(artifact.getName());
// Busy: we continue polling
if (Status.B.equals(responseStatus)) {
return new PollResult(false, false);
}

if (Status.R.equals(responseStatus)) {
// Status R and F are final
if ("R".equals(responseStatus)) {
int componentsFound = response.getResults().getComponents().size();
log.println("Artifact " + artifact.getName()
+ " polling success, meta response code "
Expand All @@ -312,10 +308,14 @@ public PollResult poll(String productId) {
return new PollResult(true, false);
}
}
log.println("Artifact " + artifact.getName()
+ " polling completed, status is " + responseStatus);
return new PollResult(true, false);

if ("F".equals(responseStatus)) {
log.println("Artifact " + artifact.getName()
+ " polling completed, status is " + responseStatus);
return new PollResult(true, false);
}
// Busy: we continue polling
log.println("Artifact " + artifact.getName() + " status is: " + responseStatus + ", continuing polling");
return new PollResult(false, false);
}

public void close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Results getResults() {
}

public static enum Status {
B("Busy"), R("Ready"), F("Fail");
B("Busy"), R("Ready"), F("Fail"), S("Scanning"), D("Downloading"), P("P-Unknown");

private String value;

Expand Down Expand Up @@ -79,7 +79,7 @@ public static class Results {

private List<Component> components;

private Status status;
private String status;

private String report_url;

Expand Down Expand Up @@ -110,7 +110,7 @@ public Integer getId() {
return id;
}

public Status getStatus() {
public String getStatus() {
return status;
}

Expand Down

0 comments on commit 40768c1

Please sign in to comment.