deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-396 explicit archive names
Date Thu, 15 May 2014 19:22:19 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 52a4ad585 -> 8457eb200


DELTASPIKE-396 explicit archive names


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/8457eb20
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/8457eb20
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/8457eb20

Branch: refs/heads/master
Commit: 8457eb200c20795181cad2426b72f8a3092bcafa
Parents: 52a4ad5
Author: gpetracek <gpetracek@apache.org>
Authored: Thu May 15 21:21:03 2014 +0200
Committer: gpetracek <gpetracek@apache.org>
Committed: Thu May 15 21:21:13 2014 +0200

----------------------------------------------------------------------
 .../deltaspike/test/util/ArchiveUtils.java      |  3 +-
 .../beanValidation/test/ArchiveUtils.java       |  3 +-
 .../deltaspike/test/util/ArchiveUtils.java      |  3 +-
 .../test/jsf/impl/util/ArchiveUtils.java        |  6 +-
 .../core/api/partialbean/util/ArchiveUtils.java |  3 +-
 .../deltaspike/test/util/ArchiveUtils.java      |  3 +-
 .../deltaspike/test/util/ArchiveUtils.java      |  3 +-
 .../test/servlet/impl/util/ArchiveUtils.java    |  3 +-
 .../test/utils/ShrinkWrapArchiveUtil.java       | 90 ++++----------------
 9 files changed, 34 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
index 2be1e05..4ca41d0 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
@@ -55,7 +55,8 @@ public class ArchiveUtils
         JavaArchive[] coreArchives = ShrinkWrapArchiveUtil.getArchives(null,
                 "META-INF/beans.xml",
                 new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.test.category"},
-                excludedPackagesOrFiles);
+                excludedPackagesOrFiles,
+                "ds-core");
 
         List<JavaArchive> archives = new ArrayList<JavaArchive>(Arrays.asList(coreArchives));
         archives.add(extensionsJar);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArchiveUtils.java
b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArchiveUtils.java
index 24278ba..5eb498d 100644
--- a/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArchiveUtils.java
+++ b/deltaspike/modules/bean-validation/impl/src/test/java/org/apache/deltaspike/beanValidation/test/ArchiveUtils.java
@@ -26,7 +26,8 @@ public class ArchiveUtils {
         JavaArchive[] coreArchives = ShrinkWrapArchiveUtil.getArchives(null,
                 "META-INF/beans.xml",
                 new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.test.category"},
-                null);
+                null,
+                "ds-core");
         return coreArchives;
     }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
b/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
index 1ac7ba9..5002241 100644
--- a/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
+++ b/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
@@ -42,7 +42,8 @@ public class ArchiveUtils
                 null,
                 "META-INF/beans.xml",
                 new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.jpa"},
-                null);
+                null,
+                "ds-core_and_jpa");
     }
 
     public static Asset getBeansXml()

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/util/ArchiveUtils.java
b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/util/ArchiveUtils.java
index 3c08ea7..acbdf26 100644
--- a/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/util/ArchiveUtils.java
+++ b/deltaspike/modules/jsf/impl/src/test/java/org/apache/deltaspike/test/jsf/impl/util/ArchiveUtils.java
@@ -59,7 +59,8 @@ public class ArchiveUtils
                 , "META-INF/beans.xml"
                 , new String[]{ "org.apache.deltaspike.core"
                               , "org.apache.deltaspike.jsf" }
-                , excludedFiles);
+                , excludedFiles,
+                "ds-core_and_jsf");
 
         List<JavaArchive> archives = new ArrayList<JavaArchive>(Arrays.asList(coreArchives));
         archives.add(grapheneJar);
@@ -75,7 +76,8 @@ public class ArchiveUtils
 
         return ShrinkWrapArchiveUtil.getArchives(null,
                 "META-INF/beans.xml",
-                new String[]{"org.apache.deltaspike.security"}, excludedFiles);
+                new String[]{"org.apache.deltaspike.security"}, excludedFiles,
+                "ds-security");
     }
 
     public static Asset getBeansXml()

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
index a3bb54f..1cb1c6d 100644
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
@@ -37,6 +37,7 @@ public abstract class ArchiveUtils
                 "META-INF/beans.xml",
                 new String[]{"org.apache.deltaspike.core",
                         "org.apache.deltaspike.test.category",
-                        "org.apache.deltaspike.partialbean"}, excludedFiles);
+                        "org.apache.deltaspike.partialbean"}, excludedFiles,
+                "ds-core_and_partial-bean");
     }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
index b5bf070..7ddbf73 100644
--- a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
@@ -38,6 +38,7 @@ public class ArchiveUtils
                 new String[]{"org.apache.deltaspike.core",
                         "org.apache.deltaspike.test.category",
                         "org.apache.deltaspike.scheduler"},
-                null);
+                null,
+                "ds-core_and_scheduler");
     }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
