tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r895457 - in /openejb/trunk/openejb3/examples/interceptors: ./ src/main/java/org/superbiz/interceptors/ src/main/resources/META-INF/ src/test/java/org/superbiz/interceptors/
Date Sun, 03 Jan 2010 18:11:09 GMT
Author: jlaskowski
Date: Sun Jan  3 18:11:07 2010
New Revision: 895457

URL: http://svn.apache.org/viewvc?rev=895457&view=rev
Log:
Method interceptor to hunt down the issue reported by Christian on the users mailing list;
junit upgraded to 3.7 with pom reformatted sligthly

Added:
    openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java
    openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java
    openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java
    openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java
      - copied, changed from r895314, openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/ThirdSLSBeanTest.java
Modified:
    openejb/trunk/openejb3/examples/interceptors/pom.xml
    openejb/trunk/openejb3/examples/interceptors/src/main/resources/META-INF/ejb-jar.xml

Modified: openejb/trunk/openejb3/examples/interceptors/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/pom.xml?rev=895457&r1=895456&r2=895457&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/pom.xml (original)
+++ openejb/trunk/openejb3/examples/interceptors/pom.xml Sun Jan  3 18:11:07 2010
@@ -19,7 +19,9 @@
 
 <!-- $Rev$ $Date$ -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.superbiz</groupId>
   <artifactId>interceptors</artifactId>
@@ -61,12 +63,11 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>4.1</version>
+      <version>4.7</version>
       <scope>test</scope>
     </dependency>
-
     <!--
-    The <scope>test</scope> guarantees that non of your runtime
+    The <scope>test</scope> guarantees that none of your runtime
     code is dependent on any OpenEJB classes.
     -->
     <dependency>
@@ -75,12 +76,10 @@
       <version>3.1.3-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
-
   </dependencies>
-
   <!--
   This section allows you to configure where to publish libraries for sharing.
-  It is not required and may be deleted.  For more information see:
+  It is not required and may be deleted. For more information see:
   http://maven.apache.org/plugins/maven-deploy-plugin/
   -->
   <distributionManagement>
@@ -92,7 +91,6 @@
       <id>localhost</id>
       <url>file://${basedir}/target/snapshot-repo/</url>
     </snapshotRepository>
-</distributionManagement>
-
+  </distributionManagement>
 </project>
 

Added: openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java?rev=895457&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java
(added)
+++ openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java
Sun Jan  3 18:11:07 2010
@@ -0,0 +1,24 @@
+/**
+ * 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.superbiz.interceptors;
+
+import javax.persistence.Entity;
+import java.util.List;
+
+public interface MethodLevelInterceptorOnlyIntf {
+    public List<String> makePersistent(Entity entity);
+}

Added: openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java?rev=895457&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java
(added)
+++ openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java
Sun Jan  3 18:11:07 2010
@@ -0,0 +1,27 @@
+/**
+ * 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.superbiz.interceptors;
+
+import javax.persistence.Entity;
+import java.util.List;
+
+public class MethodLevelInterceptorOnlyParent implements MethodLevelInterceptorOnlyIntf {
+
+    public List<String> makePersistent(Entity entity) {
+        return null;
+    }
+}

Added: openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java?rev=895457&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java
(added)
+++ openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java
Sun Jan  3 18:11:07 2010
@@ -0,0 +1,38 @@
+/**
+ * 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.superbiz.interceptors;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+import javax.interceptor.ExcludeDefaultInterceptors;
+import javax.interceptor.Interceptors;
+import javax.persistence.Entity;
+import java.util.ArrayList;
+import java.util.List;
+
+@Local(MethodLevelInterceptorOnlyIntf.class)
+@Stateless
+public class MethodLevelInterceptorOnlySLSBean extends MethodLevelInterceptorOnlyParent implements
MethodLevelInterceptorOnlyIntf {
+
+    @Override
+    @Interceptors(MethodLevelInterceptorOne.class)
+    public List<String> makePersistent(Entity entity) {
+        List<String> list = new ArrayList<String>();
+        list.add("makePersistent");
+        return list;
+    }
+}

Modified: openejb/trunk/openejb3/examples/interceptors/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/main/resources/META-INF/ejb-jar.xml?rev=895457&r1=895456&r2=895457&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/main/resources/META-INF/ejb-jar.xml (original)
+++ openejb/trunk/openejb3/examples/interceptors/src/main/resources/META-INF/ejb-jar.xml Sun
Jan  3 18:11:07 2010
@@ -51,5 +51,9 @@
       <ejb-name>SecondStatelessInterceptedBean</ejb-name>
       <exclude-default-interceptors>true</exclude-default-interceptors>
     </interceptor-binding>
+    <interceptor-binding>
+      <ejb-name>MethodLevelInterceptorOnlySLSBean</ejb-name>
+      <exclude-default-interceptors>true</exclude-default-interceptors>
+    </interceptor-binding>
   </assembly-descriptor>
 </ejb-jar>
\ No newline at end of file

Copied: openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java
(from r895314, openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/ThirdSLSBeanTest.java)
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java?p2=openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java&p1=openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/ThirdSLSBeanTest.java&r1=895314&r2=895457&rev=895457&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/ThirdSLSBeanTest.java
(original)
+++ openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java
Sun Jan  3 18:11:07 2010
@@ -16,21 +16,20 @@
  */
 package org.superbiz.interceptors;
 
