You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2012/10/01 21:41:37 UTC

[2/3] git commit: unify ShrinkWrapArchiveUtil and cleanup tests

unify ShrinkWrapArchiveUtil and cleanup tests


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

Branch: refs/heads/master
Commit: 6dc7ff71e4c8140824d67189534e6f58cfa52c4a
Parents: 4f7d702
Author: Mark Struberg <st...@apache.org>
Authored: Mon Oct 1 21:40:40 2012 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Mon Oct 1 21:40:40 2012 +0200

----------------------------------------------------------------------
 .../api/temptestutil/ShrinkWrapArchiveUtil.java    |  316 ------------
 .../apache/deltaspike/test/util/ArchiveUtils.java  |    2 +-
 .../apache/deltaspike/test/util/ArchiveUtils.java  |    8 +-
 .../test/util/ShrinkWrapArchiveUtil.java           |  315 ------------
 .../apache/deltaspike/test/util/ArchiveUtils.java  |    5 +-
 .../test/util/ShrinkWrapArchiveUtil.java           |  364 --------------
 deltaspike/test-utils/pom.xml                      |    8 +
 .../test/utils/ShrinkWrapArchiveUtil.java          |  369 +++++++++++++++
 8 files changed, 389 insertions(+), 998 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/6dc7ff71/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java
