Skip to content

Commit

Permalink
Cover sorting of tags for sort dependency exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Ekryd committed Apr 3, 2021
1 parent 8c9aa29 commit 97a1d7b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
8 changes: 5 additions & 3 deletions sorter/src/test/java/sortpom/sort/SortDependenciesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ final void scopeInSortDependenciesShouldSortByScope() throws Exception {
}

/**
* This is an odd test since we add an extra tag in the sort order file (under plugins and dependencies)
* so that it will be sorted beside dependency and plugin tags. The extra tag does not play well with
* the pom xml validation.
* This is an odd test since we add an EXTRA tag in the SORT ORDER FILE (under plugins and dependencies)
* so that it will be sorted beside dependency and plugin tags.
*
* The extra tag does not play well with the pom xml validation.
*/
@Test
final void extraTagInDependenciesAndPluginShouldBeSortedFirst() throws Exception {
SortPomImplUtil.create()
.defaultOrderFileName("sortOrderFiles/extra_dummy_tags.xml")
.sortDependencies("scope,groupId,artifactId")
.sortDependencyExclusions("groupId,artifactId")
.sortPlugins("groupId,artifactId")
.lineSeparator("\r\n")
.testFiles("/Extra_tags_dep_and_plugin.xml", "/Extra_tags_dep_and_plugin_expected.xml");
Expand Down
1 change: 0 additions & 1 deletion sorter/src/test/java/sortpom/util/TestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void performSortThatSorted() throws Exception {

expectedSortedPomInputStream = new FileInputStream("src/test/resources/" + expectedResourceFileName);
String expectedSorted = IOUtils.toString(expectedSortedPomInputStream, pluginParameters.encoding);
assertThat(actualSorted, is(expectedSorted));
assertEquals(expectedSorted, actualSorted);
} finally {
cleanupAfterTest();
Expand Down
13 changes: 13 additions & 0 deletions sorter/src/test/resources/Extra_tags_dep_and_plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
<artifactId>cglib</artifactId>
<version>2.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
<this is="dummy">
<element></element>
</this>
<exclusion>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether</artifactId>
</exclusion>
</exclusions>
</dependency>
<this is="dummy">
<element></element>
Expand Down
13 changes: 13 additions & 0 deletions sorter/src/test/resources/Extra_tags_dep_and_plugin_expected.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@
<artifactId>cglib</artifactId>
<version>2.2</version>
<scope>test</scope>
<exclusions>
<this is="dummy">
<element></element>
</this>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</exclusion>
<exclusion>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cheesymock</groupId>
Expand Down
8 changes: 8 additions & 0 deletions sorter/src/test/resources/sortOrderFiles/extra_dummy_tags.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<systemPath>systemPath</systemPath>
<optional>false</optional>
<exclusions>
<this/>
<exclusion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
Expand All @@ -54,6 +55,7 @@
<systemPath>systemPath</systemPath>
<optional>false</optional>
<exclusions>
<this/>
<exclusion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
Expand Down Expand Up @@ -122,6 +124,7 @@
<systemPath>systemPath</systemPath>
<optional>false</optional>
<exclusions>
<this/>
<exclusion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
Expand Down Expand Up @@ -165,6 +168,7 @@
<systemPath>systemPath</systemPath>
<optional>false</optional>
<exclusions>
<this/>
<exclusion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
Expand Down Expand Up @@ -401,6 +405,7 @@
<systemPath>systemPath</systemPath>
<optional>false</optional>
<exclusions>
<this/>
<exclusion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
Expand All @@ -421,6 +426,7 @@
<systemPath>systemPath</systemPath>
<optional>false</optional>
<exclusions>
<this/>
<exclusion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
Expand Down Expand Up @@ -484,6 +490,7 @@
<systemPath>systemPath</systemPath>
<optional>false</optional>
<exclusions>
<this/>
<exclusion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
Expand Down Expand Up @@ -527,6 +534,7 @@
<systemPath>systemPath</systemPath>
<optional>false</optional>
<exclusions>
<this/>
<exclusion>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
Expand Down

0 comments on commit 97a1d7b

Please sign in to comment.