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 Vincent Massol::on 3/24/2005 12:20 AM]
> 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
> 
> 
> 
Hi Vincent!

How have you started your test? What aw version?

- --
:alex |.::the_mindstorm::.|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCQfXwOCPjdDT2FEURAhgBAJ9Xs57apppzu8Dn75WNPGtU7KNryACghnHw
YzF7X5f53GFmvBUFHeVSw8c=
=MzCS
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.