You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2014/10/04 19:04:32 UTC

svn commit: r1629424 - /maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java

Author: khmarbaise
Date: Sat Oct  4 17:04:32 2014
New Revision: 1629424

URL: http://svn.apache.org/r1629424
Log:
[MEAR-199]
 - Fixed the integration test to get a comparsion between
   used manifest file and the one which is inside the EAR file.

Modified:
    maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java

Modified: maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java?rev=1629424&r1=1629423&r2=1629424&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java Sat Oct  4 17:04:32 2014
@@ -20,11 +20,17 @@ package org.apache.maven.plugin.ear.it;
  */
 
 import org.apache.maven.it.util.IOUtil;
+import org.codehaus.plexus.archiver.ear.EarArchiver;
+import org.codehaus.plexus.archiver.zip.ZipArchiver;
+import org.codehaus.plexus.archiver.zip.ZipUnArchiver;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.ReaderFactory;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.util.Properties;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
 
 /**
  * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
@@ -182,12 +188,20 @@ public class EarMojoIT
     public void testProject016()
         throws Exception
     {
-        System.out.println( "Skipped project-016: need a way to extract the EAR archive" );
-        /*
-         * final File baseDir = doTestProject( "project-016", new String[]{"ejb-sample-one-1.0.jar"} ); final File
-         * expectedManifest = new File(baseDir, "src/main/ear/META-INF/MANIFEST.MF"); // TODO: needs a way to extract
-         * the EAR archive
-         */
+        final File baseDir = doTestProject( "project-016", new String[] { "ejb-sample-one-1.0.jar" } );
+
+        final File targetFolder = new File( baseDir, "target" );
+        final File createdEarFile = new File( targetFolder, "maven-ear-plugin-test-project-016-99.0.ear" );
+
+        final File sourceManifestFile = new File( baseDir, "src/main/ear/MANIFEST.MF" );
+
+        JarFile jarFile = new JarFile( createdEarFile );
+        Manifest manifestFromCreatedEARFile = jarFile.getManifest();
+        jarFile.close();
+
+        Manifest sourceManifest = new Manifest( new FileInputStream( sourceManifestFile ) );
+
+        assertTrue( "There are differences in the manifest.", sourceManifest.equals( manifestFromCreatedEARFile ) );
     }
 
     /**