File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed
java-shared-dependencies/dependency-analyzer
src/test/java/com/google/cloud/integration Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 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 : |
Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments