[jboss-cvs] JBossAS SVN: r67556 - in projects/microcontainer/trunk/aop-mc-int/src: resources/tests/org/jboss/test/microcontainer/beans/test and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 28 08:50:41 EST 2007


Author: kabir.khan at jboss.com
Date: 2007-11-28 08:50:41 -0500 (Wed, 28 Nov 2007)
New Revision: 67556

Modified:
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ArrayBinding.java
   projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ArrayReplacement.java
   projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DomainSimpleAopTestCase.xml
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DomainSimpleTest.java
   projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/woven/test/TestArrayAspect.java
Log:
Reenable array stuff tests following aop upgrade

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ArrayBinding.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ArrayBinding.java	2007-11-28 13:44:32 UTC (rev 67555)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ArrayBinding.java	2007-11-28 13:50:41 UTC (rev 67556)
@@ -26,7 +26,7 @@
 
 import org.jboss.aop.AspectManager;
 import org.jboss.aop.advice.InterceptorFactory;
-//import org.jboss.aop.array.Type;
+import org.jboss.aop.array.Type;
 import org.jboss.logging.Logger;
 import org.jboss.util.id.GUID;
 
@@ -93,7 +93,7 @@
       {
          throw new IllegalArgumentException("Null type");
       }
-      //Type theType = Type.valueOf(type);
+      Type theType = Type.valueOf(type);
 
       ArrayList<InterceptorFactory> interceptors = null;
       if (advices != null)
@@ -111,23 +111,21 @@
          }
       }
       InterceptorFactory[] facs = interceptors != null ? interceptors.toArray(new InterceptorFactory[interceptors.size()]) : new InterceptorFactory[0];
-		System.out.println("ENABLE COMMENTED OUT CODE");
-      //org.jboss.aop.array.ArrayBinding binding = new org.jboss.aop.array.ArrayBinding(name, facs, theType);
-      //manager.addArrayBinding(binding);
-      //log.debug("Bound array binding " + name);
+      org.jboss.aop.array.ArrayBinding binding = new org.jboss.aop.array.ArrayBinding(name, facs, theType);
+      manager.addArrayBinding(binding);
+      log.debug("Bound array binding " + name);
    }
 
    public void stop() throws Exception
    {
-		System.out.println("ENABLE COMMENTED OUT CODE");
-      //manager.removeArrayBinding(name);
-      //if (advices != null)
-      //{
-      //   for (BindingEntry entry : advices)
-      //   {
-      //      entry.stop();
-      //   }
-      //}
+      manager.removeArrayBinding(name);
+      if (advices != null)
+      {
+         for (BindingEntry entry : advices)
+         {
+            entry.stop();
+         }
+      }
    }
 
    public void uninstall() throws Exception

Modified: projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ArrayReplacement.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ArrayReplacement.java	2007-11-28 13:44:32 UTC (rev 67555)
+++ projects/microcontainer/trunk/aop-mc-int/src/main/org/jboss/aop/microcontainer/beans/ArrayReplacement.java	2007-11-28 13:50:41 UTC (rev 67556)
@@ -96,31 +96,30 @@
          throw new IllegalArgumentException("Cannot define both expr and classes");
       }
 
-		System.out.println("ENABLE COMMENTED OUT CODE");
-      //org.jboss.aop.array.ArrayReplacement pcut = null;
-      //if (classes != null)
-      //{
-      //   pcut = new org.jboss.aop.array.ArrayReplacement(name, classes);
-      //}
-      //else
-      //{
-      //   try
-      //   {
-      //      ASTStart start = new TypeExpressionParser(new StringReader(expr)).Start();
-      //      pcut = new org.jboss.aop.array.ArrayReplacement(name, start);
-      //   }
-      //   catch (ParseException e)
-      //   {
-      //      throw new IllegalArgumentException("Could not parse type expression " + expr, e);
-      //   }
-      //}
-      //manager.addArrayReplacement(pcut);
+      org.jboss.aop.array.ArrayReplacement pcut = null;
+      if (classes != null)
+      {
+         pcut = new org.jboss.aop.array.ArrayReplacement(name, classes);
+      }
+      else
+      {
+         try
+         {
+            ASTStart start = new TypeExpressionParser(new StringReader(expr)).Start();
+            pcut = new org.jboss.aop.array.ArrayReplacement(name, start);
+         }
+         catch (ParseException e)
+         {
+            throw new IllegalArgumentException("Could not parse type expression " + expr, e);
+         }
+      }
+      manager.addArrayReplacement(pcut);
 
    }
 
    public void stop()
    {
-      //manager.removeArrayReplacement(name);
+      manager.removeArrayReplacement(name);
    }
 
 }

