tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [1/2] tomee git commit: TOMEE-1516 patch from Daniel Cunha, deployPathsAsWebapp(File...)
Date Sun, 22 Feb 2015 15:57:54 GMT
Repository: tomee
Updated Branches:
  refs/heads/develop 577688312 -> f2c5d3447


TOMEE-1516 patch from Daniel Cunha, deployPathsAsWebapp(File...)


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

Branch: refs/heads/develop
Commit: ae07f534835cc377100a8ded00d59c605aba4a93
Parents: 5776883
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Sun Feb 22 16:53:49 2015 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Sun Feb 22 16:53:49 2015 +0100

----------------------------------------------------------------------
 .../org/apache/tomee/embedded/Container.java     | 19 +++++++++++++++++++
 .../tomee/embedded/ClasspathAsWebappTest.java    |  4 +---
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/ae07f534/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
index 0ef0cc4..b8a52d6 100644
--- a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
+++ b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
@@ -93,6 +93,7 @@ import java.io.InputStream;
 import java.io.Writer;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -101,6 +102,8 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 
+import static java.util.Arrays.asList;
+
 /**
  * @version $Rev$ $Date$
  */
@@ -167,6 +170,22 @@ public class Container implements AutoCloseable {
         }
     }
 
+    public Container deployPathsAsWebapp(final File... jarList) {
+        try {
+            if (jarList == null || jarList.length < 1) {
+                throw new IllegalArgumentException("The file does not have content");
+            }
+
+            List<URL> urls = new ArrayList<URL>();
+            for (File jar : jarList) {
+                urls.addAll(asList(jar.toURI().toURL()));
+            }
+            return this.deployPathsAsWebapp(null, urls, null);
+        } catch (final MalformedURLException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
     public Container deployPathsAsWebapp(final String context, final List<URL> jarList,
final File docBase) {
         final ClassLoader loader = Thread.currentThread().getContextClassLoader();
         final SystemInstance systemInstance = SystemInstance.get();

http://git-wip-us.apache.org/repos/asf/tomee/blob/ae07f534/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/ClasspathAsWebappTest.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/ClasspathAsWebappTest.java
b/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/ClasspathAsWebappTest.java
index c06a378..8475684 100644
--- a/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/ClasspathAsWebappTest.java
+++ b/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/ClasspathAsWebappTest.java
@@ -19,7 +19,6 @@ package org.apache.tomee.embedded;
 import org.apache.openejb.loader.IO;
 import org.apache.openejb.loader.JarLocation;
 import org.apache.openejb.util.NetworkUtil;
-import org.apache.openejb.util.classloader.URLClassLoaderFirst;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -56,7 +55,6 @@ import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import static java.util.Arrays.asList;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -81,7 +79,7 @@ public class ClasspathAsWebappTest {
                             .http(NetworkUtil.getNextAvailablePort())
                             .property("openejb.container.additional.exclude", "org.apache.tomee.embedded.")
                             .property("openejb.additional.include", "tomee-"))
-                .deployPathsAsWebapp("", asList(JarLocation.jarLocation(MyInitializer.class).toURI().toURL()),
null)
+                .deployPathsAsWebapp(JarLocation.jarLocation(MyInitializer.class))
                 .inject(this)) {
 
             // Servlet (initializer, servlet)


Mime
View raw message