1 17 18 package org.apache.geronimo.deployment.service; 19 20 import java.net.URL ; 21 22 import org.apache.geronimo.deployment.xbeans.AttributeType; 23 import org.apache.geronimo.deployment.xbeans.ConfigurationDocument; 24 import org.apache.geronimo.deployment.xbeans.ConfigurationType; 25 import org.apache.geronimo.deployment.xbeans.GbeanType; 26 import org.apache.geronimo.deployment.xbeans.ReferenceType; 27 import org.apache.geronimo.deployment.xbeans.DependencyType; 28 import org.apache.geronimo.deployment.FooBarBean; 29 30 import junit.framework.TestCase; 31 32 37 public class ConfigPlanTest extends TestCase { 38 private URL plan1; 39 40 public void testParser() throws Exception { 41 ConfigurationDocument doc = ConfigurationDocument.Factory.parse(plan1); 42 ConfigurationType configuration = doc.getConfiguration(); 43 assertEquals("test/plan1", configuration.getConfigId()); 44 45 DependencyType[] dependencies = configuration.getDependencyArray(); 46 assertEquals(1, dependencies.length); 47 assertEquals("geronimo", dependencies[0].getGroupId()); 48 assertEquals("geronimo-kernel", dependencies[0].getArtifactId()); 49 assertEquals("DEV", dependencies[0].getVersion()); 50 51 GbeanType[] gbeans = configuration.getGbeanArray(); 52 assertEquals(1, gbeans.length); 53 assertEquals("geronimo.test:name=MyMockGMBean", gbeans[0].getGbeanName()); 54 AttributeType[] attrs = gbeans[0].getAttributeArray(); 55 assertEquals(2, attrs.length); 56 assertEquals("value", attrs[0].getName()); 57 assertEquals("1234", attrs[0].getStringValue()); 58 assertEquals("intValue", attrs[1].getName()); 59 assertEquals("1234", attrs[1].getStringValue()); 60 61 ReferenceType[] refs = gbeans[0].getReferenceArray(); 62 assertEquals(1, refs.length); 63 assertEquals("MockEndpoint", refs[0].getName2()); 64 assertEquals("geronimo.test:name=MyMockGMBean", refs[0].getGbeanName()); 65 } 66 67 protected void setUp() throws Exception { 68 super.setUp(); 69 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 70 plan1 = cl.getResource("services/plan1.xml"); 71 } 72 } 73 | Popular Tags |