Modified: projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DomainSimpleAopTestCase.xml
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DomainSimpleAopTestCase.xml	2007-11-28 13:44:32 UTC (rev 67555)
+++ projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/DomainSimpleAopTestCase.xml	2007-11-28 13:50:41 UTC (rev 67556)
@@ -59,6 +59,12 @@
          <interceptor-ref name="org.jboss.test.microcontainer.beans.TestInterceptor"/>
          <stack-ref name="TestStack"/>
       </bind>
+
+      <arrayreplacement class="org.jboss.test.microcontainer.beans.woven.test.ClassWithArray"/>
+      
+      <arraybind name="TestArrayBinding" type="READ_WRITE">
+         <interceptor-ref name="org.jboss.test.microcontainer.beans.TestInterceptor"/>
+      </arraybind>
    </domain>   
    
 </deployment>

Modified: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DomainSimpleTest.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DomainSimpleTest.java	2007-11-28 13:44:32 UTC (rev 67555)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/test/DomainSimpleTest.java	2007-11-28 13:50:41 UTC (rev 67556)
@@ -106,14 +106,11 @@
       Map map = manager.getPrecedenceDefs();
       checkShouldBeThere(map, shouldBeThere);
 
-      fail("enable following aop release");
-      //map = manager.getArrayReplacements();
-      //checkShouldBeThere(map, shouldBeThere);
+      map = manager.getArrayReplacements();
+      checkShouldBeThere(map, shouldBeThere);
 
-      fail("enable following aop release");
-      //o = manager.getArrayBinding("TestArrayBinding");
-      //checkShouldBeThere(o, shouldBeThere);
-
+      o = manager.getArrayBinding("TestArrayBinding");
+      checkShouldBeThere(o, shouldBeThere);
    }
 
    private void checkShouldBeThere(Object o, boolean shouldBeThere)

Modified: projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/woven/test/TestArrayAspect.java
===================================================================
--- projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/woven/test/TestArrayAspect.java	2007-11-28 13:44:32 UTC (rev 67555)
+++ projects/microcontainer/trunk/aop-mc-int/src/tests/org/jboss/test/microcontainer/beans/woven/test/TestArrayAspect.java	2007-11-28 13:50:41 UTC (rev 67556)
@@ -21,8 +21,8 @@
 */
 package org.jboss.test.microcontainer.beans.woven.test;
 
-//import org.jboss.aop.array.IntArrayElementReadInvocation;
-//import org.jboss.aop.array.IntArrayElementWriteInvocation;
+import org.jboss.aop.array.IntArrayElementReadInvocation;
+import org.jboss.aop.array.IntArrayElementWriteInvocation;
 
 /**
  *
@@ -34,19 +34,19 @@
    public static int value;
    public static int index;
 
-//   public Object advice(IntArrayElementWriteInvocation invocation) throws Throwable
-//   {
-//      value = invocation.getIntValue();
-//      index = invocation.getIndex();
-//      return invocation.invokeNext();
-//   }
-//
-//   public Object advice(IntArrayElementReadInvocation invocation) throws Throwable
-//   {
-//      index = invocation.getIndex();
-//      return invocation.invokeNext();
-//   }
+   public Object advice(IntArrayElementWriteInvocation invocation) throws Throwable
+   {
+      value = invocation.getIntValue();
+      index = invocation.getIndex();
+      return invocation.invokeNext();
+   }
 
+   public Object advice(IntArrayElementReadInvocation invocation) throws Throwable
+   {
+      index = invocation.getIndex();
+      return invocation.invokeNext();
+   }
+
    public static void reset()
    {
       value = -1;




More information about the jboss-cvs-commits mailing list