-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into jt-215-244
- Loading branch information
Showing
9 changed files
with
412 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
maven-plugin/plugin-core/src/test/java/org/jvnet/jaxb/maven/util/IOUtilsTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
package org.jvnet.jaxb.maven.util; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class IOUtilsTests { | ||
|
||
@Test | ||
public void reorderFilesIncludesNull() { | ||
String[] files = {"a.xsd", "c.xsd", "b.xsd" }; | ||
List<String> orderedFiles = IOUtils.reorderFiles(files, null); | ||
|
||
Assert.assertNotNull("Ordered files list should not be null", | ||
orderedFiles); | ||
Assert.assertEquals("Ordered files list should contains all elements of initial list", | ||
files.length, orderedFiles.size()); | ||
Assert.assertEquals(files[0], orderedFiles.get(0)); | ||
Assert.assertEquals(files[1], orderedFiles.get(1)); | ||
Assert.assertEquals(files[2], orderedFiles.get(2)); | ||
} | ||
|
||
@Test | ||
public void reorderFilesIncludesEmpty() { | ||
String[] files = {"a.xsd", "c.xsd", "b.xsd" }; | ||
List<String> orderedFiles = IOUtils.reorderFiles(files, new String[] {}); | ||
|
||
Assert.assertNotNull("Ordered files list should not be null", | ||
orderedFiles); | ||
Assert.assertEquals("Ordered files list should contains all elements of initial list", | ||
files.length, orderedFiles.size()); | ||
Assert.assertEquals(files[0], orderedFiles.get(0)); | ||
Assert.assertEquals(files[1], orderedFiles.get(1)); | ||
Assert.assertEquals(files[2], orderedFiles.get(2)); | ||
} | ||
|
||
@Test | ||
public void reorderFilesIncludesNoWildcard() { | ||
String[] files = {"a.xsd", "c.xsd", "b.xsd" }; | ||
List<String> orderedFiles = IOUtils.reorderFiles(files, new String[] { "b.xsd", "c.xsd", "a.xsd" }); | ||
|
||
Assert.assertNotNull("Ordered files list should not be null", | ||
orderedFiles); | ||
Assert.assertEquals("Ordered files list should contains all elements of initial list", | ||
files.length, orderedFiles.size()); | ||
Assert.assertEquals(files[2], orderedFiles.get(0)); | ||
Assert.assertEquals(files[1], orderedFiles.get(1)); | ||
Assert.assertEquals(files[0], orderedFiles.get(2)); | ||
} | ||
|
||
@Test | ||
public void reorderFilesIncludesNoWildcardWithCommonSuffix() { | ||
String[] files = {"a.xsd", "b.xsd", "service-ab.xsd" }; | ||
List<String> orderedFiles = IOUtils.reorderFiles(files, new String[] { "b.xsd", "a.xsd", "service-ab.xsd" }); | ||
|
||
Assert.assertNotNull("Ordered files list should not be null", | ||
orderedFiles); | ||
Assert.assertEquals("Ordered files list should contains all elements of initial list", | ||
files.length, orderedFiles.size()); | ||
Assert.assertEquals(files[1], orderedFiles.get(0)); | ||
Assert.assertEquals(files[0], orderedFiles.get(1)); | ||
Assert.assertEquals(files[2], orderedFiles.get(2)); | ||
} | ||
|
||
@Test | ||
public void reorderFilesIncludesWithWildcardFirst() { | ||
String[] files = {"a.xsd", "common/c1.xsd", "b.xsd", "common/c2.xsd", "common/a.xsd", "common/b.xsd" }; | ||
List<String> orderedFiles = IOUtils.reorderFiles(files, new String[] { "common/*.xsd", "a.xsd", "b.xsd" }); | ||
|
||
Assert.assertNotNull("Ordered files list should not be null", | ||
orderedFiles); | ||
Assert.assertEquals("Ordered files list should contains all elements of initial list", | ||
files.length, orderedFiles.size()); | ||
// we have all common/*.xsd files in same order | ||
Assert.assertEquals(files[1], orderedFiles.get(0)); | ||
Assert.assertEquals(files[3], orderedFiles.get(1)); | ||
Assert.assertEquals(files[4], orderedFiles.get(2)); | ||
Assert.assertEquals(files[5], orderedFiles.get(3)); | ||
// and then a.xsd | ||
Assert.assertEquals(files[0], orderedFiles.get(4)); | ||
// and finally b.xsd | ||
Assert.assertEquals(files[2], orderedFiles.get(5)); | ||
} | ||
|
||
@Test | ||
public void reorderFilesIncludesWithWildcardMiddle() { | ||
String[] files = {"a.xsd", "common/c1.xsd", "b.xsd", "common/c2.xsd", "common/a.xsd", "common/b.xsd" }; | ||
List<String> orderedFiles = IOUtils.reorderFiles(files, new String[] { "a.xsd", "common/*.xsd", "b.xsd" }); | ||
|
||
Assert.assertNotNull("Ordered files list should not be null", | ||
orderedFiles); | ||
Assert.assertEquals("Ordered files list should contains all elements of initial list", | ||
files.length, orderedFiles.size()); | ||
|
||
// we have a.xsd | ||
Assert.assertEquals(files[0], orderedFiles.get(0)); | ||
// and then all common/*.xsd files in same order | ||
Assert.assertEquals(files[1], orderedFiles.get(1)); | ||
Assert.assertEquals(files[3], orderedFiles.get(2)); | ||
Assert.assertEquals(files[4], orderedFiles.get(3)); | ||
Assert.assertEquals(files[5], orderedFiles.get(4)); | ||
// and finally b.xsd | ||
Assert.assertEquals(files[2], orderedFiles.get(5)); | ||
} | ||
|
||
@Test | ||
public void reorderFilesIncludesWithWildcardLast() { | ||
String[] files = {"a.xsd", "common/c1.xsd", "b.xsd", "common/c2.xsd", "common/a.xsd", "common/b.xsd" }; | ||
List<String> orderedFiles = IOUtils.reorderFiles(files, new String[] { "a.xsd", "b.xsd", "common/*.xsd" }); | ||
|
||
Assert.assertNotNull("Ordered files list should not be null", | ||
orderedFiles); | ||
Assert.assertEquals("Ordered files list should contains all elements of initial list", | ||
files.length, orderedFiles.size()); | ||
|
||
// we have a.xsd | ||
Assert.assertEquals(files[0], orderedFiles.get(0)); | ||
// and then b.xsd | ||
Assert.assertEquals(files[2], orderedFiles.get(1)); | ||
// and finally all common/*.xsd files in same order | ||
Assert.assertEquals(files[1], orderedFiles.get(2)); | ||
Assert.assertEquals(files[3], orderedFiles.get(3)); | ||
Assert.assertEquals(files[4], orderedFiles.get(4)); | ||
Assert.assertEquals(files[5], orderedFiles.get(5)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>jaxb-maven-plugin-tests-194</artifactId> | ||
<parent> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-maven-plugin-tests</artifactId> | ||
<version>2.0.4-SNAPSHOT</version> | ||
</parent> | ||
<packaging>jar</packaging> | ||
<name>JAXB Tools :: Maven Plugin :: Test [JAXB-TOOLS 194]</name> | ||
<description> | ||
This project tests pom artifacts filtering that may cause scanDependenciesForBindings fails on dependency of type pom. | ||
</description> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.12.0</version> | ||
<type>pom</type> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.jaxb</groupId> | ||
<artifactId>jaxb-runtime</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-maven-plugin-testing</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>generate</id> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
<configuration> | ||
<scanDependenciesForBindings>true</scanDependenciesForBindings> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.