Skip to content

Commit 00dbae0

Browse files
committed
add an IT
1 parent c459e59 commit 00dbae0

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

.github/workflows/analyze_dependency.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ jobs:
2727
distribution: temurin
2828
java-version: 17
2929
cache: maven
30-
- name: Set up Maven
31-
uses: stCarolas/setup-maven@v5
32-
with:
33-
maven-version: 3.8.2
3430
- name: Install dependency analyzer
3531
shell: bash
3632
run: |

java-shared-dependencies/dependency-analyzer/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,21 @@
4343
<artifactId>maven-surefire-plugin</artifactId>
4444
<version>3.5.0</version>
4545
<configuration>
46+
<excludes>
47+
<exclude>**/*IntegrationTest.java</exclude>
48+
</excludes>
4649
<environmentVariables>
4750
<!--this environment variable is used to set token when construct
4851
a mock http request in unit test-->
4952
<GITHUB_TOKEN>fake_value</GITHUB_TOKEN>
5053
</environmentVariables>
5154
</configuration>
5255
</plugin>
56+
<plugin>
57+
<groupId>org.apache.maven.plugins</groupId>
58+
<artifactId>maven-failsafe-plugin</artifactId>
59+
<version>3.5.0</version>
60+
</plugin>
5361
</plugins>
5462
</build>
5563

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.google.cloud.integration;
2+
3+
import com.google.cloud.DependencyAnalyzer;
4+
import com.google.cloud.external.DepsDevClient;
5+
import com.google.cloud.model.AnalysisResult;
6+
import com.google.cloud.model.ReportResult;
7+
import java.net.http.HttpClient;
8+
import org.junit.Test;
9+
10+
public class DependencyAnalyzerIntegrationTest {
11+
@Test
12+
public void testAnalyzeFromJavaSharedDependenciesBom() {
13+
DependencyAnalyzer dependencyAnalyzer = new DependencyAnalyzer(
14+
new DepsDevClient(HttpClient.newHttpClient()));
15+
String sharedDependenciesBom = "../pom.xml";
16+
AnalysisResult analyzeReport = dependencyAnalyzer.analyze(sharedDependenciesBom);
17+
System.out.println(analyzeReport.toString());
18+
ReportResult result = analyzeReport.getAnalysisResult();
19+
System.out.println(result);
20+
if (result.equals(ReportResult.FAIL)) {
21+
System.out.println(
22+
"Please refer to go/cloud-java-rotations#security-advisories-monitoring for further actions");
23+
System.exit(1);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)