[jboss-cvs] JBossAS SVN: r60922 - in projects/aop/trunk/aop/src: test/org/jboss/test/aop/introduction and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 26 17:35:17 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-02-26 17:35:16 -0500 (Mon, 26 Feb 2007)
New Revision: 60922

Added:
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/OverrideObjectInterface.java
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/OverrideObjectPOJO.java
Modified:
   projects/aop/trunk/aop/src/resources/test/introduction/introduction-aop.xml
   projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/IntroductionTester.java
Log:
Add test to verify that when introducing an interface to a class, and the class already contains the methods from the introduced interface that the original interface method is called.

Modified: projects/aop/trunk/aop/src/resources/test/introduction/introduction-aop.xml
===================================================================
--- projects/aop/trunk/aop/src/resources/test/introduction/introduction-aop.xml	2007-02-26 22:32:30 UTC (rev 60921)
+++ projects/aop/trunk/aop/src/resources/test/introduction/introduction-aop.xml	2007-02-26 22:35:16 UTC (rev 60922)
@@ -52,4 +52,11 @@
          <class>org.jboss.test.aop.introduction.NonSerializableMixin</class>
       </mixin>
    </introduction>
+   
+   <introduction class="org.jboss.test.aop.introduction.OverrideObjectPOJO">
+      <interfaces>
+         org.jboss.test.aop.introduction.OverrideObjectInterface
+      </interfaces>
+   </introduction>
+   
 </aop>
\ No newline at end of file

Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/IntroductionTester.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/IntroductionTester.java	2007-02-26 22:32:30 UTC (rev 60921)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/IntroductionTester.java	2007-02-26 22:35:16 UTC (rev 60922)
@@ -106,4 +106,23 @@
       NonSerializedIntroduction intro = (NonSerializedIntroduction)sub;
       assertEquals("original", intro.getNonMessage());
    }
+   
+   public void testObjectHasSameMethodsAsIntroduction() throws Exception
+   {
+      OverrideObjectPOJO pojo = new OverrideObjectPOJO();
+      assertFalse(pojo.invokedEquals);
+      assertFalse(pojo.invokedHashCode);
+      assertFalse(pojo.invokedToString);
+
+      OverrideObjectInterface iface = (OverrideObjectInterface)pojo;
+      
+      iface.equals(null);
+      assertTrue(pojo.invokedEquals);
+      
+      iface.hashCode();
+      assertTrue(pojo.invokedHashCode);
+      
+      iface.toString();
+      assertTrue(pojo.invokedToString);
+   }
 }

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/OverrideObjectInterface.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/OverrideObjectInterface.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/OverrideObjectInterface.java	2007-02-26 22:35:16 UTC (rev 60922)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.aop.introduction;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface OverrideObjectInterface
+{
+   boolean equals(Object o);
+   int hashCode();
+   String toString();
+}

Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/OverrideObjectPOJO.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/OverrideObjectPOJO.java	                        (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/introduction/OverrideObjectPOJO.java	2007-02-26 22:35:16 UTC (rev 60922)
@@ -0,0 +1,52 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.aop.introduction;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class OverrideObjectPOJO
+{
+   boolean invokedEquals;
+   boolean invokedHashCode;
+   boolean invokedToString;
+   
+   public boolean equals(Object o)
+   {
+      invokedEquals = true;
+      return false;
+   }
+
+   public int hashCode()
+   {
+      invokedHashCode = true;
+      return 0;
+   }
+
+   public String toString()
+   {
+      invokedToString = true;
+      return null;
+   }
+}




More information about the jboss-cvs-commits mailing list