tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r654721 - in /openejb/trunk/openejb3/container/openejb-core/src: main/java/org/apache/openejb/assembler/classic/ main/java/org/apache/openejb/config/ test/java/org/apache/openejb/config/
Date Fri, 09 May 2008 08:38:56 GMT
Author: jlaskowski
Date: Fri May  9 01:38:56 2008
New Revision: 654721

URL: http://svn.apache.org/viewvc?rev=654721&view=rev
Log:
Fix for ConfigurationFactory.getOpenEjbConfiguration() which returns sys that might've been
already passed in the constructors 
 - Enable two junit tests to cover it
More tests for ConfigurationFactory

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/WebAppInfo.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/ConfigurationFactoryTest.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/WebAppInfo.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/WebAppInfo.java?rev=654721&r1=654720&r2=654721&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/WebAppInfo.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/WebAppInfo.java
Fri May  9 01:38:56 2008
@@ -21,7 +21,6 @@
 import java.util.TreeSet;
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Collection;
 
 public class WebAppInfo extends InfoObject {
     public String codebase;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java?rev=654721&r1=654720&r2=654721&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java
Fri May  9 01:38:56 2008
@@ -253,6 +253,10 @@
 
     public OpenEjbConfiguration getOpenEjbConfiguration() throws OpenEJBException {
 
+        if (sys != null) {
+            return sys;
+        }
+        
         if (configLocation != null) {
             openejb = JaxbOpenejb.readConfig(configLocation);
         } else {

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/ConfigurationFactoryTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/ConfigurationFactoryTest.java?rev=654721&r1=654720&r2=654721&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/ConfigurationFactoryTest.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/ConfigurationFactoryTest.java
Fri May  9 01:38:56 2008
@@ -27,8 +27,10 @@
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.assembler.classic.EjbJarInfo;
 import org.apache.openejb.assembler.classic.OpenEjbConfiguration;
+import org.apache.openejb.assembler.classic.WebAppInfo;
 import org.apache.openejb.config.sys.Deployments;
 import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.WebApp;
 import org.apache.openejb.loader.SystemInstance;
 import org.junit.Test;
 
@@ -53,6 +55,20 @@
     }
 
     @Test
+    public void testConfigureApplicationWebModule() throws OpenEJBException {
+        SystemInstance.get().setProperty(ConfigurationFactory.VALIDATION_SKIP_PROPERTY, "false");
+        SystemInstance.get().setProperty(DeploymentsResolver.SEARCH_CLASSPATH_FOR_DEPLOYMENTS_PROPERTY,
"false");
+        ConfigurationFactory factory = new ConfigurationFactory();
+        final String moduleId = "testConfigureApplicationWebModule";
+        WebApp webApp = new WebApp();
+        // no real classes engaged so disable metadata (annotation) processing
+        webApp.setMetadataComplete(true);
+        WebModule webModule = new WebModule(webApp, null, null, "/some/where.war", moduleId);
+        WebAppInfo info = factory.configureApplication(webModule);
+        assertEquals(moduleId, info.moduleId);
+    }
+
+    @Test
     public void testGetOpenEjbConfiguration() throws OpenEJBException {
         SystemInstance.get().setProperty(ConfigurationFactory.VALIDATION_SKIP_PROPERTY, "false");
         SystemInstance.get().setProperty(DeploymentsResolver.SEARCH_CLASSPATH_FOR_DEPLOYMENTS_PROPERTY,
"false");
@@ -78,22 +94,22 @@
         assertEquals(0, openEjbConfig.containerSystem.applications.size());
     }
 
-//    @Test
-//    public void testConfigurationFactoryBooleanOpenEjbConfiguration() throws OpenEJBException
{
-//        final boolean offline = false;
-//        final OpenEjbConfiguration openEjbConfiguration = new OpenEjbConfiguration();
-//        ConfigurationFactory factory = new ConfigurationFactory(offline, openEjbConfiguration);
-//        assertEquals(openEjbConfiguration, factory.getOpenEjbConfiguration());
-//    }
-
-//    @Test
-//    public void testConfigurationFactoryBooleanDynamicDeployerOpenEjbConfiguration() throws
OpenEJBException {
-//        final boolean offline = false;
-//        final DynamicDeployer dynamicDeployer = null;
-//        final OpenEjbConfiguration openEjbConfiguration = new OpenEjbConfiguration();
-//        ConfigurationFactory factory = new ConfigurationFactory(offline, dynamicDeployer,
openEjbConfiguration);
-//        assertEquals(openEjbConfiguration, factory.getOpenEjbConfiguration());
-//    }
+    @Test
+    public void testConfigurationFactoryBooleanOpenEjbConfiguration() throws OpenEJBException
{
+        final boolean offline = false;
+        final OpenEjbConfiguration openEjbConfiguration = new OpenEjbConfiguration();
+        ConfigurationFactory factory = new ConfigurationFactory(offline, openEjbConfiguration);
+        assertEquals(openEjbConfiguration, factory.getOpenEjbConfiguration());
+    }
+
+    @Test
+    public void testConfigurationFactoryBooleanDynamicDeployerOpenEjbConfiguration() throws
OpenEJBException {
+        final boolean offline = false;
+        final DynamicDeployer dynamicDeployer = null;
+        final OpenEjbConfiguration openEjbConfiguration = new OpenEjbConfiguration();
+        ConfigurationFactory factory = new ConfigurationFactory(offline, dynamicDeployer,
openEjbConfiguration);
+        assertEquals(openEjbConfiguration, factory.getOpenEjbConfiguration());
+    }
 
     @Test
     public void testToConfigDeclaration() throws Exception {



Mime
View raw message