[jboss-cvs] JBossAS SVN: r94047 - in projects/interceptors/trunk/src: main/java/org/jboss/interceptor/model and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Sep 27 02:00:59 EDT 2009


Author: marius.bogoevici
Date: 2009-09-27 02:00:58 -0400 (Sun, 27 Sep 2009)
New Revision: 94047

Added:
   projects/interceptors/trunk/src/main/java/org/jboss/interceptor/InterceptorException.java
   projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/InterceptorWithDuplicateAnnotations.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/OverrideChildInterceptor.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/OverrideParentInterceptor.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/FootballTeam.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/InterceptionTest.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/InterceptorTestLogger.java
Removed:
   projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorException.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/FootballTeam.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptionTest.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptorTestLogger.java
Modified:
   projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptionModelImpl.java
   projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptorClassMetadataImpl.java
   projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandler.java
   projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreatorImpl.java
   projects/interceptors/trunk/src/main/java/org/jboss/interceptor/registry/InterceptorClassMetadataRegistry.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/InterceptorClassMetadataTest.java
   projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/SimpleInheritanceChildInterceptor.java
Log:
Introducing InterceptionMetadataException to highlight issues when extracting metadata from the classes. Adding a statically-bound class metadata registry for improving the performance of parsing classes. Non-interceptor methods that override interceptor methods will cause interceptors from the parent not to be invoked.

Copied: projects/interceptors/trunk/src/main/java/org/jboss/interceptor/InterceptorException.java (from rev 93795, projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorException.java)
===================================================================
--- projects/interceptors/trunk/src/main/java/org/jboss/interceptor/InterceptorException.java	                        (rev 0)
+++ projects/interceptors/trunk/src/main/java/org/jboss/interceptor/InterceptorException.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.interceptor;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class InterceptorException extends RuntimeException
+{
+   public InterceptorException()
+   {
+   }
+
+   public InterceptorException(String s)
+   {
+      super(s);
+   }
+
+   public InterceptorException(String s, Throwable throwable)
+   {
+      super(s, throwable);
+   }
+
+   public InterceptorException(Throwable throwable)
+   {
+      super(throwable);
+   }
+}

Modified: projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptionModelImpl.java
===================================================================
--- projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptionModelImpl.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptionModelImpl.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -17,7 +17,7 @@
 
 package org.jboss.interceptor.model;
 
-import org.jboss.interceptor.proxy.InterceptorException;
+import org.jboss.interceptor.InterceptorException;
 
 import java.lang.reflect.Method;
 import java.util.*;

Modified: projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptorClassMetadataImpl.java
===================================================================
--- projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptorClassMetadataImpl.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptorClassMetadataImpl.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -17,7 +17,7 @@
 
 package org.jboss.interceptor.model;
 
-import org.jboss.interceptor.proxy.InterceptorException;
+import org.jboss.interceptor.InterceptorException;
 import org.jboss.interceptor.util.InterceptionUtils;
 import org.jboss.interceptor.util.ReflectionUtils;
 import org.apache.commons.logging.Log;
@@ -44,35 +44,35 @@
 
       Class<?> currentClass = interceptorClass;
 
-
-      Set<String> foundMethodNames = new HashSet<String>();
+      Set<MethodHolder> foundMethods = new HashSet<MethodHolder>();
       do
       {
          Set<InterceptionType> detectedInterceptorTypes = new HashSet<InterceptionType>();
-         for (InterceptionType interceptionType : InterceptionTypeRegistry.getSupportedInterceptionTypes())
+
+         for (Method method : currentClass.getDeclaredMethods())
          {
-            for (Method method : currentClass.getDeclaredMethods())
+            for (InterceptionType interceptionType : InterceptionTypeRegistry.getSupportedInterceptionTypes())
             {
                if (InterceptionUtils.isInterceptorMethod(interceptionType, method))
                {
                   if (methodMap.get(interceptionType) == null)
                      methodMap.put(interceptionType, new LinkedList<Method>());
                   if (detectedInterceptorTypes.contains(interceptionType))
-                     throw new InterceptorException("Same interception type cannot be specified twice on the same class");
+                     throw new InterceptorMetadataException("Same interception type cannot be specified twice on the same class");
                   else
                      detectedInterceptorTypes.add(interceptionType);
                   // add method in the list - if it is there already, it means that it has been added by a subclass
                   ReflectionUtils.ensureAccessible(method);
-                  if (!foundMethodNames.contains(method.getName()))
+                  if (!foundMethods.contains(new MethodHolder(method)))
                   {
-                     methodMap.get(interceptionType).add(method);
-                     foundMethodNames.add(method.getName());
+                     methodMap.get(interceptionType).add(0, method);
                   }
                }
             }
+            foundMethods.add(new MethodHolder(method));
          }
          currentClass = currentClass.getSuperclass();
-      } while (currentClass != null);
+      } while (!Object.class.equals(currentClass));
    }
 
    public Class<?> getInterceptorClass()
