[jboss-cvs] JBossAS SVN: r69301 - in projects/aop/trunk/aop/src: main/org/jboss/aop/proxy/container and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 24 14:13:31 EST 2008
Author: kabir.khan at jboss.com
Date: 2008-01-24 14:13:30 -0500 (Thu, 24 Jan 2008)
New Revision: 69301
Added:
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsDelegate.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsInVmTestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsOutOfVmTestCase.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsTest.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect3.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect4.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect5.java
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/PerInstanceAdvice.java
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/PerJoinpointAdvice.java
projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java
projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java
projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OutOfProcessProxyFileCreator.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/ProxyFileCreatorDelegate.java
Log:
[JBAOP-467] Test that aspects of all scopes can be marshalled
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/PerInstanceAdvice.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/PerInstanceAdvice.java 2008-01-24 18:59:09 UTC (rev 69300)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/PerInstanceAdvice.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -127,7 +127,11 @@
@Override
public Object getAspectInstance()
{
- return null;
+ throw new RuntimeException("Use getAspectInstance(InstanceAdvisor instanceAdvisor) instead");
}
-
+
+ public Object getAspectInstance(InstanceAdvisor instanceAdvisor)
+ {
+ return instanceAdvisor.getPerInstanceAspect(aspectDefinition);
+ }
}
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/PerJoinpointAdvice.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/PerJoinpointAdvice.java 2008-01-24 18:59:09 UTC (rev 69300)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/PerJoinpointAdvice.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -179,8 +179,11 @@
@Override
public Object getAspectInstance()
{
- return null;
+ throw new RuntimeException("Use getAspectInstance(InstanceAdvisor instanceAdvisor) instead");
}
-
-
+
+ public Object getAspectInstance(InstanceAdvisor instanceAdvisor)
+ {
+ return instanceAdvisor.getPerInstanceJoinpointAspect(joinpoint, aspectDefinition);
+ }
}
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java 2008-01-24 18:59:09 UTC (rev 69300)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ContainerProxyFactory.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -326,7 +326,7 @@
return
"{" +
" return new " + MarshalledContainerProxy.class.getName() + "(" +
- " this.getClass()," +
+ " this," +
" this.key," +
" this.mixins," +
" this.delegate," +
@@ -339,7 +339,7 @@
{
return
"{" +
- " try{" +
+// " try{" +
" this.delegate = (" + superclass.getName() + ")$1.getDelegate();" +
" this.mixins = $1.getMixins();" +
" this.metadata = $1.getMetadata();" +
@@ -353,7 +353,7 @@
" this.currentAdvisor = domain.getAdvisor();" +
" this.instanceAdvisor = this.currentAdvisor;" +
" }" +
- " }catch(java.lang.Exception e){throw e;}" +
+// " }catch(java.lang.Exception e){throw e;}" +
"}";
}
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java 2008-01-24 18:59:09 UTC (rev 69300)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/MarshalledContainerProxy.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -29,6 +29,7 @@
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -36,6 +37,7 @@
import org.jboss.aop.Advisor;
import org.jboss.aop.AspectManager;
+import org.jboss.aop.InstanceAdvisor;
import org.jboss.aop.MethodInfo;
import org.jboss.aop.advice.AbstractAdvice;
import org.jboss.aop.advice.Interceptor;
@@ -58,13 +60,14 @@
//Fields to check if we are unmarshalling in the same JVM
public final static GUID GUID = new GUID();
+ private transient AspectManaged proxyInstance;
+
//Fields from the proxy, used when unmarshalling in the same JVM
private String proxyClassName;
private ContainerProxyCacheKey key;
private Object mixins[];
private Object delegate;
private Class clazz;
- private String instanceAdvisorDomainName;
private SimpleMetaData metadata;
//Interfaces resulting from a mixin or interface introduction
@@ -75,20 +78,21 @@
//The interceptor chains for each method used when unmarshalling in a different JVM
MarshalledInterceptors marshalledInterceptors;
+
+ //The instanceAdvisor domain name used when unmarshalling in a different JVM
+ private String instanceAdvisorDomainName;
- public MarshalledContainerProxy(Class proxyClass, ContainerProxyCacheKey key, Object[] mixins, Object delegate, Advisor currentAdvisor, SimpleMetaData metadata)
+ public MarshalledContainerProxy(AspectManaged proxyInstance, ContainerProxyCacheKey key, Object[] mixins, Object delegate, Advisor currentAdvisor, SimpleMetaData metadata)
{
+ this.proxyInstance = proxyInstance;
+ Class proxyClass = proxyInstance.getClass();
this.proxyClassName = proxyClass.getName();
this.key = key;
this.mixins = mixins;
this.delegate = delegate;
this.clazz = currentAdvisor.getClazz();
-
- if (currentAdvisor instanceof InstanceProxyContainer)
- {
- AspectManager manager = currentAdvisor.getManager();
- instanceAdvisorDomainName = manager.getManagerFQN();
- }
+
+ checkInstanceAdvisor(currentAdvisor);
this.metadata = metadata;
marshalledInterceptors = new MarshalledInterceptors(currentAdvisor, mixins);
@@ -114,6 +118,15 @@
introducedInterfaces = ifs.toArray(new String[ifs.size()]);
}
+ private void checkInstanceAdvisor(Advisor advisor)
+ {
+ if (advisor instanceof InstanceProxyContainer)
+ {
+ AspectManager manager = advisor.getManager();
+ instanceAdvisorDomainName = manager.getManagerFQN();
+ }
+ }
+
public Object readResolve() throws ObjectStreamException
{
try
@@ -237,9 +250,10 @@
MethodInfo[] methodInfos = getMethodInfos();
MarshalledMethodInfo[] marshalledInfos = new MarshalledMethodInfo[methodInfos.length];
+ boolean requiresInstanceAdvisor = false;
for (int i = 0 ; i < methodInfos.length ; i++)
{
- MarshalledMethodInfo info = new MarshalledMethodInfo(methodInfos[i]);
+ MarshalledMethodInfo info = new MarshalledMethodInfo(MarshalledContainerProxy.this, methodInfos[i]);
marshalledInfos[i] = info;
try
@@ -334,13 +348,16 @@
private static class MarshalledMethodInfo implements Serializable
{
+ transient MarshalledContainerProxy proxy;
long advisedHash;
long unadvisedHash;
Interceptor[] interceptors;
Class clazz;
+ transient boolean requiresInstanceAdvisor;
- public MarshalledMethodInfo(MethodInfo info) throws IOException
+ public MarshalledMethodInfo(MarshalledContainerProxy proxy, MethodInfo info) throws IOException
{
+ this.proxy = proxy;
try
{
this.advisedHash = MethodHashing.methodHash(info.getMethod());
@@ -352,10 +369,13 @@
}
clazz = info.getMethod().getDeclaringClass();
populateInterceptors(info);
-// interceptors = info.getInterceptors();
-// System.out.println("Interceptors for " + info.getMethod() + " " + interceptors);
}
+ public boolean getRequiresInstanceAdvisor()
+ {
+ return requiresInstanceAdvisor;
+ }
+
private void populateInterceptors(MethodInfo info)
{
Interceptor[] icptrs = info.getInterceptors();
@@ -371,18 +391,28 @@
}
else
{
- AbstractAdvice advice = (AbstractAdvice)icptrs[i];
+ AbstractAdvice advice = (AbstractAdvice)icptrs[i];
+ Object aspectInstance = null;
if (icptrs[i] instanceof PerInstanceAdvice)
{
- throw new RuntimeException("Not yet supported PerInstanceAdvice");
+ requiresInstanceAdvisor = true;
+ InstanceAdvisor ia = getProxyInstanceAdvisor();
+ aspectInstance = ((PerInstanceAdvice)advice).getAspectInstance(ia);
}
- else if (icptrs[i] instanceof PerJoinpointAdvice)
+ else if (icptrs[i] instanceof PerJoinpointAdvice && !Modifier.isStatic(info.getMethod().getModifiers()))
{
- throw new RuntimeException("Not yet supported PerJoinpointAdvice");
+ requiresInstanceAdvisor = true;
+ InstanceAdvisor ia = getProxyInstanceAdvisor();
+ aspectInstance = ((PerJoinpointAdvice)advice).getAspectInstance(ia);
}
else
{
- MarshalledAdvice ma = new MarshalledAdvice(advice.getAspectInstance(), icptrs[i].getName(), advice.getAdviceName());
+ aspectInstance = advice.getAspectInstance();
+ }
+
+ if (aspectInstance != null)
+ {
+ MarshalledAdvice ma = new MarshalledAdvice(aspectInstance, icptrs[i].getName(), advice.getAdviceName());
allIcptrs.add(ma);
}
}
@@ -391,6 +421,13 @@
}
}
+ private InstanceAdvisor getProxyInstanceAdvisor()
+ {
+ InstanceAdvisor ia = proxy.proxyInstance.getInstanceAdvisor();
+ proxy.checkInstanceAdvisor((InstanceProxyContainer)ia);
+ return ia;
+ }
+
public MethodInfo getMethodInfo(Advisor advisor)
{
MethodInfo info = new MethodInfo(clazz, advisedHash, unadvisedHash, advisor);
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java 2008-01-24 18:59:09 UTC (rev 69300)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/proxy/container/ProxyTemplate.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -144,7 +144,7 @@
private Object writeReplace() throws ObjectStreamException
{
return new MarshalledContainerProxy(
- this.getClass(),
+ this,
this.key,
this.mixins,
this.delegate,
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OutOfProcessProxyFileCreator.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OutOfProcessProxyFileCreator.java 2008-01-24 18:59:09 UTC (rev 69300)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/OutOfProcessProxyFileCreator.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -74,11 +74,12 @@
proxyFile.getAbsolutePath().replace('\\', '/');
Process proc = Runtime.getRuntime().exec(run);
- InputStream sysout = proc.getInputStream();
- InputStream syserr = proc.getErrorStream();
int result = proc.waitFor();
+ InputStream sysout = proc.getInputStream();
+ InputStream syserr = proc.getErrorStream();
+
outputStream("System.out", sysout);
outputStream("System.err", syserr);
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/ProxyFileCreatorDelegate.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/ProxyFileCreatorDelegate.java 2008-01-24 18:59:09 UTC (rev 69300)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/ProxyFileCreatorDelegate.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -112,7 +112,7 @@
InterceptorFactory[] interceptors = {advice};
AdviceBinding binding = new AdviceBinding("binding" + index, pc, null, null, interceptors);
- System.out.println("-----> Adding " + aspectClass + " to " + pointcut + " in " + this.getClass().getName());
+ System.out.println("-----> Adding: " + aspectClass);
manager.addAspectDefinition(def);
manager.addInterceptorFactory(advice.getName(), advice);
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsDelegate.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsDelegate.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsDelegate.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -0,0 +1,128 @@
+/*
+* 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.proxy;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.ObjectOutputStream;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.advice.Scope;
+import org.jboss.aop.proxy.container.AOPProxyFactory;
+import org.jboss.aop.proxy.container.AOPProxyFactoryMixin;
+import org.jboss.aop.proxy.container.AOPProxyFactoryParameters;
+import org.jboss.aop.proxy.container.GeneratedAOPProxyFactory;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SerializeContainerProxyWithScopedAspectsDelegate extends ProxyFileCreatorDelegate
+{
+ public static void main (String[] args)
+ {
+ SerializeContainerProxyWithScopedAspectsDelegate delegate = new SerializeContainerProxyWithScopedAspectsDelegate();
+ delegate.createAndSerializeProxy(args);
+ }
+
+ public void createAndSerializeProxy(File file) throws Exception
+ {
+ AspectManager manager = AspectManager.instance();
+ addAspectBinding(manager,
+ 1,
+ Scope.PER_VM,
+ TestAspect.class.getName(),
+ "advice",
+ "execution(* $instanceof{" + SomeInterface.class.getName() + "}->helloWorld(..))");
+
+ addAspectBinding(manager,
+ 2,
+ Scope.PER_CLASS,
+ TestAspect2.class.getName(),
+ "advice",
+ "execution(* $instanceof{" + SomeInterface.class.getName() + "}->helloWorld(..))");
+
+ addAspectBinding(manager,
+ 3,
+ Scope.PER_CLASS_JOINPOINT,
+ TestAspect3.class.getName(),
+ "advice",
+ "execution(* $instanceof{" + SomeInterface.class.getName() + "}->helloWorld(..))");
+
+ addAspectBinding(manager,
+ 4,
+ Scope.PER_INSTANCE,
+ TestAspect4.class.getName(),
+ "advice",
+ "execution(* $instanceof{" + SomeInterface.class.getName() + "}->helloWorld(..))");
+
+ addAspectBinding(manager,
+ 5,
+ Scope.PER_JOINPOINT,
+ TestAspect5.class.getName(),
+ "advice",
+ "execution(* $instanceof{" + SomeInterface.class.getName() + "}->helloWorld(..))");
+
+
+
+ AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
+ params.setInterfaces(new Class[] {SomeInterface.class});
+ params.setMixins(new AOPProxyFactoryMixin[] {
+ new AOPProxyFactoryMixin(OtherMixin.class, new Class[] {OtherMixinInterface.class, OtherMixinInterface2.class}, "20")
+ });
+
+ params.setTarget(new SerializablePOJO());
+ AOPProxyFactory factory = new GeneratedAOPProxyFactory();
+ SomeInterface si = (SomeInterface)factory.createAdvisedProxy(params);
+
+ TestAspect.invoked = false;
+ TestAspect2.invoked = false;
+ TestAspect3.invoked = false;
+ TestAspect4.invoked = false;
+ TestAspect5.invoked = false;
+ si.helloWorld();
+ assertTrue(TestAspect.invoked);
+ assertTrue(TestAspect2.invoked);
+ assertTrue(TestAspect3.invoked);
+ assertTrue(TestAspect4.invoked);
+ assertTrue(TestAspect5.invoked);
+
+
+ ObjectOutputStream out = null;
+ try
+ {
+ out = new ObjectOutputStream(new FileOutputStream(file));
+ out.writeObject(si);
+ }
+ finally
+ {
+ try
+ {
+ out.close();
+ }
+ catch(Exception e)
+ {
+ }
+ }
+ }
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsInVmTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsInVmTestCase.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsInVmTestCase.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.proxy;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 64431 $
+ */
+public class SerializeContainerProxyWithScopedAspectsInVmTestCase extends SerializeContainerProxyWithScopedAspectsTest
+{
+
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("SerializeContainerProxyWithScopedAspectsInVmTestCase");
+ suite.addTestSuite(SerializeContainerProxyWithScopedAspectsInVmTestCase.class);
+ return suite;
+ }
+
+ public SerializeContainerProxyWithScopedAspectsInVmTestCase(String name)
+ {
+ super(name, new InProcessProxyFileCreator(new SerializeContainerProxyWithScopedAspectsDelegate()));
+ }
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsOutOfVmTestCase.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsOutOfVmTestCase.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsOutOfVmTestCase.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.proxy;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 64431 $
+ */
+public class SerializeContainerProxyWithScopedAspectsOutOfVmTestCase extends SerializeContainerProxyWithScopedAspectsTest
+{
+
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("SerializeContainerProxyWithScopedAspectsOutOfVmTestCase");
+ suite.addTestSuite(SerializeContainerProxyWithScopedAspectsOutOfVmTestCase.class);
+ return suite;
+ }
+
+ public SerializeContainerProxyWithScopedAspectsOutOfVmTestCase(String name)
+ {
+ super(name, new OutOfProcessProxyFileCreator(SerializeContainerProxyWithScopedAspectsDelegate.class.getName()));
+ }
+
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsTest.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsTest.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/SerializeContainerProxyWithScopedAspectsTest.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.proxy;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 64431 $
+ */
+public abstract class SerializeContainerProxyWithScopedAspectsTest extends AbstractSerializeContainerTest
+{
+ public SerializeContainerProxyWithScopedAspectsTest(String name, ProxyFileCreator creator)
+ {
+ super(name, creator);
+ }
+
+ public void testContainerProxy() throws Exception
+ {
+ try
+ {
+ SomeInterface si = getSerializedProxy();
+
+ TestAspect.invoked = false;
+ TestAspect2.invoked = false;
+ TestAspect3.invoked = false;
+ TestAspect4.invoked = false;
+ TestAspect5.invoked = false;
+ si.helloWorld();
+ assertTrue(TestAspect.invoked);
+ assertTrue(TestAspect2.invoked);
+ assertTrue(TestAspect3.invoked);
+ assertTrue(TestAspect4.invoked);
+ assertTrue(TestAspect5.invoked);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect3.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect3.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect3.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -0,0 +1,42 @@
+/*
+* 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.proxy;
+
+import java.io.Serializable;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestAspect3 implements Serializable
+{
+ public static boolean invoked;
+ public Object advice(Invocation inv) throws Throwable
+ {
+ invoked = true;
+ return inv.invokeNext();
+ }
+
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect4.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect4.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect4.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -0,0 +1,42 @@
+/*
+* 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.proxy;
+
+import java.io.Serializable;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestAspect4 implements Serializable
+{
+ public static boolean invoked;
+ public Object advice(Invocation inv) throws Throwable
+ {
+ invoked = true;
+ return inv.invokeNext();
+ }
+
+}
Added: projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect5.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect5.java (rev 0)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/proxy/TestAspect5.java 2008-01-24 19:13:30 UTC (rev 69301)
@@ -0,0 +1,42 @@
+/*
+* 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.proxy;
+
+import java.io.Serializable;
+
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestAspect5 implements Serializable
+{
+ public static boolean invoked;
+ public Object advice(Invocation inv) throws Throwable
+ {
+ invoked = true;
+ return inv.invokeNext();
+ }
+
+}
More information about the jboss-cvs-commits
mailing list