deleted file mode 100644
index 0ddb732..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.test.core.api.temptestutil;
-
-
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-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.logging.Logger;
-import java.util.zip.ZipEntry;
-
-
-/**
- * Lots of neat little helpers to more easily create JavaArchives from marker files on the classpath.
- * This should finally get moved to ShrinkWrap core!
- *
- * @deprecated This class should get moved to ShrinkWrap itself!
- */
-public class ShrinkWrapArchiveUtil
-{
-    private static final Logger LOG = Logger.getLogger(ShrinkWrapArchiveUtil.class.getName());
-    /**
-     * Resolve all markerFiles from the current ClassPath and package the root nodes
-     * into a JavaArchive.
-     * @param classLoader to use
-     * @param markerFile finding this marker file will trigger creating the JavaArchive.
-     * @param includeIfPackageExists if not null, we will only create JavaArchives if the given package exists
-     * @param excludeIfPackageExists if not null, we will <b>not</b> create JavaArchives if the given package exists.
-     *                               This has a higher precedence than includeIfPackageExists.
-     */
-    public static JavaArchive[] getArchives(ClassLoader classLoader,
-                                            String markerFile,
-                                            String[] includeIfPackageExists,
-                                            String[] excludeIfPackageExists)
-    {
-        if (classLoader == null) {
-            classLoader = ShrinkWrapArchiveUtil.class.getClassLoader();
-        }
-
-        try {
-            Enumeration<URL> foundFiles = classLoader.getResources(markerFile);
-
-            List<JavaArchive> archives = new ArrayList<JavaArchive>();
-
-            while (foundFiles.hasMoreElements()) {
-                URL foundFile = foundFiles.nextElement();
-                LOG.fine("Evaluating Java ClassPath URL " + foundFile.toExternalForm());
-
-                JavaArchive archive = createArchive(foundFile, markerFile, includeIfPackageExists, excludeIfPackageExists);
-                if (archive != null) {
-                    LOG.info("Adding Java ClassPath URL as JavaArchive " + foundFile.toExternalForm());
-                    archives.add(archive);
-                }
-            }
-
-            return archives.toArray(new JavaArchive[archives.size()]);
-        }
-        catch (IOException ioe) {
-            throw new RuntimeException(ioe);
-        }
-
-    }
-
-    private static JavaArchive createArchive(URL foundFile, String markerFile,
-                                             String[] includeIfPackageExists, String[] excludeIfPackageExists)
-            throws IOException {
-        String urlString = foundFile.toString();
-        int idx = urlString.lastIndexOf(markerFile);
-        urlString = urlString.substring(0, idx);
-
-        String jarUrlPath = isJarUrl(urlString);
-        if (jarUrlPath != null)
-        {
-            final JavaArchive foundJar = ShrinkWrap.createFromZipFile(JavaArchive.class, new File(URI.create(jarUrlPath)));
-
-            if (excludeIfPackageExists != null)
-            {
-                for (String excludePackage : excludeIfPackageExists)
-                {
-                    if (foundJar.contains(excludePackage.replaceAll("\\.", "\\/"))) {
-                        return null;
-                    }
-                }
-            }
-            if (includeIfPackageExists != null)
-            {
-                for (String includePackage : includeIfPackageExists)
-                {
-                    if (foundJar.contains(includePackage.replaceAll("\\.", "\\/")))
-                    {
-                        return foundJar;
-                    }
-                }
-            }
-            return null; // couldn't find any jar
-        }
-        else
-        {
-            File f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
-            if (!f.exists())
-            {
-                // try a fallback if the URL contains %20 -> spaces
-                if (urlString.contains("%20"))
-                {
-                    urlString = urlString.replaceAll("%20", " ");
-                    f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
-                }
-
-            }
-
-            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);
-                }
-            }
-        }
-        finally {
-            try {
-                jar.close();
-            }
-            catch (IOException ignored) {
-                // all fine
-            }
-        }
-
-        return ret;
-    }
-
-    private static JavaArchive addFileArchive(File archiveBasePath,
-                                              String[] includeIfPackageExists,
-                                              String[] excludeIfPackageExists)
-            throws IOException {
-        if (!archiveBasePath.exists()) {
-            return null;
-        }
-
-        JavaArchive ret = null;
-        JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
-
-        if (includeIfPackageExists == null) {
-            // no include rule, thus add it immediately
-            ret = javaArchive;
-        }
-
-        int basePathLength = archiveBasePath.getAbsolutePath().length() + 1;
-
-        for (File archiveEntry : collectArchiveEntries(archiveBasePath) ) {
-            String entryName = archiveEntry.getAbsolutePath().substring(basePathLength);
-
-            // exclude rule
-            if (excludeIfPackageExists(entryName, excludeIfPackageExists)) {
-                continue;
-            }
-
-            // include rule
-            if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists)) {
-                ret = javaArchive;
-            }
-
-            if (entryName.endsWith(".class")) {
-                String className = pathToClassName(entryName.substring(0, entryName.length()-(".class".length())));
-
-                javaArchive.addClass(className);
-            }
-            else {
-                javaArchive.addAsResource(entryName.replace('\\', '/'));
-            }
-        }
-
-        return ret;
-    }
-
-    private static List<File> collectArchiveEntries(File archiveBasePath)
-    {
-        if (archiveBasePath.isDirectory()) {
-            List<File> archiveEntries = new ArrayList<File>();
-            File[] files = archiveBasePath.listFiles();
-
-            for (File file : files) {
-                if (file.isDirectory()) {
-                    archiveEntries.addAll(collectArchiveEntries(file));
-                }
-                else {
-                    archiveEntries.add(file);
-                }
-            }
-
-            return archiveEntries;
-        }
-
-        return Collections.EMPTY_LIST;
-    }
-
-
-    private static boolean excludeIfPackageExists(String jarEntryName, String[] excludeOnPackages) {
-        if (excludeOnPackages != null) {
-            String packageName = pathToClassName(jarEntryName);
-
-            for (String excludeOnPackage : excludeOnPackages) {
-                if (packageName.startsWith(excludeOnPackage)) {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-    private static boolean includeIfPackageExists(String jarEntryName, String[] includeOnPackages) {
-        if (includeOnPackages == null ) {
-            return true;
-        }
-
-        String packageName = pathToClassName(jarEntryName);
-
-        for (String includeOnPackage : includeOnPackages) {
-            if (packageName.startsWith(includeOnPackage)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * check if the given url path is a Jar
-     * @param urlPath to check
-     */
-    private static String isJarUrl(String urlPath) {
-        // common prefixes of the url are: jar: (tomcat), zip: (weblogic) and wsjar: (websphere)
-        final int jarColon = urlPath.indexOf(':');
-        if (urlPath.endsWith("!/") && jarColon > 0) {
-            urlPath = urlPath.substring(jarColon + 1, urlPath.length() - 2);
-            return urlPath;
-        }
-
-        return null;
-    }
-
-    private static String ensureCorrectUrlFormat(String url) {
-        //fix for wls
-        if(!url.startsWith("file:/")) {
-            url = "file:/" + url;
-        }
-        return url;
-    }
-
-    private static String pathToClassName(String pathName) {
-        return pathName.replace('/', '.').replace('\\', '.');   // replace unix and windows separators
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/6dc7ff71/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 a16c1dc..77c6a72 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
@@ -18,7 +18,7 @@
  */
 package org.apache.deltaspike.test.util;
 
-import org.apache.deltaspike.test.core.api.temptestutil.ShrinkWrapArchiveUtil;
+import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/6dc7ff71/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 98b9692..1ac7ba9 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
@@ -19,6 +19,7 @@
 package org.apache.deltaspike.test.util;
 
 import org.apache.deltaspike.test.jpa.api.shared.TestEntityManager;
+import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
 import org.jboss.shrinkwrap.api.asset.Asset;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
@@ -29,7 +30,12 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive;
 public class ArchiveUtils
 {
     public static final String SHARED_PACKAGE = TestEntityManager.class.getPackage().getName();
-    
+
+    private ArchiveUtils()
+    {
+        // private ct
+    }
+
     public static JavaArchive[] getDeltaSpikeCoreAndJpaArchive()
     {
         return ShrinkWrapArchiveUtil.getArchives(

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/6dc7ff71/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java b/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java
deleted file mode 100644
index ff8fd82..0000000
--- a/deltaspike/modules/jpa/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.test.util;
-
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-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.logging.Logger;
-import java.util.zip.ZipEntry;
-
-/**
- * Lots of neat little helpers to more easily create JavaArchives from marker files on the classpath.
- * This should finally get moved to ShrinkWrap core!
- *
- * @deprecated This class should get moved to ShrinkWrap itself!
- */
-public class ShrinkWrapArchiveUtil
-{
-    private static final Logger LOG = Logger.getLogger(ShrinkWrapArchiveUtil.class.getName());
-    /**
-     * Resolve all markerFiles from the current ClassPath and package the root nodes
-     * into a JavaArchive.
-     * @param classLoader to use
-     * @param markerFile finding this marker file will trigger creating the JavaArchive.
-     * @param includeIfPackageExists if not null, we will only create JavaArchives if the given package exists
-     * @param excludeIfPackageExists if not null, we will <b>not</b> create JavaArchives if the given package exists.
-     *                               This has a higher precedence than includeIfPackageExists.
-     */
-    public static JavaArchive[] getArchives(ClassLoader classLoader,
-                                            String markerFile,
-                                            String[] includeIfPackageExists,
-                                            String[] excludeIfPackageExists)
-    {
-        if (classLoader == null) {
-            classLoader = ShrinkWrapArchiveUtil.class.getClassLoader();
-        }
-
-        try {
-            Enumeration<URL> foundFiles = classLoader.getResources(markerFile);
-
-            List<JavaArchive> archives = new ArrayList<JavaArchive>();
-
-            while (foundFiles.hasMoreElements()) {
-                URL foundFile = foundFiles.nextElement();
-                LOG.fine("Evaluating Java ClassPath URL " + foundFile.toExternalForm());
-
-                JavaArchive archive = createArchive(foundFile, markerFile, includeIfPackageExists, excludeIfPackageExists);
-                if (archive != null) {
-                    LOG.info("Adding Java ClassPath URL as JavaArchive " + foundFile.toExternalForm());
-                    archives.add(archive);
-                }
-            }
-
-            return archives.toArray(new JavaArchive[archives.size()]);
-        }
-        catch (IOException ioe) {
-            throw new RuntimeException(ioe);
-        }
-
-    }
-
-    private static JavaArchive createArchive(URL foundFile, String markerFile,
-                                             String[] includeIfPackageExists, String[] excludeIfPackageExists)
-            throws IOException {
-        String urlString = foundFile.toString();
-        int idx = urlString.lastIndexOf(markerFile);
-        urlString = urlString.substring(0, idx);
-
-        String jarUrlPath = isJarUrl(urlString);
-        if (jarUrlPath != null)
-        {
-            final JavaArchive foundJar = ShrinkWrap.createFromZipFile(JavaArchive.class, new File(URI.create(jarUrlPath)));
-
-            if (excludeIfPackageExists != null)
-            {
-                for (String excludePackage : excludeIfPackageExists)
-                {
-                    if (foundJar.contains(excludePackage.replaceAll("\\.", "\\/"))) {
-                        return null;
-                    }
-                }
-            }
-            if (includeIfPackageExists != null)
-            {
-                for (String includePackage : includeIfPackageExists)
-                {
-                    if (foundJar.contains(includePackage.replaceAll("\\.", "\\/")))
-                    {
-                        return foundJar;
-                    }
-                }
-            }
-            return null; // couldn't find any jar
-        }
-        else
-        {
-            File f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
-            if (!f.exists())
-            {
-                // try a fallback if the URL contains %20 -> spaces
-                if (urlString.contains("%20"))
-                {
-                    urlString = urlString.replaceAll("%20", " ");
-                    f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
-                }
-
-            }
-
-            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);
-                }
-            }
-        }
-        finally {
-            try {
-                jar.close();
-            }
-            catch (IOException ignored) {
-                // all fine
-            }
-        }
-
-        return ret;
-    }
-
-    private static JavaArchive addFileArchive(File archiveBasePath,
-                                              String[] includeIfPackageExists,
-                                              String[] excludeIfPackageExists)
-    {
-        if (!archiveBasePath.exists()) {
-            return null;
-        }
-
-        JavaArchive ret = null;
-        JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
-
-        if (includeIfPackageExists == null) {
-            // no include rule, thus add it immediately
-            ret = javaArchive;
-        }
-
-        int basePathLength = archiveBasePath.getAbsolutePath().length() + 1;
-
-        for (File archiveEntry : collectArchiveEntries(archiveBasePath) ) {
-            String entryName = archiveEntry.getAbsolutePath().substring(basePathLength);
-
-            // exclude rule
-            if (excludeIfPackageExists(entryName, excludeIfPackageExists)) {
-                continue;
-            }
-
-            // include rule
-            if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists)) {
-                ret = javaArchive;
-            }
-
-            if (entryName.endsWith(".class")) {
-                String className = pathToClassName(entryName.substring(0, entryName.length()-(".class".length())));
-
-                javaArchive.addClass(className);
-            }
-            else {
-                javaArchive.addAsResource(entryName.replace('\\', '/'));
-            }
-        }
-
-        return ret;
-    }
-
-    private static List<File> collectArchiveEntries(File archiveBasePath)
-    {
-        if (archiveBasePath.isDirectory()) {
-            List<File> archiveEntries = new ArrayList<File>();
-            File[] files = archiveBasePath.listFiles();
-
-            for (File file : files) {
-                if (file.isDirectory()) {
-                    archiveEntries.addAll(collectArchiveEntries(file));
-                }
-                else {
-                    archiveEntries.add(file);
-                }
-            }
-
-            return archiveEntries;
-        }
-
-        return Collections.EMPTY_LIST;
-    }
-
-
-    private static boolean excludeIfPackageExists(String jarEntryName, String[] excludeOnPackages) {
-        if (excludeOnPackages != null) {
-            String packageName = pathToClassName(jarEntryName);
-
-            for (String excludeOnPackage : excludeOnPackages) {
-                if (packageName.startsWith(excludeOnPackage)) {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-    private static boolean includeIfPackageExists(String jarEntryName, String[] includeOnPackages) {
-        if (includeOnPackages == null ) {
-            return true;
-        }
-
-        String packageName = pathToClassName(jarEntryName);
-
-        for (String includeOnPackage : includeOnPackages) {
-            if (packageName.startsWith(includeOnPackage)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * check if the given url path is a Jar
-     * @param urlPath to check
-     */
-    private static String isJarUrl(String urlPath) {
-        // common prefixes of the url are: jar: (tomcat), zip: (weblogic) and wsjar: (websphere)
-        final int jarColon = urlPath.indexOf(':');
-        if (urlPath.endsWith("!/") && jarColon > 0) {
-            urlPath = urlPath.substring(jarColon + 1, urlPath.length() - 2);
-            return urlPath;
-        }
-
-        return null;
-    }
-
-    private static String ensureCorrectUrlFormat(String url) {
-        //fix for wls
-        if(!url.startsWith("file:/")) {
-            url = "file:/" + url;
-        }
-        return url;
-    }
-
-    private static String pathToClassName(String pathName) {
-        return pathName.replace('/', '.').replace('\\', '.');   // replace unix and windows separators
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/6dc7ff71/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 90392c3..e76391a 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
@@ -18,6 +18,7 @@
  */
 package org.apache.deltaspike.test.util;
 
+import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
 import org.jboss.shrinkwrap.api.asset.Asset;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
@@ -28,7 +29,9 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive;
 public class ArchiveUtils
 {
     private ArchiveUtils() 
-    { }
+    {
+        // private ct
+    }
     
     public static JavaArchive[] getDeltaSpikeCoreAndSecurityArchive()
     {

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/6dc7ff71/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java
deleted file mode 100644
index a466c06..0000000
--- a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.deltaspike.test.util;
-
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-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.logging.Logger;
-import java.util.zip.ZipEntry;
-
-/**
- * Lots of neat little helpers to more easily create JavaArchives from marker files on the classpath.
- * This should finally get moved to ShrinkWrap core!
- *
- * @deprecated This class should get moved to ShrinkWrap itself!
- */
-public class ShrinkWrapArchiveUtil
-{
-    private static final Logger LOG = Logger.getLogger(ShrinkWrapArchiveUtil.class.getName());
-    
-    private ShrinkWrapArchiveUtil()
-    { }
-    
-    /**
-     * Resolve all markerFiles from the current ClassPath and package the root nodes
-     * into a JavaArchive.
-     * @param classLoader to use
-     * @param markerFile finding this marker file will trigger creating the JavaArchive.
-     * @param includeIfPackageExists if not null, we will only create JavaArchives if the given package exists
-     * @param excludeIfPackageExists if not null, we will <b>not</b> create JavaArchives if the given package exists.
-     *                               This has a higher precedence than includeIfPackageExists.
-     * @return
-     */
-    public static JavaArchive[] getArchives(ClassLoader classLoader,
-                                            String markerFile,
-                                            String[] includeIfPackageExists,
-                                            String[] excludeIfPackageExists)
-    {
-        if (classLoader == null) 
-        {
-            classLoader = ShrinkWrapArchiveUtil.class.getClassLoader();
-        }
-
-        try 
-        {
-            Enumeration<URL> foundFiles = classLoader.getResources(markerFile);
-
-            List<JavaArchive> archives = new ArrayList<JavaArchive>();
-
-            while (foundFiles.hasMoreElements()) 
-            {
-                URL foundFile = foundFiles.nextElement();
-                LOG.fine("Evaluating Java ClassPath URL " + foundFile.toExternalForm());
-
-                JavaArchive archive = createArchive(foundFile, markerFile, includeIfPackageExists, 
-                        excludeIfPackageExists);
-                if (archive != null) 
-                {
-                    LOG.info("Adding Java ClassPath URL as JavaArchive " + foundFile.toExternalForm());
-                    archives.add(archive);
-                }
-            }
-
-            return archives.toArray(new JavaArchive[archives.size()]);
-        }
-        catch (IOException ioe) 
-        {
-            throw new RuntimeException(ioe);
-        }
-
-    }
-
-    private static JavaArchive createArchive(URL foundFile, String markerFile,
-                                             String[] includeIfPackageExists, String[] excludeIfPackageExists)
-        throws IOException 
-    {
-        String urlString = foundFile.toString();
-        int idx = urlString.lastIndexOf(markerFile);
-        urlString = urlString.substring(0, idx);
-
-        String jarUrlPath = isJarUrl(urlString);
-        if (jarUrlPath != null)
-        {
-            final JavaArchive foundJar = ShrinkWrap.createFromZipFile(JavaArchive.class, 
-                    new File(URI.create(jarUrlPath)));
-
-            if (excludeIfPackageExists != null)
-            {
-                for (String excludePackage : excludeIfPackageExists)
-                {
-                    if (foundJar.contains(excludePackage.replaceAll("\\.", "\\/"))) 
-                    {
-                        return null;
-                    }
-                }
-            }
-            if (includeIfPackageExists != null)
-            {
-                for (String includePackage : includeIfPackageExists)
-                {
-                    if (foundJar.contains(includePackage.replaceAll("\\.", "\\/")))
-                    {
-                        return foundJar;
-                    }
-                }
-            }
-            return null; // couldn't find any jar
-        }
-        else
-        {
-            File f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
-            if (!f.exists())
-            {
-                // try a fallback if the URL contains %20 -> spaces
-                if (urlString.contains("%20"))
-                {
-                    urlString = urlString.replaceAll("%20", " ");
-                    f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
-                }
-
-            }
-
-            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);
-                }
-            }
-        }
-        finally 
-        {
-            try 
-            {
-                jar.close();
-            }
-            catch (IOException ignored) 
-            {
-                // all fine
-            }
-        }
-
-        return ret;
-    }
-
-    private static JavaArchive addFileArchive(File archiveBasePath,
-                                              String[] includeIfPackageExists,
-                                              String[] excludeIfPackageExists)
-        throws IOException 
-    {
-        if (!archiveBasePath.exists()) 
-        {
-            return null;
-        }
-
-        JavaArchive ret = null;
-        JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
-
-        if (includeIfPackageExists == null) 
-        {
-            // no include rule, thus add it immediately
-            ret = javaArchive;
-        }
-
-        int basePathLength = archiveBasePath.getAbsolutePath().length() + 1;
-
-        for (File archiveEntry : collectArchiveEntries(archiveBasePath) ) 
-        {
-            String entryName = archiveEntry.getAbsolutePath().substring(basePathLength);
-
-            // exclude rule
-            if (excludeIfPackageExists(entryName, excludeIfPackageExists)) 
-            {
-                continue;
-            }
-
-            // include rule
-            if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists)) 
-            {
-                ret = javaArchive;
-            }
-
-            if (entryName.endsWith(".class")) 
-            {
-                String className = pathToClassName(entryName.substring(0, entryName.length() - (".class".length())));
-
-                javaArchive.addClass(className);
-            }
-            else 
-            {
-                javaArchive.addAsResource(entryName.replace('\\', '/'));
-            }
-        }
-
-        return ret;
-    }
-
-    private static List<File> collectArchiveEntries(File archiveBasePath)
-    {
-        if (archiveBasePath.isDirectory()) 
-        {
-            List<File> archiveEntries = new ArrayList<File>();
-            File[] files = archiveBasePath.listFiles();
-
-            for (File file : files) 
-            {
-                if (file.isDirectory()) 
-                {
-                    archiveEntries.addAll(collectArchiveEntries(file));
-                }
-                else 
-                {
-                    archiveEntries.add(file);
-                }
-            }
-
-            return archiveEntries;
-        }
-
-        return Collections.EMPTY_LIST;
-    }
-
-
-    private static boolean excludeIfPackageExists(String jarEntryName, String[] excludeOnPackages) 
-    {
-        if (excludeOnPackages != null) 
-        {
-            String packageName = pathToClassName(jarEntryName);
-
-            for (String excludeOnPackage : excludeOnPackages) 
-            {
-                if (packageName.startsWith(excludeOnPackage))
-                {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-
-    private static boolean includeIfPackageExists(String jarEntryName, String[] includeOnPackages) 
-    {
-        if (includeOnPackages == null ) 
-        {
-            return true;
-        }
-
-        String packageName = pathToClassName(jarEntryName);
-
-        for (String includeOnPackage : includeOnPackages) 
-        {
-            if (packageName.startsWith(includeOnPackage)) 
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * check if the given url path is a Jar
-     * @param urlPath to check
-     */
-    private static String isJarUrl(String urlPath) 
-    {
-        // common prefixes of the url are: jar: (tomcat), zip: (weblogic) and wsjar: (websphere)
-        final int jarColon = urlPath.indexOf(':');
-        if (urlPath.endsWith("!/") && jarColon > 0) 
-        {
-            urlPath = urlPath.substring(jarColon + 1, urlPath.length() - 2);
-            return urlPath;
-        }
-
-        return null;
-    }
-
-    private static String ensureCorrectUrlFormat(String url) 
-    {
-        //fix for wls
-        if (!url.startsWith("file:/")) 
-        {
-            url = "file:/" + url;
-        }
-        return url;
-    }
-
-    private static String pathToClassName(String pathName) 
-    {
-        return pathName.replace('/', '.').replace('\\', '.');   // replace unix and windows separators
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/6dc7ff71/deltaspike/test-utils/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/test-utils/pom.xml b/deltaspike/test-utils/pom.xml
index 7e6e8e6..f5f7fa0 100644
--- a/deltaspike/test-utils/pom.xml
+++ b/deltaspike/test-utils/pom.xml
@@ -36,5 +36,13 @@
         running our tests.
     </description>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.jboss.shrinkwrap</groupId>
+            <artifactId>shrinkwrap-api</artifactId>
+            <version>1.0.1</version>
+        </dependency>
+    </dependencies>
+
 </project>
 

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/6dc7ff71/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
new file mode 100644
index 0000000..3eea993
--- /dev/null
+++ b/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/utils/ShrinkWrapArchiveUtil.java
@@ -0,0 +1,369 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.test.utils;
+
+
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+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.logging.Logger;
+import java.util.zip.ZipEntry;
+
+
+/**
+ * Lots of neat little helpers to more easily create JavaArchives from marker files on the classpath.
+ * This should finally get moved to ShrinkWrap core!
+ *
+ * @deprecated This class should get moved to ShrinkWrap itself!
+ */
+public class ShrinkWrapArchiveUtil
+{
+    private static final Logger LOG = Logger.getLogger(ShrinkWrapArchiveUtil.class.getName());
+
+    private ShrinkWrapArchiveUtil()
+    {
+        // private ct for utility class
+    }
+
+    /**
+     * Resolve all markerFiles from the current ClassPath and package the root nodes
+     * into a JavaArchive.
+     * @param classLoader to use
+     * @param markerFile finding this marker file will trigger creating the JavaArchive.
+     * @param includeIfPackageExists if not null, we will only create JavaArchives if the given package exists
+     * @param excludeIfPackageExists if not null, we will <b>not</b> create JavaArchives if the given package exists.
+     *                               This has a higher precedence than includeIfPackageExists.
+     */
+    public static JavaArchive[] getArchives(ClassLoader classLoader,
+                                            String markerFile,
+                                            String[] includeIfPackageExists,
+                                            String[] excludeIfPackageExists)
+    {
+        if (classLoader == null)
+        {
+            classLoader = ShrinkWrapArchiveUtil.class.getClassLoader();
+        }
+
+        try
+        {
+            Enumeration<URL> foundFiles = classLoader.getResources(markerFile);
+
+            List<JavaArchive> archives = new ArrayList<JavaArchive>();
+
+            while (foundFiles.hasMoreElements())
+            {
+                URL foundFile = foundFiles.nextElement();
+                LOG.fine("Evaluating Java ClassPath URL " + foundFile.toExternalForm());
+
+                JavaArchive archive
+                    = createArchive(foundFile, markerFile, includeIfPackageExists, excludeIfPackageExists);
+                if (archive != null)
+                {
+                    LOG.info("Adding Java ClassPath URL as JavaArchive " + foundFile.toExternalForm());
+                    archives.add(archive);
+                }
+            }
+
+            return archives.toArray(new JavaArchive[archives.size()]);
+        }
+        catch (IOException ioe)
+        {
+            throw new RuntimeException(ioe);
+        }
+
+    }
+
+    private static JavaArchive createArchive(URL foundFile, String markerFile,
+                                             String[] includeIfPackageExists, String[] excludeIfPackageExists)
+        throws IOException
+    {
+        String urlString = foundFile.toString();
+        int idx = urlString.lastIndexOf(markerFile);
+        urlString = urlString.substring(0, idx);
+
+        String jarUrlPath = isJarUrl(urlString);
+        if (jarUrlPath != null)
+        {
+            JavaArchive foundJar = ShrinkWrap.createFromZipFile(JavaArchive.class, new File(URI.create(jarUrlPath)));
+
+            if (excludeIfPackageExists != null)
+            {
+                for (String excludePackage : excludeIfPackageExists)
+                {
+                    if (foundJar.contains(excludePackage.replaceAll("\\.", "\\/")))
+                    {
+                        return null;
+                    }
+                }
+            }
+            if (includeIfPackageExists != null)
+            {
+                for (String includePackage : includeIfPackageExists)
+                {
+                    if (foundJar.contains(includePackage.replaceAll("\\.", "\\/")))
+                    {
+                        return foundJar;
+                    }
+                }
+            }
+            return null; // couldn't find any jar
+        }
+        else
+        {
+            File f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
+            if (!f.exists())
+            {
+                // try a fallback if the URL contains %20 -> spaces
+                if (urlString.contains("%20"))
+                {
+                    urlString = urlString.replaceAll("%20", " ");
+                    f = new File( (new URL(ensureCorrectUrlFormat(urlString))).getFile() );
+                }
+
+            }
+
+            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);
+                }
+            }
+        }
+        finally
+        {
+            try
+            {
+                jar.close();
+            }
+            catch (IOException ignored)
+            {
+                // all fine
+            }
+        }
+
+        return ret;
+    }
+
+    private static JavaArchive addFileArchive(File archiveBasePath,
+                                              String[] includeIfPackageExists,
+                                              String[] excludeIfPackageExists)
+        throws IOException
+    {
+        if (!archiveBasePath.exists())
+        {
+            return null;
+        }
+
+        JavaArchive ret = null;
+        JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class);
+
+        if (includeIfPackageExists == null)
+        {
+            // no include rule, thus add it immediately
+            ret = javaArchive;
+        }
+
+        int basePathLength = archiveBasePath.getAbsolutePath().length() + 1;
+
+        for (File archiveEntry : collectArchiveEntries(archiveBasePath) )
+        {
+            String entryName = archiveEntry.getAbsolutePath().substring(basePathLength);
+
+            // exclude rule
+            if (excludeIfPackageExists(entryName, excludeIfPackageExists))
+            {
+                continue;
+            }
+
+            // include rule
+            if (ret == null && includeIfPackageExists(entryName, includeIfPackageExists))
+            {
+                ret = javaArchive;
+            }
+
+            if (entryName.endsWith(".class"))
+            {
+                String className
+                    = pathToClassName(entryName.substring(0, entryName.length() - (".class".length())));
+
+                javaArchive.addClass(className);
+            }
+            else
+            {
+                javaArchive.addAsResource(entryName.replace('\\', '/'));
+            }
+        }
+
+        return ret;
+    }
+
+    private static List<File> collectArchiveEntries(File archiveBasePath)
+    {
+        if (archiveBasePath.isDirectory())
+        {
+            List<File> archiveEntries = new ArrayList<File>();
+            File[] files = archiveBasePath.listFiles();
+
+            for (File file : files)
+            {
+                if (file.isDirectory())
+                {
+                    archiveEntries.addAll(collectArchiveEntries(file));
+                }
+                else
+                {
+                    archiveEntries.add(file);
+                }
+            }
+
+            return archiveEntries;
+        }
+
+        return Collections.EMPTY_LIST;
+    }
+
+
+    private static boolean excludeIfPackageExists(String jarEntryName, String[] excludeOnPackages)
+    {
+        if (excludeOnPackages != null)
+        {
+            String packageName = pathToClassName(jarEntryName);
+
+            for (String excludeOnPackage : excludeOnPackages)
+            {
+                if (packageName.startsWith(excludeOnPackage))
+                {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    private static boolean includeIfPackageExists(String jarEntryName, String[] includeOnPackages)
+    {
+        if (includeOnPackages == null )
+        {
+            return true;
+        }
+
+        String packageName = pathToClassName(jarEntryName);
+
+        for (String includeOnPackage : includeOnPackages)
+        {
+            if (packageName.startsWith(includeOnPackage))
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * check if the given url path is a Jar
+     * @param urlPath to check
+     */
+    private static String isJarUrl(String urlPath)
+    {
+        // common prefixes of the url are: jar: (tomcat), zip: (weblogic) and wsjar: (websphere)
+        final int jarColon = urlPath.indexOf(':');
+        if (urlPath.endsWith("!/") && jarColon > 0)
+        {
+            urlPath = urlPath.substring(jarColon + 1, urlPath.length() - 2);
+            return urlPath;
+        }
+
+        return null;
+    }
+
+    private static String ensureCorrectUrlFormat(String url)
+    {
+        //fix for wls
+        if (!url.startsWith("file:/"))
+        {
+            url = "file:/" + url;
+        }
+        return url;
+    }
+
+    private static String pathToClassName(String pathName)
+    {
+        return pathName.replace('/', '.').replace('\\', '.');   // replace unix and windows separators
+    }
+
+
+}