use of com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Artifacts in project octane-ci-java-sdk by MicroFocus.
the class SSCTestUtils method getArtificatResponse.
public static String getArtificatResponse(String status) throws IOException {
Artifacts artifacts = new Artifacts();
Artifacts.Artifact artifact = new Artifacts.Artifact();
DateFormat sourceDateFormat = new SimpleDateFormat(DateUtils.sscFormat);
artifact.uploadDate = sourceDateFormat.format(new Date());
artifact.status = status;
artifacts.setData(Arrays.asList(artifact));
artifacts.setCount(1);
return SSCTestUtils.getJson(artifacts);
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Artifacts in project octane-ci-java-sdk by MicroFocus.
the class SSCInput method buildInputWithDefaults.
public static SSCInput buildInputWithDefaults(List<Issues.Issue> issuesToReturn) {
SSCInput sscInput = new SSCInput();
sscInput.withProject("project-a", 2);
sscInput.withProjectVersion("version-a", 22);
Artifacts artifacts = buildArtifactsInput(System.currentTimeMillis());
sscInput.setArtifactsPage(artifacts);
Issues issues = new Issues();
issues.setData(new ArrayList<>());
issues.getData().addAll(issuesToReturn);
issues.setCount(issues.getData().size());
sscInput.setIssuesToReturn(issues);
return sscInput;
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Artifacts in project octane-ci-java-sdk by MicroFocus.
the class SSCInput method createArtifacts.
public static Artifacts createArtifacts(long startTimeOfBuild, String artifactStatus) {
Artifacts.Artifact artifact = new Artifacts.Artifact();
artifact.id = 1;
artifact.status = artifactStatus;
DateFormat sourceDateFormat = new SimpleDateFormat(DateUtils.sscFormat);
Date date = new Date(startTimeOfBuild + 7000);
artifact.uploadDate = sourceDateFormat.format(date);
Artifacts artifacts = new Artifacts();
artifacts.setData(Arrays.asList(artifact));
artifacts.setCount(1);
return artifacts;
}
use of com.hp.octane.integrations.services.vulnerabilities.ssc.dto.Artifacts in project octane-ci-java-sdk by MicroFocus.
the class SSCHandler method isScanProcessFinished.
public boolean isScanProcessFinished() {
logger.debug("enter isScanProcessFinished");
Artifacts artifacts = sscProjectConnector.getArtifactsOfProjectVersion(this.projectVersion.id, 10);
Artifacts.Artifact closestArtifact = getClosestArtifact(artifacts);
if (closestArtifact == null) {
logger.debug("Cannot find artifact of the run");
return false;
}
if (closestArtifact.status.equals(ARTIFACT_STATUS_COMPLETE)) {
logger.debug("artifact of the run is in completed");
return true;
}
if (closestArtifact.status.equals(ARTIFACT_ERROR_PROCESSING)) {
throw new PermanentException("artifact of the run faced error, polling should stop");
}
// todo , if there are more cases need to handle separately
logger.debug("artifact of the run is not complete, polling should continue");
return false;
}
Aggregations