You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2015/12/09 17:37:19 UTC
[10/18] tomee git commit: EOL
http://git-wip-us.apache.org/repos/asf/tomee/blob/48c99a5a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckAnnotationTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckAnnotationTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckAnnotationTest.java
index 221885c..39b9642 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckAnnotationTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckAnnotationTest.java
@@ -1,87 +1,87 @@
-/*
- * 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 org.apache.openejb.config.AppModule;
-import org.apache.openejb.config.EjbModule;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.ManagedBean;
-import org.apache.openejb.jee.MessageDrivenBean;
-import org.apache.openejb.jee.StatefulBean;
-import org.apache.openejb.jee.StatelessBean;
-import org.apache.openejb.test.annotated.Green;
-import org.apache.openejb.test.annotated.Red;
-import org.apache.openejb.test.annotated.Yellow;
-import org.apache.xbean.finder.AnnotationFinder;
-import org.apache.xbean.finder.archive.ClassesArchive;
-import org.junit.runner.RunWith;
-
-import javax.ejb.Local;
-import javax.ejb.Stateless;
-
-@RunWith(ValidationRunner.class)
-public class CheckAnnotationTest {
-
- @Keys({@Key(value = "annotation.invalid.stateful.webservice", type = KeyType.WARNING)})
- public AppModule testWebServiceWithStateful() {
- final EjbJar ejbJar = new EjbJar();
- ejbJar.addEnterpriseBean(new StatefulBean(Green.class));
- final EjbModule ejbModule = new EjbModule(ejbJar);
- ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(Green.class)).link());
-
- final AppModule appModule = new AppModule(ejbModule);
- return appModule;
- }
-
- @Keys({@Key(value = "annotation.invalid.messagedriven.webservice", type = KeyType.WARNING)})
- public AppModule testWebServiceWithMessageDriven() {
- final EjbJar ejbJar = new EjbJar();
- ejbJar.addEnterpriseBean(new MessageDrivenBean(Yellow.class));
- final EjbModule ejbModule = new EjbModule(ejbJar);
- ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(Yellow.class)).link());
-
- final AppModule appModule = new AppModule(ejbModule);
- return appModule;
- }
-
-
- @Keys({@Key(value = "annotation.invalid.managedbean.webservice", type = KeyType.WARNING)})
- public AppModule testWebServiceWithManagedBean() {
- final EjbJar ejbJar = new EjbJar();
- ejbJar.addEnterpriseBean(new ManagedBean(Red.class));
- final EjbModule ejbModule = new EjbModule(ejbJar);
- ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(Red.class)).link());
-
- final AppModule appModule = new AppModule(ejbModule);
- return appModule;
- }
-
- @Keys({@Key(value = "ann.local.forLocalBean", type = KeyType.WARNING)})
- public EjbModule shouldWarnForLocalAnnotationOnBeanWithNoInterface() {
- final EjbJar ejbJar = new EjbJar();
- ejbJar.addEnterpriseBean(new StatelessBean(EjbWithoutInterface.class));
- final EjbModule ejbModule = new EjbModule(ejbJar);
- ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(EjbWithoutInterface.class)).link());
- return ejbModule;
- }
-
- @Local
- @Stateless
- public static class EjbWithoutInterface {
- }
-
-}
+/*
+ * 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 org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.ManagedBean;
+import org.apache.openejb.jee.MessageDrivenBean;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.apache.openejb.test.annotated.Green;
+import org.apache.openejb.test.annotated.Red;
+import org.apache.openejb.test.annotated.Yellow;
+import org.apache.xbean.finder.AnnotationFinder;
+import org.apache.xbean.finder.archive.ClassesArchive;
+import org.junit.runner.RunWith;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+@RunWith(ValidationRunner.class)
+public class CheckAnnotationTest {
+
+ @Keys({@Key(value = "annotation.invalid.stateful.webservice", type = KeyType.WARNING)})
+ public AppModule testWebServiceWithStateful() {
+ final EjbJar ejbJar = new EjbJar();
+ ejbJar.addEnterpriseBean(new StatefulBean(Green.class));
+ final EjbModule ejbModule = new EjbModule(ejbJar);
+ ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(Green.class)).link());
+
+ final AppModule appModule = new AppModule(ejbModule);
+ return appModule;
+ }
+
+ @Keys({@Key(value = "annotation.invalid.messagedriven.webservice", type = KeyType.WARNING)})
+ public AppModule testWebServiceWithMessageDriven() {
+ final EjbJar ejbJar = new EjbJar();
+ ejbJar.addEnterpriseBean(new MessageDrivenBean(Yellow.class));
+ final EjbModule ejbModule = new EjbModule(ejbJar);
+ ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(Yellow.class)).link());
+
+ final AppModule appModule = new AppModule(ejbModule);
+ return appModule;
+ }
+
+
+ @Keys({@Key(value = "annotation.invalid.managedbean.webservice", type = KeyType.WARNING)})
+ public AppModule testWebServiceWithManagedBean() {
+ final EjbJar ejbJar = new EjbJar();
+ ejbJar.addEnterpriseBean(new ManagedBean(Red.class));
+ final EjbModule ejbModule = new EjbModule(ejbJar);
+ ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(Red.class)).link());
+
+ final AppModule appModule = new AppModule(ejbModule);
+ return appModule;
+ }
+
+ @Keys({@Key(value = "ann.local.forLocalBean", type = KeyType.WARNING)})
+ public EjbModule shouldWarnForLocalAnnotationOnBeanWithNoInterface() {
+ final EjbJar ejbJar = new EjbJar();
+ ejbJar.addEnterpriseBean(new StatelessBean(EjbWithoutInterface.class));
+ final EjbModule ejbModule = new EjbModule(ejbJar);
+ ejbModule.setFinder(new AnnotationFinder(new ClassesArchive(EjbWithoutInterface.class)).link());
+ return ejbModule;
+ }
+
+ @Local
+ @Stateless
+ public static class EjbWithoutInterface {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/48c99a5a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckCdiEnabledTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckCdiEnabledTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckCdiEnabledTest.java
index f064a33..945eec6 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckCdiEnabledTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckCdiEnabledTest.java
@@ -1,43 +1,43 @@
-/**
- * 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 org.apache.openejb.OpenEJBException;
-import org.apache.openejb.config.EjbModule;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.xbean.finder.AnnotationFinder;
-import org.apache.xbean.finder.archive.ClassesArchive;
-import org.junit.runner.RunWith;
-
-import javax.inject.Inject;
-
-@RunWith(ValidationRunner.class)
-public class CheckCdiEnabledTest {
- @Keys(@Key(value = "cdi.notEnabled", type = KeyType.WARNING))
- public EjbModule cdiShouldBeOn() throws OpenEJBException {
- return new EjbModule(new EjbJar())
- .finder(new AnnotationFinder(new ClassesArchive(Bean1.class, Bean2.class)));
- }
-
- public static class Bean1 {
- }
-
- public static class Bean2 {
- @Inject
- private Bean1 bean1;
- }
-}
+/**
+ * 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 org.apache.openejb.OpenEJBException;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.xbean.finder.AnnotationFinder;
+import org.apache.xbean.finder.archive.ClassesArchive;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+@RunWith(ValidationRunner.class)
+public class CheckCdiEnabledTest {
+ @Keys(@Key(value = "cdi.notEnabled", type = KeyType.WARNING))
+ public EjbModule cdiShouldBeOn() throws OpenEJBException {
+ return new EjbModule(new EjbJar())
+ .finder(new AnnotationFinder(new ClassesArchive(Bean1.class, Bean2.class)));
+ }
+
+ public static class Bean1 {
+ }
+
+ public static class Bean2 {
+ @Inject
+ private Bean1 bean1;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/48c99a5a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java
index 9c76064..c159207 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckDependsOnTest.java
@@ -1,76 +1,76 @@
-/**
- * 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 org.apache.openejb.OpenEJBException;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.SingletonBean;
-import org.junit.runner.RunWith;
-
-import javax.ejb.DependsOn;
-import javax.ejb.Singleton;
-
-@RunWith(ValidationRunner.class)
-public class CheckDependsOnTest {
- @Keys({@Key(value = "dependsOn.circuit", count = 2), @Key(value = "dependsOn.noSuchEjb", count = 2)})
- public EjbJar dependsOn() throws OpenEJBException {
- final EjbJar ejbJar = new EjbJar();
- final SingletonBean one = new SingletonBean(One.class);
- final SingletonBean two = new SingletonBean(Two.class);
- final SingletonBean three = new SingletonBean(Three.class);
- final SingletonBean four = new SingletonBean(Four.class);
- final SingletonBean five = new SingletonBean(Five.class);
- final 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 {
- }
-}
+/**
+ * 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 org.apache.openejb.OpenEJBException;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.SingletonBean;
+import org.junit.runner.RunWith;
+
+import javax.ejb.DependsOn;
+import javax.ejb.Singleton;
+
+@RunWith(ValidationRunner.class)
+public class CheckDependsOnTest {
+ @Keys({@Key(value = "dependsOn.circuit", count = 2), @Key(value = "dependsOn.noSuchEjb", count = 2)})
+ public EjbJar dependsOn() throws OpenEJBException {
+ final EjbJar ejbJar = new EjbJar();
+ final SingletonBean one = new SingletonBean(One.class);
+ final SingletonBean two = new SingletonBean(Two.class);
+ final SingletonBean three = new SingletonBean(Three.class);
+ final SingletonBean four = new SingletonBean(Four.class);
+ final SingletonBean five = new SingletonBean(Five.class);
+ final 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 {
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/48c99a5a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNameTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNameTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNameTest.java
index 2d5c63e..8e37feb 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNameTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckIncorrectPropertyNameTest.java
@@ -1,50 +1,50 @@
-/*
- * 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 org.apache.openejb.config.AppModule;
-import org.apache.openejb.config.EjbModule;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.StatefulBean;
-import org.apache.openejb.loader.SystemInstance;
-import org.junit.runner.RunWith;
-
-import javax.interceptor.AroundInvoke;
-
-@RunWith(ValidationRunner.class)
-public class CheckIncorrectPropertyNameTest {
-
-
- @Keys({@Key(value = "incorrect.property.name", type = KeyType.WARNING)})
- public AppModule testSystemPropertyNames() {
- //SystemInstance.get().setProperty("java.persistence.provider", "test");
- SystemInstance.get().setProperty("javax.naming.referral", "test");
- final EjbJar ejbJar = new EjbJar();
- ejbJar.addEnterpriseBean(new StatefulBean(Green.class));
- return new AppModule(new EjbModule(ejbJar));
- }
-}
-
-
-class Green {
-
- // need to add this @AroundInvoke to cause validation to fail. Validation does not
- // fail on warnings, which causes this framework to not work properly
- @AroundInvoke
- public void sayCheese() {
- }
+/*
+ * 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 org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.loader.SystemInstance;
+import org.junit.runner.RunWith;
+
+import javax.interceptor.AroundInvoke;
+
+@RunWith(ValidationRunner.class)
+public class CheckIncorrectPropertyNameTest {
+
+
+ @Keys({@Key(value = "incorrect.property.name", type = KeyType.WARNING)})
+ public AppModule testSystemPropertyNames() {
+ //SystemInstance.get().setProperty("java.persistence.provider", "test");
+ SystemInstance.get().setProperty("javax.naming.referral", "test");
+ final EjbJar ejbJar = new EjbJar();
+ ejbJar.addEnterpriseBean(new StatefulBean(Green.class));
+ return new AppModule(new EjbModule(ejbJar));
+ }
+}
+
+
+class Green {
+
+ // need to add this @AroundInvoke to cause validation to fail. Validation does not
+ // fail on warnings, which causes this framework to not work properly
+ @AroundInvoke
+ public void sayCheese() {
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/48c99a5a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckMissingClassTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckMissingClassTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckMissingClassTest.java
index f591370..5393bb9 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckMissingClassTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckMissingClassTest.java
@@ -1,184 +1,184 @@
-/**
- * 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 org.apache.openejb.OpenEJBException;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.EntityBean;
-import org.apache.openejb.jee.PersistenceType;
-import org.apache.openejb.jee.StatefulBean;
-import org.apache.openejb.jee.StatelessBean;
-import org.junit.runner.RunWith;
-
-import javax.ejb.EJBException;
-import javax.ejb.EntityContext;
-import javax.ejb.RemoveException;
-import javax.ejb.SessionBean;
-import javax.ejb.SessionContext;
-import java.rmi.RemoteException;
-
-@RunWith(ValidationRunner.class)
-public class CheckMissingClassTest {
- @Keys(@Key(value = "missing.class", count = 16))
- public EjbJar wrongClassType() throws OpenEJBException {
- System.setProperty("openejb.validation.output.level", "VERBOSE");
- final EjbJar ejbJar = new EjbJar();
- final StatelessBean stateless = new StatelessBean(FooStateless.class);
- stateless.setHomeAndRemote("WrongHome", "WrongRemote");
- stateless.setLocal("WrongLocal");
- stateless.setLocalHome("WrongLocalHome");
- ejbJar.addEnterpriseBean(stateless);
- final StatefulBean stateful = new StatefulBean(FooStateful.class);
- stateful.setHomeAndRemote("WrongHome", "WrongRemote");
- stateful.setLocal("WrongLocal");
- stateful.setLocalHome("WrongLocalHome");
- ejbJar.addEnterpriseBean(stateful);
- final EntityBean bmpEntityBean = new EntityBean(FooEntityBMP.class, PersistenceType.BEAN);
- bmpEntityBean.setHome("WrongHome");
- bmpEntityBean.setLocalHome("WrongLocalHome");
- bmpEntityBean.setRemote("WrongRemote");
- bmpEntityBean.setLocal("WrongLocal");
- ejbJar.addEnterpriseBean(bmpEntityBean);
- final EntityBean cmpEntityBean = new EntityBean(FooEntityCMP.class, PersistenceType.CONTAINER);
- cmpEntityBean.setHome("WrongHome");
- cmpEntityBean.setLocalHome("WrongLocalHome");
- cmpEntityBean.setRemote("WrongRemote");
- cmpEntityBean.setLocal("WrongLocal");
- ejbJar.addEnterpriseBean(cmpEntityBean);
- return ejbJar;
- }
-
- private static class FooStateless implements SessionBean {
- public void ejbCreate() {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-
- private static class FooStateful implements SessionBean {
- public void ejbCreate() {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-
- private static class FooEntityBMP implements javax.ejb.EntityBean {
- public String ejbCreate(final String id) {
- return null;
- }
-
- public void ejbPostCreate(final String id) {
- }
-
- ;
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbLoad() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws RemoveException, EJBException, RemoteException {
- }
-
- @Override
- public void ejbStore() throws EJBException, RemoteException {
- }
-
- @Override
- public void setEntityContext(final EntityContext arg0) throws EJBException, RemoteException {
- }
-
- @Override
- public void unsetEntityContext() throws EJBException, RemoteException {
- }
- }
-
- private static class FooEntityCMP implements javax.ejb.EntityBean {
- public String ejbCreate(final String id) {
- return null;
- }
-
- public void ejbPostCreate(final String id) {
- }
-
- ;
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbLoad() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws RemoveException, EJBException, RemoteException {
- }
-
- @Override
- public void ejbStore() throws EJBException, RemoteException {
- }
-
- @Override
- public void setEntityContext(final EntityContext arg0) throws EJBException, RemoteException {
- }
-
- @Override
- public void unsetEntityContext() throws EJBException, RemoteException {
- }
- }
-}
+/**
+ * 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 org.apache.openejb.OpenEJBException;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.EntityBean;
+import org.apache.openejb.jee.PersistenceType;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.junit.runner.RunWith;
+
+import javax.ejb.EJBException;
+import javax.ejb.EntityContext;
+import javax.ejb.RemoveException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import java.rmi.RemoteException;
+
+@RunWith(ValidationRunner.class)
+public class CheckMissingClassTest {
+ @Keys(@Key(value = "missing.class", count = 16))
+ public EjbJar wrongClassType() throws OpenEJBException {
+ System.setProperty("openejb.validation.output.level", "VERBOSE");
+ final EjbJar ejbJar = new EjbJar();
+ final StatelessBean stateless = new StatelessBean(FooStateless.class);
+ stateless.setHomeAndRemote("WrongHome", "WrongRemote");
+ stateless.setLocal("WrongLocal");
+ stateless.setLocalHome("WrongLocalHome");
+ ejbJar.addEnterpriseBean(stateless);
+ final StatefulBean stateful = new StatefulBean(FooStateful.class);
+ stateful.setHomeAndRemote("WrongHome", "WrongRemote");
+ stateful.setLocal("WrongLocal");
+ stateful.setLocalHome("WrongLocalHome");
+ ejbJar.addEnterpriseBean(stateful);
+ final EntityBean bmpEntityBean = new EntityBean(FooEntityBMP.class, PersistenceType.BEAN);
+ bmpEntityBean.setHome("WrongHome");
+ bmpEntityBean.setLocalHome("WrongLocalHome");
+ bmpEntityBean.setRemote("WrongRemote");
+ bmpEntityBean.setLocal("WrongLocal");
+ ejbJar.addEnterpriseBean(bmpEntityBean);
+ final EntityBean cmpEntityBean = new EntityBean(FooEntityCMP.class, PersistenceType.CONTAINER);
+ cmpEntityBean.setHome("WrongHome");
+ cmpEntityBean.setLocalHome("WrongLocalHome");
+ cmpEntityBean.setRemote("WrongRemote");
+ cmpEntityBean.setLocal("WrongLocal");
+ ejbJar.addEnterpriseBean(cmpEntityBean);
+ return ejbJar;
+ }
+
+ private static class FooStateless implements SessionBean {
+ public void ejbCreate() {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+
+ private static class FooStateful implements SessionBean {
+ public void ejbCreate() {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+
+ private static class FooEntityBMP implements javax.ejb.EntityBean {
+ public String ejbCreate(final String id) {
+ return null;
+ }
+
+ public void ejbPostCreate(final String id) {
+ }
+
+ ;
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbLoad() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws RemoveException, EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbStore() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setEntityContext(final EntityContext arg0) throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void unsetEntityContext() throws EJBException, RemoteException {
+ }
+ }
+
+ private static class FooEntityCMP implements javax.ejb.EntityBean {
+ public String ejbCreate(final String id) {
+ return null;
+ }
+
+ public void ejbPostCreate(final String id) {
+ }
+
+ ;
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbLoad() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws RemoveException, EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbStore() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setEntityContext(final EntityContext arg0) throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void unsetEntityContext() throws EJBException, RemoteException {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/48c99a5a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoBusinessMethodTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoBusinessMethodTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoBusinessMethodTest.java
index 180c6e1..f591735 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoBusinessMethodTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoBusinessMethodTest.java
@@ -1,198 +1,198 @@
-/**
- * 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 org.apache.openejb.OpenEJBException;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.StatefulBean;
-import org.apache.openejb.jee.StatelessBean;
-import org.junit.runner.RunWith;
-
-import javax.ejb.CreateException;
-import javax.ejb.EJBException;
-import javax.ejb.EJBHome;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.SessionBean;
-import javax.ejb.SessionContext;
-import java.rmi.RemoteException;
-
-@RunWith(ValidationRunner.class)
-public class CheckNoBusinessMethodTest {
- @Keys({@Key(value = "no.busines.method.case", count = 4), @Key(value = "no.busines.method.args", count = 4), @Key(value = "no.busines.method", count = 4)})
- public EjbJar noBusinessMethod() throws OpenEJBException {
- // System.setProperty("openejb.validation.output.level", "VERBOSE");
- final EjbJar ejbJar = new EjbJar();
- final StatelessBean stateLessLocal = new StatelessBean(FooStatelessSession.class);
- stateLessLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
- stateLessLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
- final StatefulBean statefulLocal = new StatefulBean(FooStatefulSession.class);
- statefulLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
- statefulLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
- final StatelessBean stateLessRemote = new StatelessBean(FooRemoteStatelessSession.class);
- stateLessRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
- stateLessRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
- final StatefulBean statefulRemote = new StatefulBean(FooRemoteStatefulSession.class);
- statefulRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
- statefulRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
- ejbJar.addEnterpriseBean(stateLessLocal);
- ejbJar.addEnterpriseBean(statefulLocal);
- ejbJar.addEnterpriseBean(stateLessRemote);
- ejbJar.addEnterpriseBean(statefulRemote);
- return ejbJar;
- }
-
- private static interface FooLocalHome extends EJBLocalHome {
- FooLocal create() throws CreateException;
- }
-
- private static interface FooLocal extends EJBLocalObject {
- void foo(String x, String y);
-
- // this method is not implemented by the bean class
- void foo1();
- }
-
- private static class FooStatelessSession implements SessionBean {
- // method name is same as in the Local interface, except arguments are different
- public void foo(final int x, final String y) {
- }
-
- // method name has a different case
- public void Foo(final String x, final String y) {
- }
-
- public void ejbCreate() {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-
- private static class FooStatefulSession implements SessionBean {
- // method name is same as in the Local interface, except arguments are different
- public void foo(final int x, final String y) {
- }
-
- // method name has a different case
- public void Foo(final String x, final String y) {
- }
-
- public void ejbCreate() {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-
- // =================
- private static interface FooRemoteHome extends EJBHome {
- FooRemote create() throws RemoteException, CreateException;
- }
-
- private static interface FooRemote extends EJBObject {
- void foo(String x, String y) throws RemoteException;
-
- // This method is not implemented by the bean class
- void foo1() throws RemoteException;
- }
-
- private static class FooRemoteStatelessSession implements SessionBean {
- // method name is same as in the Remote interface, except arguments are different
- public void foo(final int x, final String y) {
- }
-
- // method name has a different case
- public void Foo(final String x, final String y) {
- }
-
- public void ejbCreate() {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-
- private static class FooRemoteStatefulSession implements SessionBean {
- // method name is same as in the Remote interface, except arguments are different
- public void foo(final int x, final String y) {
- }
-
- // method name has a different case
- public void Foo(final String x, final String y) {
- }
-
- public void ejbCreate() {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-}
+/**
+ * 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 org.apache.openejb.OpenEJBException;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.junit.runner.RunWith;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.EJBHome;
+import javax.ejb.EJBLocalHome;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import java.rmi.RemoteException;
+
+@RunWith(ValidationRunner.class)
+public class CheckNoBusinessMethodTest {
+ @Keys({@Key(value = "no.busines.method.case", count = 4), @Key(value = "no.busines.method.args", count = 4), @Key(value = "no.busines.method", count = 4)})
+ public EjbJar noBusinessMethod() throws OpenEJBException {
+ // System.setProperty("openejb.validation.output.level", "VERBOSE");
+ final EjbJar ejbJar = new EjbJar();
+ final StatelessBean stateLessLocal = new StatelessBean(FooStatelessSession.class);
+ stateLessLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
+ stateLessLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
+ final StatefulBean statefulLocal = new StatefulBean(FooStatefulSession.class);
+ statefulLocal.setLocalHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocalHome");
+ statefulLocal.setLocal("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooLocal");
+ final StatelessBean stateLessRemote = new StatelessBean(FooRemoteStatelessSession.class);
+ stateLessRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
+ stateLessRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
+ final StatefulBean statefulRemote = new StatefulBean(FooRemoteStatefulSession.class);
+ statefulRemote.setHome("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemoteHome");
+ statefulRemote.setRemote("org.apache.openejb.config.rules.CheckNoBusinessMethodTest$FooRemote");
+ ejbJar.addEnterpriseBean(stateLessLocal);
+ ejbJar.addEnterpriseBean(statefulLocal);
+ ejbJar.addEnterpriseBean(stateLessRemote);
+ ejbJar.addEnterpriseBean(statefulRemote);
+ return ejbJar;
+ }
+
+ private static interface FooLocalHome extends EJBLocalHome {
+ FooLocal create() throws CreateException;
+ }
+
+ private static interface FooLocal extends EJBLocalObject {
+ void foo(String x, String y);
+
+ // this method is not implemented by the bean class
+ void foo1();
+ }
+
+ private static class FooStatelessSession implements SessionBean {
+ // method name is same as in the Local interface, except arguments are different
+ public void foo(final int x, final String y) {
+ }
+
+ // method name has a different case
+ public void Foo(final String x, final String y) {
+ }
+
+ public void ejbCreate() {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+
+ private static class FooStatefulSession implements SessionBean {
+ // method name is same as in the Local interface, except arguments are different
+ public void foo(final int x, final String y) {
+ }
+
+ // method name has a different case
+ public void Foo(final String x, final String y) {
+ }
+
+ public void ejbCreate() {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+
+ // =================
+ private static interface FooRemoteHome extends EJBHome {
+ FooRemote create() throws RemoteException, CreateException;
+ }
+
+ private static interface FooRemote extends EJBObject {
+ void foo(String x, String y) throws RemoteException;
+
+ // This method is not implemented by the bean class
+ void foo1() throws RemoteException;
+ }
+
+ private static class FooRemoteStatelessSession implements SessionBean {
+ // method name is same as in the Remote interface, except arguments are different
+ public void foo(final int x, final String y) {
+ }
+
+ // method name has a different case
+ public void Foo(final String x, final String y) {
+ }
+
+ public void ejbCreate() {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+
+ private static class FooRemoteStatefulSession implements SessionBean {
+ // method name is same as in the Remote interface, except arguments are different
+ public void foo(final int x, final String y) {
+ }
+
+ // method name has a different case
+ public void Foo(final String x, final String y) {
+ }
+
+ public void ejbCreate() {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/48c99a5a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoCreateMethodsTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoCreateMethodsTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoCreateMethodsTest.java
index d5f3144..554ce09 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoCreateMethodsTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckNoCreateMethodsTest.java
@@ -1,280 +1,280 @@
-/**
- * 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 org.apache.openejb.OpenEJBException;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.PersistenceType;
-import org.apache.openejb.jee.StatefulBean;
-import org.apache.openejb.jee.StatelessBean;
-import org.junit.runner.RunWith;
-
-import javax.ejb.CreateException;
-import javax.ejb.EJBException;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EntityBean;
-import javax.ejb.EntityContext;
-import javax.ejb.FinderException;
-import javax.ejb.LocalHome;
-import javax.ejb.RemoteHome;
-import javax.ejb.RemoveException;
-import javax.ejb.SessionBean;
-import javax.ejb.SessionContext;
-import java.rmi.RemoteException;
-
-@RunWith(ValidationRunner.class)
-public class CheckNoCreateMethodsTest {
- @Keys({@Key(value = "no.home.create", count = 4), @Key(value = "unused.ejb.create", count = 2, type = KeyType.WARNING),
- @Key(value = "unused.ejbPostCreate", type = KeyType.WARNING), @Key("entity.no.ejb.create"), @Key(value = "session.no.ejb.create", count = 2)})
- public EjbJar noCreateMethod() throws OpenEJBException {
- System.setProperty("openejb.validation.output.level", "VERBOSE");
- final EjbJar ejbJar = new EjbJar();
- final StatelessBean stateless = new StatelessBean(FooStateless.class);
- stateless.setHomeAndRemote(FooStatelessHome.class, FooStatelessRemote.class);
- stateless.setHomeAndLocal(FooStatelessLocalHome.class, FooStatelessLocal.class);
- ejbJar.addEnterpriseBean(stateless);
- final StatefulBean stateful = new StatefulBean(FooStateful.class);
- stateful.setHomeAndRemote(FooStatefulHome.class, FooStatefulRemote.class);
- stateful.setHomeAndLocal(FooStatefulLocalHome.class, FooStatefulLocal.class);
- ejbJar.addEnterpriseBean(stateful);
- final org.apache.openejb.jee.EntityBean bean = new org.apache.openejb.jee.EntityBean(MyEntity.class, PersistenceType.BEAN);
- bean.setLocalHome(MyLocalHome.class.getName());
- bean.setLocal(MyLocal.class.getName());
- ejbJar.addEnterpriseBean(bean);
- final org.apache.openejb.jee.EntityBean bean1 = new org.apache.openejb.jee.EntityBean(YourEntity.class, PersistenceType.BEAN);
- bean1.setLocalHome(MyLocalHome.class.getName());
- bean1.setLocal(MyLocal.class.getName());
- ejbJar.addEnterpriseBean(bean1);
- final StatelessBean bar = new StatelessBean(BarStateless.class);
- bar.setHomeAndRemote(BarStatelessHome.class, BarStatelessRemote.class);
- ejbJar.addEnterpriseBean(bar);
- final StatefulBean bazStateful = new StatefulBean(BazStateful.class);
- ejbJar.addEnterpriseBean(bazStateful);
- return ejbJar;
- }
-
- private static interface FooStatelessHome extends javax.ejb.EJBHome {
- }
-
- private static interface FooStatelessRemote extends javax.ejb.EJBObject {
- }
-
- private static interface FooStatelessLocalHome extends javax.ejb.EJBLocalHome {
- }
-
- private static interface FooStatelessLocal extends javax.ejb.EJBLocalObject {
- }
-
- private static class FooStateless implements SessionBean {
- public void ejbCreate() {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-
- private static interface FooStatefulHome extends javax.ejb.EJBHome {
- }
-
- private static interface FooStatefulRemote extends javax.ejb.EJBObject {
- }
-
- private static interface FooStatefulLocalHome extends javax.ejb.EJBLocalHome {
- }
-
- private static interface FooStatefulLocal extends javax.ejb.EJBLocalObject {
- }
-
- private static class FooStateful implements SessionBean {
- public void ejbCreate() {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-
- private static interface MyLocalHome extends EJBLocalHome {
- public MyLocal create(Integer pk) throws CreateException;
-
- public MyLocal findByPrimaryKey(Integer pk) throws FinderException;
- }
-
- private static interface MyLocal extends EJBLocalObject {
- }
-
- private static class MyEntity implements EntityBean {
- public Integer ejbCreate(final Integer pk) throws CreateException {
- return null;
- }
-
- public void ejbPostCreate(final String str) {
- }
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbLoad() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws RemoveException, EJBException, RemoteException {
- }
-
- @Override
- public void ejbStore() throws EJBException, RemoteException {
- }
-
- @Override
- public void setEntityContext(final EntityContext arg0) throws EJBException, RemoteException {
- }
-
- @Override
- public void unsetEntityContext() throws EJBException, RemoteException {
- }
- }
-
- private static class YourEntity implements EntityBean {
-// public Integer ejbCreate(Integer pk) throws CreateException {
-// return null;
-// }
-
-// public void ejbPostCreate(Integer pk) {}
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbLoad() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws RemoveException, EJBException, RemoteException {
- }
-
- @Override
- public void ejbStore() throws EJBException, RemoteException {
- }
-
- @Override
- public void setEntityContext(final EntityContext arg0) throws EJBException, RemoteException {
- }
-
- @Override
- public void unsetEntityContext() throws EJBException, RemoteException {
- }
- }
-
- private static interface BarStatelessHome extends javax.ejb.EJBHome {
- public BarStatelessRemote create() throws CreateException, RemoteException;
- }
-
- private static interface BarStatelessRemote extends javax.ejb.EJBObject {
- }
-
- private static class BarStateless implements SessionBean {
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-
- private static interface BazStatefulHome extends javax.ejb.EJBHome {
- public BazStatefulRemote create() throws CreateException, RemoteException;
- }
-
- private static interface BazStatefulRemote extends javax.ejb.EJBObject {
- }
-
- private static interface BazStatefulLocalHome extends javax.ejb.EJBLocalHome {
- public BazStatefulLocal create() throws CreateException;
- }
-
- private static interface BazStatefulLocal extends javax.ejb.EJBLocalObject {
- }
-
- @RemoteHome(BazStatefulHome.class)
- @LocalHome(BazStatefulLocalHome.class)
- private static class BazStateful implements SessionBean {
- // missing ejbCreate method
-
- @Override
- public void ejbActivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbPassivate() throws EJBException, RemoteException {
- }
-
- @Override
- public void ejbRemove() throws EJBException, RemoteException {
- }
-
- @Override
- public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
- }
- }
-}
+/**
+ * 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 org.apache.openejb.OpenEJBException;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.PersistenceType;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.junit.runner.RunWith;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.EJBLocalHome;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EntityBean;
+import javax.ejb.EntityContext;
+import javax.ejb.FinderException;
+import javax.ejb.LocalHome;
+import javax.ejb.RemoteHome;
+import javax.ejb.RemoveException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import java.rmi.RemoteException;
+
+@RunWith(ValidationRunner.class)
+public class CheckNoCreateMethodsTest {
+ @Keys({@Key(value = "no.home.create", count = 4), @Key(value = "unused.ejb.create", count = 2, type = KeyType.WARNING),
+ @Key(value = "unused.ejbPostCreate", type = KeyType.WARNING), @Key("entity.no.ejb.create"), @Key(value = "session.no.ejb.create", count = 2)})
+ public EjbJar noCreateMethod() throws OpenEJBException {
+ System.setProperty("openejb.validation.output.level", "VERBOSE");
+ final EjbJar ejbJar = new EjbJar();
+ final StatelessBean stateless = new StatelessBean(FooStateless.class);
+ stateless.setHomeAndRemote(FooStatelessHome.class, FooStatelessRemote.class);
+ stateless.setHomeAndLocal(FooStatelessLocalHome.class, FooStatelessLocal.class);
+ ejbJar.addEnterpriseBean(stateless);
+ final StatefulBean stateful = new StatefulBean(FooStateful.class);
+ stateful.setHomeAndRemote(FooStatefulHome.class, FooStatefulRemote.class);
+ stateful.setHomeAndLocal(FooStatefulLocalHome.class, FooStatefulLocal.class);
+ ejbJar.addEnterpriseBean(stateful);
+ final org.apache.openejb.jee.EntityBean bean = new org.apache.openejb.jee.EntityBean(MyEntity.class, PersistenceType.BEAN);
+ bean.setLocalHome(MyLocalHome.class.getName());
+ bean.setLocal(MyLocal.class.getName());
+ ejbJar.addEnterpriseBean(bean);
+ final org.apache.openejb.jee.EntityBean bean1 = new org.apache.openejb.jee.EntityBean(YourEntity.class, PersistenceType.BEAN);
+ bean1.setLocalHome(MyLocalHome.class.getName());
+ bean1.setLocal(MyLocal.class.getName());
+ ejbJar.addEnterpriseBean(bean1);
+ final StatelessBean bar = new StatelessBean(BarStateless.class);
+ bar.setHomeAndRemote(BarStatelessHome.class, BarStatelessRemote.class);
+ ejbJar.addEnterpriseBean(bar);
+ final StatefulBean bazStateful = new StatefulBean(BazStateful.class);
+ ejbJar.addEnterpriseBean(bazStateful);
+ return ejbJar;
+ }
+
+ private static interface FooStatelessHome extends javax.ejb.EJBHome {
+ }
+
+ private static interface FooStatelessRemote extends javax.ejb.EJBObject {
+ }
+
+ private static interface FooStatelessLocalHome extends javax.ejb.EJBLocalHome {
+ }
+
+ private static interface FooStatelessLocal extends javax.ejb.EJBLocalObject {
+ }
+
+ private static class FooStateless implements SessionBean {
+ public void ejbCreate() {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+
+ private static interface FooStatefulHome extends javax.ejb.EJBHome {
+ }
+
+ private static interface FooStatefulRemote extends javax.ejb.EJBObject {
+ }
+
+ private static interface FooStatefulLocalHome extends javax.ejb.EJBLocalHome {
+ }
+
+ private static interface FooStatefulLocal extends javax.ejb.EJBLocalObject {
+ }
+
+ private static class FooStateful implements SessionBean {
+ public void ejbCreate() {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+
+ private static interface MyLocalHome extends EJBLocalHome {
+ public MyLocal create(Integer pk) throws CreateException;
+
+ public MyLocal findByPrimaryKey(Integer pk) throws FinderException;
+ }
+
+ private static interface MyLocal extends EJBLocalObject {
+ }
+
+ private static class MyEntity implements EntityBean {
+ public Integer ejbCreate(final Integer pk) throws CreateException {
+ return null;
+ }
+
+ public void ejbPostCreate(final String str) {
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbLoad() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws RemoveException, EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbStore() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setEntityContext(final EntityContext arg0) throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void unsetEntityContext() throws EJBException, RemoteException {
+ }
+ }
+
+ private static class YourEntity implements EntityBean {
+// public Integer ejbCreate(Integer pk) throws CreateException {
+// return null;
+// }
+
+// public void ejbPostCreate(Integer pk) {}
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbLoad() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws RemoveException, EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbStore() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setEntityContext(final EntityContext arg0) throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void unsetEntityContext() throws EJBException, RemoteException {
+ }
+ }
+
+ private static interface BarStatelessHome extends javax.ejb.EJBHome {
+ public BarStatelessRemote create() throws CreateException, RemoteException;
+ }
+
+ private static interface BarStatelessRemote extends javax.ejb.EJBObject {
+ }
+
+ private static class BarStateless implements SessionBean {
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+
+ private static interface BazStatefulHome extends javax.ejb.EJBHome {
+ public BazStatefulRemote create() throws CreateException, RemoteException;
+ }
+
+ private static interface BazStatefulRemote extends javax.ejb.EJBObject {
+ }
+
+ private static interface BazStatefulLocalHome extends javax.ejb.EJBLocalHome {
+ public BazStatefulLocal create() throws CreateException;
+ }
+
+ private static interface BazStatefulLocal extends javax.ejb.EJBLocalObject {
+ }
+
+ @RemoteHome(BazStatefulHome.class)
+ @LocalHome(BazStatefulLocalHome.class)
+ private static class BazStateful implements SessionBean {
+ // missing ejbCreate method
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ @Override
+ public void setSessionContext(final SessionContext arg0) throws EJBException, RemoteException {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/48c99a5a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckPersistenceContextUsageTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckPersistenceContextUsageTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckPersistenceContextUsageTest.java
index fbd9e3a..ec84ba7 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckPersistenceContextUsageTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/CheckPersistenceContextUsageTest.java
@@ -1,99 +1,99 @@
-/**
- * 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 org.apache.openejb.OpenEJBException;
-import org.apache.openejb.config.AppModule;
-import org.apache.openejb.config.EjbModule;
-import org.apache.openejb.config.PersistenceModule;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.StatelessBean;
-import org.apache.openejb.jee.jpa.unit.PersistenceUnit;
-import org.junit.runner.RunWith;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-
-@RunWith(ValidationRunner.class)
-public class CheckPersistenceContextUsageTest {
- @Keys({@Key(value = "persistenceContextExtented.nonStateful"), @Key(value = "persistenceContextRef.noPersistenceUnits", count = 3),
- @Key(value = "persistenceContextAnnotation.onClassWithNoName"), @Key(value = "persistenceContextAnnotation.onEntityManagerFactory"),
- @Key(value = "persistenceContextAnnotation.onNonEntityManager")})
- public EjbJar wrongUsage() throws OpenEJBException {
- final EjbJar ejbJar = new EjbJar();
- ejbJar.addEnterpriseBean(new StatelessBean(FooStateless.class));
- return ejbJar;
- }
-
- @Keys({@Key(value = "persistenceContextRef.noUnitName"), @Key(value = "persistenceContextRef.noMatches")})
- public AppModule noUnitName() {
- final EjbJar ejbJar = new EjbJar();
- ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessOne.class));
- final EjbModule ejbModule = new EjbModule(ejbJar);
- final AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
- appModule.getEjbModules().add(ejbModule);
- final PersistenceUnit pu = new PersistenceUnit("fooUnit");
- final PersistenceUnit pu1 = new PersistenceUnit("fooUnit1");
- final PersistenceUnit pu2 = new PersistenceUnit("fooUnit");
- final org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu, pu1, pu2);
- final PersistenceModule pm = new PersistenceModule("foo", p);
- appModule.addPersistenceModule(pm);
- return appModule;
- }
-
- @Keys({@Key(value = "persistenceContextRef.vagueMatches")})
- public AppModule vagueMatches() {
- final EjbJar ejbJar = new EjbJar();
- ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessTwo.class));
- final EjbModule ejbModule = new EjbModule(ejbJar);
- final AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
- appModule.getEjbModules().add(ejbModule);
- final PersistenceUnit pu = new PersistenceUnit("fooUnit");
- final org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu);
- final PersistenceModule pm = new PersistenceModule("foo", p);
- appModule.getPersistenceModules().add(pm);
- final PersistenceUnit pu1 = new PersistenceUnit("fooUnit");
- final org.apache.openejb.jee.jpa.unit.Persistence p1 = new org.apache.openejb.jee.jpa.unit.Persistence(pu1);
- final PersistenceModule pm1 = new PersistenceModule("foo1", p1);
- appModule.addPersistenceModule(pm1);
- return appModule;
- }
-
- @PersistenceContext
- private static class FooStateless {
- @PersistenceContext(type = PersistenceContextType.EXTENDED)
- EntityManager em;
- @PersistenceContext
- EntityManagerFactory emf;
- @PersistenceContext
- String nonEntityManager;
- }
-
- private static class FooStatelessOne {
- @PersistenceContext
- EntityManager em;
- @PersistenceContext(unitName = "wrongName")
- EntityManager em1;
- }
-
- private static class FooStatelessTwo {
- @PersistenceContext(unitName = "fooUnit")
- EntityManager em1;
- }
-}
+/**
+ * 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 org.apache.openejb.OpenEJBException;
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.config.PersistenceModule;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.StatelessBean;
+import org.apache.openejb.jee.jpa.unit.PersistenceUnit;
+import org.junit.runner.RunWith;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceContextType;
+
+@RunWith(ValidationRunner.class)
+public class CheckPersistenceContextUsageTest {
+ @Keys({@Key(value = "persistenceContextExtented.nonStateful"), @Key(value = "persistenceContextRef.noPersistenceUnits", count = 3),
+ @Key(value = "persistenceContextAnnotation.onClassWithNoName"), @Key(value = "persistenceContextAnnotation.onEntityManagerFactory"),
+ @Key(value = "persistenceContextAnnotation.onNonEntityManager")})
+ public EjbJar wrongUsage() throws OpenEJBException {
+ final EjbJar ejbJar = new EjbJar();
+ ejbJar.addEnterpriseBean(new StatelessBean(FooStateless.class));
+ return ejbJar;
+ }
+
+ @Keys({@Key(value = "persistenceContextRef.noUnitName"), @Key(value = "persistenceContextRef.noMatches")})
+ public AppModule noUnitName() {
+ final EjbJar ejbJar = new EjbJar();
+ ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessOne.class));
+ final EjbModule ejbModule = new EjbModule(ejbJar);
+ final AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
+ appModule.getEjbModules().add(ejbModule);
+ final PersistenceUnit pu = new PersistenceUnit("fooUnit");
+ final PersistenceUnit pu1 = new PersistenceUnit("fooUnit1");
+ final PersistenceUnit pu2 = new PersistenceUnit("fooUnit");
+ final org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu, pu1, pu2);
+ final PersistenceModule pm = new PersistenceModule("foo", p);
+ appModule.addPersistenceModule(pm);
+ return appModule;
+ }
+
+ @Keys({@Key(value = "persistenceContextRef.vagueMatches")})
+ public AppModule vagueMatches() {
+ final EjbJar ejbJar = new EjbJar();
+ ejbJar.addEnterpriseBean(new StatelessBean(FooStatelessTwo.class));
+ final EjbModule ejbModule = new EjbModule(ejbJar);
+ final AppModule appModule = new AppModule(ejbModule.getClassLoader(), ejbModule.getJarLocation());
+ appModule.getEjbModules().add(ejbModule);
+ final PersistenceUnit pu = new PersistenceUnit("fooUnit");
+ final org.apache.openejb.jee.jpa.unit.Persistence p = new org.apache.openejb.jee.jpa.unit.Persistence(pu);
+ final PersistenceModule pm = new PersistenceModule("foo", p);
+ appModule.getPersistenceModules().add(pm);
+ final PersistenceUnit pu1 = new PersistenceUnit("fooUnit");
+ final org.apache.openejb.jee.jpa.unit.Persistence p1 = new org.apache.openejb.jee.jpa.unit.Persistence(pu1);
+ final PersistenceModule pm1 = new PersistenceModule("foo1", p1);
+ appModule.addPersistenceModule(pm1);
+ return appModule;
+ }
+
+ @PersistenceContext
+ private static class FooStateless {
+ @PersistenceContext(type = PersistenceContextType.EXTENDED)
+ EntityManager em;
+ @PersistenceContext
+ EntityManagerFactory emf;
+ @PersistenceContext
+ String nonEntityManager;
+ }
+
+ private static class FooStatelessOne {
+ @PersistenceContext
+ EntityManager em;
+ @PersistenceContext(unitName = "wrongName")
+ EntityManager em1;
+ }
+
+ private static class FooStatelessTwo {
+ @PersistenceContext(unitName = "fooUnit")
+ EntityManager em1;
+ }
+}