01: /**************************************************************************************
02: * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package test.deployment;
08:
09: import junit.framework.TestCase;
10: import test.annotation.DefaultValueTest;
11: import org.codehaus.aspectwerkz.transform.inlining.deployer.Deployer;
12:
13: /**
14: * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
15: */
16: public class HotDeployedTest extends TestCase {
17:
18: static int HIT = 0;
19:
20: public void target() {
21: HIT++;
22: }
23:
24: public void testDeployment() {
25: // is deployed from beginning
26: target();
27: assertEquals(1, HIT);
28: assertEquals(1, HotdeployableAspect.HIT);
29:
30: // undeploy
31: Deployer.undeploy(HotdeployableAspect.class);
32:
33: target();
34: assertEquals(2, HIT);
35: assertEquals(1, HotdeployableAspect.HIT);
36:
37: // redeploy
38: Deployer.deploy(HotdeployableAspect.class);
39: target();
40: assertEquals(3, HIT);
41: assertEquals(2, HotdeployableAspect.HIT);
42: }
43:
44: public static void main(String[] args) {
45: junit.textui.TestRunner.run(suite());
46: }
47:
48: public static junit.framework.Test suite() {
49: return new junit.framework.TestSuite(HotDeployedTest.class);
50: }
51:
52: }
|