tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: TOMEE-1758 remove:prefix for additionalLibs in arquillian
Date Fri, 25 Mar 2016 17:53:45 GMT
Repository: tomee
Updated Branches:
  refs/heads/master f8c5b36ac -> 7a676c243


TOMEE-1758 remove:prefix for additionalLibs in arquillian


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/7a676c24
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/7a676c24
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/7a676c24

Branch: refs/heads/master
Commit: 7a676c2435fbcf9ec6a44c74ef63fea97c416475
Parents: f8c5b36
Author: Romain manni-Bucau <rmannibucau@gmail.com>
Authored: Fri Mar 25 18:53:29 2016 +0100
Committer: Romain manni-Bucau <rmannibucau@gmail.com>
Committed: Fri Mar 25 18:53:29 2016 +0100

----------------------------------------------------------------------
 .../apache/openejb/arquillian/common/Setup.java | 38 ++++++++++++++------
 1 file changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/7a676c24/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
index a369129..2205b03 100644
--- a/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
+++ b/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/Setup.java
@@ -30,6 +30,7 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive;
 
 import java.io.File;
 import java.io.FileFilter;
+import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
@@ -417,17 +418,34 @@ public class Setup {
                 args = null;
             }
 
-            final Set<String> locations = ProvisioningUtil.realLocation(trim);
-            for (final String location : locations) {
-                final File from = new File(location);
-                try {
-                    final File to = new File(libFolder, from.getName());
-                    org.apache.openejb.loader.IO.copy(from, to);
-                    if (args != null) {
-                        configs.put(to, args);
+            if (trim.startsWith("remove:")) { // like mvn plugin, needed to use plus but
switch something like the jpa provider
+                final String prefix = trim.substring("remove:".length());
+                final File[] children = libFolder.listFiles(new FilenameFilter() {
+                    @Override
+                    public boolean accept(final File dir, final String name) {
+                        return name.startsWith(prefix);
+                    }
+                });
+                if (children != null && children.length > 0) {
+                    for (final File child : children) {
+                        if (!IO.delete(child) && child.getName().endsWith(".jar"))
{ // try to rename it to have it ignored
+                            child.renameTo(new File(child.getParentFile(), child.getName()
+ "_renamed"));
+                        }
+                    }
+                }
+            } else {
+                final Set<String> locations = ProvisioningUtil.realLocation(trim);
+                for (final String location : locations) {
+                    final File from = new File(location);
+                    try {
+                        final File to = new File(libFolder, from.getName());
+                        org.apache.openejb.loader.IO.copy(from, to);
+                        if (args != null) {
+                            configs.put(to, args);
+                        }
+                    } catch (final IOException e) {
+                        throw new IllegalArgumentException(e);
                     }
-                } catch (final IOException e) {
-                    throw new IllegalArgumentException(e);
                 }
             }
         }


Mime
View raw message