openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject svn commit: r1843973 - in /openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events: ./ beans/ extensions/
Date Tue, 16 Oct 2018 07:42:31 GMT
Author: tandraschko
Date: Tue Oct 16 07:42:31 2018
New Revision: 1843973

URL: http://svn.apache.org/viewvc?rev=1843973&view=rev
Log:
added some unittests for generic lifecycle events

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/AppleTree.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/CherryTree.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/Tree.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/TreeExtension.java
      - copied, changed from r1843927, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/PortableEventTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/PortableEventTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/PortableEventTest.java?rev=1843973&r1=1843972&r2=1843973&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/PortableEventTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/PortableEventTest.java
Tue Oct 16 07:42:31 2018
@@ -25,13 +25,17 @@ import org.junit.Assert;
 
 import org.apache.webbeans.test.AbstractUnitTest;
 import org.apache.webbeans.test.portable.events.beans.Apple;
+import org.apache.webbeans.test.portable.events.beans.AppleTree;
 import org.apache.webbeans.test.portable.events.beans.Cherry;
+import org.apache.webbeans.test.portable.events.beans.CherryTree;
+import org.apache.webbeans.test.portable.events.beans.Tree;
 import org.apache.webbeans.test.portable.events.extensions.AppleExtension;
 import org.apache.webbeans.test.portable.events.extensions.AppleExtension1;
 import org.apache.webbeans.test.portable.events.extensions.MessageReceiverExtension;
 import org.apache.webbeans.test.portable.events.extensions.MessageSenderExtension;
 import org.apache.webbeans.test.portable.events.extensions.NotAppleExtnsion;
 import org.apache.webbeans.test.portable.events.extensions.RawTypeExtension;
+import org.apache.webbeans.test.portable.events.extensions.TreeExtension;
 import org.apache.webbeans.test.portable.events.extensions.TypeVariableExtension;
 import org.apache.webbeans.test.portable.events.extensions.WildcardExtension;
 import org.apache.webbeans.test.portable.events.extensions.WrongTypeVariableExtension;
@@ -231,4 +235,28 @@ public class PortableEventTest extends A
         
         shutDownContainer();
     }
+    
+    
+    @Test
+    public void testNumberCallsGenerics()
+    {
+        AppleExtension1.reset();
+        
+        Collection<String> beanXmls = new ArrayList<String>();
+
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(Tree.class);
+        beanClasses.add(AppleTree.class);
+        beanClasses.add(CherryTree.class);
+        
+        addExtension(new TreeExtension());        
+        startContainer(beanClasses, beanXmls);
+        
+        Assert.assertSame(3, TreeExtension.GENERIC_CALLED);
+        Assert.assertSame(3, TreeExtension.TREE_CALLED);
+        Assert.assertSame(1, TreeExtension.APPLE_TREE_CALLED);
+        Assert.assertSame(1, TreeExtension.CHERRY_TREE_CALLED);
+        
+        shutDownContainer();
+    }
 }

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/AppleTree.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/AppleTree.java?rev=1843973&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/AppleTree.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/AppleTree.java
Tue Oct 16 07:42:31 2018
@@ -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.apache.webbeans.test.portable.events.beans;
+
+public class AppleTree extends Tree<Apple>
+{
+
+}

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/CherryTree.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/CherryTree.java?rev=1843973&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/CherryTree.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/CherryTree.java
Tue Oct 16 07:42:31 2018
@@ -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.apache.webbeans.test.portable.events.beans;
+
+public class CherryTree extends Tree<Cherry>
+{
+
+}

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/Tree.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/Tree.java?rev=1843973&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/Tree.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/beans/Tree.java
Tue Oct 16 07:42:31 2018
@@ -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.apache.webbeans.test.portable.events.beans;
+
+public abstract class Tree<F>
+{
+
+}

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java?rev=1843973&r1=1843972&r2=1843973&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java
Tue Oct 16 07:42:31 2018
@@ -19,7 +19,6 @@
 package org.apache.webbeans.test.portable.events.extensions;
 
 import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.ProcessBean;
 import javax.enterprise.inject.spi.ProcessManagedBean;

Copied: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/TreeExtension.java
(from r1843927, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/TreeExtension.java?p2=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/TreeExtension.java&p1=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java&r1=1843927&r2=1843973&rev=1843973&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/AppleExtension1.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/portable/events/extensions/TreeExtension.java
Tue Oct 16 07:42:31 2018
@@ -19,47 +19,45 @@
 package org.apache.webbeans.test.portable.events.extensions;
 
 import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
 
 import org.apache.webbeans.test.portable.events.beans.Apple;
+import org.apache.webbeans.test.portable.events.beans.Cherry;
+import org.apache.webbeans.test.portable.events.beans.Tree;
 
-public class AppleExtension1 implements Extension
+public class TreeExtension implements Extension
 {
-    public static int TYPED_CALLED = 0;
-    public static int CALLED = 0;
-    
-    public static int MANAGED_TYPED_CALLED = 0;
-    public static int MANAGED_CALLED = 0;
+    public static int GENERIC_CALLED = 0;
+    public static int TREE_CALLED = 0;
+    public static int APPLE_TREE_CALLED = 0;
+    public static int CHERRY_TREE_CALLED = 0;
     
     public static void reset()
     {
-        TYPED_CALLED = 0;
-        CALLED = 0;
-        MANAGED_TYPED_CALLED = 0;
-        MANAGED_CALLED = 0;
-    }
-    
-    public void typedProcessBean(@Observes ProcessBean<Apple> event)
-    {
-        TYPED_CALLED++;
+        GENERIC_CALLED = 0;
+        TREE_CALLED = 0;
+        APPLE_TREE_CALLED = 0;
+        CHERRY_TREE_CALLED = 0;
     }
     
-    public void processBean(@Observes ProcessBean event)
+    public void generic(@Observes ProcessAnnotatedType event)
     {
-        CALLED++;
+        GENERIC_CALLED++;
     } 
     
-    
-    public void typedProcessManagedBean(@Observes ProcessManagedBean<Apple> event)
+    public void tree(@Observes ProcessAnnotatedType<Tree> event)
     {
-        MANAGED_TYPED_CALLED++;
+        TREE_CALLED++;
     }
     
-    public void processManagedBean(@Observes ProcessManagedBean event)
+    public void appleTree(@Observes ProcessAnnotatedType<Tree<Apple>> event)
+    {
+        APPLE_TREE_CALLED++;
+    } 
+
+    public void cherryTree(@Observes ProcessAnnotatedType<Tree<Cherry>> event)
     {
-        MANAGED_CALLED++;
+        CHERRY_TREE_CALLED++;
     } 
 }



Mime
View raw message