tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject [1/3] tomee git commit: few test fixes
Date Mon, 08 Feb 2016 19:31:49 GMT
Repository: tomee
Updated Branches:
  refs/heads/master ceaec93f9 -> 68d795781


few test fixes


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

Branch: refs/heads/master
Commit: ed524ec563c88e62bad69ea8b412ddf65cea4bfa
Parents: ceaec93
Author: Romain manni-Bucau <rmannibucau@gmail.com>
Authored: Mon Feb 8 20:29:42 2016 +0100
Committer: Romain manni-Bucau <rmannibucau@gmail.com>
Committed: Mon Feb 8 20:29:42 2016 +0100

----------------------------------------------------------------------
 .../appcomposer/AppComposerConfiguration.java   |   4 +-
 .../ejb/OverloadedEjbObserverMethodsTest.java   |   2 +-
 .../tests/cipher/CipherFromAppTest.java         |   5 +-
 .../webapp/WebAppClassLoaderTest.java           |   2 +-
 .../openejb/arquillian/tests/ear/EarTest.java   |  15 -
 .../exception/DeploymentExceptionErrorTest.java |   2 +-
 arquillian/arquillian-tomee-tests/pom.xml       |  21 +-
 .../config/ApplicationComposerDeployer.java     |  12 +-
 .../openejb/config/PersistenceModule.java       |   2 +-
 .../openejb/core/CoreContainerSystem.java       |   8 +-
 .../tomee/catalina/TomEEWebappClassLoader.java  |   3 +-
 .../apache/tomee/embedded/Configuration.java"   | 346 -------
 .../org/apache/tomee/embedded/Container.java"   | 955 -------------------
 .../tomee/embedded/EmbeddedTomEEContainer.java" | 214 -----
 .../tomee/embedded/LoginConfigBuilder.java"     |  65 --
 .../java/org/apache/tomee/embedded/Main.java"   | 134 ---
 .../embedded/SecurityConstaintBuilder.java"     |  59 --
 .../internal/StandardContextCustomizer.java"    | 111 ---
 .../embedded/junit/TomEEEmbeddedRule.java"      | 136 ---
 .../META-INF/org.apache.tomee/service-jar.xml"  |  53 -
 20 files changed, 38 insertions(+), 2111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerConfiguration.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerConfiguration.java
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerConfiguration.java
index 39a1872..0375c0a 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerConfiguration.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/appcomposer/AppComposerConfiguration.java
@@ -26,6 +26,8 @@ import org.apache.openejb.testing.Module;
 public class AppComposerConfiguration {
     @Module
     public static PersistenceUnit unit() {
-        return new PersistenceUnit("jpa");
+        final PersistenceUnit jpa = new PersistenceUnit("jpa");
+        jpa.setExcludeUnlistedClasses(true);
+        return jpa;
     }
 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cdi/ejb/OverloadedEjbObserverMethodsTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cdi/ejb/OverloadedEjbObserverMethodsTest.java
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cdi/ejb/OverloadedEjbObserverMethodsTest.java
index 828c846..a1b1f05 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cdi/ejb/OverloadedEjbObserverMethodsTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cdi/ejb/OverloadedEjbObserverMethodsTest.java
@@ -52,7 +52,7 @@ public class OverloadedEjbObserverMethodsTest {
 
     @Deployment
     public static WebArchive archive() {
-        return ShrinkWrap.create(WebArchive.class)
+        return ShrinkWrap.create(WebArchive.class, "OverloadedEjbObserverMethodsTest.war")
                 .addClasses(Painter.class, Orange.class, Green.class)
                 .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cipher/CipherFromAppTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cipher/CipherFromAppTest.java
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cipher/CipherFromAppTest.java
index 32a00e5..365b0f9 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cipher/CipherFromAppTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/cipher/CipherFromAppTest.java
@@ -43,7 +43,10 @@ public class CipherFromAppTest {
                 .addAsWebInfResource(new StringAsset("" +
                         "<resource>" +
                         "   <Resource type=\"DataSource\" id=\"cipher\">" +
-                        "       PasswordCipher = constant" +
+                        "       PasswordCipher = constant\n" +
+                        // tomcat-jdbc doesnt support invalid credentials
+                        "       InitialSize = 0\n" +
+                        "       MinIdle = 0\n" +
                         "   </Resource>" +
                         "</resource>"), "resources.xml");
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/classloader/webapp/WebAppClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/classloader/webapp/WebAppClassLoaderTest.java
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/classloader/webapp/WebAppClassLoaderTest.java
index e5aadbc..228da57 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/classloader/webapp/WebAppClassLoaderTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/classloader/webapp/WebAppClassLoaderTest.java
@@ -44,7 +44,7 @@ public class WebAppClassLoaderTest {
 
     @Deployment
     public static WebArchive war() {
-        return ShrinkWrap.create(WebArchive.class)
+        return ShrinkWrap.create(WebArchive.class, "WebAppClassLoaderTest.war")
                 .addClasses(HashCdiExtension.class, HashServlet.class)
                 .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
                 .addAsServiceProvider(Extension.class, HashCdiExtension.class);

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
index 8fbd9ca..6d3757f 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarTest.java
@@ -29,16 +29,6 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import javax.annotation.PostConstruct;
-import javax.ejb.EJB;
-import javax.ejb.Singleton;
-import javax.ejb.Startup;
-import javax.servlet.ServletException;
-import javax.servlet.annotation.WebServlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 import java.net.URL;
 
 /**
@@ -57,8 +47,6 @@ public class EarTest {
         ejbJar.addClass(Bean.class);
 
         final WebArchive webapp = ShrinkWrap.create(WebArchive.class, "green.war").addClass(Hello.class);
-        System.out.println(webapp.toString(true));
-        System.out.println();
 
         final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "red.ear").addAsModule(ejbJar).addAsModule(webapp);
         ear.addAsLibraries(JarLocation.jarLocation(Test.class));
@@ -68,10 +56,7 @@ public class EarTest {
 
     @Test
     public void test() throws Exception {
-
         final URL servlet = new URL(url, "/red/green/blue");
-
-        System.out.println(servlet.toExternalForm());
         final String slurp = IO.slurp(servlet);
         Assert.assertEquals(Test.class.getName(), slurp);
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/exception/DeploymentExceptionErrorTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/exception/DeploymentExceptionErrorTest.java
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/exception/DeploymentExceptionErrorTest.java
index d06d874..80ee34d 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/exception/DeploymentExceptionErrorTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/exception/DeploymentExceptionErrorTest.java
@@ -44,7 +44,7 @@ public class DeploymentExceptionErrorTest {
     @Deployment(testable = false)
     @ShouldThrowException(OpenEJBRuntimeException.class)
     public static WebArchive war() {
-        return ShrinkWrap.create(WebArchive.class)
+        return ShrinkWrap.create(WebArchive.class, "DeploymentExceptionErrorTest.war")
                     .addAsWebInfResource(new StringAsset(Descriptors.create(BeansDescriptor.class)
                             .getOrCreateInterceptors()
                                 .clazz("i.dont.exist.so.i.ll.make.the.deployment.fail")

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/arquillian/arquillian-tomee-tests/pom.xml
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/pom.xml b/arquillian/arquillian-tomee-tests/pom.xml
index bc613fb..73e8bfa 100644
--- a/arquillian/arquillian-tomee-tests/pom.xml
+++ b/arquillian/arquillian-tomee-tests/pom.xml
@@ -249,35 +249,36 @@
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <executions>
+
               <execution>
-                <id>test-tomee-embedded</id>
+                <id>test-tomee-remote</id>
                 <phase>test</phase>
                 <goals>
                   <goal>test</goal>
                 </goals>
                 <configuration>
-                  <skip>${skip.embedded}</skip>
+                  <skip>${skip.remote.webprofile}</skip>
                   <systemPropertyVariables>
+                    <openejb.arquillian.debug>true</openejb.arquillian.debug>
                     <tomee.version>${project.version}</tomee.version>
-                    <arquillian.launch>tomee-embedded</arquillian.launch>
-                    <openejb.arquillian.adapter>tomee-embedded</openejb.arquillian.adapter>
+                    <tomee.classifier>webprofile</tomee.classifier>
+                    <arquillian.launch>tomee-remote</arquillian.launch>
+                    <openejb.arquillian.adapter>tomee-remote</openejb.arquillian.adapter>
                   </systemPropertyVariables>
                 </configuration>
               </execution>
               <execution>
-                <id>test-tomee-remote</id>
+                <id>test-tomee-embedded</id>
                 <phase>test</phase>
                 <goals>
                   <goal>test</goal>
                 </goals>
                 <configuration>
-                  <skip>${skip.remote.webprofile}</skip>
+                  <skip>${skip.embedded}</skip>
                   <systemPropertyVariables>
-                    <openejb.arquillian.debug>true</openejb.arquillian.debug>
                     <tomee.version>${project.version}</tomee.version>
-                    <tomee.classifier>webprofile</tomee.classifier>
-                    <arquillian.launch>tomee-remote</arquillian.launch>
-                    <openejb.arquillian.adapter>tomee-remote</openejb.arquillian.adapter>
+                    <arquillian.launch>tomee-embedded</arquillian.launch>
+                    <openejb.arquillian.adapter>tomee-embedded</openejb.arquillian.adapter>
                   </systemPropertyVariables>
                 </configuration>
               </execution>

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/container/openejb-core/src/main/java/org/apache/openejb/config/ApplicationComposerDeployer.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/ApplicationComposerDeployer.java
b/container/openejb-core/src/main/java/org/apache/openejb/config/ApplicationComposerDeployer.java
index 80f3cdc..c99f2aa 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/ApplicationComposerDeployer.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/ApplicationComposerDeployer.java
@@ -157,11 +157,11 @@ public class ApplicationComposerDeployer implements DynamicDeployer
{
             } else if (Persistence.class.isInstance(result)) {
                 final Persistence persistence = Persistence.class.cast(result);
                 if (!persistence.getPersistenceUnit().isEmpty()) {
-                    appModule.getPersistenceModules().add(new PersistenceModule(persistence.getPersistenceUnit().iterator().next().getName(),
persistence));
+                    appModule.getPersistenceModules().add(new PersistenceModule(appModule,
rootUrl(ejbModule), persistence));
                 }
             } else if (PersistenceUnit.class.isInstance(result)) {
                 final PersistenceUnit unit = PersistenceUnit.class.cast(result);
-                appModule.addPersistenceModule(new PersistenceModule(unit.getName(), new
Persistence(unit)));
+                appModule.addPersistenceModule(new PersistenceModule(appModule, rootUrl(ejbModule),
new Persistence(unit)));
             } else if (Beans.class.isInstance(result)) {
                 final Beans beans = Beans.class.cast(result);
                 ejbModule.setBeans(beans);
@@ -174,6 +174,14 @@ public class ApplicationComposerDeployer implements DynamicDeployer {
         return instance;
     }
 
+    private String rootUrl(final EjbModule ejbModule) {
+        try {
+            return ejbModule.getModuleUri().toURL().toExternalForm();
+        } catch (final Exception e) { // malformed, npe...shouldn't occur at this point
+            return null; // actually would be nicer to return null by default to skip any
other scanning but needed by some provider and us sometimes
+        }
+    }
+
     private void configureClasses(final WebModule web, final EjbModule ejbModule,
                                   final ApplicationComposer applicationComposer, final Classes
classes) {
         ejbModule.getEjbJar().setMetadataComplete(applicationComposer.metadataComplete());

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
b/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
index d39fbd2..9ab7339 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/PersistenceModule.java
@@ -50,7 +50,7 @@ public class PersistenceModule implements DeploymentModule {
 
     public void setRootUrl(final String rootUrl) {
         this.rootUrl = rootUrl;
-        this.uri = URLs.uri(rootUrl);
+        this.uri = rootUrl == null ? null : URLs.uri(rootUrl);
     }
 
     public Persistence getPersistence() {

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
b/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
index 3b41a3f..7995791 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/core/CoreContainerSystem.java
@@ -29,6 +29,7 @@ import javax.naming.NamingException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -177,22 +178,21 @@ public class CoreContainerSystem implements ContainerSystem {
         AppContext context = apps.get(id);
 
         if (null == context && null != id) {
-            context = apps.get(id.toString().toLowerCase());
+            context = apps.get(id.toString().toLowerCase(Locale.ENGLISH));
         }
 
         return context;
     }
 
     public void addAppContext(final AppContext appContext) {
-        apps.put(appContext.getId().toLowerCase(), appContext);
+        apps.put(appContext.getId().toLowerCase(Locale.ENGLISH), appContext);
     }
 
     public AppContext removeAppContext(final Object id) {
-
         AppContext context = apps.remove(id);
 
         if (null == context && null != id) {
-            context = apps.remove(id.toString().toLowerCase());
+            context = apps.remove(id.toString().toLowerCase(Locale.ENGLISH));
         }
 
         return context;

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomEEWebappClassLoader.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomEEWebappClassLoader.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomEEWebappClassLoader.java
index 6fb2890..e1d1dd3 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomEEWebappClassLoader.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomEEWebappClassLoader.java
@@ -238,7 +238,8 @@ public class TomEEWebappClassLoader extends ParallelWebappClassLoader
{
     }
 
     @Override
-    protected boolean filter(final String name) {
+    protected boolean filter(final String inName, final boolean isClassName) {
+        final String name = inName == null ||isClassName ? inName : inName.replace('/', '.').replace(".class",
"");
         if ("org.apache.tomee.mojarra.TomEEInjectionProvider".equals(name)) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/java/org/apache/tomee/embedded/Configuration.java"
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/java/org/apache/tomee/embedded/Container.java"
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/java/org/apache/tomee/embedded/EmbeddedTomEEContainer.java"
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/java/org/apache/tomee/embedded/LoginConfigBuilder.java"
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/java/org/apache/tomee/embedded/Main.java"
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/java/org/apache/tomee/embedded/SecurityConstaintBuilder.java"
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/java/org/apache/tomee/embedded/internal/StandardContextCustomizer.java"
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/java/org/apache/tomee/embedded/junit/TomEEEmbeddedRule.java"
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tomee/blob/ed524ec5/"tomee/tomee-embedded\253src/main/resources/META-INF/org.apache.tomee/service-jar.xml"
----------------------------------------------------------------------


Mime
View raw message