@@ -86,4 +86,41 @@
       return methods == null ? Collections.EMPTY_LIST : methods;
    }
 
+   private class MethodHolder
+   {
+      private String methodName;
+
+      private Class<?>[] parameterTypes;
+
+
+      MethodHolder(Method method)
+      {
+         this.methodName = method.getName();
+         this.parameterTypes = method.getParameterTypes();
+      }
+
+      @Override
+      public boolean equals(Object o)
+      {
+         if (this == o) return true;
+         if (o == null || getClass() != o.getClass()) return false;
+
+         MethodHolder that = (MethodHolder) o;
+
+         if (methodName != null ? !methodName.equals(that.methodName) : that.methodName != null)
+            return false;
+         if (!Arrays.equals(parameterTypes, that.parameterTypes))
+            return false;
+
+         return true;
+      }
+
+      @Override
+      public int hashCode()
+      {
+         int result = methodName != null ? methodName.hashCode() : 0;
+         result = 31 * result + (parameterTypes != null ? Arrays.hashCode(parameterTypes) : 0);
+         return result;
+      }
+   }
 }

Added: projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java
===================================================================
--- projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java	                        (rev 0)
+++ projects/interceptors/trunk/src/main/java/org/jboss/interceptor/model/InterceptorMetadataException.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.interceptor.model;
+
+import org.jboss.interceptor.InterceptorException;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class InterceptorMetadataException extends InterceptorException
+{
+   public InterceptorMetadataException()
+   {
+   }
+
+   public InterceptorMetadataException(String s)
+   {
+      super(s);
+   }
+
+   public InterceptorMetadataException(String s, Throwable throwable)
+   {
+      super(s, throwable);
+   }
+
+   public InterceptorMetadataException(Throwable throwable)
+   {
+      super(throwable);
+   }
+}

Modified: projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandler.java
===================================================================
--- projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandler.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/DirectClassInterceptionHandler.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -20,6 +20,7 @@
 import org.jboss.interceptor.model.InterceptionType;
 import org.jboss.interceptor.model.InterceptorClassMetadata;
 import org.jboss.interceptor.registry.InterceptorClassMetadataRegistry;
+import org.jboss.interceptor.InterceptorException;
 
 import javax.interceptor.InvocationContext;
 import java.lang.reflect.Method;

Deleted: projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorException.java
===================================================================
--- projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorException.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorException.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.jboss.interceptor.proxy;
-
-/**
- * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
- */
-public class InterceptorException extends RuntimeException
-{
-   public InterceptorException()
-   {
-   }
-
-   public InterceptorException(String s)
-   {
-      super(s);
-   }
-
-   public InterceptorException(String s, Throwable throwable)
-   {
-      super(s, throwable);
-   }
-
-   public InterceptorException(Throwable throwable)
-   {
-      super(throwable);
-   }
-}

Modified: projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreatorImpl.java
===================================================================
--- projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreatorImpl.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/main/java/org/jboss/interceptor/proxy/InterceptorProxyCreatorImpl.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -24,6 +24,7 @@
 import org.jboss.interceptor.registry.InterceptorRegistry;
 import org.jboss.interceptor.registry.InterceptorClassMetadataRegistry;
 import static org.jboss.interceptor.util.InterceptionUtils.isAroundInvokeInterceptionCandidate;
+import org.jboss.interceptor.InterceptorException;
 
 import javax.interceptor.AroundInvoke;
 import java.lang.reflect.Method;

