1 17 package org.apache.servicemix.jbi.deployment; 18 19 import org.apache.servicemix.jbi.config.DebugClassPathXmlApplicationContext; 20 import org.apache.servicemix.jbi.config.spring.XBeanProcessor; 21 import org.apache.servicemix.jbi.deployment.Descriptor; 22 import org.apache.servicemix.jbi.deployment.Identification; 23 import org.apache.servicemix.jbi.deployment.ServiceAssembly; 24 import org.apache.servicemix.jbi.deployment.ServiceUnit; 25 import org.springframework.context.support.AbstractXmlApplicationContext; 26 27 import java.util.Arrays ; 28 29 import javax.xml.namespace.QName ; 30 31 34 public class ServiceAssemblyTest extends DeploymentTest { 35 36 public void testParse() throws Exception { 37 38 Descriptor root = (Descriptor) context.getBean("jbi"); 40 assertNotNull("JBI Container not found in spring!", root); 41 42 ServiceAssembly serviceAssembly = root.getServiceAssembly(); 43 assertNotNull("serviceAssembly is null", serviceAssembly); 44 45 Identification identification = serviceAssembly.getIdentification(); 46 assertNotNull("identification is null", identification); 47 assertEquals("getName", "ServiceAssembly_041207153211-0800_saId", identification.getName()); 48 assertEquals("getDescription", "Description of Service Assembly : ServiceAssembly", identification.getDescription()); 49 50 ServiceUnit[] serviceUnits = serviceAssembly.getServiceUnits(); 51 assertNotNull("serviceUnits are null", serviceUnits); 52 assertEquals("serviceUnits size", 4, serviceUnits.length); 53 54 assertEquals("getIdentification().getName() for 0", "TransformationSU_041207152821-0800_suId", serviceUnits[0].getIdentification().getName()); 55 assertEquals("getIdentification().getDescription() for 0", "Description of Serviceunit: TransformationSU", serviceUnits[0].getIdentification().getDescription()); 56 assertEquals("getTarget().getArtifactsZip() for 0", "TransformationSU.zip", serviceUnits[0].getTarget().getArtifactsZip()); 57 assertEquals("getTarget().getComponentName() for 0", "SunTransformationEngine", serviceUnits[0].getTarget().getComponentName()); 58 59 assertEquals("getIdentification().getName() for 3", "SequencingEngineSU_041207152507-0800_suId", serviceUnits[3].getIdentification().getName()); 60 assertEquals("getIdentification().getDescription() for 3", "Description of Serviceunit: SequencingEngineSU", serviceUnits[3].getIdentification().getDescription()); 61 assertEquals("getTarget().getArtifactsZip() for 3", "SequencingEngineSU.zip", serviceUnits[3].getTarget().getArtifactsZip()); 62 assertEquals("getTarget().getComponentName() for 3", "SunSequencingEngine", serviceUnits[3].getTarget().getComponentName()); 63 64 Connection[] connections = serviceAssembly.getConnections().getConnections(); 65 assertNotNull("connections are null", connections); 66 assertEquals("connections size", 2, connections.length); 67 68 assertEquals("getConsumer().getServiceName() for 0", new QName ("http://www.gaiati.com/emee/ns/csi", "csi-service"), connections[0].getConsumer().getServiceName()); 69 } 70 71 protected AbstractXmlApplicationContext createBeanFactory() throws Exception { 72 return new DebugClassPathXmlApplicationContext("org/apache/servicemix/jbi/deployment/serviceAssembly.xml", 73 Arrays.asList(new Object [] { new XBeanProcessor() })); 74 } 75 76 } 77 | Popular Tags |