Source Code Cross Referenced for TestNodeHandler.java in  » Code-Analyzer » DependencyFinder » com » jeantessier » dependency » 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 » Code Analyzer » DependencyFinder » com.jeantessier.dependency 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         *  Copyright (c) 2001-2007, Jean Tessier
0003:         *  All rights reserved.
0004:         *  
0005:         *  Redistribution and use in source and binary forms, with or without
0006:         *  modification, are permitted provided that the following conditions
0007:         *  are met:
0008:         *  
0009:         *      * Redistributions of source code must retain the above copyright
0010:         *        notice, this list of conditions and the following disclaimer.
0011:         *  
0012:         *      * Redistributions in binary form must reproduce the above copyright
0013:         *        notice, this list of conditions and the following disclaimer in the
0014:         *        documentation and/or other materials provided with the distribution.
0015:         *  
0016:         *      * Neither the name of Jean Tessier nor the names of his contributors
0017:         *        may be used to endorse or promote products derived from this software
0018:         *        without specific prior written permission.
0019:         *  
0020:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0021:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0022:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0023:         *  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
0024:         *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
0025:         *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0026:         *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
0027:         *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
0028:         *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
0029:         *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
0030:         *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0031:         */
0032:
0033:        package com.jeantessier.dependency;
0034:
0035:        import org.xml.sax.*;
0036:        import org.xml.sax.helpers.*;
0037:
0038:        import junit.framework.*;
0039:
0040:        public class TestNodeHandler extends TestCase {
0041:            private static final String MY_PACKAGE_NAME = "mypackage";
0042:            private static final String MY_CLASS_NAME = "mypackage.MyClass";
0043:            private static final String MY_FEATURE_NAME = "mypackage.MyClass.myFeature";
0044:            private static final String OTHER_PACKAGE_NAME = "otherpackage";
0045:            private static final String OTHER_CLASS_NAME = "otherpackage.OtherClass";
0046:            private static final String OTHER_FEATURE_NAME = "otherpackage.OtherClass.otherFeature";
0047:
0048:            private NodeHandler handler;
0049:
0050:            protected void setUp() throws Exception {
0051:                super .setUp();
0052:
0053:                handler = new NodeHandler();
0054:            }
0055:
0056:            public void testConstructor() {
0057:                assertEquals("nb packages", 0, handler.getFactory()
0058:                        .getPackages().size());
0059:
0060:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0061:                        .size());
0062:
0063:                assertEquals("nb features", 0, handler.getFactory()
0064:                        .getFeatures().size());
0065:            }
0066:
0067:            public void testEmptyDocument() throws SAXException {
0068:                handler.startDocument();
0069:                handler.endDocument();
0070:
0071:                assertEquals("nb packages", 0, handler.getFactory()
0072:                        .getPackages().size());
0073:
0074:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0075:                        .size());
0076:
0077:                assertEquals("nb features", 0, handler.getFactory()
0078:                        .getFeatures().size());
0079:            }
0080:
0081:            public void testEmptyTopNode() throws SAXException {
0082:                Attributes attsEmpty = new AttributesImpl();
0083:
0084:                handler.startDocument();
0085:                handler.startElement(null, null, "dependencies", attsEmpty);
0086:                handler.endElement(null, null, "dependencies");
0087:                handler.endDocument();
0088:
0089:                assertEquals("nb packages", 0, handler.getFactory()
0090:                        .getPackages().size());
0091:
0092:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0093:                        .size());
0094:
0095:                assertEquals("nb features", 0, handler.getFactory()
0096:                        .getFeatures().size());
0097:            }
0098:
0099:            public void testUnspecifiedPackageNodeIsConfirmed()
0100:                    throws SAXException {
0101:                Attributes attsEmpty = new AttributesImpl();
0102:
0103:                handler.startDocument();
0104:                handler.startElement(null, null, "dependencies", attsEmpty);
0105:                handler.startElement(null, null, "package", attsEmpty);
0106:                handler.startElement(null, null, "name", attsEmpty);
0107:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0108:                        MY_PACKAGE_NAME.length());
0109:                handler.endElement(null, null, "name");
0110:                handler.endElement(null, null, "package");
0111:                handler.endElement(null, null, "dependencies");
0112:                handler.endDocument();
0113:
0114:                assertEquals("nb packages", 1, handler.getFactory()
0115:                        .getPackages().size());
0116:                assertNotNull("missing package", handler.getFactory()
0117:                        .getPackages().get(MY_PACKAGE_NAME));
0118:                assertTrue("package is inferred", ((Node) handler.getFactory()
0119:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0120:
0121:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0122:                        .size());
0123:
0124:                assertEquals("nb features", 0, handler.getFactory()
0125:                        .getFeatures().size());
0126:            }
0127:
0128:            public void testInferredPackageNode() throws SAXException {
0129:                AttributesImpl attsEmpty = new AttributesImpl();
0130:                AttributesImpl attsNo = new AttributesImpl();
0131:                attsNo.addAttribute(null, null, "confirmed", null, "no");
0132:
0133:                handler.startDocument();
0134:                handler.startElement(null, null, "dependencies", attsEmpty);
0135:                handler.startElement(null, null, "package", attsNo);
0136:                handler.startElement(null, null, "name", attsEmpty);
0137:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0138:                        MY_PACKAGE_NAME.length());
0139:                handler.endElement(null, null, "name");
0140:                handler.endElement(null, null, "package");
0141:                handler.endElement(null, null, "dependencies");
0142:                handler.endDocument();
0143:
0144:                assertEquals("nb packages", 1, handler.getFactory()
0145:                        .getPackages().size());
0146:                assertNotNull("missing package", handler.getFactory()
0147:                        .getPackages().get(MY_PACKAGE_NAME));
0148:                assertFalse("package is confirmed", ((Node) handler
0149:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
0150:                        .isConfirmed());
0151:
0152:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0153:                        .size());
0154:
0155:                assertEquals("nb features", 0, handler.getFactory()
0156:                        .getFeatures().size());
0157:            }
0158:
0159:            public void testConfirmedPackageNode() throws SAXException {
0160:                AttributesImpl attsEmpty = new AttributesImpl();
0161:                AttributesImpl attsYes = new AttributesImpl();
0162:                attsYes.addAttribute(null, null, "confirmed", null, "yes");
0163:
0164:                handler.startDocument();
0165:                handler.startElement(null, null, "dependencies", attsEmpty);
0166:                handler.startElement(null, null, "package", attsYes);
0167:                handler.startElement(null, null, "name", attsEmpty);
0168:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0169:                        MY_PACKAGE_NAME.length());
0170:                handler.endElement(null, null, "name");
0171:                handler.endElement(null, null, "package");
0172:                handler.endElement(null, null, "dependencies");
0173:                handler.endDocument();
0174:
0175:                assertEquals("nb packages", 1, handler.getFactory()
0176:                        .getPackages().size());
0177:                assertNotNull("missing package", handler.getFactory()
0178:                        .getPackages().get(MY_PACKAGE_NAME));
0179:                assertTrue("package is inferred", ((Node) handler.getFactory()
0180:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0181:
0182:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0183:                        .size());
0184:
0185:                assertEquals("nb features", 0, handler.getFactory()
0186:                        .getFeatures().size());
0187:            }
0188:
0189:            public void testUnspecifiedClassNodeIsConfirmed()
0190:                    throws SAXException {
0191:                Attributes attsEmpty = new AttributesImpl();
0192:
0193:                handler.startDocument();
0194:                handler.startElement(null, null, "dependencies", attsEmpty);
0195:                handler.startElement(null, null, "package", attsEmpty);
0196:                handler.startElement(null, null, "name", attsEmpty);
0197:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0198:                        MY_PACKAGE_NAME.length());
0199:                handler.endElement(null, null, "name");
0200:                handler.startElement(null, null, "class", attsEmpty);
0201:                handler.startElement(null, null, "name", attsEmpty);
0202:                handler.characters(MY_CLASS_NAME.toCharArray(), 0,
0203:                        MY_CLASS_NAME.length());
0204:                handler.endElement(null, null, "name");
0205:                handler.endElement(null, null, "class");
0206:                handler.endElement(null, null, "package");
0207:                handler.endElement(null, null, "dependencies");
0208:                handler.endDocument();
0209:
0210:                assertEquals("nb packages", 1, handler.getFactory()
0211:                        .getPackages().size());
0212:                assertNotNull("missing package", handler.getFactory()
0213:                        .getPackages().get(MY_PACKAGE_NAME));
0214:                assertTrue("package is inferred", ((Node) handler.getFactory()
0215:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0216:
0217:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0218:                        .size());
0219:                assertNotNull("missing class", handler.getFactory()
0220:                        .getClasses().get(MY_CLASS_NAME));
0221:                assertTrue("class is inferred", ((Node) handler.getFactory()
0222:                        .getClasses().get(MY_CLASS_NAME)).isConfirmed());
0223:
0224:                assertEquals("nb features", 0, handler.getFactory()
0225:                        .getFeatures().size());
0226:            }
0227:
0228:            public void testInferredClassNode() throws SAXException {
0229:                AttributesImpl attsEmpty = new AttributesImpl();
0230:                AttributesImpl attsNo = new AttributesImpl();
0231:                attsNo.addAttribute(null, null, "confirmed", null, "no");
0232:
0233:                handler.startDocument();
0234:                handler.startElement(null, null, "dependencies", attsEmpty);
0235:                handler.startElement(null, null, "package", attsNo);
0236:                handler.startElement(null, null, "name", attsEmpty);
0237:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0238:                        MY_PACKAGE_NAME.length());
0239:                handler.endElement(null, null, "name");
0240:                handler.startElement(null, null, "class", attsNo);
0241:                handler.startElement(null, null, "name", attsEmpty);
0242:                handler.characters(MY_CLASS_NAME.toCharArray(), 0,
0243:                        MY_CLASS_NAME.length());
0244:                handler.endElement(null, null, "name");
0245:                handler.endElement(null, null, "class");
0246:                handler.endElement(null, null, "package");
0247:                handler.endElement(null, null, "dependencies");
0248:                handler.endDocument();
0249:
0250:                assertEquals("nb packages", 1, handler.getFactory()
0251:                        .getPackages().size());
0252:                assertNotNull("missing package", handler.getFactory()
0253:                        .getPackages().get(MY_PACKAGE_NAME));
0254:                assertFalse("package is confirmed", ((Node) handler
0255:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
0256:                        .isConfirmed());
0257:
0258:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0259:                        .size());
0260:                assertNotNull("missing class", handler.getFactory()
0261:                        .getClasses().get(MY_CLASS_NAME));
0262:                assertFalse("class is confirmed", ((Node) handler.getFactory()
0263:                        .getClasses().get(MY_CLASS_NAME)).isConfirmed());
0264:
0265:                assertEquals("nb features", 0, handler.getFactory()
0266:                        .getFeatures().size());
0267:            }
0268:
0269:            public void testConfirmedClassNode() throws SAXException {
0270:                AttributesImpl attsEmpty = new AttributesImpl();
0271:                AttributesImpl attsYes = new AttributesImpl();
0272:
0273:                handler.startDocument();
0274:                handler.startElement(null, null, "dependencies", attsEmpty);
0275:                handler.startElement(null, null, "package", attsYes);
0276:                handler.startElement(null, null, "name", attsEmpty);
0277:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0278:                        MY_PACKAGE_NAME.length());
0279:                handler.endElement(null, null, "name");
0280:                handler.startElement(null, null, "class", attsYes);
0281:                handler.startElement(null, null, "name", attsEmpty);
0282:                handler.characters(MY_CLASS_NAME.toCharArray(), 0,
0283:                        MY_CLASS_NAME.length());
0284:                handler.endElement(null, null, "name");
0285:                handler.endElement(null, null, "class");
0286:                handler.endElement(null, null, "package");
0287:                handler.endElement(null, null, "dependencies");
0288:                handler.endDocument();
0289:
0290:                assertEquals("nb packages", 1, handler.getFactory()
0291:                        .getPackages().size());
0292:                assertNotNull("missing package", handler.getFactory()
0293:                        .getPackages().get(MY_PACKAGE_NAME));
0294:                assertTrue("package is inferred", ((Node) handler.getFactory()
0295:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0296:
0297:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0298:                        .size());
0299:                assertNotNull("missing class", handler.getFactory()
0300:                        .getClasses().get(MY_CLASS_NAME));
0301:                assertTrue("class is inferred", ((Node) handler.getFactory()
0302:                        .getClasses().get(MY_CLASS_NAME)).isConfirmed());
0303:
0304:                assertEquals("nb features", 0, handler.getFactory()
0305:                        .getFeatures().size());
0306:            }
0307:
0308:            public void testUnspecifiedFeatureNodeIsConfirmed()
0309:                    throws SAXException {
0310:                Attributes attsEmpty = new AttributesImpl();
0311:
0312:                handler.startDocument();
0313:                handler.startElement(null, null, "dependencies", attsEmpty);
0314:                handler.startElement(null, null, "package", attsEmpty);
0315:                handler.startElement(null, null, "name", attsEmpty);
0316:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0317:                        MY_PACKAGE_NAME.length());
0318:                handler.endElement(null, null, "name");
0319:                handler.startElement(null, null, "class", attsEmpty);
0320:                handler.startElement(null, null, "name", attsEmpty);
0321:                handler.characters(MY_CLASS_NAME.toCharArray(), 0,
0322:                        MY_CLASS_NAME.length());
0323:                handler.endElement(null, null, "name");
0324:                handler.startElement(null, null, "feature", attsEmpty);
0325:                handler.startElement(null, null, "name", attsEmpty);
0326:                handler.characters(MY_FEATURE_NAME.toCharArray(), 0,
0327:                        MY_FEATURE_NAME.length());
0328:                handler.endElement(null, null, "name");
0329:                handler.endElement(null, null, "feature");
0330:                handler.endElement(null, null, "class");
0331:                handler.endElement(null, null, "package");
0332:                handler.endElement(null, null, "dependencies");
0333:                handler.endDocument();
0334:
0335:                assertEquals("nb packages", 1, handler.getFactory()
0336:                        .getPackages().size());
0337:                assertNotNull("missing package", handler.getFactory()
0338:                        .getPackages().get(MY_PACKAGE_NAME));
0339:                assertTrue("package is inferred", ((Node) handler.getFactory()
0340:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0341:
0342:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0343:                        .size());
0344:                assertNotNull("missing class", handler.getFactory()
0345:                        .getClasses().get(MY_CLASS_NAME));
0346:                assertTrue("class is inferred", ((Node) handler.getFactory()
0347:                        .getClasses().get(MY_CLASS_NAME)).isConfirmed());
0348:
0349:                assertEquals("nb features", 1, handler.getFactory()
0350:                        .getFeatures().size());
0351:                assertNotNull("missing feature", handler.getFactory()
0352:                        .getFeatures().get(MY_FEATURE_NAME));
0353:                assertTrue("feature is inferred", ((Node) handler.getFactory()
0354:                        .getFeatures().get(MY_FEATURE_NAME)).isConfirmed());
0355:            }
0356:
0357:            public void testInferredFeatureNode() throws SAXException {
0358:                AttributesImpl attsEmpty = new AttributesImpl();
0359:                AttributesImpl attsNo = new AttributesImpl();
0360:                attsNo.addAttribute(null, null, "confirmed", null, "no");
0361:
0362:                handler.startDocument();
0363:                handler.startElement(null, null, "dependencies", attsEmpty);
0364:                handler.startElement(null, null, "package", attsNo);
0365:                handler.startElement(null, null, "name", attsEmpty);
0366:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0367:                        MY_PACKAGE_NAME.length());
0368:                handler.endElement(null, null, "name");
0369:                handler.startElement(null, null, "class", attsNo);
0370:                handler.startElement(null, null, "name", attsEmpty);
0371:                handler.characters(MY_CLASS_NAME.toCharArray(), 0,
0372:                        MY_CLASS_NAME.length());
0373:                handler.endElement(null, null, "name");
0374:                handler.startElement(null, null, "feature", attsNo);
0375:                handler.startElement(null, null, "name", attsEmpty);
0376:                handler.characters(MY_FEATURE_NAME.toCharArray(), 0,
0377:                        MY_FEATURE_NAME.length());
0378:                handler.endElement(null, null, "name");
0379:                handler.endElement(null, null, "feature");
0380:                handler.endElement(null, null, "class");
0381:                handler.endElement(null, null, "package");
0382:                handler.endElement(null, null, "dependencies");
0383:                handler.endDocument();
0384:
0385:                assertEquals("nb packages", 1, handler.getFactory()
0386:                        .getPackages().size());
0387:                assertNotNull("missing package", handler.getFactory()
0388:                        .getPackages().get(MY_PACKAGE_NAME));
0389:                assertFalse("package is confirmed", ((Node) handler
0390:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
0391:                        .isConfirmed());
0392:
0393:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0394:                        .size());
0395:                assertNotNull("missing class", handler.getFactory()
0396:                        .getClasses().get(MY_CLASS_NAME));
0397:                assertFalse("class is confirmed", ((Node) handler.getFactory()
0398:                        .getClasses().get(MY_CLASS_NAME)).isConfirmed());
0399:
0400:                assertEquals("nb features", 1, handler.getFactory()
0401:                        .getFeatures().size());
0402:                assertNotNull("missing feature", handler.getFactory()
0403:                        .getFeatures().get(MY_FEATURE_NAME));
0404:                assertFalse("feature is confirmed", ((Node) handler
0405:                        .getFactory().getFeatures().get(MY_FEATURE_NAME))
0406:                        .isConfirmed());
0407:            }
0408:
0409:            public void testConfirmedFeatureNode() throws SAXException {
0410:                AttributesImpl attsEmpty = new AttributesImpl();
0411:                AttributesImpl attsYes = new AttributesImpl();
0412:
0413:                handler.startDocument();
0414:                handler.startElement(null, null, "dependencies", attsEmpty);
0415:                handler.startElement(null, null, "package", attsYes);
0416:                handler.startElement(null, null, "name", attsEmpty);
0417:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0418:                        MY_PACKAGE_NAME.length());
0419:                handler.endElement(null, null, "name");
0420:                handler.startElement(null, null, "class", attsYes);
0421:                handler.startElement(null, null, "name", attsEmpty);
0422:                handler.characters(MY_CLASS_NAME.toCharArray(), 0,
0423:                        MY_CLASS_NAME.length());
0424:                handler.endElement(null, null, "name");
0425:                handler.startElement(null, null, "feature", attsYes);
0426:                handler.startElement(null, null, "name", attsEmpty);
0427:                handler.characters(MY_FEATURE_NAME.toCharArray(), 0,
0428:                        MY_FEATURE_NAME.length());
0429:                handler.endElement(null, null, "name");
0430:                handler.endElement(null, null, "feature");
0431:                handler.endElement(null, null, "class");
0432:                handler.endElement(null, null, "package");
0433:                handler.endElement(null, null, "dependencies");
0434:                handler.endDocument();
0435:
0436:                assertEquals("nb packages", 1, handler.getFactory()
0437:                        .getPackages().size());
0438:                assertNotNull("missing package", handler.getFactory()
0439:                        .getPackages().get(MY_PACKAGE_NAME));
0440:                assertTrue("package is inferred", ((Node) handler.getFactory()
0441:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0442:
0443:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0444:                        .size());
0445:                assertNotNull("missing class", handler.getFactory()
0446:                        .getClasses().get(MY_CLASS_NAME));
0447:                assertTrue("class is inferred", ((Node) handler.getFactory()
0448:                        .getClasses().get(MY_CLASS_NAME)).isConfirmed());
0449:
0450:                assertEquals("nb features", 1, handler.getFactory()
0451:                        .getFeatures().size());
0452:                assertNotNull("missing feature", handler.getFactory()
0453:                        .getFeatures().get(MY_FEATURE_NAME));
0454:                assertTrue("feature is inferred", ((Node) handler.getFactory()
0455:                        .getFeatures().get(MY_FEATURE_NAME)).isConfirmed());
0456:            }
0457:
0458:            public void testUnspecifiedInboundPackageDependencyIsConfirmed()
0459:                    throws SAXException {
0460:                Attributes attsEmpty = new AttributesImpl();
0461:                AttributesImpl attsPackage = new AttributesImpl();
0462:                attsPackage.addAttribute(null, null, "type", null, "package");
0463:
0464:                handler.startDocument();
0465:                handler.startElement(null, null, "dependencies", attsEmpty);
0466:                handler.startElement(null, null, "package", attsEmpty);
0467:                handler.startElement(null, null, "name", attsEmpty);
0468:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0469:                        MY_PACKAGE_NAME.length());
0470:                handler.endElement(null, null, "name");
0471:                handler.startElement(null, null, "inbound", attsPackage);
0472:                handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0,
0473:                        OTHER_PACKAGE_NAME.length());
0474:                handler.endElement(null, null, "inbound");
0475:                handler.endElement(null, null, "package");
0476:                handler.endElement(null, null, "dependencies");
0477:                handler.endDocument();
0478:
0479:                assertEquals("nb packages", 2, handler.getFactory()
0480:                        .getPackages().size());
0481:                assertNotNull("missing package", handler.getFactory()
0482:                        .getPackages().get(MY_PACKAGE_NAME));
0483:                assertTrue("package is inferred", ((Node) handler.getFactory()
0484:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0485:                assertNotNull("missing package", handler.getFactory()
0486:                        .getPackages().get(OTHER_PACKAGE_NAME));
0487:                assertTrue("package is inferred", ((Node) handler.getFactory()
0488:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
0489:
0490:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0491:                        .size());
0492:
0493:                assertEquals("nb features", 0, handler.getFactory()
0494:                        .getFeatures().size());
0495:            }
0496:
0497:            public void testInferredInboundPackageDependency()
0498:                    throws SAXException {
0499:                AttributesImpl attsEmpty = new AttributesImpl();
0500:                AttributesImpl attsNo = new AttributesImpl();
0501:                attsNo.addAttribute(null, null, "confirmed", null, "no");
0502:                AttributesImpl attsPackageNo = new AttributesImpl();
0503:                attsPackageNo.addAttribute(null, null, "type", null, "package");
0504:                attsPackageNo.addAttribute(null, null, "confirmed", null, "no");
0505:
0506:                handler.startDocument();
0507:                handler.startElement(null, null, "dependencies", attsEmpty);
0508:                handler.startElement(null, null, "package", attsNo);
0509:                handler.startElement(null, null, "name", attsEmpty);
0510:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0511:                        MY_PACKAGE_NAME.length());
0512:                handler.endElement(null, null, "name");
0513:                handler.startElement(null, null, "inbound", attsPackageNo);
0514:                handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0,
0515:                        OTHER_PACKAGE_NAME.length());
0516:                handler.endElement(null, null, "inbound");
0517:                handler.endElement(null, null, "package");
0518:                handler.endElement(null, null, "dependencies");
0519:                handler.endDocument();
0520:
0521:                assertEquals("nb packages", 2, handler.getFactory()
0522:                        .getPackages().size());
0523:                assertNotNull("missing package", handler.getFactory()
0524:                        .getPackages().get(MY_PACKAGE_NAME));
0525:                assertFalse("package is confirmed", ((Node) handler
0526:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
0527:                        .isConfirmed());
0528:                assertNotNull("missing package", handler.getFactory()
0529:                        .getPackages().get(OTHER_PACKAGE_NAME));
0530:                assertFalse("package is confirmed", ((Node) handler
0531:                        .getFactory().getPackages().get(OTHER_PACKAGE_NAME))
0532:                        .isConfirmed());
0533:
0534:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0535:                        .size());
0536:
0537:                assertEquals("nb features", 0, handler.getFactory()
0538:                        .getFeatures().size());
0539:            }
0540:
0541:            public void testConfirmedInboundPackageDependency()
0542:                    throws SAXException {
0543:                AttributesImpl attsEmpty = new AttributesImpl();
0544:                AttributesImpl attsYes = new AttributesImpl();
0545:                attsYes.addAttribute(null, null, "confirmed", null, "yes");
0546:                AttributesImpl attsPackageYes = new AttributesImpl();
0547:                attsPackageYes
0548:                        .addAttribute(null, null, "type", null, "package");
0549:                attsPackageYes.addAttribute(null, null, "confirmed", null,
0550:                        "yes");
0551:
0552:                handler.startDocument();
0553:                handler.startElement(null, null, "dependencies", attsEmpty);
0554:                handler.startElement(null, null, "package", attsYes);
0555:                handler.startElement(null, null, "name", attsEmpty);
0556:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0557:                        MY_PACKAGE_NAME.length());
0558:                handler.endElement(null, null, "name");
0559:                handler.startElement(null, null, "inbound", attsPackageYes);
0560:                handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0,
0561:                        OTHER_PACKAGE_NAME.length());
0562:                handler.endElement(null, null, "inbound");
0563:                handler.endElement(null, null, "package");
0564:                handler.endElement(null, null, "dependencies");
0565:                handler.endDocument();
0566:
0567:                assertEquals("nb packages", 2, handler.getFactory()
0568:                        .getPackages().size());
0569:                assertNotNull("missing package", handler.getFactory()
0570:                        .getPackages().get(MY_PACKAGE_NAME));
0571:                assertTrue("package is inferred", ((Node) handler.getFactory()
0572:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0573:                assertNotNull("missing package", handler.getFactory()
0574:                        .getPackages().get(OTHER_PACKAGE_NAME));
0575:                assertTrue("package is inferred", ((Node) handler.getFactory()
0576:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
0577:
0578:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0579:                        .size());
0580:
0581:                assertEquals("nb features", 0, handler.getFactory()
0582:                        .getFeatures().size());
0583:            }
0584:
0585:            public void testUnspecifiedOutboundPackageDependencyIsConfirmed()
0586:                    throws SAXException {
0587:                Attributes attsEmpty = new AttributesImpl();
0588:                AttributesImpl attsPackage = new AttributesImpl();
0589:                attsPackage.addAttribute(null, null, "type", null, "package");
0590:
0591:                handler.startDocument();
0592:                handler.startElement(null, null, "dependencies", attsEmpty);
0593:                handler.startElement(null, null, "package", attsEmpty);
0594:                handler.startElement(null, null, "name", attsEmpty);
0595:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0596:                        MY_PACKAGE_NAME.length());
0597:                handler.endElement(null, null, "name");
0598:                handler.startElement(null, null, "outbound", attsPackage);
0599:                handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0,
0600:                        OTHER_PACKAGE_NAME.length());
0601:                handler.endElement(null, null, "outbound");
0602:                handler.endElement(null, null, "package");
0603:                handler.endElement(null, null, "dependencies");
0604:                handler.endDocument();
0605:
0606:                assertEquals("nb packages", 2, handler.getFactory()
0607:                        .getPackages().size());
0608:                assertNotNull("missing package", handler.getFactory()
0609:                        .getPackages().get(MY_PACKAGE_NAME));
0610:                assertTrue("package is inferred", ((Node) handler.getFactory()
0611:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0612:                assertNotNull("missing package", handler.getFactory()
0613:                        .getPackages().get(OTHER_PACKAGE_NAME));
0614:                assertTrue("package is inferred", ((Node) handler.getFactory()
0615:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
0616:
0617:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0618:                        .size());
0619:
0620:                assertEquals("nb features", 0, handler.getFactory()
0621:                        .getFeatures().size());
0622:            }
0623:
0624:            public void testInferredOutboundPackageDependency()
0625:                    throws SAXException {
0626:                AttributesImpl attsEmpty = new AttributesImpl();
0627:                AttributesImpl attsNo = new AttributesImpl();
0628:                attsNo.addAttribute(null, null, "confirmed", null, "no");
0629:                AttributesImpl attsPackageNo = new AttributesImpl();
0630:                attsPackageNo.addAttribute(null, null, "type", null, "package");
0631:                attsPackageNo.addAttribute(null, null, "confirmed", null, "no");
0632:
0633:                handler.startDocument();
0634:                handler.startElement(null, null, "dependencies", attsEmpty);
0635:                handler.startElement(null, null, "package", attsNo);
0636:                handler.startElement(null, null, "name", attsEmpty);
0637:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0638:                        MY_PACKAGE_NAME.length());
0639:                handler.endElement(null, null, "name");
0640:                handler.startElement(null, null, "outbound", attsPackageNo);
0641:                handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0,
0642:                        OTHER_PACKAGE_NAME.length());
0643:                handler.endElement(null, null, "outbound");
0644:                handler.endElement(null, null, "package");
0645:                handler.endElement(null, null, "dependencies");
0646:                handler.endDocument();
0647:
0648:                assertEquals("nb packages", 2, handler.getFactory()
0649:                        .getPackages().size());
0650:                assertNotNull("missing package", handler.getFactory()
0651:                        .getPackages().get(MY_PACKAGE_NAME));
0652:                assertFalse("package is confirmed", ((Node) handler
0653:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
0654:                        .isConfirmed());
0655:                assertNotNull("missing package", handler.getFactory()
0656:                        .getPackages().get(OTHER_PACKAGE_NAME));
0657:                assertFalse("package is confirmed", ((Node) handler
0658:                        .getFactory().getPackages().get(OTHER_PACKAGE_NAME))
0659:                        .isConfirmed());
0660:
0661:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0662:                        .size());
0663:
0664:                assertEquals("nb features", 0, handler.getFactory()
0665:                        .getFeatures().size());
0666:            }
0667:
0668:            public void testConfirmedOutboundPackageDependency()
0669:                    throws SAXException {
0670:                AttributesImpl attsEmpty = new AttributesImpl();
0671:                AttributesImpl attsYes = new AttributesImpl();
0672:                attsYes.addAttribute(null, null, "confirmed", null, "yes");
0673:                AttributesImpl attsPackageYes = new AttributesImpl();
0674:                attsPackageYes
0675:                        .addAttribute(null, null, "type", null, "package");
0676:                attsPackageYes.addAttribute(null, null, "confirmed", null,
0677:                        "yes");
0678:
0679:                handler.startDocument();
0680:                handler.startElement(null, null, "dependencies", attsEmpty);
0681:                handler.startElement(null, null, "package", attsYes);
0682:                handler.startElement(null, null, "name", attsEmpty);
0683:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0684:                        MY_PACKAGE_NAME.length());
0685:                handler.endElement(null, null, "name");
0686:                handler.startElement(null, null, "outbound", attsPackageYes);
0687:                handler.characters(OTHER_PACKAGE_NAME.toCharArray(), 0,
0688:                        OTHER_PACKAGE_NAME.length());
0689:                handler.endElement(null, null, "outbound");
0690:                handler.endElement(null, null, "package");
0691:                handler.endElement(null, null, "dependencies");
0692:                handler.endDocument();
0693:
0694:                assertEquals("nb packages", 2, handler.getFactory()
0695:                        .getPackages().size());
0696:                assertNotNull("missing package", handler.getFactory()
0697:                        .getPackages().get(MY_PACKAGE_NAME));
0698:                assertTrue("package is inferred", ((Node) handler.getFactory()
0699:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0700:                assertNotNull("missing package", handler.getFactory()
0701:                        .getPackages().get(OTHER_PACKAGE_NAME));
0702:                assertTrue("package is inferred", ((Node) handler.getFactory()
0703:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
0704:
0705:                assertEquals("nb classes", 0, handler.getFactory().getClasses()
0706:                        .size());
0707:
0708:                assertEquals("nb features", 0, handler.getFactory()
0709:                        .getFeatures().size());
0710:            }
0711:
0712:            public void testUnspecifiedInboundClassDependencyIsConfirmed()
0713:                    throws SAXException {
0714:                Attributes attsEmpty = new AttributesImpl();
0715:                AttributesImpl attsClass = new AttributesImpl();
0716:                attsClass.addAttribute(null, null, "type", null, "class");
0717:
0718:                handler.startDocument();
0719:                handler.startElement(null, null, "dependencies", attsEmpty);
0720:                handler.startElement(null, null, "package", attsEmpty);
0721:                handler.startElement(null, null, "name", attsEmpty);
0722:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0723:                        MY_PACKAGE_NAME.length());
0724:                handler.endElement(null, null, "name");
0725:                handler.startElement(null, null, "inbound", attsClass);
0726:                handler.characters(OTHER_CLASS_NAME.toCharArray(), 0,
0727:                        OTHER_CLASS_NAME.length());
0728:                handler.endElement(null, null, "inbound");
0729:                handler.endElement(null, null, "package");
0730:                handler.endElement(null, null, "dependencies");
0731:                handler.endDocument();
0732:
0733:                assertEquals("nb packages", 2, handler.getFactory()
0734:                        .getPackages().size());
0735:                assertNotNull("missing package", handler.getFactory()
0736:                        .getPackages().get(MY_PACKAGE_NAME));
0737:                assertTrue("package is inferred", ((Node) handler.getFactory()
0738:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0739:                assertNotNull("missing package", handler.getFactory()
0740:                        .getPackages().get(OTHER_PACKAGE_NAME));
0741:                assertTrue("package is inferred", ((Node) handler.getFactory()
0742:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
0743:
0744:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0745:                        .size());
0746:                assertNotNull("missing class", handler.getFactory()
0747:                        .getClasses().get(OTHER_CLASS_NAME));
0748:                assertTrue("class is inferred", ((Node) handler.getFactory()
0749:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
0750:
0751:                assertEquals("nb features", 0, handler.getFactory()
0752:                        .getFeatures().size());
0753:            }
0754:
0755:            public void testInferredInboundClassDependency()
0756:                    throws SAXException {
0757:                AttributesImpl attsEmpty = new AttributesImpl();
0758:                AttributesImpl attsNo = new AttributesImpl();
0759:                attsNo.addAttribute(null, null, "confirmed", null, "no");
0760:                AttributesImpl attsClassNo = new AttributesImpl();
0761:                attsClassNo.addAttribute(null, null, "type", null, "class");
0762:                attsClassNo.addAttribute(null, null, "confirmed", null, "no");
0763:
0764:                handler.startDocument();
0765:                handler.startElement(null, null, "dependencies", attsEmpty);
0766:                handler.startElement(null, null, "package", attsNo);
0767:                handler.startElement(null, null, "name", attsEmpty);
0768:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0769:                        MY_PACKAGE_NAME.length());
0770:                handler.endElement(null, null, "name");
0771:                handler.startElement(null, null, "inbound", attsClassNo);
0772:                handler.characters(OTHER_CLASS_NAME.toCharArray(), 0,
0773:                        OTHER_CLASS_NAME.length());
0774:                handler.endElement(null, null, "inbound");
0775:                handler.endElement(null, null, "package");
0776:                handler.endElement(null, null, "dependencies");
0777:                handler.endDocument();
0778:
0779:                assertEquals("nb packages", 2, handler.getFactory()
0780:                        .getPackages().size());
0781:                assertNotNull("missing package", handler.getFactory()
0782:                        .getPackages().get(MY_PACKAGE_NAME));
0783:                assertFalse("package is confirmed", ((Node) handler
0784:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
0785:                        .isConfirmed());
0786:                assertNotNull("missing package", handler.getFactory()
0787:                        .getPackages().get(OTHER_PACKAGE_NAME));
0788:                assertFalse("package is confirmed", ((Node) handler
0789:                        .getFactory().getPackages().get(OTHER_PACKAGE_NAME))
0790:                        .isConfirmed());
0791:
0792:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0793:                        .size());
0794:                assertNotNull("missing class", handler.getFactory()
0795:                        .getClasses().get(OTHER_CLASS_NAME));
0796:                assertFalse("class is confirmed", ((Node) handler.getFactory()
0797:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
0798:
0799:                assertEquals("nb features", 0, handler.getFactory()
0800:                        .getFeatures().size());
0801:            }
0802:
0803:            public void testConfirmedInboundClassDependency()
0804:                    throws SAXException {
0805:                AttributesImpl attsEmpty = new AttributesImpl();
0806:                AttributesImpl attsYes = new AttributesImpl();
0807:                attsYes.addAttribute(null, null, "confirmed", null, "yes");
0808:                AttributesImpl attsClassYes = new AttributesImpl();
0809:                attsClassYes.addAttribute(null, null, "type", null, "class");
0810:                attsClassYes.addAttribute(null, null, "confirmed", null, "yes");
0811:
0812:                handler.startDocument();
0813:                handler.startElement(null, null, "dependencies", attsEmpty);
0814:                handler.startElement(null, null, "package", attsYes);
0815:                handler.startElement(null, null, "name", attsEmpty);
0816:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0817:                        MY_PACKAGE_NAME.length());
0818:                handler.endElement(null, null, "name");
0819:                handler.startElement(null, null, "inbound", attsClassYes);
0820:                handler.characters(OTHER_CLASS_NAME.toCharArray(), 0,
0821:                        OTHER_CLASS_NAME.length());
0822:                handler.endElement(null, null, "inbound");
0823:                handler.endElement(null, null, "package");
0824:                handler.endElement(null, null, "dependencies");
0825:                handler.endDocument();
0826:
0827:                assertEquals("nb packages", 2, handler.getFactory()
0828:                        .getPackages().size());
0829:                assertNotNull("missing package", handler.getFactory()
0830:                        .getPackages().get(MY_PACKAGE_NAME));
0831:                assertTrue("package is inferred", ((Node) handler.getFactory()
0832:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0833:                assertNotNull("missing package", handler.getFactory()
0834:                        .getPackages().get(OTHER_PACKAGE_NAME));
0835:                assertTrue("package is inferred", ((Node) handler.getFactory()
0836:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
0837:
0838:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0839:                        .size());
0840:                assertNotNull("missing class", handler.getFactory()
0841:                        .getClasses().get(OTHER_CLASS_NAME));
0842:                assertTrue("class is inferred", ((Node) handler.getFactory()
0843:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
0844:
0845:                assertEquals("nb features", 0, handler.getFactory()
0846:                        .getFeatures().size());
0847:            }
0848:
0849:            public void testUnspecifiedOutboundClassDependencyIsConfirmed()
0850:                    throws SAXException {
0851:                Attributes attsEmpty = new AttributesImpl();
0852:                AttributesImpl attsClass = new AttributesImpl();
0853:                attsClass.addAttribute(null, null, "type", null, "class");
0854:
0855:                handler.startDocument();
0856:                handler.startElement(null, null, "dependencies", attsEmpty);
0857:                handler.startElement(null, null, "package", attsEmpty);
0858:                handler.startElement(null, null, "name", attsEmpty);
0859:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0860:                        MY_PACKAGE_NAME.length());
0861:                handler.endElement(null, null, "name");
0862:                handler.startElement(null, null, "outbound", attsClass);
0863:                handler.characters(OTHER_CLASS_NAME.toCharArray(), 0,
0864:                        OTHER_CLASS_NAME.length());
0865:                handler.endElement(null, null, "outbound");
0866:                handler.endElement(null, null, "package");
0867:                handler.endElement(null, null, "dependencies");
0868:                handler.endDocument();
0869:
0870:                assertEquals("nb packages", 2, handler.getFactory()
0871:                        .getPackages().size());
0872:                assertNotNull("missing package", handler.getFactory()
0873:                        .getPackages().get(MY_PACKAGE_NAME));
0874:                assertTrue("package is inferred", ((Node) handler.getFactory()
0875:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0876:                assertNotNull("missing package", handler.getFactory()
0877:                        .getPackages().get(OTHER_PACKAGE_NAME));
0878:                assertTrue("package is inferred", ((Node) handler.getFactory()
0879:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
0880:
0881:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0882:                        .size());
0883:                assertNotNull("missing class", handler.getFactory()
0884:                        .getClasses().get(OTHER_CLASS_NAME));
0885:                assertTrue("class is inferred", ((Node) handler.getFactory()
0886:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
0887:
0888:                assertEquals("nb features", 0, handler.getFactory()
0889:                        .getFeatures().size());
0890:            }
0891:
0892:            public void testInferredOutboundClassDependency()
0893:                    throws SAXException {
0894:                AttributesImpl attsEmpty = new AttributesImpl();
0895:                AttributesImpl attsNo = new AttributesImpl();
0896:                attsNo.addAttribute(null, null, "confirmed", null, "no");
0897:                AttributesImpl attsClassNo = new AttributesImpl();
0898:                attsClassNo.addAttribute(null, null, "type", null, "class");
0899:                attsClassNo.addAttribute(null, null, "confirmed", null, "no");
0900:
0901:                handler.startDocument();
0902:                handler.startElement(null, null, "dependencies", attsEmpty);
0903:                handler.startElement(null, null, "package", attsNo);
0904:                handler.startElement(null, null, "name", attsEmpty);
0905:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0906:                        MY_PACKAGE_NAME.length());
0907:                handler.endElement(null, null, "name");
0908:                handler.startElement(null, null, "outbound", attsClassNo);
0909:                handler.characters(OTHER_CLASS_NAME.toCharArray(), 0,
0910:                        OTHER_CLASS_NAME.length());
0911:                handler.endElement(null, null, "outbound");
0912:                handler.endElement(null, null, "package");
0913:                handler.endElement(null, null, "dependencies");
0914:                handler.endDocument();
0915:
0916:                assertEquals("nb packages", 2, handler.getFactory()
0917:                        .getPackages().size());
0918:                assertNotNull("missing package", handler.getFactory()
0919:                        .getPackages().get(MY_PACKAGE_NAME));
0920:                assertFalse("package is confirmed", ((Node) handler
0921:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
0922:                        .isConfirmed());
0923:                assertNotNull("missing package", handler.getFactory()
0924:                        .getPackages().get(OTHER_PACKAGE_NAME));
0925:                assertFalse("package is confirmed", ((Node) handler
0926:                        .getFactory().getPackages().get(OTHER_PACKAGE_NAME))
0927:                        .isConfirmed());
0928:
0929:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0930:                        .size());
0931:                assertNotNull("missing class", handler.getFactory()
0932:                        .getClasses().get(OTHER_CLASS_NAME));
0933:                assertFalse("class is confirmed", ((Node) handler.getFactory()
0934:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
0935:
0936:                assertEquals("nb features", 0, handler.getFactory()
0937:                        .getFeatures().size());
0938:            }
0939:
0940:            public void testConfirmedOutboundClassDependency()
0941:                    throws SAXException {
0942:                AttributesImpl attsEmpty = new AttributesImpl();
0943:                AttributesImpl attsYes = new AttributesImpl();
0944:                attsYes.addAttribute(null, null, "confirmed", null, "yes");
0945:                AttributesImpl attsClassYes = new AttributesImpl();
0946:                attsClassYes.addAttribute(null, null, "type", null, "class");
0947:                attsClassYes.addAttribute(null, null, "confirmed", null, "yes");
0948:
0949:                handler.startDocument();
0950:                handler.startElement(null, null, "dependencies", attsEmpty);
0951:                handler.startElement(null, null, "package", attsYes);
0952:                handler.startElement(null, null, "name", attsEmpty);
0953:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0954:                        MY_PACKAGE_NAME.length());
0955:                handler.endElement(null, null, "name");
0956:                handler.startElement(null, null, "outbound", attsClassYes);
0957:                handler.characters(OTHER_CLASS_NAME.toCharArray(), 0,
0958:                        OTHER_CLASS_NAME.length());
0959:                handler.endElement(null, null, "outbound");
0960:                handler.endElement(null, null, "package");
0961:                handler.endElement(null, null, "dependencies");
0962:                handler.endDocument();
0963:
0964:                assertEquals("nb packages", 2, handler.getFactory()
0965:                        .getPackages().size());
0966:                assertNotNull("missing package", handler.getFactory()
0967:                        .getPackages().get(MY_PACKAGE_NAME));
0968:                assertTrue("package is inferred", ((Node) handler.getFactory()
0969:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
0970:                assertNotNull("missing package", handler.getFactory()
0971:                        .getPackages().get(OTHER_PACKAGE_NAME));
0972:                assertTrue("package is inferred", ((Node) handler.getFactory()
0973:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
0974:
0975:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
0976:                        .size());
0977:                assertNotNull("missing class", handler.getFactory()
0978:                        .getClasses().get(OTHER_CLASS_NAME));
0979:                assertTrue("class is inferred", ((Node) handler.getFactory()
0980:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
0981:
0982:                assertEquals("nb features", 0, handler.getFactory()
0983:                        .getFeatures().size());
0984:            }
0985:
0986:            // 123456
0987:
0988:            public void testUnspecifiedInboundFeatureDependencyIsConfirmed()
0989:                    throws SAXException {
0990:                Attributes attsEmpty = new AttributesImpl();
0991:                AttributesImpl attsFeature = new AttributesImpl();
0992:                attsFeature.addAttribute(null, null, "type", null, "feature");
0993:
0994:                handler.startDocument();
0995:                handler.startElement(null, null, "dependencies", attsEmpty);
0996:                handler.startElement(null, null, "package", attsEmpty);
0997:                handler.startElement(null, null, "name", attsEmpty);
0998:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
0999:                        MY_PACKAGE_NAME.length());
1000:                handler.endElement(null, null, "name");
1001:                handler.startElement(null, null, "inbound", attsFeature);
1002:                handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0,
1003:                        OTHER_FEATURE_NAME.length());
1004:                handler.endElement(null, null, "inbound");
1005:                handler.endElement(null, null, "package");
1006:                handler.endElement(null, null, "dependencies");
1007:                handler.endDocument();
1008:
1009:                assertEquals("nb packages", 2, handler.getFactory()
1010:                        .getPackages().size());
1011:                assertNotNull("missing package", handler.getFactory()
1012:                        .getPackages().get(MY_PACKAGE_NAME));
1013:                assertTrue("package is inferred", ((Node) handler.getFactory()
1014:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
1015:                assertNotNull("missing package", handler.getFactory()
1016:                        .getPackages().get(OTHER_PACKAGE_NAME));
1017:                assertTrue("package is inferred", ((Node) handler.getFactory()
1018:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
1019:
1020:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
1021:                        .size());
1022:                assertNotNull("missing class", handler.getFactory()
1023:                        .getClasses().get(OTHER_CLASS_NAME));
1024:                assertTrue("class is inferred", ((Node) handler.getFactory()
1025:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
1026:
1027:                assertEquals("nb features", 1, handler.getFactory()
1028:                        .getFeatures().size());
1029:                assertNotNull("missing feature", handler.getFactory()
1030:                        .getFeatures().get(OTHER_FEATURE_NAME));
1031:                assertTrue("feature is inferred", ((Node) handler.getFactory()
1032:                        .getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
1033:            }
1034:
1035:            public void testInferredInboundFeatureDependency()
1036:                    throws SAXException {
1037:                AttributesImpl attsEmpty = new AttributesImpl();
1038:                AttributesImpl attsNo = new AttributesImpl();
1039:                attsNo.addAttribute(null, null, "confirmed", null, "no");
1040:                AttributesImpl attsFeatureNo = new AttributesImpl();
1041:                attsFeatureNo.addAttribute(null, null, "type", null, "feature");
1042:                attsFeatureNo.addAttribute(null, null, "confirmed", null, "no");
1043:
1044:                handler.startDocument();
1045:                handler.startElement(null, null, "dependencies", attsEmpty);
1046:                handler.startElement(null, null, "package", attsNo);
1047:                handler.startElement(null, null, "name", attsEmpty);
1048:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
1049:                        MY_PACKAGE_NAME.length());
1050:                handler.endElement(null, null, "name");
1051:                handler.startElement(null, null, "inbound", attsFeatureNo);
1052:                handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0,
1053:                        OTHER_FEATURE_NAME.length());
1054:                handler.endElement(null, null, "inbound");
1055:                handler.endElement(null, null, "package");
1056:                handler.endElement(null, null, "dependencies");
1057:                handler.endDocument();
1058:
1059:                assertEquals("nb packages", 2, handler.getFactory()
1060:                        .getPackages().size());
1061:                assertNotNull("missing package", handler.getFactory()
1062:                        .getPackages().get(MY_PACKAGE_NAME));
1063:                assertFalse("package is confirmed", ((Node) handler
1064:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
1065:                        .isConfirmed());
1066:                assertNotNull("missing package", handler.getFactory()
1067:                        .getPackages().get(OTHER_PACKAGE_NAME));
1068:                assertFalse("package is confirmed", ((Node) handler
1069:                        .getFactory().getPackages().get(OTHER_PACKAGE_NAME))
1070:                        .isConfirmed());
1071:
1072:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
1073:                        .size());
1074:                assertNotNull("missing class", handler.getFactory()
1075:                        .getClasses().get(OTHER_CLASS_NAME));
1076:                assertFalse("class is confirmed", ((Node) handler.getFactory()
1077:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
1078:
1079:                assertEquals("nb features", 1, handler.getFactory()
1080:                        .getFeatures().size());
1081:                assertNotNull("missing feature", handler.getFactory()
1082:                        .getFeatures().get(OTHER_FEATURE_NAME));
1083:                assertFalse("feature is confirmed", ((Node) handler
1084:                        .getFactory().getFeatures().get(OTHER_FEATURE_NAME))
1085:                        .isConfirmed());
1086:            }
1087:
1088:            public void testConfirmedInboundFeatureDependency()
1089:                    throws SAXException {
1090:                AttributesImpl attsEmpty = new AttributesImpl();
1091:                AttributesImpl attsYes = new AttributesImpl();
1092:                attsYes.addAttribute(null, null, "confirmed", null, "yes");
1093:                AttributesImpl attsFeatureYes = new AttributesImpl();
1094:                attsFeatureYes
1095:                        .addAttribute(null, null, "type", null, "feature");
1096:                attsFeatureYes.addAttribute(null, null, "confirmed", null,
1097:                        "yes");
1098:
1099:                handler.startDocument();
1100:                handler.startElement(null, null, "dependencies", attsEmpty);
1101:                handler.startElement(null, null, "package", attsYes);
1102:                handler.startElement(null, null, "name", attsEmpty);
1103:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
1104:                        MY_PACKAGE_NAME.length());
1105:                handler.endElement(null, null, "name");
1106:                handler.startElement(null, null, "inbound", attsFeatureYes);
1107:                handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0,
1108:                        OTHER_FEATURE_NAME.length());
1109:                handler.endElement(null, null, "inbound");
1110:                handler.endElement(null, null, "package");
1111:                handler.endElement(null, null, "dependencies");
1112:                handler.endDocument();
1113:
1114:                assertEquals("nb packages", 2, handler.getFactory()
1115:                        .getPackages().size());
1116:                assertNotNull("missing package", handler.getFactory()
1117:                        .getPackages().get(MY_PACKAGE_NAME));
1118:                assertTrue("package is inferred", ((Node) handler.getFactory()
1119:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
1120:                assertNotNull("missing package", handler.getFactory()
1121:                        .getPackages().get(OTHER_PACKAGE_NAME));
1122:                assertTrue("package is inferred", ((Node) handler.getFactory()
1123:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
1124:
1125:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
1126:                        .size());
1127:                assertNotNull("missing class", handler.getFactory()
1128:                        .getClasses().get(OTHER_CLASS_NAME));
1129:                assertTrue("class is inferred", ((Node) handler.getFactory()
1130:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
1131:
1132:                assertEquals("nb features", 1, handler.getFactory()
1133:                        .getFeatures().size());
1134:                assertNotNull("missing feature", handler.getFactory()
1135:                        .getFeatures().get(OTHER_FEATURE_NAME));
1136:                assertTrue("feature is inferred", ((Node) handler.getFactory()
1137:                        .getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
1138:            }
1139:
1140:            public void testUnspecifiedOutboundFeatureDependencyIsConfirmed()
1141:                    throws SAXException {
1142:                Attributes attsEmpty = new AttributesImpl();
1143:                AttributesImpl attsFeature = new AttributesImpl();
1144:                attsFeature.addAttribute(null, null, "type", null, "feature");
1145:
1146:                handler.startDocument();
1147:                handler.startElement(null, null, "dependencies", attsEmpty);
1148:                handler.startElement(null, null, "package", attsEmpty);
1149:                handler.startElement(null, null, "name", attsEmpty);
1150:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
1151:                        MY_PACKAGE_NAME.length());
1152:                handler.endElement(null, null, "name");
1153:                handler.startElement(null, null, "outbound", attsFeature);
1154:                handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0,
1155:                        OTHER_FEATURE_NAME.length());
1156:                handler.endElement(null, null, "outbound");
1157:                handler.endElement(null, null, "package");
1158:                handler.endElement(null, null, "dependencies");
1159:                handler.endDocument();
1160:
1161:                assertEquals("nb packages", 2, handler.getFactory()
1162:                        .getPackages().size());
1163:                assertNotNull("missing package", handler.getFactory()
1164:                        .getPackages().get(MY_PACKAGE_NAME));
1165:                assertTrue("package is inferred", ((Node) handler.getFactory()
1166:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
1167:                assertNotNull("missing package", handler.getFactory()
1168:                        .getPackages().get(OTHER_PACKAGE_NAME));
1169:                assertTrue("package is inferred", ((Node) handler.getFactory()
1170:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
1171:
1172:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
1173:                        .size());
1174:                assertNotNull("missing class", handler.getFactory()
1175:                        .getClasses().get(OTHER_CLASS_NAME));
1176:                assertTrue("class is inferred", ((Node) handler.getFactory()
1177:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
1178:
1179:                assertEquals("nb features", 1, handler.getFactory()
1180:                        .getFeatures().size());
1181:                assertNotNull("missing feature", handler.getFactory()
1182:                        .getFeatures().get(OTHER_FEATURE_NAME));
1183:                assertTrue("feature is inferred", ((Node) handler.getFactory()
1184:                        .getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
1185:            }
1186:
1187:            public void testInferredOutboundFeatureDependency()
1188:                    throws SAXException {
1189:                AttributesImpl attsEmpty = new AttributesImpl();
1190:                AttributesImpl attsNo = new AttributesImpl();
1191:                attsNo.addAttribute(null, null, "confirmed", null, "no");
1192:                AttributesImpl attsFeatureNo = new AttributesImpl();
1193:                attsFeatureNo.addAttribute(null, null, "type", null, "feature");
1194:                attsFeatureNo.addAttribute(null, null, "confirmed", null, "no");
1195:
1196:                handler.startDocument();
1197:                handler.startElement(null, null, "dependencies", attsEmpty);
1198:                handler.startElement(null, null, "package", attsNo);
1199:                handler.startElement(null, null, "name", attsEmpty);
1200:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
1201:                        MY_PACKAGE_NAME.length());
1202:                handler.endElement(null, null, "name");
1203:                handler.startElement(null, null, "outbound", attsFeatureNo);
1204:                handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0,
1205:                        OTHER_FEATURE_NAME.length());
1206:                handler.endElement(null, null, "outbound");
1207:                handler.endElement(null, null, "package");
1208:                handler.endElement(null, null, "dependencies");
1209:                handler.endDocument();
1210:
1211:                assertEquals("nb packages", 2, handler.getFactory()
1212:                        .getPackages().size());
1213:                assertNotNull("missing package", handler.getFactory()
1214:                        .getPackages().get(MY_PACKAGE_NAME));
1215:                assertFalse("package is confirmed", ((Node) handler
1216:                        .getFactory().getPackages().get(MY_PACKAGE_NAME))
1217:                        .isConfirmed());
1218:                assertNotNull("missing package", handler.getFactory()
1219:                        .getPackages().get(OTHER_PACKAGE_NAME));
1220:                assertFalse("package is confirmed", ((Node) handler
1221:                        .getFactory().getPackages().get(OTHER_PACKAGE_NAME))
1222:                        .isConfirmed());
1223:
1224:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
1225:                        .size());
1226:                assertNotNull("missing class", handler.getFactory()
1227:                        .getClasses().get(OTHER_CLASS_NAME));
1228:                assertFalse("class is confirmed", ((Node) handler.getFactory()
1229:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
1230:
1231:                assertEquals("nb features", 1, handler.getFactory()
1232:                        .getFeatures().size());
1233:                assertNotNull("missing feature", handler.getFactory()
1234:                        .getFeatures().get(OTHER_FEATURE_NAME));
1235:                assertFalse("feature is confirmed", ((Node) handler
1236:                        .getFactory().getFeatures().get(OTHER_FEATURE_NAME))
1237:                        .isConfirmed());
1238:            }
1239:
1240:            public void testConfirmedOutboundFeatureDependency()
1241:                    throws SAXException {
1242:                AttributesImpl attsEmpty = new AttributesImpl();
1243:                AttributesImpl attsYes = new AttributesImpl();
1244:                attsYes.addAttribute(null, null, "confirmed", null, "yes");
1245:                AttributesImpl attsFeatureYes = new AttributesImpl();
1246:                attsFeatureYes
1247:                        .addAttribute(null, null, "type", null, "feature");
1248:                attsFeatureYes.addAttribute(null, null, "confirmed", null,
1249:                        "yes");
1250:
1251:                handler.startDocument();
1252:                handler.startElement(null, null, "dependencies", attsEmpty);
1253:                handler.startElement(null, null, "package", attsYes);
1254:                handler.startElement(null, null, "name", attsEmpty);
1255:                handler.characters(MY_PACKAGE_NAME.toCharArray(), 0,
1256:                        MY_PACKAGE_NAME.length());
1257:                handler.endElement(null, null, "name");
1258:                handler.startElement(null, null, "outbound", attsFeatureYes);
1259:                handler.characters(OTHER_FEATURE_NAME.toCharArray(), 0,
1260:                        OTHER_FEATURE_NAME.length());
1261:                handler.endElement(null, null, "outbound");
1262:                handler.endElement(null, null, "package");
1263:                handler.endElement(null, null, "dependencies");
1264:                handler.endDocument();
1265:
1266:                assertEquals("nb packages", 2, handler.getFactory()
1267:                        .getPackages().size());
1268:                assertNotNull("missing package", handler.getFactory()
1269:                        .getPackages().get(MY_PACKAGE_NAME));
1270:                assertTrue("package is inferred", ((Node) handler.getFactory()
1271:                        .getPackages().get(MY_PACKAGE_NAME)).isConfirmed());
1272:                assertNotNull("missing package", handler.getFactory()
1273:                        .getPackages().get(OTHER_PACKAGE_NAME));
1274:                assertTrue("package is inferred", ((Node) handler.getFactory()
1275:                        .getPackages().get(OTHER_PACKAGE_NAME)).isConfirmed());
1276:
1277:                assertEquals("nb classes", 1, handler.getFactory().getClasses()
1278:                        .size());
1279:                assertNotNull("missing class", handler.getFactory()
1280:                        .getClasses().get(OTHER_CLASS_NAME));
1281:                assertTrue("class is inferred", ((Node) handler.getFactory()
1282:                        .getClasses().get(OTHER_CLASS_NAME)).isConfirmed());
1283:
1284:                assertEquals("nb features", 1, handler.getFactory()
1285:                        .getFeatures().size());
1286:                assertNotNull("missing feature", handler.getFactory()
1287:                        .getFeatures().get(OTHER_FEATURE_NAME));
1288:                assertTrue("feature is inferred", ((Node) handler.getFactory()
1289:                        .getFeatures().get(OTHER_FEATURE_NAME)).isConfirmed());
1290:            }
1291:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.