You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by km...@apache.org on 2010/07/10 04:44:02 UTC

svn commit: r962746 - in /openejb/trunk/openejb3/container/openejb-core/src: main/java/org/apache/openejb/config/rules/CheckDependsOn.java test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java

Author: kmalhi
Date: Sat Jul 10 02:44:02 2010
New Revision: 962746

URL: http://svn.apache.org/viewvc?rev=962746&view=rev
Log:
Added test to check keys dependsOn.circuit and dependsOn.noSuchEjb. Also fixed logic in CheckDependsOn so that in case of a scenario where one has a dependsOn circuit as well as a Singleton depends on a non-existing ejb, the Validation engine traps both of these scenarios instead of just showing validation failure for a non existent EJB. 

Added:
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java
Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java?rev=962746&r1=962745&r2=962746&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/rules/CheckDependsOn.java Sat Jul 10 02:44:02 2010
@@ -90,7 +90,7 @@ public class CheckDependsOn extends Vali
             }
         }
 
-        if (missingBeans) return;
+       // if (missingBeans) return;
 
         try {
             References.sort(new ArrayList<Bean>(app.values()), new References.Visitor<Bean>() {

Added: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java?rev=962746&view=auto
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java (added)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java Sat Jul 10 02:44:02 2010
@@ -0,0 +1,70 @@
+/**
+ * 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.openejb.config.rules;
+
+import javax.ejb.DependsOn;
+import javax.ejb.Singleton;
+
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.SingletonBean;
+import org.junit.runner.RunWith;
+
+@RunWith(ValidationRunner.class)
+public class CheckDependsOnTest {
+    @Keys( { @Key(value = "dependsOn.circuit", count = 2), @Key(value = "dependsOn.noSuchEjb", count = 2) })
+    public EjbJar dependsOn() throws OpenEJBException {
+        EjbJar ejbJar = new EjbJar();
+        SingletonBean one = new SingletonBean(One.class);
+        SingletonBean two = new SingletonBean(Two.class);
+        SingletonBean three = new SingletonBean(Three.class);
+        SingletonBean four = new SingletonBean(Four.class);
+        SingletonBean five = new SingletonBean(Five.class);
+        SingletonBean six = new SingletonBean(Six.class);
+        ejbJar.addEnterpriseBean(one);
+        ejbJar.addEnterpriseBean(two);
+        ejbJar.addEnterpriseBean(three);
+        ejbJar.addEnterpriseBean(four);
+        ejbJar.addEnterpriseBean(five);
+        ejbJar.addEnterpriseBean(six);
+        return ejbJar;
+    }
+
+    @Singleton
+    @DependsOn("Two")
+    private static class One {}
+
+    @Singleton
+    @DependsOn("One")
+    private static class Two {}
+
+    @Singleton
+    @DependsOn("Four")
+    private static class Three {}
+
+    @Singleton
+    @DependsOn("Three")
+    private static class Four {}
+
+    @Singleton
+    @DependsOn("WrongOne")
+    private static class Five {}
+
+    @Singleton
+    @DependsOn("WrongOne")
+    private static class Six {}
+}