Source Code Cross Referenced for TestLinkMaximizerSystematic.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) 


001:        /*
002:         *  Copyright (c) 2001-2007, Jean Tessier
003:         *  All rights reserved.
004:         *  
005:         *  Redistribution and use in source and binary forms, with or without
006:         *  modification, are permitted provided that the following conditions
007:         *  are met:
008:         *  
009:         *      * Redistributions of source code must retain the above copyright
010:         *        notice, this list of conditions and the following disclaimer.
011:         *  
012:         *      * Redistributions in binary form must reproduce the above copyright
013:         *        notice, this list of conditions and the following disclaimer in the
014:         *        documentation and/or other materials provided with the distribution.
015:         *  
016:         *      * Neither the name of Jean Tessier nor the names of his contributors
017:         *        may be used to endorse or promote products derived from this software
018:         *        without specific prior written permission.
019:         *  
020:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
021:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
022:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
023:         *  A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR
024:         *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025:         *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026:         *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
027:         *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
028:         *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
029:         *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
030:         *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031:         */
032:
033:        package com.jeantessier.dependency;
034:
035:        import java.io.*;
036:        import java.util.*;
037:
038:        import junit.framework.*;
039:
040:        import org.apache.oro.text.perl.*;
041:
042:        public class TestLinkMaximizerSystematic extends TestCase {
043:            NodeFactory factory;
044:
045:            PackageNode a;
046:            ClassNode a_A;
047:            FeatureNode a_A_a;
048:
049:            PackageNode b;
050:            ClassNode b_B;
051:            FeatureNode b_B_b;
052:
053:            protected void setUp() throws Exception {
054:                factory = new NodeFactory();
055:
056:                a = factory.createPackage("a");
057:                a_A = factory.createClass("a.A");
058:                a_A_a = factory.createFeature("a.A.a()");
059:
060:                b = factory.createPackage("b");
061:                b_B = factory.createClass("b.B");
062:                b_B_b = factory.createFeature("b.B.b()");
063:            }
064:
065:            public void testPackagePackage() {
066:                a.addDependency(b);
067:
068:                Visitor visitor = new LinkMaximizer();
069:                visitor.traverseNodes(factory.getPackages().values());
070:
071:                assertEquals("a outbound", 1, a.getOutboundDependencies()
072:                        .size());
073:                assertTrue("Missing a --> b", a.getOutboundDependencies()
074:                        .contains(b));
075:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
076:                assertEquals("a_A outbound", 0, a_A.getOutboundDependencies()
077:                        .size());
078:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
079:                        .size());
080:                assertEquals("a_A_a outbound", 0, a_A_a
081:                        .getOutboundDependencies().size());
082:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
083:                        .size());
084:                assertEquals("b outbound", 0, b.getOutboundDependencies()
085:                        .size());
086:                assertEquals("b inbound", 1, b.getInboundDependencies().size());
087:                assertTrue("Missing b <-- a", b.getInboundDependencies()
088:                        .contains(a));
089:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
090:                        .size());
091:                assertEquals("b_B inbound", 0, b_B.getInboundDependencies()
092:                        .size());
093:                assertEquals("b_B_b outbound", 0, b_B_b
094:                        .getOutboundDependencies().size());
095:                assertEquals("b_B_b inbound", 0, b_B_b.getInboundDependencies()
096:                        .size());
097:            }
098:
099:            public void testPackageClass() {
100:                a.addDependency(b_B);
101:
102:                Visitor visitor = new LinkMaximizer();
103:                visitor.traverseNodes(factory.getPackages().values());
104:
105:                assertEquals("a outbound", 2, a.getOutboundDependencies()
106:                        .size());
107:                assertTrue("Missing a --> b", a.getOutboundDependencies()
108:                        .contains(b));
109:                assertTrue("Missing a --> b.B", a.getOutboundDependencies()
110:                        .contains(b_B));
111:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
112:                assertEquals("a_A outbound", 0, a_A.getOutboundDependencies()
113:                        .size());
114:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
115:                        .size());
116:                assertEquals("a_A_a outbound", 0, a_A_a
117:                        .getOutboundDependencies().size());
118:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
119:                        .size());
120:                assertEquals("b outbound", 0, b.getOutboundDependencies()
121:                        .size());
122:                assertEquals("b inbound", 1, b.getInboundDependencies().size());
123:                assertTrue("Missing b <-- a", b.getInboundDependencies()
124:                        .contains(a));
125:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
126:                        .size());
127:                assertEquals("b_B inbound", 1, b_B.getInboundDependencies()
128:                        .size());
129:                assertTrue("Missing b.B <-- a", b_B.getInboundDependencies()
130:                        .contains(a));
131:                assertEquals("b_B_b outbound", 0, b_B_b
132:                        .getOutboundDependencies().size());
133:                assertEquals("b_B_b inbound", 0, b_B_b.getInboundDependencies()
134:                        .size());
135:            }
136:
137:            public void testPackageFeature() {
138:                a.addDependency(b_B_b);
139:
140:                Visitor visitor = new LinkMaximizer();
141:                visitor.traverseNodes(factory.getPackages().values());
142:
143:                assertEquals("a outbound", 3, a.getOutboundDependencies()
144:                        .size());
145:                assertTrue("Missing a --> b", a.getOutboundDependencies()
146:                        .contains(b));
147:                assertTrue("Missing a --> b.B", a.getOutboundDependencies()
148:                        .contains(b_B));
149:                assertTrue("Missing a --> b.B.b", a.getOutboundDependencies()
150:                        .contains(b_B_b));
151:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
152:                assertEquals("a_A outbound", 0, a_A.getOutboundDependencies()
153:                        .size());
154:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
155:                        .size());
156:                assertEquals("a_A_a outbound", 0, a_A_a
157:                        .getOutboundDependencies().size());
158:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
159:                        .size());
160:                assertEquals("b outbound", 0, b.getOutboundDependencies()
161:                        .size());
162:                assertEquals("b inbound", 1, b.getInboundDependencies().size());
163:                assertTrue("Missing b <-- a", b.getInboundDependencies()
164:                        .contains(a));
165:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
166:                        .size());
167:                assertEquals("b_B inbound", 1, b_B.getInboundDependencies()
168:                        .size());
169:                assertTrue("Missing b.B <-- a", b_B.getInboundDependencies()
170:                        .contains(a));
171:                assertEquals("b_B_b outbound", 0, b_B_b
172:                        .getOutboundDependencies().size());
173:                assertEquals("b_B_b inbound", 1, b_B_b.getInboundDependencies()
174:                        .size());
175:                assertTrue("Missing b.B.b <-- a", b_B_b
176:                        .getInboundDependencies().contains(a));
177:            }
178:
179:            public void testClassPackage() {
180:                a_A.addDependency(b);
181:
182:                Visitor visitor = new LinkMaximizer();
183:                visitor.traverseNodes(factory.getPackages().values());
184:
185:                assertEquals("a outbound", 1, a.getOutboundDependencies()
186:                        .size());
187:                assertTrue("Missing a --> b", a.getOutboundDependencies()
188:                        .contains(b));
189:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
190:                assertEquals("a_A outbound", 1, a_A.getOutboundDependencies()
191:                        .size());
192:                assertTrue("Missing a.A --> b", a_A.getOutboundDependencies()
193:                        .contains(b));
194:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
195:                        .size());
196:                assertEquals("a_A_a outbound", 0, a_A_a
197:                        .getOutboundDependencies().size());
198:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
199:                        .size());
200:                assertEquals("b outbound", 0, b.getOutboundDependencies()
201:                        .size());
202:                assertEquals("b inbound", 2, b.getInboundDependencies().size());
203:                assertTrue("Missing b <-- a", b.getInboundDependencies()
204:                        .contains(a));
205:                assertTrue("Missing b <-- a.A", b.getInboundDependencies()
206:                        .contains(a_A));
207:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
208:                        .size());
209:                assertEquals("b_B inbound", 0, b_B.getInboundDependencies()
210:                        .size());
211:                assertEquals("b_B_b outbound", 0, b_B_b
212:                        .getOutboundDependencies().size());
213:                assertEquals("b_B_b inbound", 0, b_B_b.getInboundDependencies()
214:                        .size());
215:            }
216:
217:            public void testClassClass() {
218:                a_A.addDependency(b_B);
219:
220:                Visitor visitor = new LinkMaximizer();
221:                visitor.traverseNodes(factory.getPackages().values());
222:
223:                assertEquals("a outbound", 2, a.getOutboundDependencies()
224:                        .size());
225:                assertTrue("Missing a --> b", a.getOutboundDependencies()
226:                        .contains(b));
227:                assertTrue("Missing a --> b.B", a.getOutboundDependencies()
228:                        .contains(b_B));
229:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
230:                assertEquals("a_A outbound", 2, a_A.getOutboundDependencies()
231:                        .size());
232:                assertTrue("Missing a.A --> b", a_A.getOutboundDependencies()
233:                        .contains(b));
234:                assertTrue("Missing a.A --> b.B", a_A.getOutboundDependencies()
235:                        .contains(b_B));
236:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
237:                        .size());
238:                assertEquals("a_A_a outbound", 0, a_A_a
239:                        .getOutboundDependencies().size());
240:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
241:                        .size());
242:                assertEquals("b outbound", 0, b.getOutboundDependencies()
243:                        .size());
244:                assertEquals("b inbound", 2, b.getInboundDependencies().size());
245:                assertTrue("Missing b <-- a", b.getInboundDependencies()
246:                        .contains(a));
247:                assertTrue("Missing b <-- a.A", b.getInboundDependencies()
248:                        .contains(a_A));
249:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
250:                        .size());
251:                assertEquals("b_B inbound", 2, b_B.getInboundDependencies()
252:                        .size());
253:                assertTrue("Missing b.B <-- a", b_B.getInboundDependencies()
254:                        .contains(a));
255:                assertTrue("Missing b.B <-- a.A", b_B.getInboundDependencies()
256:                        .contains(a_A));
257:                assertEquals("b_B_b outbound", 0, b_B_b
258:                        .getOutboundDependencies().size());
259:                assertEquals("b_B_b inbound", 0, b_B_b.getInboundDependencies()
260:                        .size());
261:            }
262:
263:            public void testClassClassSparse() {
264:                a.addDependency(b);
265:                a_A.addDependency(b_B);
266:
267:                Visitor visitor = new LinkMaximizer();
268:                visitor.traverseNodes(factory.getPackages().values());
269:
270:                assertEquals("a outbound", 2, a.getOutboundDependencies()
271:                        .size());
272:                assertTrue("Missing a --> b", a.getOutboundDependencies()
273:                        .contains(b));
274:                assertTrue("Missing a --> b.B", a.getOutboundDependencies()
275:                        .contains(b_B));
276:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
277:                assertEquals("a_A outbound", 2, a_A.getOutboundDependencies()
278:                        .size());
279:                assertTrue("Missing a.A --> b", a_A.getOutboundDependencies()
280:                        .contains(b));
281:                assertTrue("Missing a.A --> b.B", a_A.getOutboundDependencies()
282:                        .contains(b_B));
283:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
284:                        .size());
285:                assertEquals("a_A_a outbound", 0, a_A_a
286:                        .getOutboundDependencies().size());
287:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
288:                        .size());
289:                assertEquals("b outbound", 0, b.getOutboundDependencies()
290:                        .size());
291:                assertEquals("b inbound", 2, b.getInboundDependencies().size());
292:                assertTrue("Missing b <-- a", b.getInboundDependencies()
293:                        .contains(a));
294:                assertTrue("Missing b <-- a.A", b.getInboundDependencies()
295:                        .contains(a_A));
296:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
297:                        .size());
298:                assertEquals("b_B inbound", 2, b_B.getInboundDependencies()
299:                        .size());
300:                assertTrue("Missing b.B <-- a", b_B.getInboundDependencies()
301:                        .contains(a));
302:                assertTrue("Missing b.B <-- a.A", b_B.getInboundDependencies()
303:                        .contains(a_A));
304:                assertEquals("b_B_b outbound", 0, b_B_b
305:                        .getOutboundDependencies().size());
306:                assertEquals("b_B_b inbound", 0, b_B_b.getInboundDependencies()
307:                        .size());
308:            }
309:
310:            public void testClassFeature() {
311:                a_A.addDependency(b_B_b);
312:
313:                Visitor visitor = new LinkMaximizer();
314:                visitor.traverseNodes(factory.getPackages().values());
315:
316:                assertEquals("a outbound", 3, a.getOutboundDependencies()
317:                        .size());
318:                assertTrue("Missing a --> b", a.getOutboundDependencies()
319:                        .contains(b));
320:                assertTrue("Missing a --> b.B", a.getOutboundDependencies()
321:                        .contains(b_B));
322:                assertTrue("Missing a --> b.B.b", a.getOutboundDependencies()
323:                        .contains(b_B_b));
324:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
325:                assertEquals("a_A outbound", 3, a_A.getOutboundDependencies()
326:                        .size());
327:                assertTrue("Missing a.A --> b", a_A.getOutboundDependencies()
328:                        .contains(b));
329:                assertTrue("Missing a.A --> b.B", a_A.getOutboundDependencies()
330:                        .contains(b_B));
331:                assertTrue("Missing a.A --> b.B.b", a_A
332:                        .getOutboundDependencies().contains(b_B_b));
333:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
334:                        .size());
335:                assertEquals("a_A_a outbound", 0, a_A_a
336:                        .getOutboundDependencies().size());
337:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
338:                        .size());
339:                assertEquals("b outbound", 0, b.getOutboundDependencies()
340:                        .size());
341:                assertEquals("b inbound", 2, b.getInboundDependencies().size());
342:                assertTrue("Missing b <-- a", b.getInboundDependencies()
343:                        .contains(a));
344:                assertTrue("Missing b <-- a_A", b.getInboundDependencies()
345:                        .contains(a_A));
346:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
347:                        .size());
348:                assertEquals("b_B inbound", 2, b_B.getInboundDependencies()
349:                        .size());
350:                assertTrue("Missing b.B <-- a", b_B.getInboundDependencies()
351:                        .contains(a));
352:                assertTrue("Missing b.B <-- a_A", b_B.getInboundDependencies()
353:                        .contains(a_A));
354:                assertEquals("b_B_b outbound", 0, b_B_b
355:                        .getOutboundDependencies().size());
356:                assertEquals("b_B_b inbound", 2, b_B_b.getInboundDependencies()
357:                        .size());
358:                assertTrue("Missing b.B.b <-- a", b_B_b
359:                        .getInboundDependencies().contains(a));
360:                assertTrue("Missing b.B.b <-- a_A", b_B_b
361:                        .getInboundDependencies().contains(a_A));
362:            }
363:
364:            public void testFeaturePackage() {
365:                a_A_a.addDependency(b);
366:
367:                Visitor visitor = new LinkMaximizer();
368:                visitor.traverseNodes(factory.getPackages().values());
369:
370:                assertEquals("a outbound", 1, a.getOutboundDependencies()
371:                        .size());
372:                assertTrue("Missing a --> b", a.getOutboundDependencies()
373:                        .contains(b));
374:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
375:                assertEquals("a_A outbound", 1, a_A.getOutboundDependencies()
376:                        .size());
377:                assertTrue("Missing a.A --> b", a_A.getOutboundDependencies()
378:                        .contains(b));
379:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
380:                        .size());
381:                assertEquals("a_A_a outbound", 1, a_A_a
382:                        .getOutboundDependencies().size());
383:                assertTrue("Missing a.A.a --> b", a_A_a
384:                        .getOutboundDependencies().contains(b));
385:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
386:                        .size());
387:                assertEquals("b outbound", 0, b.getOutboundDependencies()
388:                        .size());
389:                assertEquals("b inbound", 3, b.getInboundDependencies().size());
390:                assertTrue("Missing b <-- a", b.getInboundDependencies()
391:                        .contains(a));
392:                assertTrue("Missing b <-- a.A", b.getInboundDependencies()
393:                        .contains(a_A));
394:                assertTrue("Missing b <-- a.A.a", b.getInboundDependencies()
395:                        .contains(a_A_a));
396:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
397:                        .size());
398:                assertEquals("b_B inbound", 0, b_B.getInboundDependencies()
399:                        .size());
400:                assertEquals("b_B_b outbound", 0, b_B_b
401:                        .getOutboundDependencies().size());
402:                assertEquals("b_B_b inbound", 0, b_B_b.getInboundDependencies()
403:                        .size());
404:            }
405:
406:            public void testFeatureClass() {
407:                a_A_a.addDependency(b_B);
408:
409:                Visitor visitor = new LinkMaximizer();
410:                visitor.traverseNodes(factory.getPackages().values());
411:
412:                assertEquals("a outbound", 2, a.getOutboundDependencies()
413:                        .size());
414:                assertTrue("Missing a --> b", a.getOutboundDependencies()
415:                        .contains(b));
416:                assertTrue("Missing a --> b.B", a.getOutboundDependencies()
417:                        .contains(b_B));
418:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
419:                assertEquals("a_A outbound", 2, a_A.getOutboundDependencies()
420:                        .size());
421:                assertTrue("Missing a.A --> b", a_A.getOutboundDependencies()
422:                        .contains(b));
423:                assertTrue("Missing a.A --> b.B", a_A.getOutboundDependencies()
424:                        .contains(b_B));
425:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
426:                        .size());
427:                assertEquals("a_A_a outbound", 2, a_A_a
428:                        .getOutboundDependencies().size());
429:                assertTrue("Missing a.A.a --> b", a_A_a
430:                        .getOutboundDependencies().contains(b));
431:                assertTrue("Missing a.A.a --> b.B", a_A_a
432:                        .getOutboundDependencies().contains(b_B));
433:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
434:                        .size());
435:                assertEquals("b outbound", 0, b.getOutboundDependencies()
436:                        .size());
437:                assertEquals("b inbound", 3, b.getInboundDependencies().size());
438:                assertTrue("Missing b <-- a", b.getInboundDependencies()
439:                        .contains(a));
440:                assertTrue("Missing b <-- a.A", b.getInboundDependencies()
441:                        .contains(a_A));
442:                assertTrue("Missing b <-- a.A.a", b.getInboundDependencies()
443:                        .contains(a_A_a));
444:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
445:                        .size());
446:                assertEquals("b_B inbound", 3, b_B.getInboundDependencies()
447:                        .size());
448:                assertTrue("Missing b.B <-- a", b_B.getInboundDependencies()
449:                        .contains(a));
450:                assertTrue("Missing b.B <-- a.A", b_B.getInboundDependencies()
451:                        .contains(a_A));
452:                assertTrue("Missing b.B <-- a.A.a", b_B
453:                        .getInboundDependencies().contains(a_A_a));
454:                assertEquals("b_B_b outbound", 0, b_B_b
455:                        .getOutboundDependencies().size());
456:                assertEquals("b_B_b inbound", 0, b_B_b.getInboundDependencies()
457:                        .size());
458:            }
459:
460:            public void testFeatureFeature() {
461:                a_A_a.addDependency(b_B_b);
462:
463:                Visitor visitor = new LinkMaximizer();
464:                visitor.traverseNodes(factory.getPackages().values());
465:
466:                assertEquals("a outbound", 3, a.getOutboundDependencies()
467:                        .size());
468:                assertTrue("Missing a --> b", a.getOutboundDependencies()
469:                        .contains(b));
470:                assertTrue("Missing a --> b.B", a.getOutboundDependencies()
471:                        .contains(b_B));
472:                assertTrue("Missing a --> b.B.b", a.getOutboundDependencies()
473:                        .contains(b_B_b));
474:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
475:                assertEquals("a_A outbound", 3, a_A.getOutboundDependencies()
476:                        .size());
477:                assertTrue("Missing a.A --> b", a_A.getOutboundDependencies()
478:                        .contains(b));
479:                assertTrue("Missing a.A --> b.B", a_A.getOutboundDependencies()
480:                        .contains(b_B));
481:                assertTrue("Missing a.A --> b.B.b", a_A
482:                        .getOutboundDependencies().contains(b_B_b));
483:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
484:                        .size());
485:                assertEquals("a_A_a outbound", 3, a_A_a
486:                        .getOutboundDependencies().size());
487:                assertTrue("Missing a.A.a --> b", a_A_a
488:                        .getOutboundDependencies().contains(b));
489:                assertTrue("Missing a.A.a --> b.B", a_A_a
490:                        .getOutboundDependencies().contains(b_B));
491:                assertTrue("Missing a.A.a --> b.B.b", a_A_a
492:                        .getOutboundDependencies().contains(b_B_b));
493:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
494:                        .size());
495:                assertEquals("b outbound", 0, b.getOutboundDependencies()
496:                        .size());
497:                assertEquals("b inbound", 3, b.getInboundDependencies().size());
498:                assertTrue("Missing b <-- a", b.getInboundDependencies()
499:                        .contains(a));
500:                assertTrue("Missing b <-- a.A", b.getInboundDependencies()
501:                        .contains(a_A));
502:                assertTrue("Missing b <-- a.A.a", b.getInboundDependencies()
503:                        .contains(a_A_a));
504:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
505:                        .size());
506:                assertEquals("b_B inbound", 3, b_B.getInboundDependencies()
507:                        .size());
508:                assertTrue("Missing b.B <-- a", b_B.getInboundDependencies()
509:                        .contains(a));
510:                assertTrue("Missing b.B <-- a.A", b_B.getInboundDependencies()
511:                        .contains(a_A));
512:                assertTrue("Missing b.B <-- a.A.a", b_B
513:                        .getInboundDependencies().contains(a_A_a));
514:                assertEquals("b_B_b outbound", 0, b_B_b
515:                        .getOutboundDependencies().size());
516:                assertEquals("b_B_b inbound", 3, b_B_b.getInboundDependencies()
517:                        .size());
518:                assertTrue("Missing b.B.b <-- a", b_B_b
519:                        .getInboundDependencies().contains(a));
520:                assertTrue("Missing b.B.b <-- a.A", b_B_b
521:                        .getInboundDependencies().contains(a_A));
522:                assertTrue("Missing b.B.b <-- a.A.a", b_B_b
523:                        .getInboundDependencies().contains(a_A_a));
524:            }
525:
526:            public void testFeatureFeatureSparse() {
527:                a.addDependency(b);
528:                a_A.addDependency(b_B);
529:                a_A_a.addDependency(b_B_b);
530:
531:                Visitor visitor = new LinkMaximizer();
532:                visitor.traverseNodes(factory.getPackages().values());
533:
534:                assertEquals("a outbound", 3, a.getOutboundDependencies()
535:                        .size());
536:                assertTrue("Missing a --> b", a.getOutboundDependencies()
537:                        .contains(b));
538:                assertTrue("Missing a --> b.B", a.getOutboundDependencies()
539:                        .contains(b_B));
540:                assertTrue("Missing a --> b.B.b", a.getOutboundDependencies()
541:                        .contains(b_B_b));
542:                assertEquals("a inbound", 0, a.getInboundDependencies().size());
543:                assertEquals("a_A outbound", 3, a_A.getOutboundDependencies()
544:                        .size());
545:                assertTrue("Missing a.A --> b", a_A.getOutboundDependencies()
546:                        .contains(b));
547:                assertTrue("Missing a.A --> b.B", a_A.getOutboundDependencies()
548:                        .contains(b_B));
549:                assertTrue("Missing a.A --> b.B.b", a_A
550:                        .getOutboundDependencies().contains(b_B_b));
551:                assertEquals("a_A inbound", 0, a_A.getInboundDependencies()
552:                        .size());
553:                assertEquals("a_A_a outbound", 3, a_A_a
554:                        .getOutboundDependencies().size());
555:                assertTrue("Missing a.A.a --> b", a_A_a
556:                        .getOutboundDependencies().contains(b));
557:                assertTrue("Missing a.A.a --> b.B", a_A_a
558:                        .getOutboundDependencies().contains(b_B));
559:                assertTrue("Missing a.A.a --> b.B.b", a_A_a
560:                        .getOutboundDependencies().contains(b_B_b));
561:                assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies()
562:                        .size());
563:                assertEquals("b outbound", 0, b.getOutboundDependencies()
564:                        .size());
565:                assertEquals("b inbound", 3, b.getInboundDependencies().size());
566:                assertTrue("Missing b <-- a", b.getInboundDependencies()
567:                        .contains(a));
568:                assertTrue("Missing b <-- a.A", b.getInboundDependencies()
569:                        .contains(a_A));
570:                assertTrue("Missing b <-- a.A.a", b.getInboundDependencies()
571:                        .contains(a_A_a));
572:                assertEquals("b_B outbound", 0, b_B.getOutboundDependencies()
573:                        .size());
574:                assertEquals("b_B inbound", 3, b_B.getInboundDependencies()
575:                        .size());
576:                assertTrue("Missing b.B <-- a", b_B.getInboundDependencies()
577:                        .contains(a));
578:                assertTrue("Missing b.B <-- a.A", b_B.getInboundDependencies()
579:                        .contains(a_A));
580:                assertTrue("Missing b.B <-- a.A.a", b_B
581:                        .getInboundDependencies().contains(a_A_a));
582:                assertEquals("b_B_b outbound", 0, b_B_b
583:                        .getOutboundDependencies().size());
584:                assertEquals("b_B_b inbound", 3, b_B_b.getInboundDependencies()
585:                        .size());
586:                assertTrue("Missing b.B.b <-- a", b_B_b
587:                        .getInboundDependencies().contains(a));
588:                assertTrue("Missing b.B.b <-- a.A", b_B_b
589:                        .getInboundDependencies().contains(a_A));
590:                assertTrue("Missing b.B.b <-- a.A.a", b_B_b
591:                        .getInboundDependencies().contains(a_A_a));
592:            }
593:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.