Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integrate multi-source v4 endpoint #73

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main/java/com/redhat/exhort/impl/ExhortApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public String getEndpoint() {
}

public static final void main(String[] args) throws IOException, InterruptedException, ExecutionException {
// System.setProperty("EXHORT_DEV_MOD","true");
System.setProperty("EXHORT_DEV_MODE","true");
AnalysisReport analysisReport = new ExhortApi()

.stackAnalysis("/home/zgrinber/git/exhort-java-api/src/test/resources/tst_manifests/pip/pip_requirements_txt_no_ignore/requirements.txt").get();
Expand Down Expand Up @@ -114,6 +114,8 @@ static HttpClient.Version getHttpVersion() {
}

ExhortApi(final HttpClient client) {
// // temp system property - as long as prod exhort url not implemented the multi-source v4 endpoint, this property needs to be true
// System.setProperty("EXHORT_DEV_MODE","true");
this.client = client;
this.mapper = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
// Take default from config.properties in case client didn't override DEV MODE
Expand Down Expand Up @@ -263,7 +265,7 @@ public CompletableFuture<AnalysisReport> componentAnalysis(
) throws IOException {
var provider = Ecosystem.getProvider(manifestType);
var uri = URI.create(
String.format("%s/api/v3/analysis", this.endpoint));
String.format("%s/api/v4/analysis", this.endpoint));
var content = provider.provideComponent(manifestContent);

return getAnalysisReportForComponent(uri, content);
Expand All @@ -274,7 +276,7 @@ public CompletableFuture<AnalysisReport> componentAnalysis(String manifestFile)
var manifestPath = Paths.get(manifestFile);
var provider = Ecosystem.getProvider(manifestPath);
var uri = URI.create(
String.format("%s/api/v3/analysis", this.endpoint));
String.format("%s/api/v4/analysis", this.endpoint));
var content = provider.provideComponent(manifestPath);
return getAnalysisReportForComponent(uri, content);
}
Expand Down Expand Up @@ -308,7 +310,7 @@ private HttpRequest buildStackRequest(
var manifestPath = Paths.get(manifestFile);
var provider = Ecosystem.getProvider(manifestPath);
var uri = URI.create(
String.format("%s/api/v3/analysis", this.endpoint));
String.format("%s/api/v4/analysis", this.endpoint));
var content = provider.provideStack(manifestPath);

return buildRequest(content, uri, acceptType,"Stack Analysis");
Expand Down
Loading