Skip to content

Commit

Permalink
test(pom): refactor new test
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Jun 24, 2024
1 parent 7092c74 commit c88d9d2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 14 deletions.
26 changes: 17 additions & 9 deletions pkg/dependency/parser/java/pom/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,14 @@ func TestPom_Parse(t *testing.T) {
},
},
},
// ➜ mvn dependency:tree
// ...
// [INFO]
// [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ child ---
// [INFO] com.example:child:jar:3.0.0
// [INFO] \- org.example:example-exclusions:jar:3.0.0:compile
// [INFO] \- org.example:example-nested:jar:3.3.3:compile
// [INFO] ------------------------------------------------------------------------
{
name: "exclusions in child and parent dependency management",
inputFile: filepath.Join("testdata", "exclusions-parent-dependency-management", "child", "pom.xml"),
Expand All @@ -992,9 +1000,9 @@ func TestPom_Parse(t *testing.T) {
Relationship: ftypes.RelationshipRoot,
},
{
ID: "org.example:example-nested:3.3.3",
Name: "org.example:example-nested",
Version: "3.3.3",
ID: "org.example:example-exclusions:3.0.0",
Name: "org.example:example-exclusions",
Version: "3.0.0",
Relationship: ftypes.RelationshipDirect,
Locations: ftypes.Locations{
{
Expand All @@ -1004,23 +1012,23 @@ func TestPom_Parse(t *testing.T) {
},
},
{
ID: "org.example:example-dependency:1.2.3",
Name: "org.example:example-dependency",
Version: "1.2.3",
ID: "org.example:example-nested:3.3.3",
Name: "org.example:example-nested",
Version: "3.3.3",
Relationship: ftypes.RelationshipIndirect,
},
},
wantDeps: []ftypes.Dependency{
{
ID: "com.example:child:3.0.0",
DependsOn: []string{
"org.example:example-nested:3.3.3",
"org.example:example-exclusions:3.0.0",
},
},
{
ID: "org.example:example-nested:3.3.3",
ID: "org.example:example-exclusions:3.0.0",
DependsOn: []string{
"org.example:example-dependency:1.2.3",
"org.example:example-nested:3.3.3",
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>example-nested</artifactId>
<artifactId>example-exclusions</artifactId>
<exclusions>
<exclusion>
<groupId>org.example</groupId>
<artifactId>example-api-common</artifactId>
<artifactId>example-dependency</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>example-nested</artifactId>
<version>3.3.3</version>
<artifactId>example-exclusions</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>org.example</groupId>
<artifactId>example-api</artifactId>
<artifactId>example-dependency2</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>example-exclusions</artifactId>
<version>3.0.0</version>

<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>example-dependency</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.example</groupId>
<artifactId>example-dependency2</artifactId>
<version>2.3.4</version>
</dependency>
<dependency>
<groupId>org.example</groupId>
<artifactId>example-nested</artifactId>
<version>3.3.3</version>
</dependency>
</dependencies>

</project>

0 comments on commit c88d9d2

Please sign in to comment.