index 78c48fb..cda7566 100644
--- a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
+++ b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
@@ -44,7 +44,8 @@ public class ArchiveUtils
                 "META-INF/beans.xml",
                 new String[]{"org.apache.deltaspike.core",
                         "org.apache.deltaspike.test.category",
-                        "org.apache.deltaspike.security"}, excludedFiles);
+                        "org.apache.deltaspike.security"}, excludedFiles,
+                "ds-core_and_security");
     }
 
     public static Asset getBeansXml()

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
index fd1d8fa..7b4119a 100644
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
@@ -44,7 +44,8 @@ public class ArchiveUtils
         JavaArchive[] coreArchives = ShrinkWrapArchiveUtil.getArchives(null,
                 "META-INF/beans.xml",
                 new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.test.category",
-                        "org.apache.deltaspike.servlet"}, null);
+                        "org.apache.deltaspike.servlet"}, null,
+                "ds-core_and_servlet");
 
         List<JavaArchive> archives = new ArrayList<JavaArchive>(Arrays.asList(coreArchives));
         archives.add(extensionsJar);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8457eb20/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/ShrinkWrapArchiveUtil.java
----------------------------------------------------------------------
diff --git a/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/ShrinkWrapArchiveUtil.java
b/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/ShrinkWrapArchiveUtil.java
index 8e445f6..bbdd068 100644
--- a/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/ShrinkWrapArchiveUtil.java
+++ b/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/ShrinkWrapArchiveUtil.java
@@ -24,16 +24,14 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.List;
-import java.util.jar.JarInputStream;
+import java.util.UUID;
 import java.util.logging.Logger;
-import java.util.zip.ZipEntry;
 
 
 /**
@@ -45,7 +43,6 @@ import java.util.zip.ZipEntry;
 public class ShrinkWrapArchiveUtil
 {
     private static final Logger LOG = Logger.getLogger(ShrinkWrapArchiveUtil.class.getName());
-    private static String testName;
 
     private ShrinkWrapArchiveUtil()
     {
@@ -65,7 +62,8 @@ public class ShrinkWrapArchiveUtil
     public static JavaArchive[] getArchives(ClassLoader classLoader,
                                             String markerFile,
                                             String[] includeIfPackageExists,
-                                            String[] excludeIfPackageExists)
+                                            String[] excludeIfPackageExists,
+                                            String archiveName)
     {
         if (classLoader == null)
         {
@@ -84,7 +82,7 @@ public class ShrinkWrapArchiveUtil
                 LOG.fine("Evaluating Java ClassPath URL " + foundFile.toExternalForm());
 
                 JavaArchive archive
-                    = createArchive(foundFile, markerFile, includeIfPackageExists, excludeIfPackageExists);
+                    = createArchive(foundFile, markerFile, includeIfPackageExists, excludeIfPackageExists,
archiveName);
                 if (archive != null)
                 {
                     LOG.info("Test " + getTestName()
@@ -103,7 +101,9 @@ public class ShrinkWrapArchiveUtil
     }
 
     private static JavaArchive createArchive(URL foundFile, String markerFile,
-                                             String[] includeIfPackageExists, String[] excludeIfPackageExists)
+                                             String[] includeIfPackageExists,
+                                             String[] excludeIfPackageExists,
+                                             String archiveName)
         throws IOException
     {
         String urlString = foundFile.toString();
@@ -151,77 +151,14 @@ public class ShrinkWrapArchiveUtil
 
             }
 
-            return addFileArchive(f, includeIfPackageExists, excludeIfPackageExists);
-        }
-    }
-
-    private static JavaArchive addJarArchive(InputStream inputStream,
-                                             String[] includeIfPackageExists,
-                                             String[] excludeIfPackageExists)
-        throws IOException
-    {
-        JavaArchive ret = null;
-        JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
-
-        if (includeIfPackageExists == null)
-        {
-            // no include rule, thus add it immediately
-            ret = javaArchive;
-        }
-
-        JarInputStream jar = new JarInputStream(inputStream);
-        try
-        {
-            for (ZipEntry jarEntry = jar.getNextEntry(); jarEntry != null; jarEntry = jar.getNextEntry())
-            {
-                String entryName = jarEntry.getName();
-
-                if (jarEntry.isDirectory())
-                {
-                    // exclude rule
-                    if (excludeIfPackageExists(entryName, excludeIfPackageExists))
-                    {
-                        return null;
-                    }
-
-                    if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists))
-                    {
-                        ret = javaArchive;
-                    }
-
-                    continue;
-                }
-
-                if (entryName.endsWith(".class"))
-                {
-                    String className
-                        = pathToClassName(entryName.substring(0, entryName.length() - (".class".length())));
-                    javaArchive.addClass(className);
-                }
-                else
-                {
-                    javaArchive.addAsResource(entryName);
-                }
-            }
+            return addFileArchive(f, includeIfPackageExists, excludeIfPackageExists, archiveName);
         }
-        finally
-        {
-            try
-            {
-                jar.close();
-            }
-            catch (IOException ignored)
-            {
-                // all fine
-            }
-        }
-
-        return ret;
     }
 
     private static JavaArchive addFileArchive(File archiveBasePath,
                                               String[] includeIfPackageExists,
-                                              String[] excludeIfPackageExists)
+                                              String[] excludeIfPackageExists,
+                                              String archiveName)
         throws IOException
     {
         if (!archiveBasePath.exists())
@@ -229,8 +166,13 @@ public class ShrinkWrapArchiveUtil
             return null;
         }
 
+        if (archiveName == null)
+        {
+            archiveName = UUID.randomUUID().toString();
+        }
+
         JavaArchive ret = null;
-        JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
+        JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar");
 
         if (includeIfPackageExists == null)
         {


Mime
View raw message