Source Code Cross Referenced for CtorExecution.java in  » Aspect-oriented » aspectwerkz-2.0 » test » 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 
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;
008:
009:        import junit.framework.TestCase;
010:        import org.codehaus.aspectwerkz.annotation.Before;
011:        import org.codehaus.aspectwerkz.annotation.Around;
012:        import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint;
013:        import org.codehaus.aspectwerkz.transform.inlining.weaver.SerialVersionUidVisitor;
014:
015:        import java.io.Serializable;
016:        import java.lang.reflect.Field;
017:
018:        /**
019:         * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
020:         */
021:        public class CtorExecution extends TestCase implements  Serializable {
022:
023:            static int s_count = 0;
024:
025:            public CtorExecution m_ref;
026:
027:            public int m_i;// = 1;
028:
029:            public CtorExecution(CtorExecution ref) {
030:                postInit(this );
031:                //m_ref = ref;
032:            }
033:
034:            static void postInit(CtorExecution target) {
035:                ;
036:            }
037:
038:            public CtorExecution() {
039:                // tricky INVOKESPECIAL indexing
040:                this (new CtorExecution((CtorExecution) null));
041:                new CtorExecution((CtorExecution) null);
042:                postInit(this );
043:            }
044:
045:            public CtorExecution(String s) {
046:                // tricky INVOKESPECIAL indexing
047:                // and tricky new CtorExecution() call before instance initialization
048:                // and tricky method call before instance initialization
049:                super ((new CtorExecution()).string(s));
050:                (new CtorExecution()).string(s);
051:            }
052:
053:            public CtorExecution(int i) {
054:                // tricky field get and set before instance initialization
055:                super ("" + (new CtorExecution()).m_i++);
056:                (new CtorExecution()).m_i++;
057:            }
058:
059:            public String string(String s) {
060:                return s;
061:            }
062:
063:            public void testSome() {
064:                s_count = 0;
065:                CtorExecution me = new CtorExecution();
066:                me = new CtorExecution(me);
067:                me = new CtorExecution("foo");
068:                me = new CtorExecution(2);
069:                assertEquals(116, s_count);// don't know if it is the right number but decompiled seems ok..
070:            }
071:
072:            public void testSerialVer() throws Throwable {
073:                Class x = CtorExecution.class;
074:                long l = SerialVersionUidVisitor.calculateSerialVersionUID(x);
075:                // uncomment me and turn off weaver to compute the expected serialVerUID
076:                //System.out.println(l);
077:
078:                Field f = x.getDeclaredField("serialVersionUID");
079:                long uid = ((Long) f.get(null)).longValue();
080:                //System.out.println(uid);
081:                assertEquals(3813928159352352835L, uid);
082:            }
083:
084:            public static class Aspect {
085:                @Before("within(test.CtorExecution)")
086:                void before(StaticJoinPoint sjp) {
087:                    s_count++;
088:                    //System.err.println(sjp.getSignature());
089:                }
090:
091:                @Around("execution(test.CtorExecution.new(..))" + " || (call(test.CtorExecution.new(..)) && within(test.CtorExecution))")
092:                Object around(StaticJoinPoint sjp) throws Throwable {
093:                    s_count++;
094:                    //System.out.println(sjp.getSignature());
095:                    return sjp.proceed();
096:                }
097:
098:            }
099:
100:            public static void main(String[] args) {
101:                junit.textui.TestRunner.run(suite());
102:            }
103:
104:            public static junit.framework.Test suite() {
105:                return new junit.framework.TestSuite(CtorExecution.class);
106:            }
107:
108:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.