openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1565970 - in /openwebbeans/branches/owb_1.2.x/webbeans-impl/src: main/java/org/apache/webbeans/event/ main/java/org/apache/webbeans/util/ test/java/org/apache/webbeans/newtests/specalization/observer/ test/java/org/apache/webbeans/newtests...
Date Sat, 08 Feb 2014 11:41:40 GMT
Author: gpetracek
Date: Sat Feb  8 11:41:39 2014
New Revision: 1565970

URL: http://svn.apache.org/r1565970
Log:
OWB-930 NotificationManager#disableOverriddenObservers fixed

Added:
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanA.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanB.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanC.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanD.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanE.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/ProtectedObserverTest.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanA.java
      - copied, changed from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanA.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanB.java
      - copied, changed from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanB.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanC.java
      - copied, changed from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanC.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanD.java
      - copied, changed from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanD.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanE.java
      - copied, changed from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanE.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/PublicObserverTest.java
      - copied, changed from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/ObserverTest.java
Removed:
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanA.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanB.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanC.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanD.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanE.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/ObserverTest.java
Modified:
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/observer/AlternativeSpecializes.xml

Modified: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=1565970&r1=1565969&r2=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
Sat Feb  8 11:41:39 2014
@@ -101,8 +101,9 @@ public final class NotificationManager
                 {
                     AnnotatedMethod<?> observerMethod = ((ObserverMethodImpl<?>)observer).getObserverMethod();
 
-                    // we only remove methods from a superclass
-                    if (!observerMethod.getJavaMember().getDeclaringClass().equals(subClass))
+                    //needs to be a subtype and not the class itself (otherwise all observer-methods
get removed)
+                    if (subClass.isAssignableFrom(observerMethod.getJavaMember().getDeclaringClass())
&&
+                            !subClass.equals(observerMethod.getJavaMember().getDeclaringClass()))
                     {
                         try
                         {

Modified: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1565970&r1=1565969&r2=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Sat Feb  8 11:41:39 2014
@@ -130,8 +130,6 @@ import java.util.Set;
 
 /**
  * Contains some utility methods used in the all project.
- *
- * @version $Rev$ $Date$
  */
 @SuppressWarnings("unchecked")
 public final class WebBeansUtil
@@ -724,7 +722,7 @@ public final class WebBeansUtil
                     throw new DefinitionException("@Specialized Class : " + specializedClass.getName()
                             + " must have all bean types of its super class");
                 }
-                webBeansContext.getBeanManagerImpl().getNotificationManager().disableOverriddenObservers(superClass);
+                webBeansContext.getBeanManagerImpl().getNotificationManager().disableOverriddenObservers(specializedClass);
 
                 // Recursively configure super class first if super class is also a special
bean.
                 // So the name and bean meta data could be populated to this beanclass.

Added: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanA.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanA.java?rev=1565970&view=auto
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanA.java
(added)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanA.java
Sat Feb  8 11:41:39 2014
@@ -0,0 +1,41 @@
+/*
+ * 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.newtests.specalization.observer.prot;
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import java.io.Serializable;
+
+@ApplicationScoped
+public class BeanA implements Serializable
+{
+    private static final long serialVersionUID = 9096367220631667211L;
+
+    protected void observeTestEvent(@Observes TestEvent testEvent)
+    {
+        testEvent.addInvocation(getBeanName());
+    }
+
+    public String getBeanName()
+    {
+        return getClass().getSimpleName();
+    }
+}

Added: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanB.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanB.java?rev=1565970&view=auto
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanB.java
(added)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanB.java
Sat Feb  8 11:41:39 2014
@@ -0,0 +1,45 @@
+/*
+ * 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.newtests.specalization.observer.prot;
+
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@ApplicationScoped
+public class BeanB extends BeanA
+{
+    private static final long serialVersionUID = 821164664338581947L;
+
+    @Override
+    protected void observeTestEvent(@Observes TestEvent testEvent)
+    {
+        testEvent.addInvocation(getBeanName());
+    }
+
+    @Override
+    public String getBeanName()
+    {
+        return super.getBeanName() + ":[specialize]";
+    }
+}

Added: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanC.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanC.java?rev=1565970&view=auto
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanC.java
(added)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanC.java
Sat Feb  8 11:41:39 2014
@@ -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.apache.webbeans.newtests.specalization.observer.prot;
+
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@Alternative
+@ApplicationScoped
+public class BeanC extends BeanA
+{
+    private static final long serialVersionUID = 821164664338581947L;
+
+    @Override
+    public String getBeanName()
+    {
+        return super.getBeanName() + ":[alternative]:[specialize]";
+    }
+}

Added: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanD.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanD.java?rev=1565970&view=auto
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanD.java
(added)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanD.java
Sat Feb  8 11:41:39 2014
@@ -0,0 +1,47 @@
+/*
+ * 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.newtests.specalization.observer.prot;
+
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@Alternative
+@ApplicationScoped
+public class BeanD extends BeanA
+{
+    private static final long serialVersionUID = 821164664338581947L;
+
+    @Override
+    protected void observeTestEvent(@Observes TestEvent testEvent)
+    {
+        testEvent.addInvocation(getBeanName());
+    }
+
+    @Override
+    public String getBeanName()
+    {
+        return super.getBeanName() + ":[alternative]:[specialize]";
+    }
+}

Added: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanE.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanE.java?rev=1565970&view=auto
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanE.java
(added)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/BeanE.java
Sat Feb  8 11:41:39 2014
@@ -0,0 +1,36 @@
+/*
+ * 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.newtests.specalization.observer.prot;
+
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Specializes;
+
+@Specializes
+@ApplicationScoped
+public class BeanE extends BeanA
+{
+    private static final long serialVersionUID = 821164664338581947L;
+
+    @Override
+    public String getBeanName()
+    {
+        return super.getBeanName() + ":[specialize]";
+    }
+}

Added: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/ProtectedObserverTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/ProtectedObserverTest.java?rev=1565970&view=auto
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/ProtectedObserverTest.java
(added)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/prot/ProtectedObserverTest.java
Sat Feb  8 11:41:39 2014
@@ -0,0 +1,123 @@
+/*
+ * 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.newtests.specalization.observer.prot;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+public class ProtectedObserverTest extends AbstractUnitTest
+{
+    private static final String PACKAGE_NAME = TestEvent.class.getPackage().getName();
+    
+    @Test
+    public void testObserverMethodsInParentOfAlternativeAndSpecializedBeans()
+    {
+        Collection<String> beanXmls = new ArrayList<String>();
+        beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeSpecializes"));
+
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(BeanA.class);
+        beanClasses.add(BeanC.class);
+        startContainer(beanClasses, beanXmls);
+        
+        Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+        Assert.assertEquals(1, beans.size());
+        
+        TestEvent testEvent = new TestEvent();
+        getBeanManager().fireEvent(testEvent);
+
+        Assert.assertEquals(1, testEvent.getCalledObservers().size());
+        Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+        shutDownContainer();
+    }
+    
+    @Test
+    public void testOverrideObserverMethodsInAlternativeAndSpecializedBeans()
+    {
+        Collection<String> beanXmls = new ArrayList<String>();
+        beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeSpecializes"));
+
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(BeanA.class);
+        beanClasses.add(BeanD.class);
+        startContainer(beanClasses, beanXmls);
+        
+        Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+        Assert.assertEquals(1, beans.size());
+        
+        TestEvent testEvent = new TestEvent();
+        getBeanManager().fireEvent(testEvent);
+        
+        Assert.assertEquals(1, testEvent.getCalledObservers().size());
+        Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[alternative]:[specialize]"));
+        
+        shutDownContainer();
+    }
+    
+    @Test
+    public void testObserverMethodsInParentOfSpecializedBeans()
+    {
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(BeanA.class);
+        beanClasses.add(BeanE.class);
+        startContainer(beanClasses, null);
+
+        Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+        Assert.assertEquals(1, beans.size());
+
+        TestEvent testEvent = new TestEvent();
+        getBeanManager().fireEvent(testEvent);
+
+        Assert.assertEquals(BeanE.class, beans.toArray(new Bean<?>[0])[0].getBeanClass());
+        Assert.assertEquals(1, testEvent.getCalledObservers().size());
+        Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+        shutDownContainer();
+    }
+
+    @Test
+    public void testOverrideObserverMethodsInSpecializedBeans()
+    {
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(BeanA.class);
+        beanClasses.add(BeanB.class);
+        startContainer(beanClasses, null);
+
+        Set<Bean<?>> beans = getBeanManager().getBeans(BeanA.class);
+        Assert.assertEquals(1, beans.size());
+
+        TestEvent testEvent = new TestEvent();
+        getBeanManager().fireEvent(testEvent);
+
+        Assert.assertEquals(1, testEvent.getCalledObservers().size());
+        Assert.assertTrue(testEvent.getCalledObservers().iterator().next().endsWith(":[specialize]"));
+
+        shutDownContainer();
+    }
+}

Copied: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanA.java
(from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanA.java)
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanA.java?p2=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanA.java&p1=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanA.java&r1=1563820&r2=1565970&rev=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanA.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanA.java
Sat Feb  8 11:41:39 2014
@@ -16,7 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.webbeans.newtests.specalization.observer;
+package org.apache.webbeans.newtests.specalization.observer.pub;
+
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.event.Observes;
@@ -27,7 +29,7 @@ public class BeanA implements Serializab
 {
     private static final long serialVersionUID = 9096367220631667211L;
 
-    protected void observeTestEvent(@Observes TestEvent testEvent)
+    public void observeTestEvent(@Observes TestEvent testEvent)
     {
         testEvent.addInvocation(getBeanName());
     }

Copied: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanB.java
(from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanB.java)
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanB.java?p2=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanB.java&p1=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanB.java&r1=1563820&r2=1565970&rev=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanB.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanB.java
Sat Feb  8 11:41:39 2014
@@ -16,9 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.webbeans.newtests.specalization.observer;
+package org.apache.webbeans.newtests.specalization.observer.pub;
 
 
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Specializes;
@@ -30,7 +32,7 @@ public class BeanB extends BeanA
     private static final long serialVersionUID = 821164664338581947L;
 
     @Override
-    protected void observeTestEvent(@Observes TestEvent testEvent)
+    public void observeTestEvent(@Observes TestEvent testEvent)
     {
         testEvent.addInvocation(getBeanName());
     }

Copied: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanC.java
(from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanC.java)
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanC.java?p2=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanC.java&p1=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanC.java&r1=1563820&r2=1565970&rev=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanC.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanC.java
Sat Feb  8 11:41:39 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.webbeans.newtests.specalization.observer;
+package org.apache.webbeans.newtests.specalization.observer.pub;
 
 
 import javax.enterprise.context.ApplicationScoped;

Copied: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanD.java
(from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanD.java)
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanD.java?p2=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanD.java&p1=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanD.java&r1=1563820&r2=1565970&rev=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanD.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanD.java
Sat Feb  8 11:41:39 2014
@@ -16,9 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.webbeans.newtests.specalization.observer;
+package org.apache.webbeans.newtests.specalization.observer.pub;
 
 
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
+
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Alternative;
@@ -32,7 +34,7 @@ public class BeanD extends BeanA
     private static final long serialVersionUID = 821164664338581947L;
 
     @Override
-    protected void observeTestEvent(@Observes TestEvent testEvent)
+    public void observeTestEvent(@Observes TestEvent testEvent)
     {
         testEvent.addInvocation(getBeanName());
     }

Copied: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanE.java
(from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanE.java)
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanE.java?p2=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanE.java&p1=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanE.java&r1=1563820&r2=1565970&rev=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/BeanE.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/BeanE.java
Sat Feb  8 11:41:39 2014
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.webbeans.newtests.specalization.observer;
+package org.apache.webbeans.newtests.specalization.observer.pub;
 
 
 import javax.enterprise.context.ApplicationScoped;

Copied: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/PublicObserverTest.java
(from r1563820, openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/ObserverTest.java)
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/PublicObserverTest.java?p2=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/PublicObserverTest.java&p1=openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/ObserverTest.java&r1=1563820&r2=1565970&rev=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/ObserverTest.java
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/observer/pub/PublicObserverTest.java
Sat Feb  8 11:41:39 2014
@@ -16,22 +16,22 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.webbeans.newtests.specalization.observer;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Bean;
+package org.apache.webbeans.newtests.specalization.observer.pub;
 
 import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.specalization.observer.TestEvent;
 import org.junit.Assert;
 import org.junit.Test;
 
+import javax.enterprise.inject.spi.Bean;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
 
-public class ObserverTest extends AbstractUnitTest
+public class PublicObserverTest extends AbstractUnitTest
 {
-    private static final String PACKAGE_NAME = ObserverTest.class.getPackage().getName();
+    private static final String PACKAGE_NAME = TestEvent.class.getPackage().getName();
     
     @Test
     public void testObserverMethodsInParentOfAlternativeAndSpecializedBeans()

Modified: openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/observer/AlternativeSpecializes.xml
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/observer/AlternativeSpecializes.xml?rev=1565970&r1=1565969&r2=1565970&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/observer/AlternativeSpecializes.xml
(original)
+++ openwebbeans/branches/owb_1.2.x/webbeans-impl/src/test/resources/org/apache/webbeans/newtests/specalization/observer/AlternativeSpecializes.xml
Sat Feb  8 11:41:39 2014
@@ -19,7 +19,9 @@ under the License.
 -->
 <beans>
 	<alternatives>
-		<class>org.apache.webbeans.newtests.specalization.observer.BeanC</class>
-		<class>org.apache.webbeans.newtests.specalization.observer.BeanD</class>
+		<class>org.apache.webbeans.newtests.specalization.observer.prot.BeanC</class>
+		<class>org.apache.webbeans.newtests.specalization.observer.prot.BeanD</class>
+		<class>org.apache.webbeans.newtests.specalization.observer.pub.BeanC</class>
+		<class>org.apache.webbeans.newtests.specalization.observer.pub.BeanD</class>
 	</alternatives>
 </beans>
\ No newline at end of file



Mime
View raw message