1 23 24 package org.objectweb.fractal.adl.conform; 25 26 import java.util.Map ; 27 import java.util.HashMap ; 28 29 import org.objectweb.fractal.adl.ADLException; 30 import org.objectweb.fractal.adl.Definition; 31 import org.objectweb.fractal.adl.Loader; 32 import org.objectweb.fractal.adl.arguments.ArgumentLoader; 33 import org.objectweb.fractal.adl.arguments.ArgumentComponentLoader; 34 import org.objectweb.fractal.adl.attributes.AttributeLoader; 35 import org.objectweb.fractal.adl.bindings.TypeBindingLoader; 36 import org.objectweb.fractal.adl.implementations.ImplementationLoader; 37 import org.objectweb.fractal.adl.interfaces.InterfaceLoader; 38 import org.objectweb.fractal.adl.types.TypeLoader; 39 import org.objectweb.fractal.adl.xml.XMLLoader; 40 41 public class TestArguments extends Test { 42 43 public Loader l; 44 45 public Map context; 46 47 public TestArguments (final String name) { 48 super(name); 49 } 50 51 protected void setUp () { 52 context = new HashMap (); 53 54 ArgumentLoader pv = new ArgumentLoader(); 55 InterfaceLoader iv = new InterfaceLoader(); 56 TypeLoader tv = new TypeLoader(); 57 ImplementationLoader impv = new ImplementationLoader(); 58 AttributeLoader attrv1 = new AttributeLoader(); 59 ArgumentComponentLoader compv = new ArgumentComponentLoader(); 60 TypeBindingLoader bindv = new TypeBindingLoader(); 61 AttributeLoader attrv2 = new AttributeLoader(); 62 63 pv.clientLoader = new XMLLoader(false); 64 iv.clientLoader = pv; 65 tv.clientLoader = iv; 66 impv.clientLoader = tv; 67 attrv1.clientLoader = impv; 68 compv.clientLoader = attrv1; 69 bindv.clientLoader = compv; 70 attrv2.clientLoader = bindv; 71 l = attrv2; 72 } 73 74 public void test1 () throws ADLException { 75 context.put("p", "org.objectweb.fractal.adl.conform.components.IImpl"); 76 Definition d1 = l.load("ARG1", context); 77 Definition d2 = l.load("ARG2", null); 78 compare(d1, d2); 79 } 80 81 public void test2 () { 82 try { 83 l.load("ARG1", context); 84 fail(); 85 } catch (ADLException e) { 86 } 87 } 88 89 public void test3 () throws ADLException { 90 context.put("p", "org.objectweb.fractal.adl.conform.components.IImpl"); 91 context.put("q", "ARG1"); 92 context.put("r", "primitive"); 93 Definition d1 = l.load("ARG3", context); 94 Definition d2 = l.load("ARG4", null); 95 compare(d1, d2); 96 } 97 98 public void test4 () throws ADLException { 99 context.put("p", "org.objectweb.fractal.adl.conform.components.IImpl"); 100 context.put("q", "org.objectweb.fractal.adl.conform.components.IImpl"); 101 Definition d1 = l.load("ARG5", context); 102 Definition d2 = l.load("ARG6", null); 103 compare(d1, d2); 104 } 105 106 public void test5 () throws ADLException { 107 context.put("u1", "org.objectweb.fractal.adl.conform.components.IImpl"); 108 context.put("v1", "org.objectweb.fractal.adl.conform.components.IImpl"); 109 context.put("u2", "org.objectweb.fractal.adl.conform.components.IImpl"); 110 context.put("v2", "org.objectweb.fractal.adl.conform.components.IImpl"); 111 Definition d1 = l.load("ARG7", context); 112 Definition d2 = l.load("ARG8", null); 113 compare(d1, d2); 114 } 115 116 public void test6 () { 117 try { 118 context.put("u", "org.objectweb.fractal.adl.conform.components.IImpl"); 119 l.load("ARG9", context); 120 fail(); 121 } catch (ADLException e) { 122 } 123 } 124 125 public void test7 () { 126 try { 127 context.put("u", "org.objectweb.fractal.adl.conform.components.IImpl"); 128 l.load("ARG10", context); 129 fail(); 130 } catch (ADLException e) { 131 } 132 } 133 } 134 | Popular Tags |