+import junit.framework.TestCase;
 import org.junit.Before;
 import org.junit.Test;
 
-import javax.naming.InitialContext;
 import javax.naming.Context;
-import java.util.Properties;
-import java.util.List;
+import javax.naming.InitialContext;
 import java.util.ArrayList;
-
-import junit.framework.TestCase;
+import java.util.List;
+import java.util.Properties;
 
 /**
  * @version $Rev$ $Date$
  */
-public class ThirdSLSBeanTest extends TestCase {
+public class MethodLevelInterceptorOnlyTest extends TestCase {
     private InitialContext initCtx;
 
     @Before
@@ -44,35 +43,15 @@
 
     @Test
     public void testMethodWithDefaultInterceptorsExcluded() throws Exception {
-        ThirdSLSBeanLocal bean = (ThirdSLSBeanLocal) initCtx.lookup("ThirdSLSBeanLocal");
-
-        assert bean != null;
-
-        List<String> expected = new ArrayList<String>();
-        expected.add("ClassLevelInterceptorOne");
-        expected.add("ClassLevelInterceptorTwo");
-        expected.add("MethodLevelInterceptorOne");
-        expected.add("MethodLevelInterceptorTwo");
-        expected.add("ThirdSLSBean");
-        expected.add("businessMethod");
-
-        List<String> actual = bean.businessMethod();
-        assert expected.equals(actual) : "Expected " + expected + ", but got " + actual;
-    }
-
-    @Test
-    public void testMethodWithDefaultAndClassInterceptorsExcluded() throws Exception {
-        ThirdSLSBeanLocal bean = (ThirdSLSBeanLocal) initCtx.lookup("ThirdSLSBeanLocal");
+        MethodLevelInterceptorOnlyIntf bean = (MethodLevelInterceptorOnlyIntf) initCtx.lookup("MethodLevelInterceptorOnlySLSBeanLocal");
 
         assert bean != null;
 
         List<String> expected = new ArrayList<String>();
         expected.add("MethodLevelInterceptorOne");
-        expected.add("MethodLevelInterceptorTwo");
-        expected.add("ThirdSLSBean");
-        expected.add("anotherBusinessMethod");
+        expected.add("makePersistent");
 
-        List<String> actual = bean.anotherBusinessMethod();
+        List<String> actual = bean.makePersistent(null);
         assert expected.equals(actual) : "Expected " + expected + ", but got " + actual;
     }
-}
+}
\ No newline at end of file



Mime
View raw message