Source Code Cross Referenced for StaticMembersTest.java in  » Byte-Code » PROSE » ch » ethz » prose » crosscut » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Byte Code » PROSE » ch.ethz.prose.crosscut 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //$Id$
002:        //=====================================================================
003:        //
004:        //(history at end)
005:        //
006:
007:        package ch.ethz.prose.crosscut;
008:
009:        import junit.framework.TestCase;
010:        import ch.ethz.prose.*;
011:        import ch.ethz.prose.filter.*;
012:
013:        /**
014:         * Cross-cut static members.
015:         * 
016:         * @version $Revision$
017:         * @author Johann Gyger
018:         */
019:        public class StaticMembersTest extends TestCase {
020:
021:            public static int value;
022:
023:            protected static boolean crosscutted;
024:
025:            public static int getValue() {
026:                return value;
027:            }
028:
029:            public static void setValue(int newValue) {
030:                value = newValue;
031:            }
032:
033:            public StaticMembersTest(String name) {
034:                super (name);
035:            }
036:
037:            protected void setUp() throws SystemStartupException {
038:                ProseSystem.startup();
039:                crosscutted = false;
040:            }
041:
042:            protected void tearDown() throws SystemTeardownException {
043:                ProseSystem.teardown();
044:            }
045:
046:            public void test_010_static_getcut() {
047:                ProseSystem.getAspectManager().insert(new Get());
048:                getValue();
049:                assertTrue("Static field `value' is crosscutted by a GetCut",
050:                        crosscutted);
051:            }
052:
053:            public void test_020_static_setcut() {
054:                ProseSystem.getAspectManager().insert(new Set());
055:                setValue(42);
056:                assertTrue("Static field `value' is crosscutted by a SetCut",
057:                        crosscutted);
058:            }
059:
060:            public void test_030_static_methodcut_entry() {
061:                ProseSystem.getAspectManager().insert(new MethodBefore());
062:                getValue();
063:                assertTrue(
064:                        "Static method `getValue' is crosscutted by a MethodCut (before)",
065:                        crosscutted);
066:            }
067:
068:            public void test_040_static_methodcut_exit() {
069:                ProseSystem.getAspectManager().insert(new MethodAfter());
070:                getValue();
071:                assertTrue(
072:                        "Static method `getValue' is crosscutted by a MethodCut (after)",
073:                        crosscutted);
074:            }
075:
076:            public static class Get extends DefaultAspect {
077:                public Crosscut c = new GetCut() {
078:                    public void GET_ARGS(StaticMembersTest c, int v) {
079:                        crosscutted = true;
080:                    }
081:
082:                    protected PointCutter pointCutter() {
083:                        return Fields.named("value");
084:                    }
085:
086:                    protected Class[] potentialCrosscutClasses() {
087:                        return new Class[] { StaticMembersTest.class };
088:                    }
089:                };
090:            };
091:
092:            public static class Set extends DefaultAspect {
093:                public Crosscut c = new SetCut() {
094:                    public void SET_ARGS(StaticMembersTest c, int v) {
095:                        crosscutted = true;
096:                    }
097:
098:                    protected PointCutter pointCutter() {
099:                        return Fields.named("value");
100:                    }
101:
102:                    protected Class[] potentialCrosscutClasses() {
103:                        return new Class[] { StaticMembersTest.class };
104:                    }
105:                };
106:            };
107:
108:            public static class MethodBefore extends DefaultAspect {
109:                public Crosscut c = new MethodCut() {
110:                    public void METHOD_ARGS(StaticMembersTest c) {
111:                        crosscutted = true;
112:                    }
113:
114:                    protected PointCutter pointCutter() {
115:                        return Within.method("getValue").AND(
116:                                Executions.before());
117:                    }
118:
119:                    protected Class[] potentialCrosscutClasses() {
120:                        return new Class[] { StaticMembersTest.class };
121:                    }
122:                };
123:            };
124:
125:            public static class MethodAfter extends DefaultAspect {
126:                public Crosscut c = new MethodCut() {
127:                    public void METHOD_ARGS(StaticMembersTest c) {
128:                        crosscutted = true;
129:                    }
130:
131:                    protected PointCutter pointCutter() {
132:                        return Within.method("getValue")
133:                                .AND(Executions.after());
134:                    }
135:
136:                    protected Class[] potentialCrosscutClasses() {
137:                        return new Class[] { StaticMembersTest.class };
138:                    }
139:                };
140:            };
141:        }
142:
143:        //======================================================================
144:        //
145:        // $Log$
146:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.