14 changed files with 28 additions and 264 deletions
@ -1,22 +0,0 @@
|
||||
// package dto;
|
||||
|
||||
// import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
// import io.smallrye.common.constraint.NotNull;
|
||||
// import lombok.Builder;
|
||||
// import lombok.Data;
|
||||
// import lombok.extern.jackson.Jacksonized;
|
||||
|
||||
// import org.jboss.pnc.api.deliverablesanalyzer.dto.AnalysisReport;
|
||||
|
||||
// import javax.validation.Valid;
|
||||
// import java.util.Set;
|
||||
|
||||
// @Data
|
||||
// @Jacksonized
|
||||
// @Builder(builderClassName = "Builder")
|
||||
// @JsonIgnoreProperties(ignoreUnknown = true)
|
||||
// public class AnalysisReportCouchDbDoc {
|
||||
// @NotNull
|
||||
// @Valid
|
||||
// private final AnalysisReport doc;
|
||||
// }
|
||||
@ -1,25 +0,0 @@
|
||||
// package dto;
|
||||
|
||||
// import lombok.AllArgsConstructor;
|
||||
// import lombok.Builder;
|
||||
// import lombok.Getter;
|
||||
// import lombok.ToString;
|
||||
// import lombok.extern.jackson.Jacksonized;
|
||||
|
||||
// import org.jboss.pnc.api.dto.Request;
|
||||
|
||||
// import java.io.Serializable;
|
||||
|
||||
// @ToString
|
||||
// @Getter
|
||||
// @AllArgsConstructor
|
||||
// @Jacksonized
|
||||
// @Builder
|
||||
// public class AnalyzeResponse implements Serializable {
|
||||
|
||||
// // private static final long serialVersionUID = -2043312712105992478L;
|
||||
|
||||
// private String id;
|
||||
|
||||
// private Request cancelRequest;
|
||||
// }
|
||||
@ -1,21 +0,0 @@
|
||||
// package dto;
|
||||
|
||||
// import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
// import io.smallrye.common.constraint.NotNull;
|
||||
// import lombok.Builder;
|
||||
// import lombok.Data;
|
||||
// import lombok.extern.jackson.Jacksonized;
|
||||
|
||||
// import javax.validation.Valid;
|
||||
// import java.util.Set;
|
||||
|
||||
// @Data
|
||||
// @Jacksonized
|
||||
// @Builder(builderClassName = "Builder")
|
||||
// @JsonIgnoreProperties(ignoreUnknown = true)
|
||||
// public class CouchDbReportDatabase {
|
||||
|
||||
// @NotNull
|
||||
// @Valid
|
||||
// private final Set<AnalysisReportCouchDbDoc> rows;
|
||||
// }
|
||||
@ -1,41 +0,0 @@
|
||||
// package dto;
|
||||
|
||||
// import org.eclipse.microprofile.config.ConfigProvider;
|
||||
// // // import org.jboss.pnc.api.deliverablesanalyzer.dto.AnalyzePayload;
|
||||
// // import org.jboss.pnc.api.dto.HeartbeatConfig;
|
||||
// // import org.jboss.pnc.api.dto.Request;
|
||||
|
||||
// import java.net.URI;
|
||||
// import java.net.URISyntaxException;
|
||||
// import java.nio.charset.StandardCharsets;
|
||||
// import java.sql.Struct;
|
||||
// import java.util.*;
|
||||
|
||||
// import static constants.HttpHeaders.AUTHORIZATION_STRING;
|
||||
|
||||
// public class ScanAnalyzePayload {
|
||||
|
||||
// private static final String COUCHDB_USERNAME = ConfigProvider.getConfig().getValue("couchdb.username", String.class);
|
||||
// private static final String COUCHDB_PASSWORD = ConfigProvider.getConfig().getValue("couchdb.password", String.class);
|
||||
// private static final String COUCHDB_DATABASE_NAME = ConfigProvider.getConfig().getValue("couchdb.name", String.class);
|
||||
// private static final String COUCHDB_DATABASE_URL = ConfigProvider.getConfig().getValue("couchdb.url", String.class);
|
||||
|
||||
// private ScanAnalyzePayload() {
|
||||
// }
|
||||
|
||||
// public static AnalyzePayload getAnalyzePayload(List<String> urls) throws URISyntaxException {
|
||||
// return constructAnalyzePayload(urls);
|
||||
// }
|
||||
|
||||
// private static AnalyzePayload constructAnalyzePayload(List<String> urls) throws URISyntaxException {
|
||||
// String operationId = UUID.randomUUID().toString();
|
||||
// List<Request.Header> headers = new ArrayList<>(Arrays.asList(new Request.Header(AUTHORIZATION_STRING, getEncodedCredentials())));
|
||||
// Request callbackRequest = new Request(Request.Method.PUT, new URI(COUCHDB_DATABASE_URL + "/" + COUCHDB_DATABASE_NAME + "/" + operationId), headers);
|
||||
// return new AnalyzePayload(operationId, urls, null, callbackRequest, null);
|
||||
// }
|
||||
|
||||
// public static String getEncodedCredentials() {
|
||||
// return "Basic " + Base64.getEncoder().encodeToString((COUCHDB_USERNAME + ":" + COUCHDB_PASSWORD).getBytes());
|
||||
// }
|
||||
|
||||
// }
|
||||
@ -1,48 +0,0 @@
|
||||
// org.acme.rest.json;
|
||||
|
||||
// import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
// import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
|
||||
// public class Scan {
|
||||
|
||||
// public String source;
|
||||
// public String hub;
|
||||
// public String username;
|
||||
// public String password;
|
||||
// public String scanUrl;
|
||||
// public String scanId;
|
||||
// public String advisoryId;
|
||||
// public String owner;
|
||||
// public String release;
|
||||
// public String base;
|
||||
|
||||
// public Scan() {
|
||||
// }
|
||||
|
||||
// public Scan(String hub, String source, String username, String password, String scanUrl, String scanId, String advisoryId, String owner, String release, String base) {
|
||||
// this.hub = hub;
|
||||
// this.source = source;
|
||||
// this.username = username;
|
||||
// this.password = password;
|
||||
// this.scanUrl = scanUrl;
|
||||
// this.scanId = scanId;
|
||||
// this.advisoryId = advisoryId;
|
||||
// this.owner = owner;
|
||||
// this.release = release;
|
||||
// this.base = base;
|
||||
// }
|
||||
|
||||
// public String toJson(){
|
||||
// ObjectMapper mapper = new ObjectMapper();
|
||||
// String test = "aaa";
|
||||
// try {
|
||||
// String jsonInString = mapper.writeValueAsString(this);
|
||||
// System.out.println(jsonInString);
|
||||
|
||||
// return jsonInString;
|
||||
// } catch (Exception ex){
|
||||
// // throw ex;
|
||||
// }
|
||||
// return test;
|
||||
// }
|
||||
// }
|
||||
@ -1,54 +0,0 @@
|
||||
// org.acme.rest.json;
|
||||
|
||||
// import java.util.Collections;
|
||||
// import java.util.LinkedHashMap;
|
||||
// import java.util.Set;
|
||||
|
||||
// import javax.ws.rs.DELETE;
|
||||
// import javax.ws.rs.GET;
|
||||
// import javax.ws.rs.POST;
|
||||
// import javax.ws.rs.Path;
|
||||
// import javax.inject.Inject;
|
||||
// import javax.ws.rs.GET;
|
||||
// import javax.ws.rs.Path;
|
||||
// import javax.ws.rs.PathParam;
|
||||
// import java.util.Set;
|
||||
// import java.util.stream.Collectors;
|
||||
// import javax.inject.Inject;
|
||||
// import javax.ws.rs.Consumes;
|
||||
|
||||
// import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
// import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
|
||||
// // @Path("/api/v1/[osh-scan]")
|
||||
// @Path("/scanGet")
|
||||
// public class ScanResource {
|
||||
|
||||
// // ScansService scanServuce;
|
||||
|
||||
// private Set<Scan> Scans = Collections.newSetFromMap(Collections.synchronizedMap(new LinkedHashMap<>()));
|
||||
|
||||
// public ScanResource() {
|
||||
// Scans.add(new Scan("a","a","a","a","a","a","a","a","a","a"));
|
||||
// }
|
||||
|
||||
// @GET
|
||||
// @Path("/{id}")
|
||||
// public Set<Scan> list(@PathParam("id") String id) {
|
||||
// // CouchDbReportDatabase couchDbReportDatabase = delaResultsService.getAllReports(true);
|
||||
// // Set<AnalysisReport> analysisReports = couchDbReportDatabase.getRows().stream().filter(analysisDoc -> analysisDoc.getDoc().isSuccess()).collect(Collectors.mapping(analysisDoc -> analysisDoc.getDoc(), Collectors.toSet()));
|
||||
// // return analysisReports;
|
||||
|
||||
// //use to return specific scanIds
|
||||
// System.out.println(Scans);
|
||||
// System.out.println(id);
|
||||
// return Scans;
|
||||
// }
|
||||
|
||||
// @POST
|
||||
// @Consumes({ "application/json"})
|
||||
// public Set<Scan> add(Scan Scan) {
|
||||
// Scans.add(Scan);
|
||||
// return Scans;
|
||||
// }
|
||||
// }
|
||||
@ -1,19 +0,0 @@
|
||||
// org.acme.rest.json; |
||||
|
||||
// import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; |
||||
// import org.jboss.resteasy.annotations.jaxrs.QueryParam; |
||||
|
||||
// import javax.ws.rs.GET; |
||||
// import javax.ws.rs.Path; |
||||
// import javax.ws.rs.QueryParam; |
||||
// import java.util.Set; |
||||
|
||||
// @Path("/scans") |
||||
// @RegisterRestClient |
||||
// public interface ScansService { |
||||
|
||||
// @GET |
||||
// @Path("/{scanId}"); |
||||
// @ClientHeaderParam(name=AUTHORIZATION_STRING, value = "{getAuthorizationHeader}" ) |
||||
// Set<Scan> getById(@QueryParam String scanId); |
||||
// } |
||||
@ -1,17 +0,0 @@
|
||||
// package rest;
|
||||
|
||||
// import dto.AnalyzeResponse;
|
||||
// import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
|
||||
// import org.jboss.pnc.api.deliverablesanalyzer.dto.AnalyzePayload;
|
||||
|
||||
// import javax.ws.rs.POST;
|
||||
// import javax.ws.rs.Path;
|
||||
|
||||
// @Path("/")
|
||||
// @RegisterRestClient
|
||||
// public interface sendScan {
|
||||
|
||||
// @POST
|
||||
// AnalyzeResponse invokeDelaAnalysis(AnalyzePayload analyzePayload);
|
||||
|
||||
// }
|
||||
Loading…
Reference in new issue