Re: [aspectwerkz-user] Advice weaving problem when using hot deployment w/ annotation
Alexandru Popescu <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [quote Alexandre Vasseur::on 3/24/2005 10:28 AM] > Hi Vincent > > Your project does not contain any aop.xml file. > Even with hot deployment, one such file must be there. > In that file you have two options: > - declare the aspect that you will hotdeploy / undeploy (deployed at > startup) using the usual <aspect class=../> > - declare a <deployment-scope where you say : at that place I do allow > aspect deployment / undeployment (whatever the aspect is) > > If you are using a deployment-scope, you can then use the Deployer API > to deploy at that scope. There should be some sample around else it is > probably like that : > SystemDefinitionContainer.getDefinition(uuid, > ClassLoader).getDeploymentScope(scopeName) > > There is no hotswap occuring in your current app, since the scope was > empty and there was no aspect declared. > Also, does the maven build magic handle AnnotationC ? > (PS: can't you play with Java 5 - that s much easier) > > Alex > > > On Wed, 23 Mar 2005 23:20:54 +0100, Vincent Massol <[email protected]> wrote: >> Hi there, >> >> I'm trying to test hot deployment of aspects using annotations but there's >> something I don't understand. The problem at execution is that there are no >> errors as if the weaving does not occur. I can see that the Aspects are >> loaded as I get the following in the console: >> >> Deployer::INFO - deploying aspect [org.apache.cactus2.SampleTest] in class >> loader [sun.misc.Launcher$AppClassLoader@53ba3d] >> Deployer::INFO - undeploying aspect [org.apache.cactus2.SampleTest] from >> class loader [sun.misc.Launcher$AppClassLoader@53ba3d] >> >> But there should also be "it works" printed on the console >> >> I have 3 very simple classes: >> >> public class CactusTestSetup extends TestSetup >> { >> private Test wrappedTest; >> private DeploymentHandle deploymentHandle; >> >> public CactusTestSetup(Test test) >> { >> super(test); >> this.wrappedTest = test; >> } >> >> public void setUp() >> { >> this.deploymentHandle = >> Deployer.deploy(this.wrappedTest.getClass()); >> } >> >> public void tearDown() >> { >> Deployer.undeploy(this.deploymentHandle); >> } >> } >> >> public class Sample >> { >> private int counter = 0; >> >> public void doGet() >> { >> counter++; >> } >> >> public int getCounter() >> { >> return this.counter; >> } >> } >> >> public class SampleTest extends TestCase >> { >> public SampleTest(String name) >> { >> super(name); >> } >> >> public static Test suite() >> { >> TestSuite suite = new TestSuite(); >> suite.addTest( >> new CactusTestSetup(new SampleTest("testMethodToTest"))); >> return suite; >> } >> >> /** >> * @Around("execution(public void org.apache.cactus2.Sample.doGet(..))") >> */ >> public void redirect(JoinPoint jp) throws Throwable >> { >> System.out.println("it works"); >> } >> >> public void testMethodToTest() >> { >> Sample sample = new Sample(); >> sample.doGet(); >> assertEquals(0, sample.getCounter()); >> } >> } >> >> I know that I'm also supposed to have the AspectWerkz native library in my >> path and I was expecting to get some failure because I don't have them yet. >> I guess I should try adding them but still this is puzzling me. >> >> Thanks >> -Vincent >> >> > Oke, I see Alex already took a look at this. - -- :alex |.::the_mindstorm::.| -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (MingW32) iD8DBQFCQn8WOCPjdDT2FEURAuoZAKC4M3jk6tq+2wQaxXb75JkwbrZKUgCfRTM1 VlNW1dWI0qf3L1S1GRU3z4Q= =pccv -----END PGP SIGNATURE-----