Source Code Cross Referenced for CollectionFieldTest.java in  » Aspect-oriented » aspectwerkz-2.0 » test » staticfield » 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 » Aspect oriented » aspectwerkz 2.0 » test.staticfield 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**************************************************************************************
002:         * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved.                 *
003:         * http://aspectwerkz.codehaus.org                                                    *
004:         * ---------------------------------------------------------------------------------- *
005:         * The software in this package is published under the terms of the LGPL license      *
006:         * a copy of which has been included with this distribution in the license.txt file.  *
007:         **************************************************************************************/package test.staticfield;
008:
009:        import junit.framework.TestCase;
010:
011:        import java.util.ArrayList;
012:        import java.util.Collection;
013:
014:        /**
015:         * Test case for AW-92 for collection field altered
016:         *
017:         * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
018:         */
019:        public class CollectionFieldTest extends TestCase {
020:            public static String s_log = "";
021:
022:            private static Collection s_field = new ArrayList();
023:
024:            private Collection m_field = new ArrayList();
025:
026:            //-- member field --//
027:            public void testCollectionFieldOutsideStaticContext() {
028:                s_log = "";
029:                alterFieldOutsideStaticContext();
030:                assertEquals("MyPreAdvice2 ", s_log);
031:            }
032:
033:            public void testCollectionFieldInsideStaticContext() {
034:                s_log = "";
035:                alterFieldInsideStaticContext(this );
036:                assertEquals("MyPreAdvice2 ", s_log);
037:            }
038:
039:            public void testGetCollectionFieldOusideStaticContext() {
040:                s_log = "";
041:                getFieldOutsideStaticContext();
042:                assertEquals("MyPostAdvice2 MyPreAdvice2 ", s_log);
043:            }
044:
045:            public void testGetCollectionFieldInsideStaticContext() {
046:                s_log = "";
047:                getFieldInsideStaticContext(this );
048:                assertEquals("MyPostAdvice2 MyPreAdvice2 ", s_log);
049:            }
050:
051:            //-- static field --//
052:            public void testStaticCollectionFieldOutsideStaticContext() {
053:                s_log = "";
054:                alterStaticFieldOutsideStaticContext();
055:                assertEquals("MyPreAdvice1 ", s_log);
056:            }
057:
058:            public void testStaticCollectionFieldInsideStaticContext() {
059:                s_log = "";
060:                alterStaticFieldInsideStaticContext();
061:                assertEquals("MyPreAdvice1 ", s_log);
062:            }
063:
064:            public void testGetStaticCollectionFieldInsideStaticContext() {
065:                s_log = "";
066:                getStaticFieldInsideStaticContext();
067:                assertEquals("MyPostAdvice1 MyPreAdvice1 ", s_log);
068:            }
069:
070:            public void testGetStaticCollectionFieldOutsideStaticContext() {
071:                s_log = "";
072:                getStaticFieldOutsideStaticContext();
073:                assertEquals("MyPostAdvice1 MyPreAdvice1 ", s_log);
074:            }
075:
076:            // -- methods for member collection field -- //
077:            public void alterFieldOutsideStaticContext() {
078:                m_field.clear();
079:            }
080:
081:            public static void alterFieldInsideStaticContext(
082:                    CollectionFieldTest myself) {
083:                myself.m_field.clear();
084:            }
085:
086:            public void getFieldOutsideStaticContext() {
087:                Collection ref = m_field;
088:                m_field = new ArrayList();
089:            }
090:
091:            public static void getFieldInsideStaticContext(
092:                    CollectionFieldTest myself) {
093:                Collection ref = myself.m_field;
094:                myself.m_field = new ArrayList();
095:            }
096:
097:            // -- method for static member collection -- //
098:            public void alterStaticFieldOutsideStaticContext() {
099:                s_field.clear();
100:            }
101:
102:            public static void alterStaticFieldInsideStaticContext() {
103:                s_field.clear();
104:            }
105:
106:            public void getStaticFieldOutsideStaticContext() {
107:                Collection ref = s_field;
108:                s_field = new ArrayList();
109:            }
110:
111:            public static void getStaticFieldInsideStaticContext() {
112:                Collection ref = s_field;
113:                s_field = new ArrayList();
114:            }
115:
116:            //-- check the bytecode created FYI. That's fun here. --//
117:            public void showComplexUsage() {
118:                int local = 0;
119:                while (m_field.remove(null)) {
120:                    local++;
121:                }
122:            }
123:
124:            //-- junit hooks --//
125:            public static void main(String[] args) {
126:                junit.textui.TestRunner.run(suite());
127:            }
128:
129:            public static junit.framework.Test suite() {
130:                return new junit.framework.TestSuite(CollectionFieldTest.class);
131:            }
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.