Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Integration tests based on maven-invoker-plugin #4

Merged
merged 3 commits into from

2 participants

Jussi Malinen Stuart McCulloch
Jussi Malinen

This pull request includes integration tests based on maven-invoker-plugin, and also a change to mojo execution, that sets directories with files as included in jar: 58bbb1c

Stuart McCulloch
Owner

Looks good, thanks! I'll add another IT for the leftover entries scenario and fix that without regressing this testcase.

Stuart McCulloch mcculls merged commit 17260d3 into from
Jussi Malinen

Excellent! Thanks!

Do you have any plans/guestimates for the schedule of the next release? (I'm okay with "no idea", just wanted to ask. I think we can use SNAPSHOT to compile our project until then...)

Stuart McCulloch
Owner

Definitely before the end of the month, hopefully sooner depending on my spare time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 18, 2012
  1. Jussi Malinen
Commits on Oct 5, 2012
  1. Jussi Malinen
Commits on Oct 6, 2012
  1. Jussi Malinen
This page is out of date. Refresh to see the latest.
1  .gitignore
View
@@ -2,3 +2,4 @@ target
.project
.classpath
.settings
+.DS_Store
22 pom.xml
View
@@ -103,6 +103,28 @@
<artifactId>maven-site-plugin</artifactId>
<version>3.1</version>
</plugin>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.7</version>
+ <configuration>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <postBuildHookScript>verify.bsh</postBuildHookScript>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
BIN  src/it/empty_dirs/example_with_empty_dir.jar
View
Binary file not shown
50 src/it/empty_dirs/pom.xml
View
@@ -0,0 +1,50 @@
+<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>com.test</groupId>
+ <artifactId>mytest</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>mytest</name>
+ <url>http://maven.apache.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>jarjar-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>jarjar</goal>
+ </goals>
+ <configuration>
+ <input>example_with_empty_dir.jar</input>
+ <output>target/out.jar</output>
+ <includes>
+ <include>junit:junit</include>
+ </includes>
+ <rules>
+ <rule>
+ <pattern>junit.**</pattern>
+ <result>com.test.@0</result>
+ </rule>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
36 src/it/empty_dirs/verify.bsh
View
@@ -0,0 +1,36 @@
+import java.io.*;
+import java.util.jar.JarFile;
+
+JarFile getFile() {
+ File file = new File(basedir, "target/out.jar" );
+ if ( !file.isFile() ) {
+ throw new FileNotFoundException( "Could not find generated JAR: " + file );
+ }
+ return new JarFile(file);
+}
+
+mustNotExist(JarFile file, String path) {
+ if (file.getEntry(path) != null)
+ throw new RuntimeException(path + " should not be in "+file.getName());
+}
+
+mustExist(JarFile file, String path) {
+ if (file.getEntry(path) == null)
+ throw new RuntimeException(path + " should be in "+file.getName());
+}
+
+verifyNoEmptyDir() {
+ mustNotExist(getFile(), "test/empty/");
+}
+
+verifyDirWithFilesIsPresent() {
+ mustExist(getFile(), "test/has_file/");
+}
+
+testDirectoriesCreatedByRulesAreIncluded() {
+ mustExist(getFile(), "com/test/junit/");
+}
+
+verifyNoEmptyDir();
+verifyDirWithFilesIsPresent();
+testDirectoriesCreatedByRulesAreIncluded();
1  src/main/java/com/tonicsystems/jarjar/JarJarMojo.java
View
@@ -180,7 +180,6 @@ public void execute()
final Archiver archiver = archiverManager.getArchiver( "zip" );
archiver.setDestFile( uberZip );
- archiver.setIncludeEmptyDirs( false );
if ( inputFile.isDirectory() )
{
Something went wrong with that request. Please try again.