Modified: projects/interceptors/trunk/src/main/java/org/jboss/interceptor/registry/InterceptorClassMetadataRegistry.java
===================================================================
--- projects/interceptors/trunk/src/main/java/org/jboss/interceptor/registry/InterceptorClassMetadataRegistry.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/main/java/org/jboss/interceptor/registry/InterceptorClassMetadataRegistry.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -58,7 +58,8 @@
             {
                interceptorClassMetadataMap.put(interceptorClass, new InterceptorClassMetadataImpl(interceptorClass));
             }
-         } catch (Exception e)
+         }
+         finally 
          {
             lock.unlock();
          }

Deleted: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/FootballTeam.java
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/FootballTeam.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/FootballTeam.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.jboss.interceptors;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.InvocationContext;
-
-/**
- * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
- */
-public class FootballTeam {
-
-   private String teamName;
-
-    // an empty-argument constructor is required for proxifycation
-    public FootballTeam() {
-
-    }
-
-    public FootballTeam(String s) {
-        this.teamName = s;
-    }
-
-    public String getName() {
-        InterceptorTestLogger.add(FootballTeam.class, "getName");
-        return teamName;
-    }
-
-    @AroundInvoke
-    public Object itsMe(InvocationContext invocationContext) throws Exception {
-        InterceptorTestLogger.add(FootballTeam.class, "aroundInvokeBefore");
-        Object result = invocationContext.proceed();
-        InterceptorTestLogger.add(FootballTeam.class, "aroundInvokeAfter");
-        return result;
-    }
-}

Deleted: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptionTest.java
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptionTest.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptionTest.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -1,151 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.jboss.interceptors;
-
-import org.jboss.interceptor.model.InterceptionModelBuilder;
-import org.jboss.interceptor.proxy.InterceptorProxyCreator;
-import org.jboss.interceptor.proxy.InterceptorProxyCreatorImpl;
-import org.jboss.interceptor.proxy.DirectClassInterceptionHandlerFactory;
-import org.jboss.interceptor.registry.InterceptorRegistry;
-import org.jboss.interceptor.util.InterceptionUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.InvocationContext;
-
-/**
- * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
- */
-public class InterceptionTest
-{
-   private static final String TEAM_NAME = "Ajax Amsterdam";
-
-   private String[] expectedLoggedValues = {
-         "org.jboss.interceptors.InterceptionTest$MyFirstInterceptor_postConstruct",
-         "org.jboss.interceptors.InterceptionTest$MyFirstInterceptor_aroundInvokeBefore",
-         "org.jboss.interceptors.InterceptionTest$MySecondInterceptor_aroundInvokeBefore",
-         "org.jboss.interceptors.FootballTeam_aroundInvokeBefore",
-         "org.jboss.interceptors.FootballTeam_getName",
-         "org.jboss.interceptors.FootballTeam_aroundInvokeAfter",
-         "org.jboss.interceptors.InterceptionTest$MySecondInterceptor_aroundInvokeAfter",
-         "org.jboss.interceptors.InterceptionTest$MyFirstInterceptor_aroundInvokeAfter",
-         "org.jboss.interceptors.InterceptionTest$MySecondInterceptor_preDestroy"
-
-   };
-   private InterceptorProxyCreator interceptorProxyCreator;
-
-   @Before
-   public void resetLogAndSetupClasses() throws Exception
-   {
-      InterceptorTestLogger.reset();
-      InterceptorRegistry<Class<?>> interceptorRegistry = new InterceptorRegistry<Class<?>>();
-
-      InterceptionModelBuilder<Class<?>> builder = InterceptionModelBuilder.<Class<?>>newBuilderFor(FootballTeam.class);
-
-      builder.interceptAroundInvoke(FootballTeam.class.getMethod("getName")).with(MyFirstInterceptor.class, MySecondInterceptor.class);
-      builder.interceptPostConstruct().with(MyFirstInterceptor.class);
-      builder.interceptPreDestroy().with(MySecondInterceptor.class);
-      interceptorRegistry.registerInterceptionModel(FootballTeam.class, builder.build());
-
-      interceptorProxyCreator = new InterceptorProxyCreatorImpl(interceptorRegistry, new DirectClassInterceptionHandlerFactory());
-
-   }
-
-   @Test
-   public void testInterceptionWithInstrumentedClass() throws Exception
-   {
-
-      FootballTeam proxy = interceptorProxyCreator.createInstrumentedInstance(FootballTeam.class, new Class<?>[]{String.class}, new Object[]{TEAM_NAME});
-      //FootballTeam proxy = interceptorProxyCreator.createProxyFromInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
-      executeAssertionsOnProxy(proxy);
-
-   }
-
-
-   @Test
-   public void testInterceptionWithProxifiedObject() throws Exception
-   {
-      FootballTeam proxy = interceptorProxyCreator.createProxyFromInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
-      executeAssertionsOnProxy(proxy);
-
-   }
-
-   private void executeAssertionsOnProxy(FootballTeam proxy)
-   {
-      InterceptionUtils.executePostConstruct(proxy);
-      Assert.assertEquals(TEAM_NAME, proxy.getName());
-      InterceptionUtils.executePredestroy(proxy);
-      Object[] logValues = InterceptorTestLogger.getLog().toArray();
-      Assert.assertArrayEquals(iterateAndDisplay(logValues), expectedLoggedValues, logValues);
-   }
-
-   private String iterateAndDisplay(Object[] logValues)
-   {
-      StringBuffer buffer = new StringBuffer();
-      for (Object logValue: logValues)
-      {
-         buffer.append(logValue.toString()).append("\n");
-      }
-      return buffer.toString();
-   }
-
-
-   public static class MyFirstInterceptor
-   {
-
-      @AroundInvoke
-      private Object doAround(InvocationContext invocationContext) throws Exception
-      {
-         InterceptorTestLogger.add(MyFirstInterceptor.class, "aroundInvokeBefore");
-         Object result = invocationContext.proceed();
-         InterceptorTestLogger.add(MyFirstInterceptor.class, "aroundInvokeAfter");
-         return result;
-      }
-
-      @PostConstruct
-      public Object doAfterConstruction(InvocationContext invocationContext) throws Exception
-      {
-         InterceptorTestLogger.add(MyFirstInterceptor.class, "postConstruct");
-         return invocationContext.proceed();
-      }
-   }
-
-   public static class MySecondInterceptor extends MyFirstInterceptor
-   {
-      @AroundInvoke
-      private Object doAround(InvocationContext invocationContext) throws Exception
-      {
-         InterceptorTestLogger.add(MySecondInterceptor.class, "aroundInvokeBefore");
-         Object result = invocationContext.proceed();
-         InterceptorTestLogger.add(MySecondInterceptor.class, "aroundInvokeAfter");
-         return result;
-      }
-
-      @PreDestroy
-      private Object doneHere(InvocationContext invocationContext) throws Exception
-      {
-         InterceptorTestLogger.add(MySecondInterceptor.class, "preDestroy");
-         return invocationContext.proceed();
-      }
-   }
-}
-

