Source Code Cross Referenced for TestXml2Site.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » engine » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.engine 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
0003:         * Distributed under the terms of either:
0004:         * - the common development and distribution license (CDDL), v1.0; or
0005:         * - the GNU Lesser General Public License, v2.1 or later
0006:         * $Id: TestXml2Site.java 3634 2007-01-08 21:42:24Z gbevin $
0007:         */
0008:        package com.uwyn.rife.engine;
0009:
0010:        import com.uwyn.rife.engine.exceptions.*;
0011:
0012:        import com.uwyn.rife.database.Datasources;
0013:        import com.uwyn.rife.rep.Rep;
0014:        import com.uwyn.rife.resources.ResourceFinderClasspath;
0015:        import com.uwyn.rife.template.Template;
0016:        import com.uwyn.rife.template.TemplateFactory;
0017:        import java.util.Collection;
0018:        import junit.framework.TestCase;
0019:
0020:        public class TestXml2Site extends TestCase {
0021:            public TestXml2Site(String name) {
0022:                super (name);
0023:            }
0024:
0025:            public void testParser() {
0026:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
0027:                        .getInstance();
0028:                SiteBuilder builder = new SiteBuilder("xml/test_xml2site.xml",
0029:                        resourcefinder);
0030:
0031:                Site site = builder.getSite();
0032:
0033:                assertEquals(site.getUrls().size(), 6);
0034:                assertEquals(site.getIds().size(), 9);
0035:
0036:                assertEquals("com.uwyn.rife.engine.testelements.engine.Simple",
0037:                        site.resolveUrl("/test/element1", null)
0038:                                .getImplementation());
0039:                assertNull(site.resolveUrl("/test/element1/path/info", null));
0040:                assertNull(site.resolveUrl("/test/element1_notthere", null));
0041:                assertEquals(
0042:                        "com.uwyn.rife.engine.testelements.submission.Normal",
0043:                        site.searchFallback("").getImplementation());
0044:                assertEquals(
0045:                        "com.uwyn.rife.engine.testelements.submission.Normal",
0046:                        site.searchFallback("/hskjhjdz").getImplementation());
0047:                assertEquals(
0048:                        "com.uwyn.rife.engine.testelements.outputs.Normal",
0049:                        site.searchFallback("/subsite").getImplementation());
0050:                assertEquals(
0051:                        "com.uwyn.rife.engine.testelements.outputs.Normal",
0052:                        site.searchFallback("/subsitedfzefze")
0053:                                .getImplementation());
0054:                assertEquals(
0055:                        "com.uwyn.rife.engine.testelements.outputs.Normal",
0056:                        site.searchFallback("/subsite/kjdkfj")
0057:                                .getImplementation());
0058:
0059:                Collection<String> global_exits = null;
0060:                Collection<String> global_vars = null;
0061:
0062:                ElementInfo elementinfo1 = site.resolveUrl("/test/element1",
0063:                        null);
0064:                assertNotNull(elementinfo1);
0065:                assertSame(site.resolveId(".ELEMENT1"), elementinfo1);
0066:                assertEquals(elementinfo1.getImplementation(),
0067:                        com.uwyn.rife.engine.testelements.engine.Simple.class
0068:                                .getName());
0069:                assertTrue(elementinfo1.hasGlobalExits());
0070:                global_exits = elementinfo1.getGlobalExitNames();
0071:                assertNotNull(global_exits);
0072:                assertEquals(global_exits.size(), 2);
0073:                assertTrue(global_exits.contains("globalexit1"));
0074:                assertTrue(global_exits.contains("globalexit2"));
0075:                assertTrue(elementinfo1.hasGlobalVars());
0076:                global_vars = elementinfo1.getGlobalVarNames();
0077:                assertNotNull(global_vars);
0078:                assertEquals(global_vars.size(), 8);
0079:                assertTrue(global_vars.contains("globalvar1"));
0080:                assertTrue(global_vars.contains("globalvar2"));
0081:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0082:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0083:                assertTrue(global_vars
0084:                        .contains("onemoreprefixgroup_shortObject"));
0085:                assertTrue(global_vars.contains("double"));
0086:                assertTrue(global_vars.contains("long"));
0087:                assertTrue(global_vars.contains("shortObject"));
0088:                assertEquals(elementinfo1.getNamedGlobalBeanNames().size(), 1);
0089:                assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
0090:                        .getClassname(),
0091:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0092:                assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
0093:                        .getPrefix(), "onemoreprefixgroup_");
0094:                assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
0095:                        .getGroupName(), "anothergroup");
0096:                assertNull(elementinfo1.getInheritanceStack());
0097:                assertEquals(11 + Rep.getProperties().size(), elementinfo1
0098:                        .getPropertyNames().size());
0099:                assertEquals("elementpropval", elementinfo1
0100:                        .getProperty("prop1"));
0101:                assertTrue(elementinfo1.getProperty("prop2") instanceof  Template);
0102:                assertEquals(((Template) elementinfo1.getProperty("prop2"))
0103:                        .getContent(), TemplateFactory.ENGINEHTML.get(
0104:                        "unsetvalues_output_in").getContent());
0105:                assertSame(Datasources.getRepInstance().getDatasource(
0106:                        "purgingunittestspgsql"), elementinfo1
0107:                        .getProperty("prop6"));
0108:                assertSame(Datasources.getRepInstance().getDatasource(
0109:                        "sessiondurationunittestspgsql"), elementinfo1
0110:                        .getProperty("prop7"));
0111:
0112:                ElementInfo elementinfo2 = site.resolveUrl("/test/element2",
0113:                        null);
0114:                assertNotNull(elementinfo2);
0115:                assertSame(site.resolveId(".ELEMENT2"), elementinfo2);
0116:                assertEquals(elementinfo2.getImplementation(),
0117:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0118:                                .getName());
0119:                assertTrue(elementinfo2.hasGlobalExits());
0120:                global_exits = elementinfo2.getGlobalExitNames();
0121:                assertNotNull(global_exits);
0122:                assertEquals(global_exits.size(), 2);
0123:                assertTrue(global_exits.contains("globalexit1"));
0124:                assertTrue(global_exits.contains("globalexit2"));
0125:                assertTrue(elementinfo2.hasGlobalVars());
0126:                global_vars = elementinfo2.getGlobalVarNames();
0127:                assertNotNull(global_vars);
0128:                assertEquals(global_vars.size(), 8);
0129:                assertTrue(global_vars.contains("globalvar1"));
0130:                assertTrue(global_vars.contains("globalvar2"));
0131:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0132:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0133:                assertTrue(global_vars
0134:                        .contains("onemoreprefixgroup_shortObject"));
0135:                assertTrue(global_vars.contains("double"));
0136:                assertTrue(global_vars.contains("long"));
0137:                assertTrue(global_vars.contains("shortObject"));
0138:                assertEquals(elementinfo2.getNamedGlobalBeanNames().size(), 1);
0139:                assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
0140:                        .getClassname(),
0141:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0142:                assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
0143:                        .getPrefix(), "onemoreprefixgroup_");
0144:                assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
0145:                        .getGroupName(), "anothergroup");
0146:                assertNotNull(elementinfo2.getInheritanceStack());
0147:                assertEquals(2, elementinfo2.getInheritanceStack().size());
0148:                assertEquals(elementinfo2.getInheritanceStack().get(0)
0149:                        .getImplementation(),
0150:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0151:                                .getName());
0152:                assertEquals(elementinfo2.getInheritanceStack().get(1)
0153:                        .getImplementation(),
0154:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0155:                                .getName());
0156:                assertEquals(3 + Rep.getProperties().size(), elementinfo2
0157:                        .getPropertyNames().size());
0158:                assertEquals("sitepropval", elementinfo2.getProperty("prop1"));
0159:                assertTrue(elementinfo2.getProperty("prop2") instanceof  Template);
0160:                assertEquals(((Template) elementinfo2.getProperty("prop2"))
0161:                        .getContent(), TemplateFactory.ENGINEHTML.get(
0162:                        "unsetvalues_output_in").getContent());
0163:                assertSame(Datasources.getRepInstance().getDatasource(
0164:                        "purgingunittestspgsql"), elementinfo2
0165:                        .getProperty("prop6"));
0166:
0167:                ElementInfo elementinfo3 = site.resolveId(".ELEMENT3");
0168:                assertNotNull(elementinfo3);
0169:                assertEquals(elementinfo3.getImplementation(),
0170:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0171:                                .getName());
0172:                assertTrue(elementinfo3.hasGlobalExits());
0173:                global_exits = elementinfo3.getGlobalExitNames();
0174:                assertNotNull(global_exits);
0175:                assertEquals(global_exits.size(), 2);
0176:                assertTrue(global_exits.contains("globalexit1"));
0177:                assertTrue(global_exits.contains("globalexit2"));
0178:                assertTrue(elementinfo3.hasGlobalVars());
0179:                global_vars = elementinfo3.getGlobalVarNames();
0180:                assertNotNull(global_vars);
0181:                assertEquals(global_vars.size(), 8);
0182:                assertTrue(global_vars.contains("globalvar1"));
0183:                assertTrue(global_vars.contains("globalvar2"));
0184:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0185:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0186:                assertTrue(global_vars
0187:                        .contains("onemoreprefixgroup_shortObject"));
0188:                assertTrue(global_vars.contains("double"));
0189:                assertTrue(global_vars.contains("long"));
0190:                assertTrue(global_vars.contains("shortObject"));
0191:                assertEquals(elementinfo3.getNamedGlobalBeanNames().size(), 1);
0192:                assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
0193:                        .getClassname(),
0194:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0195:                assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
0196:                        .getPrefix(), "onemoreprefixgroup_");
0197:                assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
0198:                        .getGroupName(), "anothergroup");
0199:                assertNull(elementinfo3.getInheritanceStack());
0200:                assertEquals(3 + Rep.getProperties().size(), elementinfo3
0201:                        .getPropertyNames().size());
0202:                assertEquals("sitepropval", elementinfo3.getProperty("prop1"));
0203:                assertTrue(elementinfo3.getProperty("prop2") instanceof  Template);
0204:                assertEquals(((Template) elementinfo3.getProperty("prop2"))
0205:                        .getContent(), TemplateFactory.ENGINEHTML.get(
0206:                        "unsetvalues_output_in").getContent());
0207:                assertSame(Datasources.getRepInstance().getDatasource(
0208:                        "purgingunittestspgsql"), elementinfo3
0209:                        .getProperty("prop6"));
0210:
0211:                ElementInfo elementinfo4 = site.resolveId(".ELEMENT4");
0212:                assertNotNull(elementinfo4);
0213:                assertEquals(
0214:                        elementinfo4.getImplementation(),
0215:                        com.uwyn.rife.engine.testelements.submission.Normal.class
0216:                                .getName());
0217:                assertTrue(elementinfo4.hasGlobalExits());
0218:                global_exits = elementinfo4.getGlobalExitNames();
0219:                assertNotNull(global_exits);
0220:                assertEquals(global_exits.size(), 2);
0221:                assertTrue(global_exits.contains("globalexit1"));
0222:                assertTrue(global_exits.contains("globalexit2"));
0223:                assertTrue(elementinfo4.hasGlobalVars());
0224:                global_vars = elementinfo4.getGlobalVarNames();
0225:                assertNotNull(global_vars);
0226:                assertEquals(global_vars.size(), 8);
0227:                assertTrue(global_vars.contains("globalvar1"));
0228:                assertTrue(global_vars.contains("globalvar2"));
0229:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0230:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0231:                assertTrue(global_vars
0232:                        .contains("onemoreprefixgroup_shortObject"));
0233:                assertTrue(global_vars.contains("double"));
0234:                assertTrue(global_vars.contains("long"));
0235:                assertTrue(global_vars.contains("shortObject"));
0236:                assertEquals(elementinfo4.getNamedGlobalBeanNames().size(), 1);
0237:                assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
0238:                        .getClassname(),
0239:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0240:                assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
0241:                        .getPrefix(), "onemoreprefixgroup_");
0242:                assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
0243:                        .getGroupName(), "anothergroup");
0244:                assertNull(elementinfo4.getInheritanceStack());
0245:                assertEquals(3 + Rep.getProperties().size(), elementinfo4
0246:                        .getPropertyNames().size());
0247:                assertEquals("sitepropval", elementinfo4.getProperty("prop1"));
0248:                assertTrue(elementinfo4.getProperty("prop2") instanceof  Template);
0249:                assertEquals(((Template) elementinfo4.getProperty("prop2"))
0250:                        .getContent(), TemplateFactory.ENGINEHTML.get(
0251:                        "unsetvalues_output_in").getContent());
0252:                assertSame(Datasources.getRepInstance().getDatasource(
0253:                        "purgingunittestspgsql"), elementinfo4
0254:                        .getProperty("prop6"));
0255:
0256:                ElementInfo subsite_elementinfo2 = site.resolveUrl(
0257:                        "/subsite/test/element2", null);
0258:                assertNotNull(subsite_elementinfo2);
0259:                assertSame(site.resolveId(".SUBSITE.ELEMENT2"),
0260:                        subsite_elementinfo2);
0261:                assertEquals(subsite_elementinfo2.getImplementation(),
0262:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0263:                                .getName());
0264:                assertTrue(subsite_elementinfo2.hasGlobalExits());
0265:                global_exits = subsite_elementinfo2.getGlobalExitNames();
0266:                assertNotNull(global_exits);
0267:                assertEquals(global_exits.size(), 3);
0268:                assertTrue(global_exits.contains("globalexit1"));
0269:                assertTrue(global_exits.contains("globalexit2"));
0270:                assertTrue(global_exits.contains("globalexit3"));
0271:                assertTrue(subsite_elementinfo2.hasGlobalVars());
0272:                global_vars = subsite_elementinfo2.getGlobalVarNames();
0273:                assertNotNull(global_vars);
0274:                assertEquals(global_vars.size(), 9);
0275:                assertTrue(global_vars.contains("globalvar1"));
0276:                assertTrue(global_vars.contains("globalvar2"));
0277:                assertTrue(global_vars.contains("globalvar3"));
0278:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0279:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0280:                assertTrue(global_vars
0281:                        .contains("onemoreprefixgroup_shortObject"));
0282:                assertTrue(global_vars.contains("double"));
0283:                assertTrue(global_vars.contains("long"));
0284:                assertTrue(global_vars.contains("shortObject"));
0285:                assertEquals(subsite_elementinfo2.getNamedGlobalBeanNames()
0286:                        .size(), 1);
0287:                assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
0288:                        "globalbean1").getClassname(),
0289:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0290:                assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
0291:                        "globalbean1").getPrefix(), "onemoreprefixgroup_");
0292:                assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
0293:                        "globalbean1").getGroupName(), "anothergroup");
0294:                assertNotNull(subsite_elementinfo2.getInheritanceStack());
0295:                assertEquals(2, subsite_elementinfo2.getInheritanceStack()
0296:                        .size());
0297:                assertEquals(subsite_elementinfo2.getInheritanceStack().get(0)
0298:                        .getImplementation(),
0299:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0300:                                .getName());
0301:                assertEquals(
0302:                        subsite_elementinfo2.getInheritanceStack().get(1)
0303:                                .getImplementation(),
0304:                        com.uwyn.rife.engine.testelements.submission.Normal.class
0305:                                .getName());
0306:                assertEquals(6 + Rep.getProperties().size(),
0307:                        subsite_elementinfo2.getPropertyNames().size());
0308:                assertEquals("elementpropval", subsite_elementinfo2
0309:                        .getProperty("prop1"));
0310:                assertTrue(subsite_elementinfo2.getProperty("prop2") instanceof  Template);
0311:                assertEquals(((Template) subsite_elementinfo2
0312:                        .getProperty("prop2")).getContent(),
0313:                        TemplateFactory.ENGINEHTML.get("noblocks_in")
0314:                                .getContent());
0315:                assertEquals("the value 3", subsite_elementinfo2
0316:                        .getProperty("prop3"));
0317:                assertSame(Datasources.getRepInstance().getDatasource(
0318:                        "unittestspgsql"), subsite_elementinfo2
0319:                        .getProperty("prop4"));
0320:                assertEquals("unittests\n			pgsql", subsite_elementinfo2
0321:                        .getProperty("prop5"));
0322:                assertSame(Datasources.getRepInstance().getDatasource(
0323:                        "purgingunittestspgsql"), subsite_elementinfo2
0324:                        .getProperty("prop6"));
0325:
0326:                ElementInfo subsite_elementinfo3 = site.resolveUrl(
0327:                        "/subsite/test/element3", null);
0328:                assertNotNull(subsite_elementinfo3);
0329:                assertSame(site.resolveId(".SUBSITE.ELEMENT3"),
0330:                        subsite_elementinfo3);
0331:                assertEquals(subsite_elementinfo3.getImplementation(),
0332:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0333:                                .getName());
0334:                assertTrue(subsite_elementinfo3.hasGlobalExits());
0335:                global_exits = subsite_elementinfo3.getGlobalExitNames();
0336:                assertNotNull(global_exits);
0337:                assertEquals(global_exits.size(), 3);
0338:                assertTrue(global_exits.contains("globalexit1"));
0339:                assertTrue(global_exits.contains("globalexit2"));
0340:                assertTrue(global_exits.contains("globalexit3"));
0341:                assertTrue(subsite_elementinfo3.hasGlobalVars());
0342:                global_vars = subsite_elementinfo3.getGlobalVarNames();
0343:                assertNotNull(global_vars);
0344:                assertEquals(global_vars.size(), 9);
0345:                assertTrue(global_vars.contains("globalvar1"));
0346:                assertTrue(global_vars.contains("globalvar2"));
0347:                assertTrue(global_vars.contains("globalvar3"));
0348:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0349:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0350:                assertTrue(global_vars
0351:                        .contains("onemoreprefixgroup_shortObject"));
0352:                assertTrue(global_vars.contains("double"));
0353:                assertTrue(global_vars.contains("long"));
0354:                assertTrue(global_vars.contains("shortObject"));
0355:                assertEquals(subsite_elementinfo3.getNamedGlobalBeanNames()
0356:                        .size(), 1);
0357:                assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
0358:                        "globalbean1").getClassname(),
0359:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0360:                assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
0361:                        "globalbean1").getPrefix(), "onemoreprefixgroup_");
0362:                assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
0363:                        "globalbean1").getGroupName(), "anothergroup");
0364:                assertNotNull(subsite_elementinfo3.getInheritanceStack());
0365:                assertEquals(2, subsite_elementinfo3.getInheritanceStack()
0366:                        .size());
0367:                assertEquals(subsite_elementinfo3.getInheritanceStack().get(0)
0368:                        .getImplementation(),
0369:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0370:                                .getName());
0371:                assertEquals(
0372:                        subsite_elementinfo3.getInheritanceStack().get(1)
0373:                                .getImplementation(),
0374:                        com.uwyn.rife.engine.testelements.submission.Normal.class
0375:                                .getName());
0376:                assertTrue(subsite_elementinfo3.hasDepartureVars());
0377:                assertEquals(1, subsite_elementinfo3.getDepartureVars().size());
0378:                assertEquals("globalvar3", subsite_elementinfo3
0379:                        .getDepartureVars().get(0));
0380:                assertEquals(6 + Rep.getProperties().size(),
0381:                        subsite_elementinfo3.getPropertyNames().size());
0382:                assertEquals("subsitepropval", subsite_elementinfo3
0383:                        .getProperty("prop1"));
0384:                assertTrue(subsite_elementinfo3.getProperty("prop2") instanceof  Template);
0385:                assertEquals(((Template) subsite_elementinfo3
0386:                        .getProperty("prop2")).getContent(),
0387:                        TemplateFactory.ENGINEHTML.get("noblocks_in")
0388:                                .getContent());
0389:                assertEquals("the value 3", subsite_elementinfo3
0390:                        .getProperty("prop3"));
0391:                assertSame(Datasources.getRepInstance().getDatasource(
0392:                        "unittestspgsql"), subsite_elementinfo3
0393:                        .getProperty("prop4"));
0394:                assertEquals("unittests\n			pgsql", subsite_elementinfo3
0395:                        .getProperty("prop5"));
0396:                assertSame(Datasources.getRepInstance().getDatasource(
0397:                        "purgingunittestspgsql"), subsite_elementinfo3
0398:                        .getProperty("prop6"));
0399:
0400:                ElementInfo elementinfo5 = site.resolveId(".ELEMENT5");
0401:                assertNotNull(elementinfo5);
0402:                assertEquals(
0403:                        elementinfo5.getImplementation(),
0404:                        com.uwyn.rife.engine.testelements.exits.SimpleSource.class
0405:                                .getName());
0406:                assertTrue(elementinfo5.hasGlobalExits());
0407:                global_exits = elementinfo5.getGlobalExitNames();
0408:                assertNotNull(global_exits);
0409:                assertEquals(global_exits.size(), 2);
0410:                assertTrue(global_exits.contains("globalexit1"));
0411:                assertTrue(global_exits.contains("globalexit2"));
0412:                assertTrue(elementinfo5.hasGlobalVars());
0413:                global_vars = elementinfo5.getGlobalVarNames();
0414:                assertNotNull(global_vars);
0415:                assertEquals(global_vars.size(), 8);
0416:                assertTrue(global_vars.contains("globalvar1"));
0417:                assertTrue(global_vars.contains("globalvar2"));
0418:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0419:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0420:                assertTrue(global_vars
0421:                        .contains("onemoreprefixgroup_shortObject"));
0422:                assertTrue(global_vars.contains("double"));
0423:                assertTrue(global_vars.contains("long"));
0424:                assertTrue(global_vars.contains("shortObject"));
0425:                assertEquals(elementinfo5.getNamedGlobalBeanNames().size(), 1);
0426:                assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
0427:                        .getClassname(),
0428:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0429:                assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
0430:                        .getPrefix(), "onemoreprefixgroup_");
0431:                assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
0432:                        .getGroupName(), "anothergroup");
0433:                assertNull(elementinfo5.getInheritanceStack());
0434:                assertEquals(3 + Rep.getProperties().size(), elementinfo5
0435:                        .getPropertyNames().size());
0436:                assertEquals("sitepropval", elementinfo5.getProperty("prop1"));
0437:                assertTrue(elementinfo5.getProperty("prop2") instanceof  Template);
0438:                assertEquals(((Template) elementinfo5.getProperty("prop2"))
0439:                        .getContent(), TemplateFactory.ENGINEHTML.get(
0440:                        "unsetvalues_output_in").getContent());
0441:                assertSame(Datasources.getRepInstance().getDatasource(
0442:                        "purgingunittestspgsql"), elementinfo5
0443:                        .getProperty("prop6"));
0444:
0445:                ElementInfo elementinfo6 = site.resolveUrl("/test/element6",
0446:                        null);
0447:                assertNotNull(elementinfo6);
0448:                assertSame(site.resolveId(".ELEMENT6"), elementinfo6);
0449:                assertEquals(elementinfo6.getImplementation(),
0450:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0451:                                .getName());
0452:                assertTrue(elementinfo6.hasGlobalExits());
0453:                global_exits = elementinfo6.getGlobalExitNames();
0454:                assertNotNull(global_exits);
0455:                assertEquals(global_exits.size(), 2);
0456:                assertTrue(global_exits.contains("globalexit1"));
0457:                assertTrue(global_exits.contains("globalexit2"));
0458:                assertTrue(elementinfo6.hasGlobalVars());
0459:                global_vars = elementinfo6.getGlobalVarNames();
0460:                assertNotNull(global_vars);
0461:                assertEquals(global_vars.size(), 9);
0462:                assertTrue(global_vars.contains("globalvar1"));
0463:                assertTrue(global_vars.contains("globalvar2"));
0464:                assertTrue(global_vars.contains("globalvar4"));
0465:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0466:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0467:                assertTrue(global_vars
0468:                        .contains("onemoreprefixgroup_shortObject"));
0469:                assertTrue(global_vars.contains("double"));
0470:                assertTrue(global_vars.contains("long"));
0471:                assertTrue(global_vars.contains("shortObject"));
0472:                assertEquals(elementinfo6.getNamedGlobalBeanNames().size(), 1);
0473:                assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
0474:                        .getClassname(),
0475:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0476:                assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
0477:                        .getPrefix(), "onemoreprefixgroup_");
0478:                assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
0479:                        .getGroupName(), "anothergroup");
0480:                assertNotNull(elementinfo6.getInheritanceStack());
0481:                assertEquals(3, elementinfo6.getInheritanceStack().size());
0482:                assertEquals(elementinfo6.getInheritanceStack().get(0)
0483:                        .getImplementation(),
0484:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0485:                                .getName());
0486:                assertEquals(elementinfo6.getInheritanceStack().get(1)
0487:                        .getImplementation(),
0488:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0489:                                .getName());
0490:                assertEquals(
0491:                        elementinfo6.getInheritanceStack().get(2)
0492:                                .getImplementation(),
0493:                        com.uwyn.rife.engine.testelements.exits.SimpleSource.class
0494:                                .getName());
0495:                assertEquals(3 + Rep.getProperties().size(), elementinfo6
0496:                        .getPropertyNames().size());
0497:                assertEquals("sitepropval", elementinfo6.getProperty("prop1"));
0498:                assertTrue(elementinfo6.getProperty("prop2") instanceof  Template);
0499:                assertEquals(((Template) elementinfo6.getProperty("prop2"))
0500:                        .getContent(), TemplateFactory.ENGINEHTML.get(
0501:                        "unsetvalues_output_in").getContent());
0502:                assertSame(Datasources.getRepInstance().getDatasource(
0503:                        "purgingunittestspgsql"), elementinfo6
0504:                        .getProperty("prop6"));
0505:
0506:                ElementInfo elementinfo7 = site.resolveUrl("/test/element7",
0507:                        null);
0508:                assertNotNull(elementinfo7);
0509:                assertSame(site.resolveId(".test_xml2elementinfo3"),
0510:                        elementinfo7);
0511:                assertEquals(elementinfo7.getImplementation(),
0512:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0513:                                .getName());
0514:                assertTrue(elementinfo7.hasGlobalExits());
0515:                global_exits = elementinfo7.getGlobalExitNames();
0516:                assertNotNull(global_exits);
0517:                assertEquals(global_exits.size(), 2);
0518:                assertTrue(global_exits.contains("globalexit1"));
0519:                assertTrue(global_exits.contains("globalexit2"));
0520:                assertTrue(elementinfo7.hasGlobalVars());
0521:                global_vars = elementinfo7.getGlobalVarNames();
0522:                assertNotNull(global_vars);
0523:                assertEquals(global_vars.size(), 9);
0524:                assertTrue(global_vars.contains("globalvar1"));
0525:                assertTrue(global_vars.contains("globalvar2"));
0526:                assertTrue(global_vars.contains("globalvar4"));
0527:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0528:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0529:                assertTrue(global_vars
0530:                        .contains("onemoreprefixgroup_shortObject"));
0531:                assertTrue(global_vars.contains("double"));
0532:                assertTrue(global_vars.contains("long"));
0533:                assertTrue(global_vars.contains("shortObject"));
0534:                assertEquals(elementinfo7.getNamedGlobalBeanNames().size(), 1);
0535:                assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
0536:                        .getClassname(),
0537:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0538:                assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
0539:                        .getPrefix(), "onemoreprefixgroup_");
0540:                assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
0541:                        .getGroupName(), "anothergroup");
0542:                assertNotNull(elementinfo7.getInheritanceStack());
0543:                assertEquals(2, elementinfo7.getInheritanceStack().size());
0544:                assertEquals(elementinfo7.getInheritanceStack().get(0)
0545:                        .getImplementation(),
0546:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0547:                                .getName());
0548:                assertEquals(
0549:                        elementinfo7.getInheritanceStack().get(1)
0550:                                .getImplementation(),
0551:                        com.uwyn.rife.engine.testelements.exits.SimpleSource.class
0552:                                .getName());
0553:                assertEquals(3 + Rep.getProperties().size(), elementinfo7
0554:                        .getPropertyNames().size());
0555:                assertEquals("sitepropval", elementinfo7.getProperty("prop1"));
0556:                assertTrue(elementinfo7.getProperty("prop2") instanceof  Template);
0557:                assertEquals(((Template) elementinfo7.getProperty("prop2"))
0558:                        .getContent(), TemplateFactory.ENGINEHTML.get(
0559:                        "unsetvalues_output_in").getContent());
0560:                assertSame(Datasources.getRepInstance().getDatasource(
0561:                        "purgingunittestspgsql"), elementinfo7
0562:                        .getProperty("prop6"));
0563:
0564:                assertSame(elementinfo1.getFlowLink("exit1").getTarget(),
0565:                        elementinfo2);
0566:                assertEquals(elementinfo1.getFlowLink("exit1").isSnapback(),
0567:                        false);
0568:                assertNull(elementinfo1.getFlowLink("exit2").getTarget());
0569:                assertEquals(elementinfo1.getFlowLink("exit2").isSnapback(),
0570:                        true);
0571:
0572:                Collection<String> inputs = null;
0573:
0574:                inputs = elementinfo1.getDataLinkInputs("output1",
0575:                        elementinfo2, false, null);
0576:                assertNotNull(inputs);
0577:                assertEquals(inputs.size(), 2);
0578:                assertTrue(inputs.contains("input1"));
0579:                assertTrue(inputs.contains("input2"));
0580:
0581:                inputs = elementinfo1.getDataLinkInputs("output1",
0582:                        elementinfo3, false, null);
0583:                assertNull(inputs);
0584:
0585:                inputs = elementinfo1.getDataLinkInputs("output1",
0586:                        elementinfo3, true, null);
0587:                assertNull(inputs);
0588:
0589:                inputs = elementinfo1.getDataLinkInputs("output2",
0590:                        elementinfo2, false, null);
0591:                assertNull(inputs);
0592:
0593:                inputs = elementinfo1.getDataLinkInputs("output2",
0594:                        elementinfo3, false, null);
0595:                assertNull(inputs);
0596:
0597:                inputs = elementinfo1.getDataLinkInputs("output2",
0598:                        elementinfo3, true, null);
0599:                assertNotNull(inputs);
0600:                assertEquals(inputs.size(), 1);
0601:                assertTrue(inputs.contains("input2"));
0602:
0603:                inputs = elementinfo1.getDataLinkInputs("output3",
0604:                        elementinfo2, false, elementinfo1.getFlowLink("exit3"));
0605:                assertNotNull(inputs);
0606:                assertEquals(inputs.size(), 1);
0607:                assertTrue(inputs.contains("input1"));
0608:
0609:                inputs = elementinfo1.getDataLinkInputs("output3",
0610:                        elementinfo2, false, null);
0611:                assertNull(inputs);
0612:
0613:                inputs = elementinfo1.getDataLinkInputs("output4",
0614:                        elementinfo2, false, elementinfo1.getFlowLink("exit4"));
0615:                assertNotNull(inputs);
0616:                assertEquals(inputs.size(), 1);
0617:                assertTrue(inputs.contains("input1"));
0618:
0619:                inputs = elementinfo1.getDataLinkInputs("output4",
0620:                        elementinfo2, false, null);
0621:                assertNull(inputs);
0622:            }
0623:
0624:            public void testElementsInlinedParser() {
0625:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
0626:                        .getInstance();
0627:                SiteBuilder builder = new SiteBuilder(
0628:                        "xml/test_xml2site_inlinedelements.xml", resourcefinder);
0629:
0630:                Site site = builder.getSite();
0631:
0632:                assertEquals(site.getUrls().size(), 6);
0633:                assertEquals(site.getIds().size(), 9);
0634:
0635:                assertEquals("com.uwyn.rife.engine.testelements.engine.Simple",
0636:                        site.resolveUrl("/test/element1", null)
0637:                                .getImplementation());
0638:                assertNull(site.resolveUrl("/test/element1/path/info", null));
0639:                assertNull(site.resolveUrl("/test/element1_notthere", null));
0640:                assertEquals(
0641:                        "com.uwyn.rife.engine.testelements.submission.Normal",
0642:                        site.searchFallback("").getImplementation());
0643:                assertEquals(
0644:                        "com.uwyn.rife.engine.testelements.submission.Normal",
0645:                        site.searchFallback("/hskjhjdz").getImplementation());
0646:                assertEquals(
0647:                        "com.uwyn.rife.engine.testelements.outputs.Normal",
0648:                        site.searchFallback("/subsite").getImplementation());
0649:                assertEquals(
0650:                        "com.uwyn.rife.engine.testelements.outputs.Normal",
0651:                        site.searchFallback("/subsitedfzefze")
0652:                                .getImplementation());
0653:                assertEquals(
0654:                        "com.uwyn.rife.engine.testelements.outputs.Normal",
0655:                        site.searchFallback("/subsite/kjdkfj")
0656:                                .getImplementation());
0657:
0658:                Collection<String> global_exits = null;
0659:                Collection<String> global_vars = null;
0660:
0661:                ElementInfo elementinfo1 = site.resolveUrl("/test/element1",
0662:                        null);
0663:                assertNotNull(elementinfo1);
0664:                assertSame(site.resolveId(".ELEMENT1"), elementinfo1);
0665:                assertEquals(elementinfo1.getImplementation(),
0666:                        com.uwyn.rife.engine.testelements.engine.Simple.class
0667:                                .getName());
0668:                assertTrue(elementinfo1.hasGlobalExits());
0669:                global_exits = elementinfo1.getGlobalExitNames();
0670:                assertNotNull(global_exits);
0671:                assertEquals(global_exits.size(), 2);
0672:                assertTrue(global_exits.contains("globalexit1"));
0673:                assertTrue(global_exits.contains("globalexit2"));
0674:                assertTrue(elementinfo1.hasGlobalVars());
0675:                global_vars = elementinfo1.getGlobalVarNames();
0676:                assertNotNull(global_vars);
0677:                assertEquals(global_vars.size(), 8);
0678:                assertTrue(global_vars.contains("globalvar1"));
0679:                assertTrue(global_vars.contains("globalvar2"));
0680:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0681:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0682:                assertTrue(global_vars
0683:                        .contains("onemoreprefixgroup_shortObject"));
0684:                assertTrue(global_vars.contains("double"));
0685:                assertTrue(global_vars.contains("long"));
0686:                assertTrue(global_vars.contains("shortObject"));
0687:                assertEquals(elementinfo1.getNamedGlobalBeanNames().size(), 1);
0688:                assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
0689:                        .getClassname(),
0690:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0691:                assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
0692:                        .getPrefix(), "onemoreprefixgroup_");
0693:                assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
0694:                        .getGroupName(), "anothergroup");
0695:                assertNull(elementinfo1.getInheritanceStack());
0696:                assertEquals(elementinfo1.getPropertyNames().size(), 5 + Rep
0697:                        .getProperties().size());
0698:                assertTrue(elementinfo1.containsProperty("property1"));
0699:                assertTrue(elementinfo1.containsProperty("property2"));
0700:                assertTrue(elementinfo1.containsProperty("property3"));
0701:                assertTrue(elementinfo1.containsProperty("property4"));
0702:                assertEquals("value1", elementinfo1.getProperty("property1"));
0703:                assertTrue(elementinfo1.getProperty("property2") instanceof  Template);
0704:                assertEquals(((Template) elementinfo1.getProperty("property2"))
0705:                        .getContent(), TemplateFactory.ENGINEHTML.get(
0706:                        "noblocks_in").getContent());
0707:                assertEquals("the value 3", elementinfo1
0708:                        .getProperty("property3"));
0709:                assertSame(Datasources.getRepInstance().getDatasource(
0710:                        "unittestspgsql"), elementinfo1
0711:                        .getProperty("property4"));
0712:                assertEquals("unittests\n			pgsql", elementinfo1
0713:                        .getProperty("property5"));
0714:
0715:                ElementInfo elementinfo2 = site.resolveUrl("/test/element2",
0716:                        null);
0717:                assertNotNull(elementinfo2);
0718:                assertSame(site.resolveId(".ELEMENT2"), elementinfo2);
0719:                assertEquals(elementinfo2.getImplementation(),
0720:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0721:                                .getName());
0722:                assertTrue(elementinfo2.hasGlobalExits());
0723:                global_exits = elementinfo2.getGlobalExitNames();
0724:                assertNotNull(global_exits);
0725:                assertEquals(global_exits.size(), 2);
0726:                assertTrue(global_exits.contains("globalexit1"));
0727:                assertTrue(global_exits.contains("globalexit2"));
0728:                assertTrue(elementinfo2.hasGlobalVars());
0729:                global_vars = elementinfo2.getGlobalVarNames();
0730:                assertNotNull(global_vars);
0731:                assertEquals(global_vars.size(), 8);
0732:                assertTrue(global_vars.contains("globalvar1"));
0733:                assertTrue(global_vars.contains("globalvar2"));
0734:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0735:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0736:                assertTrue(global_vars
0737:                        .contains("onemoreprefixgroup_shortObject"));
0738:                assertTrue(global_vars.contains("double"));
0739:                assertTrue(global_vars.contains("long"));
0740:                assertTrue(global_vars.contains("shortObject"));
0741:                assertEquals(elementinfo2.getNamedGlobalBeanNames().size(), 1);
0742:                assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
0743:                        .getClassname(),
0744:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0745:                assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
0746:                        .getPrefix(), "onemoreprefixgroup_");
0747:                assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
0748:                        .getGroupName(), "anothergroup");
0749:                assertNotNull(elementinfo2.getInheritanceStack());
0750:                assertEquals(2, elementinfo2.getInheritanceStack().size());
0751:                assertEquals(elementinfo2.getInheritanceStack().get(0)
0752:                        .getImplementation(),
0753:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0754:                                .getName());
0755:                assertEquals(elementinfo2.getInheritanceStack().get(1)
0756:                        .getImplementation(),
0757:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0758:                                .getName());
0759:                assertEquals(0 + Rep.getProperties().size(), elementinfo2
0760:                        .getPropertyNames().size());
0761:
0762:                ElementInfo elementinfo3 = site.resolveId(".ELEMENT3");
0763:                assertNotNull(elementinfo3);
0764:                assertEquals(elementinfo3.getImplementation(),
0765:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0766:                                .getName());
0767:                assertTrue(elementinfo3.hasGlobalExits());
0768:                global_exits = elementinfo3.getGlobalExitNames();
0769:                assertNotNull(global_exits);
0770:                assertEquals(global_exits.size(), 2);
0771:                assertTrue(global_exits.contains("globalexit1"));
0772:                assertTrue(global_exits.contains("globalexit2"));
0773:                assertTrue(elementinfo3.hasGlobalVars());
0774:                global_vars = elementinfo3.getGlobalVarNames();
0775:                assertNotNull(global_vars);
0776:                assertEquals(global_vars.size(), 8);
0777:                assertTrue(global_vars.contains("globalvar1"));
0778:                assertTrue(global_vars.contains("globalvar2"));
0779:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0780:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0781:                assertTrue(global_vars
0782:                        .contains("onemoreprefixgroup_shortObject"));
0783:                assertTrue(global_vars.contains("double"));
0784:                assertTrue(global_vars.contains("long"));
0785:                assertTrue(global_vars.contains("shortObject"));
0786:                assertEquals(elementinfo3.getNamedGlobalBeanNames().size(), 1);
0787:                assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
0788:                        .getClassname(),
0789:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0790:                assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
0791:                        .getPrefix(), "onemoreprefixgroup_");
0792:                assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
0793:                        .getGroupName(), "anothergroup");
0794:                assertNull(elementinfo3.getInheritanceStack());
0795:                assertEquals(0 + Rep.getProperties().size(), elementinfo3
0796:                        .getPropertyNames().size());
0797:
0798:                ElementInfo elementinfo4 = site.resolveId(".ELEMENT4");
0799:                assertNotNull(elementinfo4);
0800:                assertEquals(
0801:                        elementinfo4.getImplementation(),
0802:                        com.uwyn.rife.engine.testelements.submission.Normal.class
0803:                                .getName());
0804:                assertTrue(elementinfo4.hasGlobalExits());
0805:                global_exits = elementinfo4.getGlobalExitNames();
0806:                assertNotNull(global_exits);
0807:                assertEquals(global_exits.size(), 2);
0808:                assertTrue(global_exits.contains("globalexit1"));
0809:                assertTrue(global_exits.contains("globalexit2"));
0810:                assertTrue(elementinfo4.hasGlobalVars());
0811:                global_vars = elementinfo4.getGlobalVarNames();
0812:                assertNotNull(global_vars);
0813:                assertEquals(global_vars.size(), 8);
0814:                assertTrue(global_vars.contains("globalvar1"));
0815:                assertTrue(global_vars.contains("globalvar2"));
0816:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0817:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0818:                assertTrue(global_vars
0819:                        .contains("onemoreprefixgroup_shortObject"));
0820:                assertTrue(global_vars.contains("double"));
0821:                assertTrue(global_vars.contains("long"));
0822:                assertTrue(global_vars.contains("shortObject"));
0823:                assertEquals(elementinfo4.getNamedGlobalBeanNames().size(), 1);
0824:                assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
0825:                        .getClassname(),
0826:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0827:                assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
0828:                        .getPrefix(), "onemoreprefixgroup_");
0829:                assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
0830:                        .getGroupName(), "anothergroup");
0831:                assertNull(elementinfo4.getInheritanceStack());
0832:                assertEquals(0 + Rep.getProperties().size(), elementinfo4
0833:                        .getPropertyNames().size());
0834:
0835:                ElementInfo subsite_elementinfo2 = site.resolveUrl(
0836:                        "/subsite/test/element2", null);
0837:                assertNotNull(subsite_elementinfo2);
0838:                assertSame(site.resolveId(".SUBSITE.ELEMENT2"),
0839:                        subsite_elementinfo2);
0840:                assertEquals(subsite_elementinfo2.getImplementation(),
0841:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0842:                                .getName());
0843:                assertTrue(subsite_elementinfo2.hasGlobalExits());
0844:                global_exits = subsite_elementinfo2.getGlobalExitNames();
0845:                assertNotNull(global_exits);
0846:                assertEquals(global_exits.size(), 3);
0847:                assertTrue(global_exits.contains("globalexit1"));
0848:                assertTrue(global_exits.contains("globalexit2"));
0849:                assertTrue(global_exits.contains("globalexit3"));
0850:                assertTrue(subsite_elementinfo2.hasGlobalVars());
0851:                global_vars = subsite_elementinfo2.getGlobalVarNames();
0852:                assertNotNull(global_vars);
0853:                assertEquals(global_vars.size(), 9);
0854:                assertTrue(global_vars.contains("globalvar1"));
0855:                assertTrue(global_vars.contains("globalvar2"));
0856:                assertTrue(global_vars.contains("globalvar3"));
0857:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0858:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0859:                assertTrue(global_vars
0860:                        .contains("onemoreprefixgroup_shortObject"));
0861:                assertTrue(global_vars.contains("double"));
0862:                assertTrue(global_vars.contains("long"));
0863:                assertTrue(global_vars.contains("shortObject"));
0864:                assertEquals(subsite_elementinfo2.getNamedGlobalBeanNames()
0865:                        .size(), 1);
0866:                assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
0867:                        "globalbean1").getClassname(),
0868:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0869:                assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
0870:                        "globalbean1").getPrefix(), "onemoreprefixgroup_");
0871:                assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
0872:                        "globalbean1").getGroupName(), "anothergroup");
0873:                assertNotNull(subsite_elementinfo2.getInheritanceStack());
0874:                assertEquals(2, subsite_elementinfo2.getInheritanceStack()
0875:                        .size());
0876:                assertEquals(subsite_elementinfo2.getInheritanceStack().get(0)
0877:                        .getImplementation(),
0878:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0879:                                .getName());
0880:                assertEquals(
0881:                        subsite_elementinfo2.getInheritanceStack().get(1)
0882:                                .getImplementation(),
0883:                        com.uwyn.rife.engine.testelements.submission.Normal.class
0884:                                .getName());
0885:                assertEquals(1 + Rep.getProperties().size(),
0886:                        subsite_elementinfo2.getPropertyNames().size());
0887:                assertEquals("elementpropval", subsite_elementinfo2
0888:                        .getProperty("prop1"));
0889:
0890:                ElementInfo subsite_elementinfo3 = site.resolveUrl(
0891:                        "/subsite/test/element3", null);
0892:                assertNotNull(subsite_elementinfo3);
0893:                assertSame(site.resolveId(".SUBSITE.ELEMENT3"),
0894:                        subsite_elementinfo3);
0895:                assertEquals(subsite_elementinfo3.getImplementation(),
0896:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0897:                                .getName());
0898:                assertTrue(subsite_elementinfo3.hasGlobalExits());
0899:                global_exits = subsite_elementinfo3.getGlobalExitNames();
0900:                assertNotNull(global_exits);
0901:                assertEquals(global_exits.size(), 3);
0902:                assertTrue(global_exits.contains("globalexit1"));
0903:                assertTrue(global_exits.contains("globalexit2"));
0904:                assertTrue(global_exits.contains("globalexit3"));
0905:                assertTrue(subsite_elementinfo3.hasGlobalVars());
0906:                global_vars = subsite_elementinfo3.getGlobalVarNames();
0907:                assertNotNull(global_vars);
0908:                assertEquals(global_vars.size(), 9);
0909:                assertTrue(global_vars.contains("globalvar1"));
0910:                assertTrue(global_vars.contains("globalvar2"));
0911:                assertTrue(global_vars.contains("globalvar3"));
0912:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0913:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0914:                assertTrue(global_vars
0915:                        .contains("onemoreprefixgroup_shortObject"));
0916:                assertTrue(global_vars.contains("double"));
0917:                assertTrue(global_vars.contains("long"));
0918:                assertTrue(global_vars.contains("shortObject"));
0919:                assertEquals(subsite_elementinfo3.getNamedGlobalBeanNames()
0920:                        .size(), 1);
0921:                assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
0922:                        "globalbean1").getClassname(),
0923:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0924:                assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
0925:                        "globalbean1").getPrefix(), "onemoreprefixgroup_");
0926:                assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
0927:                        "globalbean1").getGroupName(), "anothergroup");
0928:                assertNotNull(subsite_elementinfo3.getInheritanceStack());
0929:                assertEquals(2, subsite_elementinfo3.getInheritanceStack()
0930:                        .size());
0931:                assertEquals(subsite_elementinfo3.getInheritanceStack().get(0)
0932:                        .getImplementation(),
0933:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
0934:                                .getName());
0935:                assertEquals(
0936:                        subsite_elementinfo3.getInheritanceStack().get(1)
0937:                                .getImplementation(),
0938:                        com.uwyn.rife.engine.testelements.submission.Normal.class
0939:                                .getName());
0940:                assertTrue(subsite_elementinfo3.hasDepartureVars());
0941:                assertEquals(1, subsite_elementinfo3.getDepartureVars().size());
0942:                assertEquals("globalvar3", subsite_elementinfo3
0943:                        .getDepartureVars().get(0));
0944:                assertEquals(1 + Rep.getProperties().size(),
0945:                        subsite_elementinfo3.getPropertyNames().size());
0946:                assertEquals("subsitepropval", subsite_elementinfo3
0947:                        .getProperty("prop1"));
0948:
0949:                ElementInfo elementinfo5 = site.resolveId(".ELEMENT5");
0950:                assertNotNull(elementinfo5);
0951:                assertEquals(
0952:                        elementinfo5.getImplementation(),
0953:                        com.uwyn.rife.engine.testelements.exits.SimpleSource.class
0954:                                .getName());
0955:                assertTrue(elementinfo5.hasGlobalExits());
0956:                global_exits = elementinfo5.getGlobalExitNames();
0957:                assertNotNull(global_exits);
0958:                assertEquals(global_exits.size(), 2);
0959:                assertTrue(global_exits.contains("globalexit1"));
0960:                assertTrue(global_exits.contains("globalexit2"));
0961:                assertTrue(elementinfo5.hasGlobalVars());
0962:                global_vars = elementinfo5.getGlobalVarNames();
0963:                assertNotNull(global_vars);
0964:                assertEquals(global_vars.size(), 8);
0965:                assertTrue(global_vars.contains("globalvar1"));
0966:                assertTrue(global_vars.contains("globalvar2"));
0967:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
0968:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
0969:                assertTrue(global_vars
0970:                        .contains("onemoreprefixgroup_shortObject"));
0971:                assertTrue(global_vars.contains("double"));
0972:                assertTrue(global_vars.contains("long"));
0973:                assertTrue(global_vars.contains("shortObject"));
0974:                assertEquals(elementinfo5.getNamedGlobalBeanNames().size(), 1);
0975:                assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
0976:                        .getClassname(),
0977:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
0978:                assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
0979:                        .getPrefix(), "onemoreprefixgroup_");
0980:                assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
0981:                        .getGroupName(), "anothergroup");
0982:                assertNull(elementinfo5.getInheritanceStack());
0983:                assertEquals(0 + Rep.getProperties().size(), elementinfo5
0984:                        .getPropertyNames().size());
0985:
0986:                ElementInfo elementinfo6 = site.resolveUrl("/test/element6",
0987:                        null);
0988:                assertNotNull(elementinfo6);
0989:                assertSame(site.resolveId(".ELEMENT6"), elementinfo6);
0990:                assertEquals(elementinfo6.getImplementation(),
0991:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
0992:                                .getName());
0993:                assertTrue(elementinfo6.hasGlobalExits());
0994:                global_exits = elementinfo6.getGlobalExitNames();
0995:                assertNotNull(global_exits);
0996:                assertEquals(global_exits.size(), 2);
0997:                assertTrue(global_exits.contains("globalexit1"));
0998:                assertTrue(global_exits.contains("globalexit2"));
0999:                assertTrue(elementinfo6.hasGlobalVars());
1000:                global_vars = elementinfo6.getGlobalVarNames();
1001:                assertNotNull(global_vars);
1002:                assertEquals(global_vars.size(), 9);
1003:                assertTrue(global_vars.contains("globalvar1"));
1004:                assertTrue(global_vars.contains("globalvar2"));
1005:                assertTrue(global_vars.contains("globalvar4"));
1006:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
1007:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
1008:                assertTrue(global_vars
1009:                        .contains("onemoreprefixgroup_shortObject"));
1010:                assertTrue(global_vars.contains("double"));
1011:                assertTrue(global_vars.contains("long"));
1012:                assertTrue(global_vars.contains("shortObject"));
1013:                assertEquals(elementinfo6.getNamedGlobalBeanNames().size(), 1);
1014:                assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
1015:                        .getClassname(),
1016:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
1017:                assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
1018:                        .getPrefix(), "onemoreprefixgroup_");
1019:                assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
1020:                        .getGroupName(), "anothergroup");
1021:                assertNotNull(elementinfo6.getInheritanceStack());
1022:                assertEquals(3, elementinfo6.getInheritanceStack().size());
1023:                assertEquals(elementinfo6.getInheritanceStack().get(0)
1024:                        .getImplementation(),
1025:                        com.uwyn.rife.engine.testelements.outputs.Normal.class
1026:                                .getName());
1027:                assertEquals(elementinfo6.getInheritanceStack().get(1)
1028:                        .getImplementation(),
1029:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
1030:                                .getName());
1031:                assertEquals(
1032:                        elementinfo6.getInheritanceStack().get(2)
1033:                                .getImplementation(),
1034:                        com.uwyn.rife.engine.testelements.exits.SimpleSource.class
1035:                                .getName());
1036:                assertEquals(0 + Rep.getProperties().size(), elementinfo6
1037:                        .getPropertyNames().size());
1038:
1039:                ElementInfo elementinfo7 = site.resolveUrl("/test/element7",
1040:                        null);
1041:                assertNotNull(elementinfo7);
1042:                assertSame(site.resolveId(".ELEMENT7"), elementinfo7);
1043:                assertEquals(elementinfo7.getImplementation(),
1044:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
1045:                                .getName());
1046:                assertTrue(elementinfo7.hasGlobalExits());
1047:                global_exits = elementinfo7.getGlobalExitNames();
1048:                assertNotNull(global_exits);
1049:                assertEquals(global_exits.size(), 2);
1050:                assertTrue(global_exits.contains("globalexit1"));
1051:                assertTrue(global_exits.contains("globalexit2"));
1052:                assertTrue(elementinfo7.hasGlobalVars());
1053:                global_vars = elementinfo7.getGlobalVarNames();
1054:                assertNotNull(global_vars);
1055:                assertEquals(global_vars.size(), 9);
1056:                assertTrue(global_vars.contains("globalvar1"));
1057:                assertTrue(global_vars.contains("globalvar2"));
1058:                assertTrue(global_vars.contains("globalvar4"));
1059:                assertTrue(global_vars.contains("onemoreprefixgroup_double"));
1060:                assertTrue(global_vars.contains("onemoreprefixgroup_long"));
1061:                assertTrue(global_vars
1062:                        .contains("onemoreprefixgroup_shortObject"));
1063:                assertTrue(global_vars.contains("double"));
1064:                assertTrue(global_vars.contains("long"));
1065:                assertTrue(global_vars.contains("shortObject"));
1066:                assertEquals(elementinfo7.getNamedGlobalBeanNames().size(), 1);
1067:                assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
1068:                        .getClassname(),
1069:                        "com.uwyn.rife.engine.testelements.submission.BeanImpl");
1070:                assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
1071:                        .getPrefix(), "onemoreprefixgroup_");
1072:                assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
1073:                        .getGroupName(), "anothergroup");
1074:                assertNotNull(elementinfo7.getInheritanceStack());
1075:                assertEquals(2, elementinfo7.getInheritanceStack().size());
1076:                assertEquals(elementinfo7.getInheritanceStack().get(0)
1077:                        .getImplementation(),
1078:                        com.uwyn.rife.engine.testelements.inputs.Normal.class
1079:                                .getName());
1080:                assertEquals(
1081:                        elementinfo7.getInheritanceStack().get(1)
1082:                                .getImplementation(),
1083:                        com.uwyn.rife.engine.testelements.exits.SimpleSource.class
1084:                                .getName());
1085:                assertEquals(0 + Rep.getProperties().size(), elementinfo7
1086:                        .getPropertyNames().size());
1087:
1088:                assertSame(elementinfo1.getFlowLink("exit1").getTarget(),
1089:                        elementinfo2);
1090:                assertEquals(elementinfo1.getFlowLink("exit1").isSnapback(),
1091:                        false);
1092:                assertNull(elementinfo1.getFlowLink("exit2").getTarget());
1093:                assertEquals(elementinfo1.getFlowLink("exit2").isSnapback(),
1094:                        true);
1095:
1096:                Collection<String> inputs = null;
1097:
1098:                inputs = elementinfo1.getDataLinkInputs("output1",
1099:                        elementinfo2, false, null);
1100:                assertNotNull(inputs);
1101:                assertEquals(inputs.size(), 2);
1102:                assertTrue(inputs.contains("input1"));
1103:                assertTrue(inputs.contains("input2"));
1104:
1105:                inputs = elementinfo1.getDataLinkInputs("output1",
1106:                        elementinfo3, false, null);
1107:                assertNull(inputs);
1108:
1109:                inputs = elementinfo1.getDataLinkInputs("output1",
1110:                        elementinfo3, true, null);
1111:                assertNull(inputs);
1112:
1113:                inputs = elementinfo1.getDataLinkInputs("output2",
1114:                        elementinfo2, false, null);
1115:                assertNull(inputs);
1116:
1117:                inputs = elementinfo1.getDataLinkInputs("output2",
1118:                        elementinfo3, false, null);
1119:                assertNull(inputs);
1120:
1121:                inputs = elementinfo1.getDataLinkInputs("output2",
1122:                        elementinfo3, true, null);
1123:                assertNotNull(inputs);
1124:                assertEquals(inputs.size(), 1);
1125:                assertTrue(inputs.contains("input2"));
1126:            }
1127:
1128:            public void testCircularSubsites() {
1129:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1130:                        .getInstance();
1131:                SiteBuilder builder = new SiteBuilder(
1132:                        "site/circularsubite_parent.xml", resourcefinder);
1133:
1134:                try {
1135:                    builder.getSite();
1136:                    fail();
1137:                } catch (ProcessingErrorException e) {
1138:                    assertTrue(true);
1139:                }
1140:            }
1141:
1142:            public void testGlobalConflictInput() {
1143:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1144:                        .getInstance();
1145:                SiteBuilder builder = new SiteBuilder(
1146:                        "site/global_conflict_input.xml", resourcefinder);
1147:
1148:                try {
1149:                    builder.getSite();
1150:                    fail();
1151:                } catch (EngineException e) {
1152:                    assertTrue(true);
1153:                }
1154:            }
1155:
1156:            public void testGlobalConflictOutput() {
1157:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1158:                        .getInstance();
1159:                SiteBuilder builder = new SiteBuilder(
1160:                        "site/global_conflict_input.xml", resourcefinder);
1161:
1162:                try {
1163:                    builder.getSite();
1164:                    fail();
1165:                } catch (EngineException e) {
1166:                    assertTrue(true);
1167:                }
1168:            }
1169:
1170:            public void testFlawedElementUrl() {
1171:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1172:                        .getInstance();
1173:                SiteBuilder builder = new SiteBuilder(
1174:                        "site/flawed_element_url.xml", resourcefinder);
1175:
1176:                try {
1177:                    builder.getSite();
1178:                    fail();
1179:                } catch (ElementUrlInvalidException e) {
1180:                    assertEquals(e.getId(), "test_xml2elementinfo1");
1181:                    assertEquals(e.getUrl(), "/cant/end/with/slash/");
1182:                }
1183:            }
1184:
1185:            public void testFlawedElementUrl2() {
1186:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1187:                        .getInstance();
1188:                SiteBuilder builder = new SiteBuilder(
1189:                        "site/flawed_element_url2.xml", resourcefinder);
1190:
1191:                try {
1192:                    builder.getSite();
1193:                    fail();
1194:                } catch (ElementUrlInvalidException e) {
1195:                    assertEquals(e.getId(), "test_xml2elementinfo1");
1196:                    assertEquals(e.getUrl(), "");
1197:                }
1198:            }
1199:
1200:            public void testFlawedDataLinkDestid() {
1201:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1202:                        .getInstance();
1203:                SiteBuilder builder = new SiteBuilder(
1204:                        "site/flawed_datalink_destid.xml", resourcefinder);
1205:
1206:                try {
1207:                    builder.getSite();
1208:                    fail();
1209:                } catch (ElementIdNotFoundInSiteException e) {
1210:                    assertEquals(e.getId(), ".ELEMENT32");
1211:                    assertEquals(e.getSiteId(), ".");
1212:                }
1213:            }
1214:
1215:            public void testFlawedDataLinkDestinput() {
1216:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1217:                        .getInstance();
1218:                SiteBuilder builder = new SiteBuilder(
1219:                        "site/flawed_datalink_destinput.xml", resourcefinder);
1220:
1221:                try {
1222:                    builder.getSite();
1223:                    fail();
1224:                } catch (OutputUnknownException e) {
1225:                    assertEquals(e.getDeclarationName(),
1226:                            "xml/test_xml2elementinfo1.xml");
1227:                    assertEquals(e.getOutputName(), "Output1");
1228:                }
1229:            }
1230:
1231:            public void testFlawedDataLinkSrcoutput() {
1232:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1233:                        .getInstance();
1234:                SiteBuilder builder = new SiteBuilder(
1235:                        "site/flawed_datalink_srcoutput.xml", resourcefinder);
1236:
1237:                try {
1238:                    builder.getSite();
1239:                    fail();
1240:                } catch (OutputUnknownException e) {
1241:                    assertEquals(e.getDeclarationName(),
1242:                            "xml/test_xml2elementinfo1.xml");
1243:                    assertEquals(e.getOutputName(), "Output14");
1244:                }
1245:            }
1246:
1247:            public void testFlawedDataLinkTargetMissing() {
1248:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1249:                        .getInstance();
1250:                SiteBuilder builder = new SiteBuilder(
1251:                        "site/flawed_datalink_target_missing.xml",
1252:                        resourcefinder);
1253:
1254:                try {
1255:                    builder.getSite();
1256:                    fail();
1257:                } catch (DataLinkTargetRequiredException e) {
1258:                    assertEquals(e.getSiteDeclarationName(),
1259:                            "site/flawed_datalink_target_missing.xml");
1260:                    assertEquals(e.getOutputName(), "Output1");
1261:                    assertEquals(e.getElementId(), "ELEMENT1");
1262:                }
1263:            }
1264:
1265:            public void testFlawedDataLinkAmbigousTarget() {
1266:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1267:                        .getInstance();
1268:                SiteBuilder builder = new SiteBuilder(
1269:                        "site/flawed_datalink_ambigous_target.xml",
1270:                        resourcefinder);
1271:
1272:                try {
1273:                    builder.getSite();
1274:                    fail();
1275:                } catch (DataLinkAmbiguousTargetException e) {
1276:                    assertEquals(e.getSiteDeclarationName(),
1277:                            "site/flawed_datalink_ambigous_target.xml");
1278:                    assertEquals(e.getOutputName(), "Output1");
1279:                    assertEquals(e.getElementId(), "ELEMENT1");
1280:                }
1281:            }
1282:
1283:            public void testFlawedDataLinkOutputMissing() {
1284:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1285:                        .getInstance();
1286:                SiteBuilder builder = new SiteBuilder(
1287:                        "site/flawed_datalink_output_missing.xml",
1288:                        resourcefinder);
1289:
1290:                try {
1291:                    builder.getSite();
1292:                    fail();
1293:                } catch (DataLinkOutputRequiredException e) {
1294:                    assertEquals(e.getSiteDeclarationName(),
1295:                            "site/flawed_datalink_output_missing.xml");
1296:                    assertEquals(e.getElementId(), "ELEMENT1");
1297:                }
1298:            }
1299:
1300:            public void testFlawedDataLinkAmbigousOutput() {
1301:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1302:                        .getInstance();
1303:                SiteBuilder builder = new SiteBuilder(
1304:                        "site/flawed_datalink_ambigous_output.xml",
1305:                        resourcefinder);
1306:
1307:                try {
1308:                    builder.getSite();
1309:                    fail();
1310:                } catch (DataLinkAmbiguousOutputException e) {
1311:                    assertEquals(e.getSiteDeclarationName(),
1312:                            "site/flawed_datalink_ambigous_output.xml");
1313:                    assertEquals(e.getElementId(), "ELEMENT1");
1314:                }
1315:            }
1316:
1317:            public void testFlawedDataLinkInputMissing() {
1318:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1319:                        .getInstance();
1320:                SiteBuilder builder = new SiteBuilder(
1321:                        "site/flawed_datalink_input_missing.xml",
1322:                        resourcefinder);
1323:
1324:                try {
1325:                    builder.getSite();
1326:                    fail();
1327:                } catch (DataLinkInputRequiredException e) {
1328:                    assertEquals(e.getSiteDeclarationName(),
1329:                            "site/flawed_datalink_input_missing.xml");
1330:                    assertEquals(e.getElementId(), "ELEMENT1");
1331:                    assertEquals(e.getDestinationId(), "ELEMENT2");
1332:                    assertFalse(e.getSnapback());
1333:                }
1334:            }
1335:
1336:            public void testFlawedDataLinkAmbigousInput() {
1337:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1338:                        .getInstance();
1339:                SiteBuilder builder = new SiteBuilder(
1340:                        "site/flawed_datalink_ambigous_input.xml",
1341:                        resourcefinder);
1342:
1343:                try {
1344:                    builder.getSite();
1345:                    fail();
1346:                } catch (DataLinkAmbiguousInputException e) {
1347:                    assertEquals(e.getSiteDeclarationName(),
1348:                            "site/flawed_datalink_ambigous_input.xml");
1349:                    assertEquals(e.getElementId(), "ELEMENT1");
1350:                    assertEquals(e.getDestinationId(), null);
1351:                    assertTrue(e.getSnapback());
1352:                }
1353:            }
1354:
1355:            public void testFlawedDataLinkIncompatibleInputOutput() {
1356:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1357:                        .getInstance();
1358:                SiteBuilder builder = new SiteBuilder(
1359:                        "site/flawed_datalink_incompatible_inputoutput1.xml",
1360:                        resourcefinder);
1361:
1362:                try {
1363:                    builder.getSite();
1364:                    fail();
1365:                } catch (DataLinkIncompatibleInputOutputException e) {
1366:                    assertEquals(e.getSiteDeclarationName(),
1367:                            "site/flawed_datalink_incompatible_inputoutput1.xml");
1368:                    assertEquals(e.getElementId(), "ELEMENT1");
1369:                    assertEquals(e.getDestinationId(), null);
1370:                    assertTrue(e.getSnapback());
1371:                }
1372:
1373:                builder = new SiteBuilder(
1374:                        "site/flawed_datalink_incompatible_inputoutput2.xml",
1375:                        resourcefinder);
1376:                try {
1377:                    builder.getSite();
1378:                    fail();
1379:                } catch (DataLinkIncompatibleInputOutputException e) {
1380:                    assertEquals(e.getSiteDeclarationName(),
1381:                            "site/flawed_datalink_incompatible_inputoutput2.xml");
1382:                    assertEquals(e.getElementId(), "ELEMENT1");
1383:                    assertEquals(e.getDestinationId(), null);
1384:                    assertTrue(e.getSnapback());
1385:                }
1386:            }
1387:
1388:            public void testFlawedDataLinkUnknownSrcOutbean() {
1389:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1390:                        .getInstance();
1391:                SiteBuilder builder = new SiteBuilder(
1392:                        "site/flawed_datalink_unknown_outbean.xml",
1393:                        resourcefinder);
1394:
1395:                try {
1396:                    builder.getSite();
1397:                    fail();
1398:                } catch (DataLinkUnknownSrcOutbeanException e) {
1399:                    assertEquals(e.getSiteDeclarationName(),
1400:                            "site/flawed_datalink_unknown_outbean.xml");
1401:                    assertEquals(e.getSrcOutbean(), "unknownoutbean1");
1402:                    assertEquals(e.getElementId(), "ELEMENT1");
1403:                    assertEquals(e.getDestinationId(), ".ELEMENT2");
1404:                    assertFalse(e.getSnapback());
1405:                }
1406:            }
1407:
1408:            public void testFlawedDataLinkUnknownDestInbean() {
1409:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1410:                        .getInstance();
1411:                SiteBuilder builder = new SiteBuilder(
1412:                        "site/flawed_datalink_unknown_inbean.xml",
1413:                        resourcefinder);
1414:
1415:                try {
1416:                    builder.getSite();
1417:                    fail();
1418:                } catch (DataLinkUnknownDestInbeanException e) {
1419:                    assertEquals(e.getSiteDeclarationName(),
1420:                            "site/flawed_datalink_unknown_inbean.xml");
1421:                    assertEquals(e.getDestInbean(), "unknowninbean1");
1422:                    assertEquals(e.getElementId(), "ELEMENT1");
1423:                    assertEquals(e.getDestinationId(), ".ELEMENT2");
1424:                    assertFalse(e.getSnapback());
1425:                }
1426:            }
1427:
1428:            public void testFlawedFlowLinkDestidInvalid() {
1429:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1430:                        .getInstance();
1431:                SiteBuilder builder = new SiteBuilder(
1432:                        "site/flawed_flowlink_destid_invalid.xml",
1433:                        resourcefinder);
1434:
1435:                try {
1436:                    builder.getSite();
1437:                    fail();
1438:                } catch (ElementIdNotFoundInSiteException e) {
1439:                    assertEquals(e.getId(), ".ELEMENT22");
1440:                    assertEquals(e.getSiteId(), ".");
1441:                }
1442:            }
1443:
1444:            public void testFlawedFlowLinkTargetMissing() {
1445:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1446:                        .getInstance();
1447:                SiteBuilder builder = new SiteBuilder(
1448:                        "site/flawed_flowlink_target_missing.xml",
1449:                        resourcefinder);
1450:
1451:                try {
1452:                    builder.getSite();
1453:                    fail();
1454:                } catch (FlowLinkTargetRequiredException e) {
1455:                    assertEquals(e.getSiteDeclarationName(),
1456:                            "site/flawed_flowlink_target_missing.xml");
1457:                    assertEquals(e.getExitName(), "Exit1");
1458:                    assertEquals(e.getElementId(), "ELEMENT1");
1459:                }
1460:            }
1461:
1462:            public void testFlawedFlowLinkAmbigousTarget() {
1463:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1464:                        .getInstance();
1465:                SiteBuilder builder = new SiteBuilder(
1466:                        "site/flawed_flowlink_ambigous_target.xml",
1467:                        resourcefinder);
1468:
1469:                try {
1470:                    builder.getSite();
1471:                    fail();
1472:                } catch (FlowLinkAmbiguousTargetException e) {
1473:                    assertEquals(e.getSiteDeclarationName(),
1474:                            "site/flawed_flowlink_ambigous_target.xml");
1475:                    assertEquals(e.getExitName(), "Exit1");
1476:                    assertEquals(e.getElementId(), "ELEMENT1");
1477:                }
1478:            }
1479:
1480:            public void testFlawedFlowLinkSrcexit() {
1481:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1482:                        .getInstance();
1483:                SiteBuilder builder = new SiteBuilder(
1484:                        "site/flawed_flowlink_srcexit.xml", resourcefinder);
1485:
1486:                try {
1487:                    builder.getSite();
1488:                    fail();
1489:                } catch (ExitUnknownException e) {
1490:                    assertEquals(e.getDeclarationName(),
1491:                            "xml/test_xml2elementinfo1.xml");
1492:                    assertEquals(e.getExitName(), "Exit19");
1493:                }
1494:            }
1495:
1496:            public void testFlawedFlowLinkSpecificDataLinkDestid() {
1497:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1498:                        .getInstance();
1499:                SiteBuilder builder = new SiteBuilder(
1500:                        "site/flawed_flowlink_specific_datalink_destid.xml",
1501:                        resourcefinder);
1502:
1503:                try {
1504:                    builder.getSite();
1505:                    fail();
1506:                } catch (FlowLinkSpecificDataLinkDestIdSpecifiedException e) {
1507:                    assertEquals(e.getSiteDeclarationName(),
1508:                            "site/flawed_flowlink_specific_datalink_destid.xml");
1509:                    assertEquals(e.getExitName(), "Exit1");
1510:                    assertEquals(e.getElementId(), "ELEMENT1");
1511:                }
1512:            }
1513:
1514:            public void testFlawedGlobalExitAmbigousTarget1() {
1515:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1516:                        .getInstance();
1517:                SiteBuilder builder = new SiteBuilder(
1518:                        "site/flawed_globalexit_ambigous_target1.xml",
1519:                        resourcefinder);
1520:
1521:                try {
1522:                    builder.getSite();
1523:                    fail();
1524:                } catch (GlobalExitAmbiguousTargetException e) {
1525:                    assertEquals(e.getSiteDeclarationName(),
1526:                            "site/flawed_globalexit_ambigous_target1.xml");
1527:                    assertEquals(e.getGlobalExitName(), "exit1");
1528:                }
1529:            }
1530:
1531:            public void testFlawedGlobalExitAmbigousTarget2() {
1532:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1533:                        .getInstance();
1534:                SiteBuilder builder = new SiteBuilder(
1535:                        "site/flawed_globalexit_ambigous_target2.xml",
1536:                        resourcefinder);
1537:
1538:                try {
1539:                    builder.getSite();
1540:                    fail();
1541:                } catch (GlobalExitAmbiguousTargetException e) {
1542:                    assertEquals(e.getSiteDeclarationName(),
1543:                            "site/flawed_globalexit_ambigous_target2.xml");
1544:                    assertEquals(e.getGlobalExitName(), "exit2");
1545:                }
1546:            }
1547:
1548:            public void testFlawedGlobalExitAmbigousTarget3() {
1549:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1550:                        .getInstance();
1551:                SiteBuilder builder = new SiteBuilder(
1552:                        "site/flawed_globalexit_ambigous_target3.xml",
1553:                        resourcefinder);
1554:
1555:                try {
1556:                    builder.getSite();
1557:                    fail();
1558:                } catch (GlobalExitAmbiguousTargetException e) {
1559:                    assertEquals(e.getSiteDeclarationName(),
1560:                            "site/flawed_globalexit_ambigous_target3.xml");
1561:                    assertEquals(e.getGlobalExitName(), "exit3");
1562:                }
1563:            }
1564:
1565:            public void testFlawedGlobalExitTargetMissing() {
1566:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1567:                        .getInstance();
1568:                SiteBuilder builder = new SiteBuilder(
1569:                        "site/flawed_globalexit_target_missing.xml",
1570:                        resourcefinder);
1571:
1572:                try {
1573:                    builder.getSite();
1574:                    fail();
1575:                } catch (GlobalExitTargetRequiredException e) {
1576:                    assertEquals(e.getSiteDeclarationName(),
1577:                            "site/flawed_globalexit_target_missing.xml");
1578:                    assertEquals(e.getGlobalExitName(), "exit1");
1579:                }
1580:            }
1581:
1582:            public void testMissingElementImplementation() {
1583:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1584:                        .getInstance();
1585:                SiteBuilder builder = new SiteBuilder("test_site",
1586:                        resourcefinder);
1587:                builder.enterElement("not_found_declaration_name")
1588:                        .leaveElement();
1589:
1590:                try {
1591:                    builder.getSite();
1592:                    fail();
1593:                } catch (MissingImplementationException e) {
1594:                    assertEquals("not_found_declaration_name", e
1595:                            .getDeclarationName());
1596:                }
1597:            }
1598:
1599:            public void testFlawedUnknownInbeanGroup() {
1600:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1601:                        .getInstance();
1602:                SiteBuilder builder = new SiteBuilder(
1603:                        "site/flawed_unknown_inbean_group.xml", resourcefinder);
1604:
1605:                try {
1606:                    builder.getSite();
1607:                    fail();
1608:                } catch (InbeanGroupNotFoundException e) {
1609:                    assertEquals(e.getDeclarationName(),
1610:                            "xml/test_xml2elementinfo1.xml");
1611:                    assertEquals(e.getClassName(),
1612:                            "com.uwyn.rife.engine.testelements.submission.BeanImpl");
1613:                    assertEquals(e.getGroupName(), "unknowngroup");
1614:                }
1615:            }
1616:
1617:            public void testFlawedUnknownOutbeanGroup() {
1618:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1619:                        .getInstance();
1620:                SiteBuilder builder = new SiteBuilder(
1621:                        "site/flawed_unknown_outbean_group.xml", resourcefinder);
1622:
1623:                try {
1624:                    builder.getSite();
1625:                    fail();
1626:                } catch (OutbeanGroupNotFoundException e) {
1627:                    assertEquals(e.getDeclarationName(),
1628:                            "xml/test_xml2elementinfo1.xml");
1629:                    assertEquals(e.getClassName(),
1630:                            "com.uwyn.rife.engine.testelements.submission.BeanImpl");
1631:                    assertEquals(e.getGroupName(), "unknowngroup");
1632:                }
1633:            }
1634:
1635:            public void testFlawedUnknownGlobalbeanGroup() {
1636:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1637:                        .getInstance();
1638:                SiteBuilder builder = new SiteBuilder(
1639:                        "site/flawed_unknown_globalbean_group.xml",
1640:                        resourcefinder);
1641:
1642:                try {
1643:                    builder.getSite();
1644:                    fail();
1645:                } catch (GlobalBeanGroupNotFoundException e) {
1646:                    assertEquals(e.getSiteDeclarationName(),
1647:                            "site/flawed_unknown_globalbean_group.xml");
1648:                    assertEquals(e.getClassName(),
1649:                            "com.uwyn.rife.engine.testelements.submission.BeanImpl");
1650:                    assertEquals(e.getGroupName(), "unknowngroup");
1651:                }
1652:            }
1653:
1654:            public void testFlawedNonValidationInbeanGroup() {
1655:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1656:                        .getInstance();
1657:                SiteBuilder builder = new SiteBuilder(
1658:                        "site/flawed_nonvalidation_inbean_group.xml",
1659:                        resourcefinder);
1660:
1661:                try {
1662:                    builder.getSite();
1663:                    fail();
1664:                } catch (InbeanGroupRequiresValidatedConstrainedException e) {
1665:                    assertEquals(e.getDeclarationName(),
1666:                            "xml/test_xml2elementinfo1.xml");
1667:                    assertEquals(e.getClassName(),
1668:                            "com.uwyn.rife.engine.testelements.exits.BeanImpl1");
1669:                    assertEquals(e.getGroupName(), "somegroup");
1670:                }
1671:            }
1672:
1673:            public void testFlawedNonValidationOutbeanGroup() {
1674:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1675:                        .getInstance();
1676:                SiteBuilder builder = new SiteBuilder(
1677:                        "site/flawed_nonvalidation_outbean_group.xml",
1678:                        resourcefinder);
1679:
1680:                try {
1681:                    builder.getSite();
1682:                    fail();
1683:                } catch (OutbeanGroupRequiresValidatedConstrainedException e) {
1684:                    assertEquals(e.getDeclarationName(),
1685:                            "xml/test_xml2elementinfo1.xml");
1686:                    assertEquals(e.getClassName(),
1687:                            "com.uwyn.rife.engine.testelements.exits.BeanImpl1");
1688:                    assertEquals(e.getGroupName(), "somegroup");
1689:                }
1690:            }
1691:
1692:            public void testFlawedNonValidationGlobalbeanGroup() {
1693:                ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
1694:                        .getInstance();
1695:                SiteBuilder builder = new SiteBuilder(
1696:                        "site/flawed_nonvalidation_globalbean_group.xml",
1697:                        resourcefinder);
1698:
1699:                try {
1700:                    builder.getSite();
1701:                    fail();
1702:                } catch (GlobalBeanGroupRequiresValidatedConstrainedException e) {
1703:                    assertEquals(e.getSiteDeclarationName(),
1704:                            "site/flawed_nonvalidation_globalbean_group.xml");
1705:                    assertEquals(e.getClassName(),
1706:                            "com.uwyn.rife.engine.testelements.exits.BeanImpl1");
1707:                    assertEquals(e.getGroupName(), "somegroup");
1708:                }
1709:            }
1710:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.