[jboss-cvs] JBossAS SVN: r76042 - in projects/aop/branches/joinpoint_graph/aop/src: main/org/jboss/aop/joinpoint and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Jul 20 19:58:04 EDT 2008
Author: flavia.rainone at jboss.com
Date: 2008-07-20 19:58:03 -0400 (Sun, 20 Jul 2008)
New Revision: 76042
Modified:
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/AdvisorManagedMatchingStrategy.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/AspectManager.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/Domain.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/DynamicMatchingStrategy.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/IndexedMatchingStrategy.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/JoinPointManager.java
projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/JoinPointRegistry.java
projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/test/aop/dynamicgenadvisor/DynamicTester.java
Log:
[JBAOP-509] Updated IndexedJoinPointManager to start using the AdviceBinding pointcutResolved method.
Fixed a few bugs found during integration, and updated DynamicTester. Added javadoc to the main integration
classes.
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/AdvisorManagedMatchingStrategy.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/AdvisorManagedMatchingStrategy.java 2008-07-20 23:33:43 UTC (rev 76041)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/AdvisorManagedMatchingStrategy.java 2008-07-20 23:58:03 UTC (rev 76042)
@@ -24,8 +24,9 @@
import org.jboss.aop.joinpoint.JoinPointRegistry;
/**
+ * Strategy that delegates the pointcut matching to Advisors.
+ *
* @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- *
*/
public class AdvisorManagedMatchingStrategy implements DynamicMatchingStrategy
{
@@ -51,4 +52,9 @@
public void register(MethodByConInfo info){}
public void register(MethodByMethodInfo info){}};
}
+
+ public boolean requiresRebuild()
+ {
+ return true;
+ }
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/AspectManager.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/AspectManager.java 2008-07-20 23:33:43 UTC (rev 76041)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/AspectManager.java 2008-07-20 23:58:03 UTC (rev 76042)
@@ -347,7 +347,7 @@
{
maintainAdvisorMethodInterceptors = (new Boolean(methodInterceptors)).booleanValue();
}
- manager.setDynamicMatchingStrategy(new AdvisorManagedMatchingStrategy());
+ manager.setDynamicMatchingStrategy(new IndexedMatchingStrategy());
Deployment.deploy();
return null;
}
@@ -1801,6 +1801,7 @@
newSubscribers = copySubDomainsFromQueue(false);
}
}
+ joinPointManager.annotationOverrideAdded(introduction);
}
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/Domain.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/Domain.java 2008-07-20 23:33:43 UTC (rev 76041)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/Domain.java 2008-07-20 23:58:03 UTC (rev 76042)
@@ -377,6 +377,11 @@
}
return super.getAnnotationOverrides();
}
+
+ public List<AnnotationIntroduction> getOwnAnnotationOverrides()
+ {
+ return super.getAnnotationOverrides();
+ }
public boolean hasOwnAnnotationOverrides()
{
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/DynamicMatchingStrategy.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/DynamicMatchingStrategy.java 2008-07-20 23:33:43 UTC (rev 76041)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/DynamicMatchingStrategy.java 2008-07-20 23:58:03 UTC (rev 76042)
@@ -24,12 +24,42 @@
import org.jboss.aop.joinpoint.JoinPointRegistry;
/**
+ * Strategy that defines how pointcut matching takes place at runtime.
+ *
* @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- *
*/
public interface DynamicMatchingStrategy
{
+ /**
+ * Returns the joinpoint manager to be used by {@code manager}.
+ *
+ * @param manager the aspect manager
+ * @return an instance that will be responsible for managing the joinpoints
+ * contained in {@code manager}
+ */
JoinPointManager getJoinPointManager(AspectManager manager);
+
+ /**
+ * Returns the joinpoint manager to be used by {@code domain}.
+ *
+ * @param manager an aop domain
+ * @return an instance that will be responsible for managing the joinpoints
+ * contained in {@code domain}
+ */
JoinPointManager getJoinPointManager(Domain domain);
+
+ /**
+ * Returns the joinpoint registry, where all joinpoint infos must be registered
+ * upon creation.
+ *
+ * @return the registry where all joinpoint infos must be registered
+ */
JoinPointRegistry getJoinPointRegistry();
+
+ /**
+ * Indicates wheter this strategy requires chain rebuilding.
+ *
+ * @return {@code true} only if this strategy recquires chain rebuilding.
+ */
+ boolean requiresRebuild();
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/IndexedMatchingStrategy.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/IndexedMatchingStrategy.java 2008-07-20 23:33:43 UTC (rev 76041)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/IndexedMatchingStrategy.java 2008-07-20 23:58:03 UTC (rev 76042)
@@ -25,8 +25,8 @@
import org.jboss.aop.joinpoint.graph.JoinPointGraphFactory;
/**
+ * MatchingStrategy that performs pointcut matching by using a joinpoint indexer.
*
- *
* @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
*/
public class IndexedMatchingStrategy implements DynamicMatchingStrategy
@@ -45,4 +45,9 @@
{
return JoinPointGraphFactory.getRegistry();
}
+
+ public boolean requiresRebuild()
+ {
+ return false;
+ }
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/JoinPointManager.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/JoinPointManager.java 2008-07-20 23:33:43 UTC (rev 76041)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/JoinPointManager.java 2008-07-20 23:58:03 UTC (rev 76042)
@@ -24,31 +24,17 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
import org.jboss.aop.advice.AdviceBinding;
-import org.jboss.aop.advice.Interceptor;
-import org.jboss.aop.advice.InterceptorFactory;
-import org.jboss.aop.advice.PrecedenceSorter;
-import org.jboss.aop.instrument.InstrumentorEnum;
-import org.jboss.aop.instrument.InstrumentorFactory;
-import org.jboss.aop.joinpoint.ConstructorCalledByConstructorJoinpoint;
-import org.jboss.aop.joinpoint.ConstructorCalledByMethodJoinpoint;
-import org.jboss.aop.joinpoint.ConstructorJoinpoint;
-import org.jboss.aop.joinpoint.FieldJoinpoint;
-import org.jboss.aop.joinpoint.Joinpoint;
-import org.jboss.aop.joinpoint.MethodCalledByConstructorJoinpoint;
-import org.jboss.aop.joinpoint.MethodCalledByMethodJoinpoint;
-import org.jboss.aop.joinpoint.MethodJoinpoint;
+import org.jboss.aop.introduction.AnnotationIntroduction;
import org.jboss.aop.joinpoint.graph.JoinPointGraph;
import org.jboss.aop.joinpoint.graph.JoinPointGraphFactory;
import org.jboss.aop.pointcut.Pointcut;
/**
- * Now the RebuldingChainTestCase has two flavours: with joins and without joins (both test different deadlock scenarios)
+ * Manages all the joinpoints of a specific aop domain, keeping their chains
+ * consistent with the bindings contained in the domain.
*
* @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
*/
@@ -57,51 +43,100 @@
protected AspectManager domain;
protected DynamicAOPStrategy dynamicWeavingStrategy;
- public JoinPointManager(AspectManager domain)
+ /**
+ * Constructor.
+ *
+ * @param domain the domain associated with this manager
+ */
+ protected JoinPointManager(AspectManager domain)
{
this.domain = domain;
this.dynamicWeavingStrategy = domain.getDynamicAOPStrategy();
}
+ /**
+ * Notifies the joinpoint manager that a binding has been added to the domain.
+ * As a result, all joinpoint chains will be updated accordingly.
+ *
+ * @param binding the binding added to the domain
+ */
public synchronized void bindingAdded(AdviceBinding binding)
{
this.internalBindingAdded(binding);
dynamicWeavingStrategy.interceptorChainsUpdated();
}
+ /**
+ * Notifies this joinpoint manager that a binding has been updated to the domain.
+ * As a result, all joinpoint chains will be updated accordingly.
+ *
+ * @param newBinding the new form of the updated binding
+ * @param oldBinding the old form of the updated binding
+ */
public synchronized void bindingUpdated(AdviceBinding newBinding, AdviceBinding oldBinding)
{
this.internalBindingUpdated(newBinding, oldBinding);
dynamicWeavingStrategy.interceptorChainsUpdated();
}
+ /**
+ * Notifies this joinpoint manager that a binding has been removed from the domain.
+ * As a result, all joinpoint chains will be updated accordingly.
+ *
+ * @param binding the binding removed from the domain
+ */
public synchronized void bindingRemoved(AdviceBinding binding)
{
this.internalBindingRemoved(binding);
this.dynamicWeavingStrategy.interceptorChainsUpdated();
}
+ /**
+ * Notifies this joinpoint manager that a set of bindings has been removed from the
+ * domain. As a result, all joinpoint chains will be updated accordingly.
+ *
+ * @param bindings the bindings removed from the domain
+ */
public synchronized void bindingsRemoved(Collection<AdviceBinding> bindings)
{
this.internalBindingsRemoved(bindings);
this.dynamicWeavingStrategy.interceptorChainsUpdated();
}
+ /**
+ * Notifies this joinpoint manager that an annotation introduction has been
+ * added to the domain.
+ *
+ * @param introduction the annotation introduction added to the domain
+ */
+ public abstract void annotationOverrideAdded(AnnotationIntroduction introduction);
protected abstract void internalBindingAdded(AdviceBinding binding);
protected abstract void internalBindingUpdated(AdviceBinding newBinding, AdviceBinding oldBinding);
protected abstract void internalBindingRemoved(AdviceBinding binding);
protected abstract void internalBindingsRemoved(Collection<AdviceBinding> bindings);
}
+/**
+ * This joinpoint manager delegates management of joinpoints to the advisors.
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
class AdvisedJoinPointManager extends JoinPointManager
{
-
+ /**
+ * Constructor.
+ *
+ * @param domain the domain associated with this manager
+ */
public AdvisedJoinPointManager(AspectManager domain)
{
super(domain);
}
@Override
+ public void annotationOverrideAdded(AnnotationIntroduction introduction){}
+
+ @Override
protected void internalBindingAdded(AdviceBinding binding)
{
synchronized (domain.getAdvisors())
@@ -181,28 +216,44 @@
}
}
+/**
+ * JoinPointManager that keeps tracking of the joinpoints by indexing them.
+ *
+ * @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
+ */
class IndexedJoinPointManager extends JoinPointManager
{
- Map<AdviceBinding,Collection<CreatedInterceptorInfo>> createdInterceptors;
private JoinPointGraph joinPointGraph;
- boolean generatedAdvisorMode;
+ /**
+ * Constructor.
+ *
+ * @param aspectManager the aspect manager instance this manager is associated
+ * with
+ */
public IndexedJoinPointManager(AspectManager aspectManager)
{
super(aspectManager);
- generatedAdvisorMode = InstrumentorFactory.getInstrumentor() ==
- InstrumentorEnum.GENERATED_ADVISOR;
this.joinPointGraph = JoinPointGraphFactory.create();
- this.createdInterceptors = new HashMap<AdviceBinding,Collection<CreatedInterceptorInfo>>();
}
+ /**
+ * Constructor.
+ *
+ * @param domain the domain associated with this manager
+ */
public IndexedJoinPointManager(Domain domain)
{
super(domain);
this.joinPointGraph = JoinPointGraphFactory.create(domain);
- this.createdInterceptors = new HashMap<AdviceBinding,Collection<CreatedInterceptorInfo>>();
}
+ @Override
+ public void annotationOverrideAdded(AnnotationIntroduction introduction)
+ {
+ joinPointGraph.update(introduction);
+ }
+
protected Collection<JoinPointInfo> getMatch(Pointcut pointcut)
{
return joinPointGraph.search(pointcut);
@@ -211,90 +262,29 @@
@Override
protected void internalBindingAdded(AdviceBinding binding)
{
- Collection<CreatedInterceptorInfo> createdInterceptorInfos = null;
- if (this.createdInterceptors.containsKey(binding))
- {
- createdInterceptorInfos = this.createdInterceptors.get(binding);
- }
- else
- {
- createdInterceptorInfos = new ArrayList<CreatedInterceptorInfo>();
- this.createdInterceptors.put(binding, createdInterceptorInfos);
- }
-
for (JoinPointInfo joinPointInfo: getMatch(binding.getPointcut()))
{
joinPointInfo.getInterceptorChainReadWriteLock().writeLock().lock();
try
{
// add the interceptors to the chain
- joinPointInfo.getAdvisor().pointcutResolved(joinPointInfo, binding,
- joinPointInfo.getJoinpoint());
-
- // add the created interceptors to the map
- ArrayList<Interceptor> interceptors = joinPointInfo.getInterceptorChain();
- InterceptorFactory[] factories = binding.getInterceptorFactories();
- int initialIndex = interceptors.size() - factories.length;
- Interceptor[] created = new Interceptor[factories.length];
- int i = 0;
- for (Iterator<Interceptor> iterator = interceptors.listIterator(initialIndex);
- iterator.hasNext(); i++)
- {
- created[i] = iterator.next();
- }
- //this.createdInterceptors.put(binding.getName(), created);
- synchronized(binding)
- {
-
- createdInterceptorInfos.add(new CreatedInterceptorInfo(joinPointInfo, created));
- }
-
- // set the chain in the appropriate order
- joinPointInfo.setInterceptors(PrecedenceSorter.applyPrecedence(
- interceptors.toArray(new Interceptor[interceptors.size()]), domain));
+ binding.pointcutResolved(joinPointInfo, domain);
}
finally
{
- if (generatedAdvisorMode)
- {
- ((GeneratedClassAdvisor) joinPointInfo.getAdvisor()).interceptorChainUpdated(joinPointInfo);
- }
+ joinPointInfo.getAdvisor().interceptorChainUpdated(joinPointInfo);
joinPointInfo.getInterceptorChainReadWriteLock().writeLock().unlock();
}
}
}
-
- /* (non-Javadoc)
- * @see org.jboss.aop.JoinPointManager#internalBindingRemoved(org.jboss.aop.advice.AdviceBinding)
- */
@Override
protected void internalBindingRemoved(AdviceBinding binding)
{
//Interceptor[]
synchronized(binding)
{
- Collection<CreatedInterceptorInfo> createdInterceptorInfos = this.createdInterceptors.get(binding);
- for (CreatedInterceptorInfo createdInterceptorInfo: createdInterceptorInfos)
- {
- JoinPointInfo info = createdInterceptorInfo.info;
- info.getInterceptorChainReadWriteLock().writeLock().lock();
- try
- {
- ArrayList<Interceptor> interceptors = info.getInterceptorChain();
- for (Interceptor interceptor: createdInterceptorInfo.interceptors)
- {
- interceptors.remove(interceptor);
- }
- info.setInterceptors(interceptors.toArray(new Interceptor[interceptors.size()]));
- }
- finally
- {
- ((GeneratedClassAdvisor) info.getAdvisor()).interceptorChainUpdated(info);
- info.getInterceptorChainReadWriteLock().writeLock().unlock();
- }
- }
- createdInterceptorInfos.clear();
+ binding.clearChains();
for (Advisor advisor: binding.getAdvisors())
{
advisor.adviceBindingRemoved(binding);
@@ -303,10 +293,6 @@
}
}
-
- /* (non-Javadoc)
- * @see org.jboss.aop.JoinPointManager#internalBindingUpdated(org.jboss.aop.advice.AdviceBinding, org.jboss.aop.advice.AdviceBinding)
- */
@Override
protected void internalBindingUpdated(AdviceBinding newBinding, AdviceBinding oldBinding)
{
@@ -314,10 +300,6 @@
this.internalBindingAdded(newBinding);
}
-
- /* (non-Javadoc)
- * @see org.jboss.aop.JoinPointManager#internalBindingsRemoved(java.util.Collection)
- */
@Override
protected void internalBindingsRemoved(Collection<AdviceBinding> bindings)
{
@@ -326,64 +308,4 @@
this.internalBindingRemoved(binding);
}
}
-
- private Joinpoint createJoinpoint(JoinPointInfo joinPointInfo)
- {
- if (joinPointInfo instanceof FieldInfo)
- {
- return new FieldJoinpoint(((FieldInfo) joinPointInfo).getField());
- }
- if (joinPointInfo instanceof ConstructorInfo)
- {
- return new ConstructorJoinpoint(
- ((ConstructorInfo) joinPointInfo).getConstructor());
- }
- if (joinPointInfo instanceof ConstructionInfo)
- {
- return new ConstructorJoinpoint(
- ((ConstructionInfo) joinPointInfo).getConstructor());
- }
- if (joinPointInfo instanceof MethodInfo)
- {
- return new MethodJoinpoint(((MethodInfo) joinPointInfo).getMethod());
- }
- if (joinPointInfo instanceof ConByConInfo)
- {
- return new ConstructorCalledByConstructorJoinpoint(
- ((ConByConInfo) joinPointInfo).getCallingConstructor(),
- ((ConByConInfo) joinPointInfo).getConstructor());
- }
- if (joinPointInfo instanceof ConByMethodInfo)
- {
- return new ConstructorCalledByMethodJoinpoint(
- ((ConByMethodInfo) joinPointInfo).getCallingMethod(),
- ((ConByMethodInfo) joinPointInfo).getConstructor());
- }
- if (joinPointInfo instanceof MethodByConInfo)
- {
- return new MethodCalledByConstructorJoinpoint(
- ((MethodByConInfo) joinPointInfo).getCallingConstructor(),
- ((MethodByConInfo) joinPointInfo).getMethod());
- }
- if (joinPointInfo instanceof MethodByMethodInfo)
- {
- return new MethodCalledByMethodJoinpoint(
- ((MethodByMethodInfo) joinPointInfo).getCallingMethod(),
- ((MethodByMethodInfo) joinPointInfo).getMethod());
- }
- throw new RuntimeException("Unexpected JoinPointInfo type: " +
- joinPointInfo.getClass());
- }
-
- public static class CreatedInterceptorInfo
- {
- public JoinPointInfo info;
- public Interceptor[] interceptors;
-
- public CreatedInterceptorInfo(JoinPointInfo info, Interceptor[] interceptors)
- {
- this.info = info;
- this.interceptors = interceptors;
- }
- }
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/JoinPointRegistry.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/JoinPointRegistry.java 2008-07-20 23:33:43 UTC (rev 76041)
+++ projects/aop/branches/joinpoint_graph/aop/src/main/org/jboss/aop/joinpoint/JoinPointRegistry.java 2008-07-20 23:58:03 UTC (rev 76042)
@@ -31,17 +31,67 @@
import org.jboss.aop.MethodInfo;
/**
+ * A registry for keeping track of all joinpoint infos created.
+ * Every joinpoint info must register itself on a registry upon creation.
+ *
* @author <a href="flavia.rainone at jboss.com">Flavia Rainone</a>
- *
+ * @see org.jboss.aop.DynamicMatchingStrategy#getJoinPointRegistry()
*/
public interface JoinPointRegistry
{
+ /**
+ * Registers {@code info}.
+ *
+ * @param info a newly created joinpoint info
+ */
public void register(ConstructorInfo info);
+
+ /**
+ * Registers {@code info}.
+ *
+ * @param info a newly created joinpoint info
+ */
public void register(ConstructionInfo info);
+
+ /**
+ * Registers {@code info}.
+ *
+ * @param info a newly created joinpoint info
+ */
public void register(FieldInfo info);
+
+ /**
+ * Registers {@code info}.
+ *
+ * @param info a newly created joinpoint info
+ */
public void register(MethodInfo info);
+
+ /**
+ * Registers {@code info}.
+ *
+ * @param info a newly created joinpoint info
+ */
public void register(ConByConInfo info);
+
+ /**
+ * Registers {@code info}.
+ *
+ * @param info a newly created joinpoint info
+ */
public void register(ConByMethodInfo info);
+
+ /**
+ * Registers {@code info}.
+ *
+ * @param info a newly created joinpoint info
+ */
public void register(MethodByConInfo info);
+
+ /**
+ * Registers {@code info}.
+ *
+ * @param info a newly created joinpoint info
+ */
public void register(MethodByMethodInfo info);
}
\ No newline at end of file
Modified: projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/test/aop/dynamicgenadvisor/DynamicTester.java
===================================================================
--- projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/test/aop/dynamicgenadvisor/DynamicTester.java 2008-07-20 23:33:43 UTC (rev 76041)
+++ projects/aop/branches/joinpoint_graph/aop/src/test/org/jboss/test/aop/dynamicgenadvisor/DynamicTester.java 2008-07-20 23:58:03 UTC (rev 76042)
@@ -384,16 +384,22 @@
pojo1.someMethod(123);
assertEquals(3, Interceptions.size());
assertEquals(Interceptions.getMethodName("MyInterceptor", "POJO", "someMethod"), Interceptions.get(0));
- assertEquals(Interceptions.getMethodName("YourInterceptor", "POJO", "someMethod"), Interceptions.get(1));
- assertEquals(Interceptions.getMethodName("MyInterceptor", "POJO", "someMethod"), Interceptions.get(2));
+ String yourInterceptor = Interceptions.getMethodName("YourInterceptor", "POJO", "someMethod");
+ String myInterceptor = Interceptions.getMethodName("MyInterceptor", "POJO", "someMethod");
+ String interception1 = Interceptions.get(1);
+ String interception2 = Interceptions.get(2);
+ assertTrue((interception1.equals(yourInterceptor) && interception2.equals(myInterceptor))
+ || (interception1.equals(myInterceptor) && interception2.equals(yourInterceptor)));
Interceptions.clear();
pojo2.someMethod(123);
assertEquals(3, Interceptions.size());
assertEquals(Interceptions.getMethodName("MyInterceptor", "POJO", "someMethod"), Interceptions.get(0));
- assertEquals(Interceptions.getMethodName("YourInterceptor", "POJO", "someMethod"), Interceptions.get(1));
- assertEquals(Interceptions.getMethodName("MyAspect", "POJO", "someMethod"), Interceptions.get(2));
-
+ String myAspectName = Interceptions.getMethodName("MyAspect", "POJO", "someMethod");
+ interception1 = Interceptions.get(1);
+ interception2 = Interceptions.get(2);
+ assertTrue((interception1.equals(yourInterceptor) && interception2.equals(myAspectName))
+ || (interception1.equals(myAspectName) && interception2.equals(yourInterceptor)));
Interceptions.clear();
pojo3.someMethod(123);
@@ -565,8 +571,12 @@
assertEquals(66, pojo1.i);
assertEquals(5, Interceptions.size());
assertEquals(Interceptions.getFieldWriteName("MyInterceptor", "POJO", "i"), Interceptions.get(0));
- assertEquals(Interceptions.getFieldWriteName("YourInterceptor", "POJO", "i"), Interceptions.get(1));
- assertEquals(Interceptions.getFieldWriteName("MyInterceptor", "POJO", "i"), Interceptions.get(2));
+ String yourInterceptor = Interceptions.getFieldWriteName("YourInterceptor", "POJO", "i");
+ String myInterceptor = Interceptions.getFieldWriteName("MyInterceptor", "POJO", "i");
+ String interception1 = Interceptions.get(1);
+ String interception2 = Interceptions.get(2);
+ assertTrue((interception1.equals(yourInterceptor) && interception2.equals(myInterceptor))
+ || (interception1.equals(myInterceptor) && interception2.equals(yourInterceptor)));
assertEquals(Interceptions.getFieldReadName("MyInterceptor", "POJO", "i"), Interceptions.get(3));
assertEquals(Interceptions.getFieldReadName("YourInterceptor", "POJO", "i"), Interceptions.get(4));
@@ -577,8 +587,12 @@
assertEquals(Interceptions.getFieldWriteName("MyInterceptor", "POJO", "i"), Interceptions.get(0));
assertEquals(Interceptions.getFieldWriteName("YourInterceptor", "POJO", "i"), Interceptions.get(1));
assertEquals(Interceptions.getFieldReadName("MyInterceptor", "POJO", "i"), Interceptions.get(2));
- assertEquals(Interceptions.getFieldReadName("YourInterceptor", "POJO", "i"), Interceptions.get(3));
- assertEquals(Interceptions.getFieldReadName("MyAspect", "POJO", "i"), Interceptions.get(4));
+ String myAspectName = Interceptions.getFieldReadName("MyAspect", "POJO", "i");
+ yourInterceptor = Interceptions.getFieldReadName("YourInterceptor", "POJO", "i");
+ String interception3 = Interceptions.get(3);
+ String interception4 = Interceptions.get(4);
+ assertTrue((interception3.equals(yourInterceptor) && interception4.equals(myAspectName))
+ || (interception3.equals(myAspectName) && interception4.equals(yourInterceptor)));
Interceptions.clear();
@@ -596,8 +610,12 @@
pojo1.i = 50;
assertEquals(50, pojo1.i);
assertEquals(3, Interceptions.size());
- assertEquals(Interceptions.getFieldWriteName("YourInterceptor", "POJO", "i"), Interceptions.get(0));
- assertEquals(Interceptions.getFieldWriteName("MyInterceptor", "POJO", "i"), Interceptions.get(1));
+ yourInterceptor = Interceptions.getFieldWriteName("YourInterceptor", "POJO", "i");
+ myInterceptor = Interceptions.getFieldWriteName("MyInterceptor", "POJO", "i");
+ String interception0 = Interceptions.get(0);
+ interception1 = Interceptions.get(1);
+ assertTrue((interception0.equals(yourInterceptor) && interception1.equals(myInterceptor))
+ || (interception0.equals(myInterceptor) && interception1.equals(yourInterceptor)));
assertEquals(Interceptions.getFieldReadName("YourInterceptor", "POJO", "i"), Interceptions.get(2));
Interceptions.clear();
@@ -605,10 +623,13 @@
assertEquals(100, pojo2.i);
assertEquals(3, Interceptions.size());
assertEquals(Interceptions.getFieldWriteName("YourInterceptor", "POJO", "i"), Interceptions.get(0));
- assertEquals(Interceptions.getFieldReadName("YourInterceptor", "POJO", "i"), Interceptions.get(1));
- assertEquals(Interceptions.getFieldReadName("MyAspect", "POJO", "i"), Interceptions.get(2));
-
-
+ myAspectName = Interceptions.getFieldReadName("MyAspect", "POJO", "i");
+ yourInterceptor = Interceptions.getFieldReadName("YourInterceptor", "POJO", "i");
+ interception1 = Interceptions.get(1);
+ interception2 = Interceptions.get(2);
+ assertTrue((interception1.equals(yourInterceptor) && interception2.equals(myAspectName))
+ || (interception1.equals(myAspectName) && interception2.equals(yourInterceptor)));
+
System.out.println("================> removing binding");
getInstanceDomain(pojo1).removeBinding(nameA);
@@ -626,9 +647,11 @@
assertEquals(100, pojo2.i);
assertEquals(3, Interceptions.size());
assertEquals(Interceptions.getFieldWriteName("YourInterceptor", "POJO", "i"), Interceptions.get(0));
- assertEquals(Interceptions.getFieldReadName("YourInterceptor", "POJO", "i"), Interceptions.get(1));
- assertEquals(Interceptions.getFieldReadName("MyAspect", "POJO", "i"), Interceptions.get(2));
-
+ interception1 = Interceptions.get(1);
+ interception2 = Interceptions.get(2);
+ assertTrue((interception1.equals(yourInterceptor) && interception2.equals(myAspectName))
+ || (interception1.equals(myAspectName) && interception2.equals(yourInterceptor)));
+
AspectManager.instance().removeBinding(nameTopB);
Interceptions.clear();
pojo1.i = 14;
More information about the jboss-cvs-commits
mailing list