Deleted: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptorTestLogger.java
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptorTestLogger.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptorTestLogger.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the
- * distribution for a full listing of individual contributors.
- *
- * Licensed 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.jboss.interceptors;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collections;
-
-/**
- * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
- */
-public class InterceptorTestLogger {
-
-    private static final List<String> log = new ArrayList<String>();
-
-    public static void add(Class<?> clazz, String logValue) {
-        log.add(clazz.getName() + "_" + logValue);  
-    }
-
-    public static List<String> getLog() {
-        return Collections.unmodifiableList(log);
-    }
-
-    public static void reset() {
-        log.clear();
-    }
-}

Modified: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/InterceptorClassMetadataTest.java
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/InterceptorClassMetadataTest.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/InterceptorClassMetadataTest.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -18,11 +18,12 @@
 package org.jboss.interceptors.metadata;
 
 import org.junit.Test;
-import org.junit.Assert;
 import static org.junit.Assert.assertEquals;
 import org.jboss.interceptor.model.InterceptorClassMetadata;
 import org.jboss.interceptor.model.InterceptionType;
+import org.jboss.interceptor.model.InterceptorMetadataException;
 import org.jboss.interceptor.registry.InterceptorClassMetadataRegistry;
+import org.jboss.interceptor.InterceptorException;
 
 import java.lang.reflect.Method;
 import java.util.List;
