Source Code Cross Referenced for PhysicalInstrumentedMethodsTestApp.java in  » Net » Terracotta » com » tctest » 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 » Net » Terracotta » com.tctest 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice.  All rights reserved.
0003:         */
0004:        package com.tctest;
0005:
0006:        import EDU.oswego.cs.dl.util.concurrent.CyclicBarrier;
0007:
0008:        import com.tc.object.TCObject;
0009:        import com.tc.object.bytecode.ClassAdapterBase;
0010:        import com.tc.object.bytecode.TransparentAccess;
0011:        import com.tc.object.config.ConfigVisitor;
0012:        import com.tc.object.config.DSOClientConfigHelper;
0013:        import com.tc.object.config.TransparencyClassSpec;
0014:        import com.tc.simulator.app.ApplicationConfig;
0015:        import com.tc.simulator.listener.ListenerProvider;
0016:        import com.tc.util.Assert;
0017:        import com.tctest.runner.AbstractTransparentApp;
0018:
0019:        import java.lang.reflect.Field;
0020:        import java.lang.reflect.Method;
0021:        import java.util.HashMap;
0022:        import java.util.HashSet;
0023:        import java.util.Iterator;
0024:        import java.util.LinkedHashMap;
0025:        import java.util.LinkedHashSet;
0026:        import java.util.Map;
0027:        import java.util.Set;
0028:        import java.util.Map.Entry;
0029:
0030:        public class PhysicalInstrumentedMethodsTestApp extends
0031:                AbstractTransparentApp {
0032:
0033:            private final CyclicBarrier barrier;
0034:
0035:            private TestSubSubClass subRoot;
0036:
0037:            public PhysicalInstrumentedMethodsTestApp(String appId,
0038:                    ApplicationConfig cfg, ListenerProvider listenerProvider) {
0039:                super (appId, cfg, listenerProvider);
0040:                barrier = new CyclicBarrier(getParticipantCount());
0041:            }
0042:
0043:            public void run() {
0044:                try {
0045:                    int index = barrier.barrier();
0046:
0047:                    validateGenerateTCObjectFieldAndMethod(index);
0048:
0049:                    if (index == 0) {
0050:                        subRoot = new TestSubSubClass();
0051:                    }
0052:
0053:                    barrier.barrier();
0054:
0055:                    fieldSettingTest(index);
0056:                    fieldGettingTest(index);
0057:                } catch (Throwable t) {
0058:                    notifyError(t);
0059:                }
0060:            }
0061:
0062:            private void validateGenerateTCObjectFieldAndMethod(int index) {
0063:                if (index == 0) {
0064:                    validateGeneratedTCObjectField();
0065:                    validateGeneratedTCObjectMethod();
0066:                }
0067:            }
0068:
0069:            private void validateGeneratedTCObjectField() {
0070:                Field f = null;
0071:                try {
0072:                    f = TestParentClass.class
0073:                            .getDeclaredField(ClassAdapterBase.MANAGED_FIELD_NAME);
0074:                    Assert.assertNotNull(f);
0075:                } catch (NoSuchFieldException e) {
0076:                    throw new AssertionError(
0077:                            "TestParentClass.class does not contain field "
0078:                                    + ClassAdapterBase.MANAGED_FIELD_NAME);
0079:                }
0080:
0081:                try {
0082:                    f = TestSubClass.class
0083:                            .getDeclaredField(ClassAdapterBase.MANAGED_FIELD_NAME);
0084:                    throw new AssertionError(
0085:                            "Should have thrown an NoSuchFieldException.");
0086:                } catch (NoSuchFieldException e) {
0087:                    // ignore Exception
0088:                }
0089:
0090:                try {
0091:                    f = TestSubSubClass.class
0092:                            .getDeclaredField(ClassAdapterBase.MANAGED_FIELD_NAME);
0093:                    throw new AssertionError(
0094:                            "Should have thrown an NoSuchFieldException.");
0095:                } catch (NoSuchFieldException e) {
0096:                    // ignore Exception
0097:                }
0098:            }
0099:
0100:            private void validateGeneratedTCObjectMethod() {
0101:                try {
0102:                    TestParentClass.class.getDeclaredMethod(
0103:                            ClassAdapterBase.MANAGED_METHOD,
0104:                            new Class[] { TCObject.class });
0105:                } catch (NoSuchMethodException e) {
0106:                    throw new AssertionError(
0107:                            "TestParentClass.class does not contain method "
0108:                                    + ClassAdapterBase.MANAGED_METHOD);
0109:                }
0110:
0111:                try {
0112:                    TestSubClass.class.getDeclaredMethod(
0113:                            ClassAdapterBase.MANAGED_METHOD,
0114:                            new Class[] { TCObject.class });
0115:                    throw new AssertionError(
0116:                            "Should have thrown a NoSuchMethodException.");
0117:                } catch (NoSuchMethodException e) {
0118:                    // ignore
0119:                }
0120:
0121:                try {
0122:                    TestSubSubClass.class.getDeclaredMethod(
0123:                            ClassAdapterBase.MANAGED_METHOD,
0124:                            new Class[] { TCObject.class });
0125:                    throw new AssertionError(
0126:                            "Should have thrown a NoSuchMethodException.");
0127:                } catch (NoSuchMethodException e) {
0128:                    // ignore
0129:                }
0130:
0131:            }
0132:
0133:            private void fieldSettingTest(int index) throws Exception {
0134:                subClassFieldUnManagedSettingUsingReflectionTest(index);
0135:                subClassFieldUnManagedSettingTest(index);
0136:                subClassFieldManagedSettingUsingReflectionTest(index);
0137:                subClassFieldManagedSettingTest(index);
0138:            }
0139:
0140:            private void fieldGettingTest(int index) throws Exception {
0141:                subClassAllFieldsUnManagedGettingTest(index);
0142:                subClassAllFieldsUnManagedGettingUsingReflectionTest(index);
0143:                subClassAllFieldsManagedGettingTest(index);
0144:                subClassAllFieldsManagedGettingUsingReflectionTest(index);
0145:            }
0146:
0147:            private void clear() throws Exception {
0148:                synchronized (subRoot) {
0149:                    subRoot.clear();
0150:                }
0151:
0152:                barrier.barrier();
0153:            }
0154:
0155:            private void subClassFieldUnManagedSettingUsingReflectionTest(
0156:                    int index) throws Exception {
0157:                clear();
0158:
0159:                Set referenceSet = new HashSet();
0160:                referenceSet.add("first element");
0161:                referenceSet.add("second element");
0162:
0163:                Map referenceMap = new HashMap();
0164:                referenceMap.put("first key", "first element");
0165:                referenceMap.put("second key", "second element");
0166:
0167:                int[] referenceArray = new int[] { 1, 2 };
0168:
0169:                synchronized (subRoot) {
0170:                    if (index == 0) {
0171:                        Class subRootClass = subRoot.getClass();
0172:
0173:                        // __tc_setfield will not notify the other clients.
0174:                        Method m = subRootClass.getDeclaredMethod(
0175:                                "__tc_setfield", new Class[] { String.class,
0176:                                        Object.class });
0177:                        m
0178:                                .invoke(
0179:                                        subRoot,
0180:                                        new Object[] {
0181:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField",
0182:                                                new Integer(2) });
0183:                        m
0184:                                .invoke(
0185:                                        subRoot,
0186:                                        new Object[] {
0187:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField",
0188:                                                new Integer(7) });
0189:                        m
0190:                                .invoke(
0191:                                        subRoot,
0192:                                        new Object[] {
0193:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField",
0194:                                                new Integer(4) });
0195:                        m
0196:                                .invoke(
0197:                                        subRoot,
0198:                                        new Object[] {
0199:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField",
0200:                                                referenceSet });
0201:                        m
0202:                                .invoke(
0203:                                        subRoot,
0204:                                        new Object[] {
0205:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField",
0206:                                                "testString" });
0207:                        m
0208:                                .invoke(
0209:                                        subRoot,
0210:                                        new Object[] {
0211:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField",
0212:                                                new Integer(5) });
0213:                        m
0214:                                .invoke(
0215:                                        subRoot,
0216:                                        new Object[] {
0217:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField",
0218:                                                referenceMap });
0219:                        m
0220:                                .invoke(
0221:                                        subRoot,
0222:                                        new Object[] {
0223:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField",
0224:                                                referenceArray });
0225:
0226:                        // This setting should do nothing.
0227:                        m
0228:                                .invoke(
0229:                                        subRoot,
0230:                                        new Object[] {
0231:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0",
0232:                                                null });
0233:                        TransparentAccess ta = (TransparentAccess) subRoot;
0234:                        Assert
0235:                                .assertNotNull(ta
0236:                                        .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0"));
0237:
0238:                        Assert.assertEquals(2, subRoot.getGrandChildIntField());
0239:                        Assert.assertEquals(new Integer(7), subRoot
0240:                                .getGrandChildObjectField());
0241:                        Assert.assertEquals(4, subRoot.getChildIntField());
0242:                        assertSetsEqual(referenceSet, subRoot
0243:                                .getChildSetField());
0244:                        Assert.assertEquals("testString", subRoot
0245:                                .getChildStringField());
0246:
0247:                        Assert.assertEquals(5, subRoot.getParentIntField());
0248:                        assertMappings(referenceMap, subRoot
0249:                                .getParentMapField());
0250:                        assertIntegerArray(referenceArray, subRoot
0251:                                .getParentArrayField());
0252:
0253:                    }
0254:                }
0255:                barrier.barrier();
0256:            }
0257:
0258:            private void subClassFieldUnManagedSettingTest(int index)
0259:                    throws Exception {
0260:                clear();
0261:
0262:                Set referenceSet = new HashSet();
0263:                referenceSet.add("first element");
0264:                referenceSet.add("second element");
0265:
0266:                Map referenceMap = new HashMap();
0267:                referenceMap.put("first key", "first element");
0268:                referenceMap.put("second key", "second element");
0269:
0270:                int[] referenceArray = new int[] { 1, 2 };
0271:
0272:                synchronized (subRoot) {
0273:                    if (index == 0) {
0274:                        TransparentAccess ta = (TransparentAccess) subRoot;
0275:
0276:                        // __tc_setfield will not notify the other clients.
0277:                        ta
0278:                                .__tc_setfield(
0279:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField",
0280:                                        new Integer(2));
0281:                        ta
0282:                                .__tc_setfield(
0283:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField",
0284:                                        new Integer(7));
0285:                        ta
0286:                                .__tc_setfield(
0287:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField",
0288:                                        new Integer(4));
0289:                        ta
0290:                                .__tc_setfield(
0291:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField",
0292:                                        referenceSet);
0293:                        ta
0294:                                .__tc_setfield(
0295:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField",
0296:                                        "testString");
0297:                        ta
0298:                                .__tc_setfield(
0299:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField",
0300:                                        new Integer(5));
0301:                        ta
0302:                                .__tc_setfield(
0303:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField",
0304:                                        referenceMap);
0305:                        ta
0306:                                .__tc_setfield(
0307:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField",
0308:                                        referenceArray);
0309:
0310:                        // This setting should do nothing.
0311:                        ta
0312:                                .__tc_setfield(
0313:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0",
0314:                                        null);
0315:
0316:                        Assert
0317:                                .assertNotNull(ta
0318:                                        .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0"));
0319:
0320:                        Assert.assertEquals(2, subRoot.getGrandChildIntField());
0321:                        Assert.assertEquals(new Integer(7), subRoot
0322:                                .getGrandChildObjectField());
0323:                        Assert.assertEquals(4, subRoot.getChildIntField());
0324:                        assertSetsEqual(referenceSet, subRoot
0325:                                .getChildSetField());
0326:                        Assert.assertEquals("testString", subRoot
0327:                                .getChildStringField());
0328:
0329:                        Assert.assertEquals(5, subRoot.getParentIntField());
0330:                        assertMappings(referenceMap, subRoot
0331:                                .getParentMapField());
0332:                        assertIntegerArray(referenceArray, subRoot
0333:                                .getParentArrayField());
0334:                    }
0335:                }
0336:                barrier.barrier();
0337:            }
0338:
0339:            private void subClassFieldManagedSettingUsingReflectionTest(
0340:                    int index) throws Exception {
0341:                clear();
0342:
0343:                Set referenceSet = new HashSet();
0344:                referenceSet.add("first element");
0345:                referenceSet.add("second element");
0346:
0347:                Map referenceMap = new HashMap();
0348:                referenceMap.put("first key", "first element");
0349:                referenceMap.put("second key", "second element");
0350:
0351:                int[] referenceArray = new int[] { 1, 2 };
0352:
0353:                synchronized (subRoot) {
0354:                    if (index == 0) {
0355:                        Class subRootClass = subRoot.getClass();
0356:
0357:                        Method m = subRootClass.getDeclaredMethod(
0358:                                "__tc_setmanagedfield", new Class[] {
0359:                                        String.class, Object.class });
0360:                        m
0361:                                .invoke(
0362:                                        subRoot,
0363:                                        new Object[] {
0364:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField",
0365:                                                new Integer(2) });
0366:                        m
0367:                                .invoke(
0368:                                        subRoot,
0369:                                        new Object[] {
0370:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField",
0371:                                                new Integer(7) });
0372:                        m
0373:                                .invoke(
0374:                                        subRoot,
0375:                                        new Object[] {
0376:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField",
0377:                                                new Integer(4) });
0378:                        m
0379:                                .invoke(
0380:                                        subRoot,
0381:                                        new Object[] {
0382:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField",
0383:                                                referenceSet });
0384:                        m
0385:                                .invoke(
0386:                                        subRoot,
0387:                                        new Object[] {
0388:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField",
0389:                                                "testString" });
0390:                        m
0391:                                .invoke(
0392:                                        subRoot,
0393:                                        new Object[] {
0394:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField",
0395:                                                new Integer(5) });
0396:                        m
0397:                                .invoke(
0398:                                        subRoot,
0399:                                        new Object[] {
0400:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField",
0401:                                                referenceMap });
0402:                        m
0403:                                .invoke(
0404:                                        subRoot,
0405:                                        new Object[] {
0406:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField",
0407:                                                referenceArray });
0408:
0409:                        // This setting should do nothing.
0410:                        m
0411:                                .invoke(
0412:                                        subRoot,
0413:                                        new Object[] {
0414:                                                "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0",
0415:                                                null });
0416:                    }
0417:                }
0418:
0419:                barrier.barrier();
0420:
0421:                TransparentAccess ta = (TransparentAccess) subRoot;
0422:                Assert
0423:                        .assertNotNull(ta
0424:                                .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0"));
0425:
0426:                Assert.assertEquals(2, subRoot.getGrandChildIntField());
0427:                Assert.assertEquals(new Integer(7), subRoot
0428:                        .getGrandChildObjectField());
0429:                Assert.assertEquals(4, subRoot.getChildIntField());
0430:                assertSetsEqual(referenceSet, subRoot.getChildSetField());
0431:                Assert
0432:                        .assertEquals("testString", subRoot
0433:                                .getChildStringField());
0434:
0435:                Assert.assertEquals(5, subRoot.getParentIntField());
0436:                assertMappings(referenceMap, subRoot.getParentMapField());
0437:                assertIntegerArray(referenceArray, subRoot
0438:                        .getParentArrayField());
0439:
0440:                barrier.barrier();
0441:            }
0442:
0443:            private void subClassFieldManagedSettingTest(int index)
0444:                    throws Exception {
0445:                clear();
0446:
0447:                Set referenceSet = new HashSet();
0448:                referenceSet.add("first element");
0449:                referenceSet.add("second element");
0450:
0451:                Map referenceMap = new HashMap();
0452:                referenceMap.put("first key", "first element");
0453:                referenceMap.put("second key", "second element");
0454:
0455:                int[] referenceArray = new int[] { 1, 2 };
0456:                TransparentAccess ta = (TransparentAccess) subRoot;
0457:
0458:                synchronized (subRoot) {
0459:                    if (index == 0) {
0460:                        ta
0461:                                .__tc_setmanagedfield(
0462:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField",
0463:                                        new Integer(2));
0464:                        ta
0465:                                .__tc_setmanagedfield(
0466:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField",
0467:                                        new Integer(7));
0468:                        ta
0469:                                .__tc_setmanagedfield(
0470:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField",
0471:                                        new Integer(4));
0472:                        ta
0473:                                .__tc_setmanagedfield(
0474:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField",
0475:                                        referenceSet);
0476:                        ta
0477:                                .__tc_setmanagedfield(
0478:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField",
0479:                                        "testString");
0480:                        ta
0481:                                .__tc_setmanagedfield(
0482:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField",
0483:                                        new Integer(5));
0484:                        ta
0485:                                .__tc_setmanagedfield(
0486:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField",
0487:                                        referenceMap);
0488:                        ta
0489:                                .__tc_setmanagedfield(
0490:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField",
0491:                                        referenceArray);
0492:
0493:                        // This setting should do nothing.
0494:                        ta
0495:                                .__tc_setmanagedfield(
0496:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0",
0497:                                        null);
0498:                    }
0499:                }
0500:
0501:                barrier.barrier();
0502:
0503:                Assert
0504:                        .assertNotNull(ta
0505:                                .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0"));
0506:
0507:                Assert.assertEquals(2, subRoot.getGrandChildIntField());
0508:                Assert.assertEquals(new Integer(7), subRoot
0509:                        .getGrandChildObjectField());
0510:                Assert.assertEquals(4, subRoot.getChildIntField());
0511:                assertSetsEqual(referenceSet, subRoot.getChildSetField());
0512:                Assert
0513:                        .assertEquals("testString", subRoot
0514:                                .getChildStringField());
0515:
0516:                Assert.assertEquals(5, subRoot.getParentIntField());
0517:                assertMappings(referenceMap, subRoot.getParentMapField());
0518:                assertIntegerArray(referenceArray, subRoot
0519:                        .getParentArrayField());
0520:
0521:                barrier.barrier();
0522:            }
0523:
0524:            private void subClassAllFieldsUnManagedGettingUsingReflectionTest(
0525:                    int index) throws Exception {
0526:                clear();
0527:
0528:                Set referenceSet = new HashSet();
0529:                referenceSet.add("first element");
0530:                referenceSet.add("second element");
0531:
0532:                Map referenceMap = new HashMap();
0533:                referenceMap.put("first key", "first element");
0534:                referenceMap.put("second key", "second element");
0535:
0536:                int[] referenceArray = new int[] { 1, 2 };
0537:
0538:                synchronized (subRoot) {
0539:                    TransparentAccess ta = (TransparentAccess) subRoot;
0540:                    if (index == 0) {
0541:                        ta
0542:                                .__tc_setmanagedfield(
0543:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField",
0544:                                        new Integer(2));
0545:                        ta
0546:                                .__tc_setmanagedfield(
0547:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField",
0548:                                        new Integer(7));
0549:                        ta
0550:                                .__tc_setmanagedfield(
0551:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField",
0552:                                        new Integer(4));
0553:                        ta
0554:                                .__tc_setmanagedfield(
0555:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField",
0556:                                        referenceSet);
0557:                        ta
0558:                                .__tc_setmanagedfield(
0559:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField",
0560:                                        "testString");
0561:                        ta
0562:                                .__tc_setmanagedfield(
0563:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField",
0564:                                        new Integer(5));
0565:                        ta
0566:                                .__tc_setmanagedfield(
0567:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField",
0568:                                        referenceMap);
0569:                        ta
0570:                                .__tc_setmanagedfield(
0571:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField",
0572:                                        referenceArray);
0573:
0574:                        Map map = new HashMap();
0575:                        // __tc_getallfields() will not resolve reference.
0576:                        Class subRootClass = subRoot.getClass();
0577:
0578:                        Method m = subRootClass.getDeclaredMethod(
0579:                                "__tc_getallfields", new Class[] { Map.class });
0580:                        m.invoke(subRoot, new Object[] { map });
0581:
0582:                        Assert
0583:                                .assertEquals(
0584:                                        new Integer(2),
0585:                                        map
0586:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField"));
0587:                        Assert
0588:                                .assertEquals(
0589:                                        new Integer(7),
0590:                                        map
0591:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField"));
0592:                        Assert
0593:                                .assertTrue(this  == map
0594:                                        .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0"));
0595:                        Assert
0596:                                .assertEquals(
0597:                                        4,
0598:                                        ((Integer) map
0599:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField"))
0600:                                                .intValue());
0601:                        assertSetsEqual(
0602:                                referenceSet,
0603:                                (Set) map
0604:                                        .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField"));
0605:                        Assert
0606:                                .assertEquals(
0607:                                        "testString",
0608:                                        map
0609:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField"));
0610:
0611:                        Assert
0612:                                .assertEquals(
0613:                                        5,
0614:                                        ((Integer) map
0615:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField"))
0616:                                                .intValue());
0617:                        assertMappings(
0618:                                referenceMap,
0619:                                (Map) map
0620:                                        .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField"));
0621:                        assertIntegerArray(
0622:                                referenceArray,
0623:                                (int[]) map
0624:                                        .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField"));
0625:
0626:                    }
0627:                }
0628:                barrier.barrier();
0629:            }
0630:
0631:            private void subClassAllFieldsUnManagedGettingTest(int index)
0632:                    throws Exception {
0633:                clear();
0634:
0635:                Set referenceSet = new HashSet();
0636:                referenceSet.add("first element");
0637:                referenceSet.add("second element");
0638:
0639:                Map referenceMap = new HashMap();
0640:                referenceMap.put("first key", "first element");
0641:                referenceMap.put("second key", "second element");
0642:
0643:                int[] referenceArray = new int[] { 1, 2 };
0644:
0645:                synchronized (subRoot) {
0646:                    TransparentAccess ta = (TransparentAccess) subRoot;
0647:                    if (index == 0) {
0648:                        ta
0649:                                .__tc_setmanagedfield(
0650:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField",
0651:                                        new Integer(2));
0652:                        ta
0653:                                .__tc_setmanagedfield(
0654:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField",
0655:                                        new Integer(7));
0656:                        ta
0657:                                .__tc_setmanagedfield(
0658:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField",
0659:                                        new Integer(4));
0660:                        ta
0661:                                .__tc_setmanagedfield(
0662:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField",
0663:                                        referenceSet);
0664:                        ta
0665:                                .__tc_setmanagedfield(
0666:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField",
0667:                                        "testString");
0668:                        ta
0669:                                .__tc_setmanagedfield(
0670:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField",
0671:                                        new Integer(5));
0672:                        ta
0673:                                .__tc_setmanagedfield(
0674:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField",
0675:                                        referenceMap);
0676:                        ta
0677:                                .__tc_setmanagedfield(
0678:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField",
0679:                                        referenceArray);
0680:
0681:                        Map map = new HashMap();
0682:                        // __tc_getallfields() will not resolve reference.
0683:                        ta.__tc_getallfields(map);
0684:                        Assert
0685:                                .assertEquals(
0686:                                        new Integer(2),
0687:                                        map
0688:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField"));
0689:                        Assert
0690:                                .assertEquals(
0691:                                        new Integer(7),
0692:                                        map
0693:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField"));
0694:                        Assert
0695:                                .assertTrue(this  == map
0696:                                        .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0"));
0697:                        Assert
0698:                                .assertEquals(
0699:                                        4,
0700:                                        ((Integer) map
0701:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField"))
0702:                                                .intValue());
0703:                        assertSetsEqual(
0704:                                referenceSet,
0705:                                (Set) map
0706:                                        .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField"));
0707:                        Assert
0708:                                .assertEquals(
0709:                                        "testString",
0710:                                        map
0711:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField"));
0712:
0713:                        Assert
0714:                                .assertEquals(
0715:                                        5,
0716:                                        ((Integer) map
0717:                                                .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField"))
0718:                                                .intValue());
0719:                        assertMappings(
0720:                                referenceMap,
0721:                                (Map) map
0722:                                        .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField"));
0723:                        assertIntegerArray(
0724:                                referenceArray,
0725:                                (int[]) map
0726:                                        .get("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField"));
0727:
0728:                    }
0729:                }
0730:                barrier.barrier();
0731:            }
0732:
0733:            private void subClassAllFieldsManagedGettingUsingReflectionTest(
0734:                    int index) throws Exception {
0735:                clear();
0736:
0737:                Set referenceSet = new HashSet();
0738:                referenceSet.add("first element");
0739:                referenceSet.add("second element");
0740:
0741:                Map referenceMap = new HashMap();
0742:                referenceMap.put("first key", "first element");
0743:                referenceMap.put("second key", "second element");
0744:
0745:                int[] referenceArray = new int[] { 1, 2 };
0746:
0747:                synchronized (subRoot) {
0748:                    TransparentAccess ta = (TransparentAccess) subRoot;
0749:                    if (index == 0) {
0750:                        ta
0751:                                .__tc_setmanagedfield(
0752:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField",
0753:                                        new Integer(2));
0754:                        ta
0755:                                .__tc_setmanagedfield(
0756:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField",
0757:                                        new Integer(7));
0758:                        ta
0759:                                .__tc_setmanagedfield(
0760:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField",
0761:                                        new Integer(4));
0762:                        ta
0763:                                .__tc_setmanagedfield(
0764:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField",
0765:                                        referenceSet);
0766:                        ta
0767:                                .__tc_setmanagedfield(
0768:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField",
0769:                                        "testString");
0770:                        ta
0771:                                .__tc_setmanagedfield(
0772:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField",
0773:                                        new Integer(5));
0774:                        ta
0775:                                .__tc_setmanagedfield(
0776:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField",
0777:                                        referenceMap);
0778:                        ta
0779:                                .__tc_setmanagedfield(
0780:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField",
0781:                                        referenceArray);
0782:                    }
0783:                }
0784:
0785:                barrier.barrier();
0786:
0787:                Class subRootClass = subRoot.getClass();
0788:
0789:                Method m = subRootClass.getDeclaredMethod(
0790:                        "__tc_getmanagedfield", new Class[] { String.class });
0791:                Assert
0792:                        .assertEquals(
0793:                                2,
0794:                                ((Integer) m
0795:                                        .invoke(
0796:                                                subRoot,
0797:                                                new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField" }))
0798:                                        .intValue());
0799:                Assert
0800:                        .assertEquals(
0801:                                7,
0802:                                ((Integer) m
0803:                                        .invoke(
0804:                                                subRoot,
0805:                                                new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField" }))
0806:                                        .intValue());
0807:                Assert
0808:                        .assertNotNull(m
0809:                                .invoke(
0810:                                        subRoot,
0811:                                        new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0" }));
0812:                if (index == 0) {
0813:                    Assert
0814:                            .assertTrue(this  == m
0815:                                    .invoke(
0816:                                            subRoot,
0817:                                            new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0" }));
0818:                }
0819:                Assert
0820:                        .assertEquals(
0821:                                4,
0822:                                ((Integer) m
0823:                                        .invoke(
0824:                                                subRoot,
0825:                                                new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField" }))
0826:                                        .intValue());
0827:                assertSetsEqual(
0828:                        referenceSet,
0829:                        (Set) m
0830:                                .invoke(
0831:                                        subRoot,
0832:                                        new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField" }));
0833:                Assert
0834:                        .assertEquals(
0835:                                "testString",
0836:                                m
0837:                                        .invoke(
0838:                                                subRoot,
0839:                                                new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField" }));
0840:                Assert
0841:                        .assertEquals(
0842:                                5,
0843:                                ((Integer) m
0844:                                        .invoke(
0845:                                                subRoot,
0846:                                                new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField" }))
0847:                                        .intValue());
0848:                assertMappings(
0849:                        referenceMap,
0850:                        (Map) m
0851:                                .invoke(
0852:                                        subRoot,
0853:                                        new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField" }));
0854:                assertIntegerArray(
0855:                        referenceArray,
0856:                        (int[]) m
0857:                                .invoke(
0858:                                        subRoot,
0859:                                        new Object[] { "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField" }));
0860:
0861:                barrier.barrier();
0862:            }
0863:
0864:            private void subClassAllFieldsManagedGettingTest(int index)
0865:                    throws Exception {
0866:                clear();
0867:
0868:                Set referenceSet = new HashSet();
0869:                referenceSet.add("first element");
0870:                referenceSet.add("second element");
0871:
0872:                Map referenceMap = new HashMap();
0873:                referenceMap.put("first key", "first element");
0874:                referenceMap.put("second key", "second element");
0875:
0876:                int[] referenceArray = new int[] { 1, 2 };
0877:                TransparentAccess ta = (TransparentAccess) subRoot;
0878:
0879:                synchronized (subRoot) {
0880:                    if (index == 0) {
0881:                        ta
0882:                                .__tc_setmanagedfield(
0883:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField",
0884:                                        new Integer(2));
0885:                        ta
0886:                                .__tc_setmanagedfield(
0887:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField",
0888:                                        new Integer(7));
0889:                        ta
0890:                                .__tc_setmanagedfield(
0891:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField",
0892:                                        new Integer(4));
0893:                        ta
0894:                                .__tc_setmanagedfield(
0895:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField",
0896:                                        referenceSet);
0897:                        ta
0898:                                .__tc_setmanagedfield(
0899:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField",
0900:                                        "testString");
0901:                        ta
0902:                                .__tc_setmanagedfield(
0903:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField",
0904:                                        new Integer(5));
0905:                        ta
0906:                                .__tc_setmanagedfield(
0907:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField",
0908:                                        referenceMap);
0909:                        ta
0910:                                .__tc_setmanagedfield(
0911:                                        "com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField",
0912:                                        referenceArray);
0913:                    }
0914:                }
0915:
0916:                barrier.barrier();
0917:
0918:                Assert
0919:                        .assertEquals(
0920:                                2,
0921:                                ((Integer) ta
0922:                                        .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildIntField"))
0923:                                        .intValue());
0924:                Assert
0925:                        .assertEquals(
0926:                                new Integer(7),
0927:                                ta
0928:                                        .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.grandChildObjectField"));
0929:                Assert
0930:                        .assertNotNull(ta
0931:                                .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0"));
0932:                if (index == 0) {
0933:                    Assert
0934:                            .assertTrue(this  == ta
0935:                                    .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubSubClass.this$0"));
0936:                }
0937:                Assert
0938:                        .assertEquals(
0939:                                4,
0940:                                ((Integer) ta
0941:                                        .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childIntField"))
0942:                                        .intValue());
0943:                assertSetsEqual(
0944:                        referenceSet,
0945:                        (Set) ta
0946:                                .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childSetField"));
0947:                Assert
0948:                        .assertEquals(
0949:                                "testString",
0950:                                ta
0951:                                        .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestSubClass.childStringField"));
0952:
0953:                Assert
0954:                        .assertEquals(
0955:                                5,
0956:                                ((Integer) ta
0957:                                        .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentIntField"))
0958:                                        .intValue());
0959:                assertMappings(
0960:                        referenceMap,
0961:                        (Map) ta
0962:                                .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentMapField"));
0963:                assertIntegerArray(
0964:                        referenceArray,
0965:                        (int[]) ta
0966:                                .__tc_getmanagedfield("com.tctest.PhysicalInstrumentedMethodsTestApp$TestParentClass.parentArrayField"));
0967:
0968:                barrier.barrier();
0969:            }
0970:
0971:            private void assertIntegerArray(int[] expect, int[] actual) {
0972:                Assert.assertEquals(expect.length, actual.length);
0973:
0974:                for (int i = 0; i < expect.length; i++) {
0975:                    Assert.assertEquals(expect[i], actual[i]);
0976:                }
0977:            }
0978:
0979:            private void assertMappings(Map expect, Map actual) {
0980:                Assert.assertEquals(expect.size(), actual.size());
0981:
0982:                Set expectEntries = expect.entrySet();
0983:                Set actualEntries = actual.entrySet();
0984:                if (actual instanceof  LinkedHashMap) {
0985:                    for (Iterator iExpect = expectEntries.iterator(), iActual = actualEntries
0986:                            .iterator(); iExpect.hasNext();) {
0987:                        Assert.assertEquals(iExpect.next(), iActual.next());
0988:                    }
0989:                }
0990:
0991:                for (Iterator i = expectEntries.iterator(); i.hasNext();) {
0992:                    Entry entry = (Entry) i.next();
0993:                    Assert.assertEquals(entry.getValue(), actual.get(entry
0994:                            .getKey()));
0995:                }
0996:
0997:                for (Iterator i = actualEntries.iterator(); i.hasNext();) {
0998:                    Entry entry = (Entry) i.next();
0999:                    Assert.assertEquals(entry.getValue(), expect.get(entry
1000:                            .getKey()));
1001:                }
1002:            }
1003:
1004:            private void assertSetsEqual(Set expectElements, Set actual) {
1005:                Assert.assertEquals(expectElements.size(), actual.size());
1006:
1007:                if (actual instanceof  LinkedHashSet) {
1008:                    for (Iterator iExpect = expectElements.iterator(), iActual = actual
1009:                            .iterator(); iExpect.hasNext();) {
1010:                        Assert.assertEquals(iExpect.next(), iActual.next());
1011:                    }
1012:                }
1013:
1014:                Assert.assertTrue(expectElements.containsAll(actual));
1015:                Assert.assertTrue(actual.containsAll(expectElements));
1016:
1017:                if (expectElements.isEmpty()) {
1018:                    Assert.assertTrue(actual.isEmpty());
1019:                } else {
1020:                    Assert.assertFalse(actual.isEmpty());
1021:                }
1022:            }
1023:
1024:            public static void visitL1DSOConfig(ConfigVisitor visitor,
1025:                    DSOClientConfigHelper config) {
1026:                TransparencyClassSpec spec = config
1027:                        .getOrCreateSpec(CyclicBarrier.class.getName());
1028:                config.addWriteAutolock("* " + CyclicBarrier.class.getName()
1029:                        + "*.*(..)");
1030:
1031:                String testClass = PhysicalInstrumentedMethodsTestApp.class
1032:                        .getName();
1033:                spec = config.getOrCreateSpec(testClass);
1034:                config.addIncludePattern(testClass + "$*");
1035:                config.addIncludePattern(testClass + "$*$TestSubSubInnerClass");
1036:
1037:                String methodExpression = "* " + testClass + "*.*(..)";
1038:                config.addWriteAutolock(methodExpression);
1039:
1040:                spec.addRoot("subRoot", "subRoot");
1041:                spec.addRoot("barrier", "barrier");
1042:            }
1043:
1044:            private static class TestParentClass {
1045:                private int parentIntField;
1046:                private Map parentMapField;
1047:                private int[] parentArrayField;
1048:
1049:                public TestParentClass() {
1050:                    this .parentIntField = 0;
1051:                    this .parentMapField = new HashMap();
1052:                }
1053:
1054:                public int getParentIntField() {
1055:                    return parentIntField;
1056:                }
1057:
1058:                public void setParentIntField(int parentIntField) {
1059:                    this .parentIntField = parentIntField;
1060:                }
1061:
1062:                public Map getParentMapField() {
1063:                    return parentMapField;
1064:                }
1065:
1066:                public void setParentMapField(Map parentMapField) {
1067:                    this .parentMapField = parentMapField;
1068:                }
1069:
1070:                public int[] getParentArrayField() {
1071:                    return parentArrayField;
1072:                }
1073:
1074:                public void setParentArrayField(int[] parentArrayField) {
1075:                    this .parentArrayField = parentArrayField;
1076:                }
1077:
1078:                public void clear() {
1079:                    this .parentIntField = 0;
1080:                    this .parentMapField.clear();
1081:                }
1082:            }
1083:
1084:            private static class TestSubClass extends TestParentClass {
1085:                private int childIntField;
1086:                private Set childSetField;
1087:                private String childStringField;
1088:                private int index;
1089:
1090:                public TestSubClass() {
1091:                    this .index = 0;
1092:                    this .childIntField = 0;
1093:                    this .childSetField = new HashSet();
1094:                }
1095:
1096:                public void clear() {
1097:                    this .index = 0;
1098:                    this .childIntField = 0;
1099:                    this .childSetField.clear();
1100:                    super .clear();
1101:                }
1102:
1103:                public int getChildIntField() {
1104:                    return childIntField;
1105:                }
1106:
1107:                public void setChildIntField(int childIntField) {
1108:                    this .childIntField = childIntField;
1109:                }
1110:
1111:                public Set getChildSetField() {
1112:                    return childSetField;
1113:                }
1114:
1115:                public void setChildSetField(Set childSetField) {
1116:                    this .childSetField = childSetField;
1117:                }
1118:
1119:                public String getChildStringField() {
1120:                    return childStringField;
1121:                }
1122:
1123:                public void setChildStringField(String childStringField) {
1124:                    this .childStringField = childStringField;
1125:                }
1126:
1127:                public int getIndex() {
1128:                    return index;
1129:                }
1130:
1131:                public void setIndex(int index) {
1132:                    this .index = index;
1133:                }
1134:            }
1135:
1136:            private class TestSubSubClass extends TestSubClass {
1137:                private int grandChildIntField;
1138:                private Object grandChildObjectField;
1139:                private TestSubSubInnerClass t;
1140:
1141:                public TestSubSubClass() {
1142:                    super ();
1143:                    this .grandChildIntField = 0;
1144:                    this .grandChildObjectField = new Object();
1145:                    this .t = new TestSubSubInnerClass(10);
1146:                }
1147:
1148:                public Object getT() {
1149:                    // this method here to remove eclipse warning
1150:                    return this .t;
1151:                }
1152:
1153:                public int getGrandChildIntField() {
1154:                    return grandChildIntField;
1155:                }
1156:
1157:                public void setGrandChildIntField(int grandChildIntField) {
1158:                    this .grandChildIntField = grandChildIntField;
1159:                }
1160:
1161:                public Object getGrandChildObjectField() {
1162:                    return grandChildObjectField;
1163:                }
1164:
1165:                public void setGrandChildObjectField(
1166:                        Object grandChildObjectField) {
1167:                    this .grandChildObjectField = grandChildObjectField;
1168:                }
1169:
1170:                public void clear() {
1171:                    this .grandChildIntField = 0;
1172:                    this .grandChildObjectField = new Object();
1173:                    super .clear();
1174:                }
1175:
1176:                private class TestSubSubInnerClass {
1177:                    private long l;
1178:
1179:                    public TestSubSubInnerClass(long l) {
1180:                        this .l = l;
1181:                    }
1182:
1183:                    long getL() {
1184:                        // this method here to remove eclipse warning
1185:                        return this.l;
1186:                    }
1187:
1188:                }
1189:            }
1190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.