001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003: * Distributed under the terms of either:
004: * - the common development and distribution license (CDDL), v1.0; or
005: * - the GNU Lesser General Public License, v2.1 or later
006: * $Id: TestJanino2Site.java 3634 2007-01-08 21:42:24Z gbevin $
007: */
008: package com.uwyn.rife.engine;
009:
010: import com.uwyn.rife.rep.Rep;
011: import com.uwyn.rife.resources.ResourceFinderClasspath;
012: import java.util.Collection;
013: import junit.framework.TestCase;
014:
015: public class TestJanino2Site extends TestCase {
016: public TestJanino2Site(String name) {
017: super (name);
018: }
019:
020: public void testParser() {
021: ResourceFinderClasspath resourcefinder = ResourceFinderClasspath
022: .getInstance();
023: SiteBuilder builder = new SiteBuilder(
024: "janino/test_janino2site.janino", resourcefinder);
025:
026: Site site = builder.getSite();
027:
028: assertEquals(site.getUrls().size(), 6);
029: assertEquals(site.getIds().size(), 9);
030:
031: assertEquals("com.uwyn.rife.engine.testelements.engine.Simple",
032: site.resolveUrl("/test/element1", null)
033: .getImplementation());
034: assertNull(site.resolveUrl("/test/element1/path/info", null));
035: assertNull(site.resolveUrl("/test/element1_notthere", null));
036: assertEquals(
037: "com.uwyn.rife.engine.testelements.submission.Normal",
038: site.searchFallback("").getImplementation());
039: assertEquals(
040: "com.uwyn.rife.engine.testelements.submission.Normal",
041: site.searchFallback("/hskjhjdz").getImplementation());
042: assertEquals(
043: "com.uwyn.rife.engine.testelements.outputs.Normal",
044: site.searchFallback("/subsite").getImplementation());
045: assertEquals(
046: "com.uwyn.rife.engine.testelements.outputs.Normal",
047: site.searchFallback("/subsitedfzefze")
048: .getImplementation());
049: assertEquals(
050: "com.uwyn.rife.engine.testelements.outputs.Normal",
051: site.searchFallback("/subsite/kjdkfj")
052: .getImplementation());
053:
054: Collection<String> global_exits = null;
055: Collection<String> global_vars = null;
056:
057: ElementInfo elementinfo1 = site.resolveUrl("/test/element1",
058: null);
059: assertNotNull(elementinfo1);
060: assertSame(site.resolveId(".ELEMENT1"), elementinfo1);
061: assertEquals(elementinfo1.getImplementation(),
062: com.uwyn.rife.engine.testelements.engine.Simple.class
063: .getName());
064: assertTrue(elementinfo1.hasGlobalExits());
065: global_exits = elementinfo1.getGlobalExitNames();
066: assertNotNull(global_exits);
067: assertEquals(global_exits.size(), 2);
068: assertTrue(global_exits.contains("globalexit1"));
069: assertTrue(global_exits.contains("globalexit2"));
070: assertTrue(elementinfo1.hasGlobalVars());
071: global_vars = elementinfo1.getGlobalVarNames();
072: assertNotNull(global_vars);
073: assertEquals(global_vars.size(), 8);
074: assertTrue(global_vars.contains("globalvar1"));
075: assertTrue(global_vars.contains("globalvar2"));
076: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
077: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
078: assertTrue(global_vars
079: .contains("onemoreprefixgroup_shortObject"));
080: assertTrue(global_vars.contains("double"));
081: assertTrue(global_vars.contains("long"));
082: assertTrue(global_vars.contains("shortObject"));
083: assertEquals(elementinfo1.getNamedGlobalBeanNames().size(), 1);
084: assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
085: .getClassname(),
086: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
087: assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
088: .getPrefix(), "onemoreprefixgroup_");
089: assertEquals(elementinfo1.getNamedGlobalBeanInfo("globalbean1")
090: .getGroupName(), "anothergroup");
091: assertNull(elementinfo1.getInheritanceStack());
092: assertEquals(elementinfo1.getPropertyNames().size(), 4 + Rep
093: .getProperties().size());
094: assertEquals("value1", elementinfo1.getProperty("property1"));
095: assertEquals("value2", elementinfo1.getProperty("property2"));
096: assertEquals("value3", elementinfo1.getProperty("property3"));
097: assertEquals("value4", elementinfo1.getProperty("property4"));
098:
099: ElementInfo elementinfo2 = site.resolveUrl("/test/element2",
100: null);
101: assertNotNull(elementinfo2);
102: assertSame(site.resolveId(".ELEMENT2"), elementinfo2);
103: assertEquals(elementinfo2.getImplementation(),
104: com.uwyn.rife.engine.testelements.outputs.Normal.class
105: .getName());
106: assertTrue(elementinfo2.hasGlobalExits());
107: global_exits = elementinfo2.getGlobalExitNames();
108: assertNotNull(global_exits);
109: assertEquals(global_exits.size(), 2);
110: assertTrue(global_exits.contains("globalexit1"));
111: assertTrue(global_exits.contains("globalexit2"));
112: assertTrue(elementinfo2.hasGlobalVars());
113: global_vars = elementinfo2.getGlobalVarNames();
114: assertNotNull(global_vars);
115: assertEquals(global_vars.size(), 8);
116: assertTrue(global_vars.contains("globalvar1"));
117: assertTrue(global_vars.contains("globalvar2"));
118: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
119: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
120: assertTrue(global_vars
121: .contains("onemoreprefixgroup_shortObject"));
122: assertTrue(global_vars.contains("double"));
123: assertTrue(global_vars.contains("long"));
124: assertTrue(global_vars.contains("shortObject"));
125: assertEquals(elementinfo2.getNamedGlobalBeanNames().size(), 1);
126: assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
127: .getClassname(),
128: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
129: assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
130: .getPrefix(), "onemoreprefixgroup_");
131: assertEquals(elementinfo2.getNamedGlobalBeanInfo("globalbean1")
132: .getGroupName(), "anothergroup");
133: assertNotNull(elementinfo2.getInheritanceStack());
134: assertEquals(2, elementinfo2.getInheritanceStack().size());
135: assertEquals(elementinfo2.getInheritanceStack().get(0)
136: .getImplementation(),
137: com.uwyn.rife.engine.testelements.outputs.Normal.class
138: .getName());
139: assertEquals(elementinfo2.getInheritanceStack().get(1)
140: .getImplementation(),
141: com.uwyn.rife.engine.testelements.inputs.Normal.class
142: .getName());
143: assertEquals(0 + Rep.getProperties().size(), elementinfo2
144: .getPropertyNames().size());
145:
146: ElementInfo elementinfo3 = site.resolveId(".ELEMENT3");
147: assertNotNull(elementinfo3);
148: assertEquals(elementinfo3.getImplementation(),
149: com.uwyn.rife.engine.testelements.inputs.Normal.class
150: .getName());
151: assertTrue(elementinfo3.hasGlobalExits());
152: global_exits = elementinfo3.getGlobalExitNames();
153: assertNotNull(global_exits);
154: assertEquals(global_exits.size(), 2);
155: assertTrue(global_exits.contains("globalexit1"));
156: assertTrue(global_exits.contains("globalexit2"));
157: assertTrue(elementinfo3.hasGlobalVars());
158: global_vars = elementinfo3.getGlobalVarNames();
159: assertNotNull(global_vars);
160: assertEquals(global_vars.size(), 8);
161: assertTrue(global_vars.contains("globalvar1"));
162: assertTrue(global_vars.contains("globalvar2"));
163: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
164: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
165: assertTrue(global_vars
166: .contains("onemoreprefixgroup_shortObject"));
167: assertTrue(global_vars.contains("double"));
168: assertTrue(global_vars.contains("long"));
169: assertTrue(global_vars.contains("shortObject"));
170: assertEquals(elementinfo3.getNamedGlobalBeanNames().size(), 1);
171: assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
172: .getClassname(),
173: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
174: assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
175: .getPrefix(), "onemoreprefixgroup_");
176: assertEquals(elementinfo3.getNamedGlobalBeanInfo("globalbean1")
177: .getGroupName(), "anothergroup");
178: assertNull(elementinfo3.getInheritanceStack());
179: assertEquals(0 + Rep.getProperties().size(), elementinfo3
180: .getPropertyNames().size());
181:
182: ElementInfo elementinfo4 = site.resolveId(".ELEMENT4");
183: assertNotNull(elementinfo4);
184: assertEquals(
185: elementinfo4.getImplementation(),
186: com.uwyn.rife.engine.testelements.submission.Normal.class
187: .getName());
188: assertTrue(elementinfo4.hasGlobalExits());
189: global_exits = elementinfo4.getGlobalExitNames();
190: assertNotNull(global_exits);
191: assertEquals(global_exits.size(), 2);
192: assertTrue(global_exits.contains("globalexit1"));
193: assertTrue(global_exits.contains("globalexit2"));
194: assertTrue(elementinfo4.hasGlobalVars());
195: global_vars = elementinfo4.getGlobalVarNames();
196: assertNotNull(global_vars);
197: assertEquals(global_vars.size(), 8);
198: assertTrue(global_vars.contains("globalvar1"));
199: assertTrue(global_vars.contains("globalvar2"));
200: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
201: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
202: assertTrue(global_vars
203: .contains("onemoreprefixgroup_shortObject"));
204: assertTrue(global_vars.contains("double"));
205: assertTrue(global_vars.contains("long"));
206: assertTrue(global_vars.contains("shortObject"));
207: assertEquals(elementinfo4.getNamedGlobalBeanNames().size(), 1);
208: assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
209: .getClassname(),
210: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
211: assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
212: .getPrefix(), "onemoreprefixgroup_");
213: assertEquals(elementinfo4.getNamedGlobalBeanInfo("globalbean1")
214: .getGroupName(), "anothergroup");
215: assertNull(elementinfo4.getInheritanceStack());
216: assertEquals(0 + Rep.getProperties().size(), elementinfo4
217: .getPropertyNames().size());
218:
219: ElementInfo subsite_elementinfo2 = site.resolveUrl(
220: "/subsite/test/element2", null);
221: assertNotNull(subsite_elementinfo2);
222: assertSame(site.resolveId(".SUBSITE.ELEMENT2"),
223: subsite_elementinfo2);
224: assertEquals(subsite_elementinfo2.getImplementation(),
225: com.uwyn.rife.engine.testelements.outputs.Normal.class
226: .getName());
227: assertTrue(subsite_elementinfo2.hasGlobalExits());
228: global_exits = subsite_elementinfo2.getGlobalExitNames();
229: assertNotNull(global_exits);
230: assertEquals(global_exits.size(), 3);
231: assertTrue(global_exits.contains("globalexit1"));
232: assertTrue(global_exits.contains("globalexit2"));
233: assertTrue(global_exits.contains("globalexit3"));
234: assertTrue(subsite_elementinfo2.hasGlobalVars());
235: global_vars = subsite_elementinfo2.getGlobalVarNames();
236: assertNotNull(global_vars);
237: assertEquals(global_vars.size(), 9);
238: assertTrue(global_vars.contains("globalvar1"));
239: assertTrue(global_vars.contains("globalvar2"));
240: assertTrue(global_vars.contains("globalvar3"));
241: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
242: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
243: assertTrue(global_vars
244: .contains("onemoreprefixgroup_shortObject"));
245: assertTrue(global_vars.contains("double"));
246: assertTrue(global_vars.contains("long"));
247: assertTrue(global_vars.contains("shortObject"));
248: assertEquals(subsite_elementinfo2.getNamedGlobalBeanNames()
249: .size(), 1);
250: assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
251: "globalbean1").getClassname(),
252: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
253: assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
254: "globalbean1").getPrefix(), "onemoreprefixgroup_");
255: assertEquals(subsite_elementinfo2.getNamedGlobalBeanInfo(
256: "globalbean1").getGroupName(), "anothergroup");
257: assertNotNull(subsite_elementinfo2.getInheritanceStack());
258: assertEquals(2, subsite_elementinfo2.getInheritanceStack()
259: .size());
260: assertEquals(subsite_elementinfo2.getInheritanceStack().get(0)
261: .getImplementation(),
262: com.uwyn.rife.engine.testelements.outputs.Normal.class
263: .getName());
264: assertEquals(
265: subsite_elementinfo2.getInheritanceStack().get(1)
266: .getImplementation(),
267: com.uwyn.rife.engine.testelements.submission.Normal.class
268: .getName());
269: assertEquals(0 + Rep.getProperties().size(),
270: subsite_elementinfo2.getPropertyNames().size());
271:
272: ElementInfo subsite_elementinfo3 = site.resolveUrl(
273: "/subsite/test/element3", null);
274: assertNotNull(subsite_elementinfo3);
275: assertSame(site.resolveId(".SUBSITE.ELEMENT3"),
276: subsite_elementinfo3);
277: assertEquals(subsite_elementinfo3.getImplementation(),
278: com.uwyn.rife.engine.testelements.inputs.Normal.class
279: .getName());
280: assertTrue(subsite_elementinfo3.hasGlobalExits());
281: global_exits = subsite_elementinfo3.getGlobalExitNames();
282: assertNotNull(global_exits);
283: assertEquals(global_exits.size(), 3);
284: assertTrue(global_exits.contains("globalexit1"));
285: assertTrue(global_exits.contains("globalexit2"));
286: assertTrue(global_exits.contains("globalexit3"));
287: assertTrue(subsite_elementinfo3.hasGlobalVars());
288: global_vars = subsite_elementinfo3.getGlobalVarNames();
289: assertNotNull(global_vars);
290: assertEquals(global_vars.size(), 9);
291: assertTrue(global_vars.contains("globalvar1"));
292: assertTrue(global_vars.contains("globalvar2"));
293: assertTrue(global_vars.contains("globalvar3"));
294: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
295: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
296: assertTrue(global_vars
297: .contains("onemoreprefixgroup_shortObject"));
298: assertTrue(global_vars.contains("double"));
299: assertTrue(global_vars.contains("long"));
300: assertTrue(global_vars.contains("shortObject"));
301: assertEquals(subsite_elementinfo3.getNamedGlobalBeanNames()
302: .size(), 1);
303: assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
304: "globalbean1").getClassname(),
305: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
306: assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
307: "globalbean1").getPrefix(), "onemoreprefixgroup_");
308: assertEquals(subsite_elementinfo3.getNamedGlobalBeanInfo(
309: "globalbean1").getGroupName(), "anothergroup");
310: assertNotNull(subsite_elementinfo3.getInheritanceStack());
311: assertEquals(2, subsite_elementinfo3.getInheritanceStack()
312: .size());
313: assertEquals(subsite_elementinfo3.getInheritanceStack().get(0)
314: .getImplementation(),
315: com.uwyn.rife.engine.testelements.inputs.Normal.class
316: .getName());
317: assertEquals(
318: subsite_elementinfo3.getInheritanceStack().get(1)
319: .getImplementation(),
320: com.uwyn.rife.engine.testelements.submission.Normal.class
321: .getName());
322: assertTrue(subsite_elementinfo3.hasDepartureVars());
323: assertEquals(1, subsite_elementinfo3.getDepartureVars().size());
324: assertEquals("globalvar3", subsite_elementinfo3
325: .getDepartureVars().get(0));
326: assertEquals(0 + Rep.getProperties().size(),
327: subsite_elementinfo3.getPropertyNames().size());
328:
329: ElementInfo elementinfo5 = site.resolveId(".ELEMENT5");
330: assertNotNull(elementinfo5);
331: assertEquals(
332: elementinfo5.getImplementation(),
333: com.uwyn.rife.engine.testelements.exits.SimpleSource.class
334: .getName());
335: assertTrue(elementinfo5.hasGlobalExits());
336: global_exits = elementinfo5.getGlobalExitNames();
337: assertNotNull(global_exits);
338: assertEquals(global_exits.size(), 2);
339: assertTrue(global_exits.contains("globalexit1"));
340: assertTrue(global_exits.contains("globalexit2"));
341: assertTrue(elementinfo5.hasGlobalVars());
342: global_vars = elementinfo5.getGlobalVarNames();
343: assertNotNull(global_vars);
344: assertEquals(global_vars.size(), 8);
345: assertTrue(global_vars.contains("globalvar1"));
346: assertTrue(global_vars.contains("globalvar2"));
347: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
348: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
349: assertTrue(global_vars
350: .contains("onemoreprefixgroup_shortObject"));
351: assertTrue(global_vars.contains("double"));
352: assertTrue(global_vars.contains("long"));
353: assertTrue(global_vars.contains("shortObject"));
354: assertEquals(elementinfo5.getNamedGlobalBeanNames().size(), 1);
355: assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
356: .getClassname(),
357: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
358: assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
359: .getPrefix(), "onemoreprefixgroup_");
360: assertEquals(elementinfo5.getNamedGlobalBeanInfo("globalbean1")
361: .getGroupName(), "anothergroup");
362: assertNull(elementinfo5.getInheritanceStack());
363: assertEquals(0 + Rep.getProperties().size(), elementinfo5
364: .getPropertyNames().size());
365:
366: ElementInfo elementinfo6 = site.resolveUrl("/test/element6",
367: null);
368: assertNotNull(elementinfo6);
369: assertSame(site.resolveId(".ELEMENT6"), elementinfo6);
370: assertEquals(elementinfo6.getImplementation(),
371: com.uwyn.rife.engine.testelements.outputs.Normal.class
372: .getName());
373: assertTrue(elementinfo6.hasGlobalExits());
374: global_exits = elementinfo6.getGlobalExitNames();
375: assertNotNull(global_exits);
376: assertEquals(global_exits.size(), 2);
377: assertTrue(global_exits.contains("globalexit1"));
378: assertTrue(global_exits.contains("globalexit2"));
379: assertTrue(elementinfo6.hasGlobalVars());
380: global_vars = elementinfo6.getGlobalVarNames();
381: assertNotNull(global_vars);
382: assertEquals(global_vars.size(), 9);
383: assertTrue(global_vars.contains("globalvar1"));
384: assertTrue(global_vars.contains("globalvar2"));
385: assertTrue(global_vars.contains("globalvar4"));
386: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
387: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
388: assertTrue(global_vars
389: .contains("onemoreprefixgroup_shortObject"));
390: assertTrue(global_vars.contains("double"));
391: assertTrue(global_vars.contains("long"));
392: assertTrue(global_vars.contains("shortObject"));
393: assertEquals(elementinfo6.getNamedGlobalBeanNames().size(), 1);
394: assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
395: .getClassname(),
396: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
397: assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
398: .getPrefix(), "onemoreprefixgroup_");
399: assertEquals(elementinfo6.getNamedGlobalBeanInfo("globalbean1")
400: .getGroupName(), "anothergroup");
401: assertNotNull(elementinfo6.getInheritanceStack());
402: assertEquals(3, elementinfo6.getInheritanceStack().size());
403: assertEquals(elementinfo6.getInheritanceStack().get(0)
404: .getImplementation(),
405: com.uwyn.rife.engine.testelements.outputs.Normal.class
406: .getName());
407: assertEquals(elementinfo6.getInheritanceStack().get(1)
408: .getImplementation(),
409: com.uwyn.rife.engine.testelements.inputs.Normal.class
410: .getName());
411: assertEquals(
412: elementinfo6.getInheritanceStack().get(2)
413: .getImplementation(),
414: com.uwyn.rife.engine.testelements.exits.SimpleSource.class
415: .getName());
416: assertEquals(0 + Rep.getProperties().size(), elementinfo6
417: .getPropertyNames().size());
418:
419: ElementInfo elementinfo7 = site.resolveUrl("/test/element7",
420: null);
421: assertNotNull(elementinfo7);
422: assertSame(site.resolveId(".test_janino2elementinfo3"),
423: elementinfo7);
424: assertEquals(elementinfo7.getImplementation(),
425: com.uwyn.rife.engine.testelements.inputs.Normal.class
426: .getName());
427: assertTrue(elementinfo7.hasGlobalExits());
428: global_exits = elementinfo7.getGlobalExitNames();
429: assertNotNull(global_exits);
430: assertEquals(global_exits.size(), 2);
431: assertTrue(global_exits.contains("globalexit1"));
432: assertTrue(global_exits.contains("globalexit2"));
433: assertTrue(elementinfo7.hasGlobalVars());
434: global_vars = elementinfo7.getGlobalVarNames();
435: assertNotNull(global_vars);
436: assertEquals(global_vars.size(), 9);
437: assertTrue(global_vars.contains("globalvar1"));
438: assertTrue(global_vars.contains("globalvar2"));
439: assertTrue(global_vars.contains("globalvar4"));
440: assertTrue(global_vars.contains("onemoreprefixgroup_double"));
441: assertTrue(global_vars.contains("onemoreprefixgroup_long"));
442: assertTrue(global_vars
443: .contains("onemoreprefixgroup_shortObject"));
444: assertTrue(global_vars.contains("double"));
445: assertTrue(global_vars.contains("long"));
446: assertTrue(global_vars.contains("shortObject"));
447: assertEquals(elementinfo7.getNamedGlobalBeanNames().size(), 1);
448: assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
449: .getClassname(),
450: "com.uwyn.rife.engine.testelements.submission.BeanImpl");
451: assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
452: .getPrefix(), "onemoreprefixgroup_");
453: assertEquals(elementinfo7.getNamedGlobalBeanInfo("globalbean1")
454: .getGroupName(), "anothergroup");
455: assertEquals(elementinfo1
456: .getGlobalVarDefaultValues("globalvar1").length, 1);
457: assertEquals(elementinfo1
458: .getGlobalVarDefaultValues("globalvar1")[0], "default1");
459: assertNotNull(elementinfo7.getInheritanceStack());
460: assertEquals(2, elementinfo7.getInheritanceStack().size());
461: assertEquals(elementinfo7.getInheritanceStack().get(0)
462: .getImplementation(),
463: com.uwyn.rife.engine.testelements.inputs.Normal.class
464: .getName());
465: assertEquals(
466: elementinfo7.getInheritanceStack().get(1)
467: .getImplementation(),
468: com.uwyn.rife.engine.testelements.exits.SimpleSource.class
469: .getName());
470:
471: assertSame(elementinfo1.getFlowLink("exit1").getTarget(),
472: elementinfo2);
473: assertEquals(elementinfo1.getFlowLink("exit1").isSnapback(),
474: false);
475: assertNull(elementinfo1.getFlowLink("exit2").getTarget());
476: assertEquals(elementinfo1.getFlowLink("exit2").isSnapback(),
477: true);
478:
479: Collection<String> inputs = null;
480:
481: inputs = elementinfo1.getDataLinkInputs("output1",
482: elementinfo2, false, null);
483: assertNotNull(inputs);
484: assertEquals(inputs.size(), 2);
485: assertTrue(inputs.contains("input1"));
486: assertTrue(inputs.contains("input2"));
487:
488: inputs = elementinfo1.getDataLinkInputs("output1",
489: elementinfo3, false, null);
490: assertNull(inputs);
491:
492: inputs = elementinfo1.getDataLinkInputs("output1",
493: elementinfo3, true, null);
494: assertNull(inputs);
495:
496: inputs = elementinfo1.getDataLinkInputs("output2",
497: elementinfo2, false, null);
498: assertNull(inputs);
499:
500: inputs = elementinfo1.getDataLinkInputs("output2",
501: elementinfo3, false, null);
502: assertNull(inputs);
503:
504: inputs = elementinfo1.getDataLinkInputs("output2",
505: elementinfo3, true, null);
506: assertNotNull(inputs);
507: assertEquals(inputs.size(), 1);
508: assertTrue(inputs.contains("input2"));
509:
510: inputs = elementinfo1.getDataLinkInputs("output3",
511: elementinfo2, false, elementinfo1.getFlowLink("exit3"));
512: assertNotNull(inputs);
513: assertEquals(inputs.size(), 1);
514: assertTrue(inputs.contains("input1"));
515:
516: inputs = elementinfo1.getDataLinkInputs("output3",
517: elementinfo2, false, null);
518: assertNull(inputs);
519:
520: inputs = elementinfo1.getDataLinkInputs("output4",
521: elementinfo2, false, elementinfo1.getFlowLink("exit4"));
522: assertNotNull(inputs);
523: assertEquals(inputs.size(), 1);
524: assertTrue(inputs.contains("input1"));
525:
526: inputs = elementinfo1.getDataLinkInputs("output4",
527: elementinfo2, false, null);
528: assertNull(inputs);
529: }
530: }
|