@@ -32,7 +33,7 @@
  */
 public class InterceptorClassMetadataTest
 {
-   
+
    @Test
    public void testInterceptorWithAllMethods()
    {
@@ -87,4 +88,63 @@
 
    }
 
+   @Test
+   public void testSimpleInheritance()
+   {
+      InterceptorClassMetadata interceptorClassMetadata = InterceptorClassMetadataRegistry.getRegistry().getInterceptorClassMetadata(SimpleInheritanceChildInterceptor.class);
+
+      List<Method> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
+      assertEquals(true, postConstructMethods.size() == 1);
+      assertEquals(postConstructMethods.get(0).getName(), "doPostConstruct");
+
+      List<Method> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
+      assertEquals(true, preDestroyMethods.size() == 0);
+
+      List<Method> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
+      assertEquals(true, aroundInvokeMethods.size() == 1);
+      assertEquals(aroundInvokeMethods.get(0).getName(), "doAroundInvoke");
+
+      List<Method> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
+      assertEquals(true, postActivateMethods.size() == 0);
+
+      List<Method> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
+      assertEquals(true, prePassivateMethods.size() == 0);
+
+   }
+
+   @Test
+   public void testInheritanceWithAndWithoutOverriding()
+   {
+      InterceptorClassMetadata interceptorClassMetadata = InterceptorClassMetadataRegistry.getRegistry().getInterceptorClassMetadata(OverrideChildInterceptor.class);
+
+      List<Method> postConstructMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_CONSTRUCT);
+      assertEquals(true, postConstructMethods.size() == 1);
+      assertEquals(postConstructMethods.get(0).getName(), "methodOverriddenAndUsedAsInterceptor");
+
+      List<Method> preDestroyMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_DESTROY);
+      assertEquals(true, preDestroyMethods.size() == 0);
+
+      List<Method> aroundInvokeMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.AROUND_INVOKE);
+      assertEquals(true, aroundInvokeMethods.size() == 2);
+      assertEquals(aroundInvokeMethods.get(0).getName(), "methodDefinedOnParentAndUsedAsInterceptor");
+      assertEquals(aroundInvokeMethods.get(1).getName(), "methodDefinedOnChildAndUsedAsInterceptor");
+
+      List<Method> postActivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.POST_ACTIVATE);
+      assertEquals(true, postActivateMethods.size() == 0);
+
+
+      List<Method> prePassivateMethods = interceptorClassMetadata.getInterceptorMethods(InterceptionType.PRE_PASSIVATE);
+      assertEquals(true, prePassivateMethods.size() == 0);
+
+   }
+
+   @Test(expected = InterceptorMetadataException.class)
+   public void testDuplicateAnnotations()
+   {
+      InterceptorClassMetadata interceptorClassMetadata = InterceptorClassMetadataRegistry.getRegistry().getInterceptorClassMetadata(InterceptorWithDuplicateAnnotations.class);
+
+   }
+
+
+
 }

Added: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/InterceptorWithDuplicateAnnotations.java
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/InterceptorWithDuplicateAnnotations.java	                        (rev 0)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/InterceptorWithDuplicateAnnotations.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.interceptors.metadata;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class InterceptorWithDuplicateAnnotations
+{
+   @AroundInvoke
+   public Object doAroundInvoke(InvocationContext invocationContext)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @AroundInvoke
+   public Object doAroundInvokeAgain(InvocationContext invocationContext)
+   {
+      throw new UnsupportedOperationException();
+   }
+}

Added: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/OverrideChildInterceptor.java
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/OverrideChildInterceptor.java	                        (rev 0)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/OverrideChildInterceptor.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.interceptors.metadata;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.InvocationContext;
+import javax.interceptor.AroundInvoke;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class OverrideChildInterceptor extends OverrideParentInterceptor
+{
+   @AroundInvoke
+   Object methodDefinedOnChildAndUsedAsInterceptor(InvocationContext invocationContext)
+   {
+      throw  new UnsupportedOperationException();
+   }
+
+   @PostConstruct
+   void methodOverriddenAndUsedAsInterceptor(InvocationContext invocationContext)
+   {
+
+   }
+
+   void methodOverriddenAndNotUsedAsInterceptor(InvocationContext invocationContext)
+   {
+
+   }
+}

Added: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/OverrideParentInterceptor.java
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/OverrideParentInterceptor.java	                        (rev 0)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/OverrideParentInterceptor.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.interceptors.metadata;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.InvocationContext;
+import javax.interceptor.AroundInvoke;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class OverrideParentInterceptor
+{
+   @AroundInvoke
+   Object methodDefinedOnParentAndUsedAsInterceptor(InvocationContext invocationContext)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   @PostConstruct
+   void methodOverriddenAndUsedAsInterceptor(InvocationContext invocationContext)
+   {
+
+   }
+
+   @PreDestroy
+   void methodOverriddenAndNotUsedAsInterceptor(InvocationContext invocationContext)
+   {
+
+   }
+}

