Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ under the License.
</dependency>

<!-- test -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

import org.apache.maven.plugin.AbstractMojo;
Expand Down Expand Up @@ -106,6 +107,7 @@ public void execute() throws MojoExecutionException {
remoteResourcesBundle.setSourceEncoding(sourceEncoding);

DirectoryScanner scanner = new DirectoryScanner();
scanner.setFilenameComparator(Comparator.naturalOrder());

scanner.setBasedir(resourcesDirectory);
if (includes != null && includes.length != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.jar.JarOutputStream;
import java.util.zip.ZipEntry;

Expand All @@ -51,6 +52,9 @@
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.stringContainsInOrder;

/**
* RemoteResources plugin Test Case
*/
Expand Down Expand Up @@ -88,7 +92,9 @@ public void testNoBundles() throws Exception {
}

public void testCreateBundle() throws Exception {
buildResourceBundle("default-createbundle", null, new String[] {"SIMPLE.txt"}, null);
List<String> resources =
Arrays.asList("FILTER.txt.vm", "ISO-8859-1.bin.vm", "PROPERTIES.txt.vm", "SIMPLE.txt", "UTF-8.bin.vm");
buildResourceBundle("default-createbundle", null, resources.toArray(new String[0]), null);
}

public void testSimpleBundles() throws Exception {
Expand Down Expand Up @@ -299,9 +305,10 @@ protected void buildResourceBundle(String id, String sourceEncoding, String[] re
assertTrue(xmlFile.exists());

String data = FileUtils.fileRead(xmlFile);
for (String resourceName1 : resourceNames) {
assertTrue(data.contains(resourceName1));
}

List<String> expectedOrder = new ArrayList<>(Arrays.asList(resourceNames));
Collections.sort(expectedOrder);
assertThat(data, stringContainsInOrder(expectedOrder));

if (null != jarName) {
try (OutputStream fos = Files.newOutputStream(jarName.toPath());
Expand Down