You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2019/01/28 17:21:26 UTC

[tomee] branch master updated (702359f -> d5f01a6)

This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git.


    from 702359f  closes apache/tomee#375 *Merged*
     new f3af4b4  Make observers more CDI like. This will make the commented test to work. If we have to make it really CDI like test has to check for both color and object and implementation has to change to call both color and object observer methods.
     new d5f01a6  closes apache/tomee#362 *Merged*

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/openejb/client/Observers.java  | 17 ++++++++++++-----
 .../java/org/apache/openejb/client/ObserversTest.java   |  1 -
 2 files changed, 12 insertions(+), 6 deletions(-)


[tomee] 02/02: closes apache/tomee#362 *Merged*

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit d5f01a64d60c3ed6cd9afe5c612e023a8b45a7c6
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Mon Jan 28 17:21:20 2019 +0000

    closes apache/tomee#362 *Merged*


[tomee] 01/02: Make observers more CDI like. This will make the commented test to work. If we have to make it really CDI like test has to check for both color and object and implementation has to change to call both color and object observer methods.

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit f3af4b431f70da179c714091683e72773d95907c
Author: Doychin Bondzhev <do...@dsoft-bg.com>
AuthorDate: Mon Jan 7 22:42:47 2019 +0200

    Make observers more CDI like. This will make the commented test to work. If we have to make it really CDI like test has to check for both color and object and implementation has to change to call both color and object observer methods.
---
 .../main/java/org/apache/openejb/client/Observers.java  | 17 ++++++++++++-----
 .../java/org/apache/openejb/client/ObserversTest.java   |  1 -
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/server/openejb-client/src/main/java/org/apache/openejb/client/Observers.java b/server/openejb-client/src/main/java/org/apache/openejb/client/Observers.java
index d36aa52..b637798 100644
--- a/server/openejb-client/src/main/java/org/apache/openejb/client/Observers.java
+++ b/server/openejb-client/src/main/java/org/apache/openejb/client/Observers.java
@@ -141,12 +141,19 @@ public class Observers {
                 throw new IllegalArgumentException("event cannot be null");
             }
 
-            final Class eventType = event.getClass();
-            final Method method = methods.get(eventType);
+            Class eventType = event.getClass();
+            while (eventType != Object.class) {
+                final Method method = methods.get(eventType);
 
-            if (method != null) {
-                method.invoke(observer, event);
-            } else if (defaultMethod != null) {
+                if (method != null) {
+                    method.invoke(observer, event);
+
+                    return;
+                }
+
+                eventType = eventType.getSuperclass();
+            }
+            if (defaultMethod != null) {
                 defaultMethod.invoke(observer, event);
             }
         }
diff --git a/server/openejb-client/src/test/java/org/apache/openejb/client/ObserversTest.java b/server/openejb-client/src/test/java/org/apache/openejb/client/ObserversTest.java
index 6760037..0e7fa78 100644
--- a/server/openejb-client/src/test/java/org/apache/openejb/client/ObserversTest.java
+++ b/server/openejb-client/src/test/java/org/apache/openejb/client/ObserversTest.java
@@ -50,7 +50,6 @@ public class ObserversTest extends Assert {
     }
 
     @Test
-    @Ignore("Object invoked instead")
     public void colorStillInvoked() throws Exception {
         observers.fireEvent(new Green());
         assertEvent(BasicObserver.color);