Modified: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/SimpleInheritanceChildInterceptor.java
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/SimpleInheritanceChildInterceptor.java	2009-09-27 04:56:19 UTC (rev 94046)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/metadata/SimpleInheritanceChildInterceptor.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -23,7 +23,7 @@
 /**
  * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
  */
-public class SimpleInheritanceChildInterceptor
+public class SimpleInheritanceChildInterceptor extends SimpleInheritanceParentInterceptor
 {
    @AroundInvoke
    public Object doAroundInvoke(InvocationContext invocationContext)

Copied: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/FootballTeam.java (from rev 94046, projects/interceptors/trunk/src/test/java/org/jboss/interceptors/FootballTeam.java)
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/FootballTeam.java	                        (rev 0)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/FootballTeam.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.interceptors.proxy;
+
+import org.jboss.interceptors.proxy.InterceptorTestLogger;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class FootballTeam {
+
+   private String teamName;
+
+    // an empty-argument constructor is required for proxifycation
+    public FootballTeam() {
+
+    }
+
+    public FootballTeam(String s) {
+        this.teamName = s;
+    }
+
+    public String getName() {
+        InterceptorTestLogger.add(FootballTeam.class, "getName");
+        return teamName;
+    }
+
+    @AroundInvoke
+    public Object itsMe(InvocationContext invocationContext) throws Exception {
+        InterceptorTestLogger.add(FootballTeam.class, "aroundInvokeBefore");
+        Object result = invocationContext.proceed();
+        InterceptorTestLogger.add(FootballTeam.class, "aroundInvokeAfter");
+        return result;
+    }
+}

Copied: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/InterceptionTest.java (from rev 94046, projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptionTest.java)
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/InterceptionTest.java	                        (rev 0)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/InterceptionTest.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.interceptors.proxy;
+
+import org.jboss.interceptor.model.InterceptionModelBuilder;
+import org.jboss.interceptor.proxy.InterceptorProxyCreator;
+import org.jboss.interceptor.proxy.InterceptorProxyCreatorImpl;
+import org.jboss.interceptor.proxy.DirectClassInterceptionHandlerFactory;
+import org.jboss.interceptor.registry.InterceptorRegistry;
+import org.jboss.interceptor.util.InterceptionUtils;
+import org.jboss.interceptors.proxy.FootballTeam;
+import org.jboss.interceptors.proxy.InterceptorTestLogger;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class InterceptionTest
+{
+   private static final String TEAM_NAME = "Ajax Amsterdam";
+
+   private String[] expectedLoggedValues = {
+         "org.jboss.interceptors.proxy.InterceptionTest$MyFirstInterceptor_postConstruct",
+         "org.jboss.interceptors.proxy.InterceptionTest$MyFirstInterceptor_aroundInvokeBefore",
+         "org.jboss.interceptors.proxy.InterceptionTest$MySecondInterceptor_aroundInvokeBefore",
+         "org.jboss.interceptors.proxy.FootballTeam_aroundInvokeBefore",
+         "org.jboss.interceptors.proxy.FootballTeam_getName",
+         "org.jboss.interceptors.proxy.FootballTeam_aroundInvokeAfter",
+         "org.jboss.interceptors.proxy.InterceptionTest$MySecondInterceptor_aroundInvokeAfter",
+         "org.jboss.interceptors.proxy.InterceptionTest$MyFirstInterceptor_aroundInvokeAfter",
+         "org.jboss.interceptors.proxy.InterceptionTest$MySecondInterceptor_preDestroy"
+
+   };
+   private InterceptorProxyCreator interceptorProxyCreator;
+
+   @Before
+   public void resetLogAndSetupClasses() throws Exception
+   {
+      InterceptorTestLogger.reset();
+      InterceptorRegistry<Class<?>> interceptorRegistry = new InterceptorRegistry<Class<?>>();
+
+      InterceptionModelBuilder<Class<?>> builder = InterceptionModelBuilder.<Class<?>>newBuilderFor(FootballTeam.class);
+
+      builder.interceptAroundInvoke(FootballTeam.class.getMethod("getName")).with(MyFirstInterceptor.class, MySecondInterceptor.class);
+      builder.interceptPostConstruct().with(MyFirstInterceptor.class);
+      builder.interceptPreDestroy().with(MySecondInterceptor.class);
+      interceptorRegistry.registerInterceptionModel(FootballTeam.class, builder.build());
+
+      interceptorProxyCreator = new InterceptorProxyCreatorImpl(interceptorRegistry, new DirectClassInterceptionHandlerFactory());
+
+   }
+
+   @Test
+   public void testInterceptionWithInstrumentedClass() throws Exception
+   {
+
+      FootballTeam proxy = interceptorProxyCreator.createInstrumentedInstance(FootballTeam.class, new Class<?>[]{String.class}, new Object[]{TEAM_NAME});
+      //FootballTeam proxy = interceptorProxyCreator.createProxyFromInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
+      executeAssertionsOnProxy(proxy);
+
+   }
+
+
+   @Test
+   public void testInterceptionWithProxifiedObject() throws Exception
+   {
+      FootballTeam proxy = interceptorProxyCreator.createProxyFromInstance(new FootballTeam(TEAM_NAME), FootballTeam.class);
+      executeAssertionsOnProxy(proxy);
+
+   }
+
+   private void executeAssertionsOnProxy(FootballTeam proxy)
+   {
+      InterceptionUtils.executePostConstruct(proxy);
+      Assert.assertEquals(TEAM_NAME, proxy.getName());
+      InterceptionUtils.executePredestroy(proxy);
+      Object[] logValues = InterceptorTestLogger.getLog().toArray();
+      Assert.assertArrayEquals(iterateAndDisplay(logValues), expectedLoggedValues, logValues);
+   }
+
+   private String iterateAndDisplay(Object[] logValues)
+   {
+      StringBuffer buffer = new StringBuffer();
+      for (Object logValue: logValues)
+      {
+         buffer.append(logValue.toString()).append("\n");
+      }
+      return buffer.toString();
+   }
+
+
+   public static class MyFirstInterceptor
+   {
+
+      @AroundInvoke
+      private Object doAround(InvocationContext invocationContext) throws Exception
+      {
+         InterceptorTestLogger.add(MyFirstInterceptor.class, "aroundInvokeBefore");
+         Object result = invocationContext.proceed();
+         InterceptorTestLogger.add(MyFirstInterceptor.class, "aroundInvokeAfter");
+         return result;
+      }
+
+      @PostConstruct
+      public void doAfterConstruction(InvocationContext invocationContext) throws Exception
+      {
+         InterceptorTestLogger.add(MyFirstInterceptor.class, "postConstruct");
+      }
+   }
+
+   public static class MySecondInterceptor extends MyFirstInterceptor
+   {
+      @AroundInvoke
+      private Object doAround(InvocationContext invocationContext) throws Exception
+      {
+         InterceptorTestLogger.add(MySecondInterceptor.class, "aroundInvokeBefore");
+         Object result = invocationContext.proceed();
+         InterceptorTestLogger.add(MySecondInterceptor.class, "aroundInvokeAfter");
+         return result;
+      }
+
+      @PreDestroy
+      private void doneHere(InvocationContext invocationContext) throws Exception
+      {
+         InterceptorTestLogger.add(MySecondInterceptor.class, "preDestroy");
+      }
+   }
+}
+

Copied: projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/InterceptorTestLogger.java (from rev 93795, projects/interceptors/trunk/src/test/java/org/jboss/interceptors/InterceptorTestLogger.java)
===================================================================
--- projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/InterceptorTestLogger.java	                        (rev 0)
+++ projects/interceptors/trunk/src/test/java/org/jboss/interceptors/proxy/InterceptorTestLogger.java	2009-09-27 06:00:58 UTC (rev 94047)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual
+ * contributors by the @authors tag. See the copyright.txt in the
+ * distribution for a full listing of individual contributors.
+ *
+ * Licensed 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.jboss.interceptors.proxy;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class InterceptorTestLogger {
+
+    private static final List<String> log = new ArrayList<String>();
+
+    public static void add(Class<?> clazz, String logValue) {
+        log.add(clazz.getName() + "_" + logValue);  
+    }
+
+    public static List<String> getLog() {
+        return Collections.unmodifiableList(log);
+    }
+
+    public static void reset() {
+        log.clear();
+    }
+}




More information about the jboss-cvs-commits mailing list