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.SharedLibrary; 24 import org.apache.servicemix.jbi.jaxp.SourceTransformer; 25 import org.springframework.context.support.AbstractXmlApplicationContext; 26 27 import java.util.Arrays ; 28 29 import junit.framework.TestCase; 30 31 34 public class SharedLibraryTest extends TestCase { 35 36 protected AbstractXmlApplicationContext context; 37 protected SourceTransformer transformer = new SourceTransformer(); 38 39 public void testParse() throws Exception { 40 41 Descriptor root = (Descriptor) context.getBeansOfType(Descriptor.class).values().iterator().next(); 43 assertNotNull("JBI Container not found in spring!", root); 44 45 SharedLibrary sl = root.getSharedLibrary(); 46 Identification identification = sl.getIdentification(); 47 assertEquals("getName", "TestSharedLibrary", identification.getName()); 48 assertEquals("getDescription", "This is a test shared library.", identification.getDescription()); 49 50 } 51 52 protected String toString(Object [] objects) { 53 if (objects == null) { 54 return "null Object[]"; 55 } 56 StringBuffer buffer = new StringBuffer ("["); 57 for (int i = 0; i < objects.length; i++) { 58 Object object = objects[i]; 59 if (i > 0) { 60 buffer.append(", "); 61 } 62 buffer.append(object); 63 } 64 buffer.append("]"); 65 return buffer.toString(); 66 } 67 68 protected void setUp() throws Exception { 69 context = createBeanFactory(); 70 } 71 72 protected AbstractXmlApplicationContext createBeanFactory() throws Exception { 73 return new DebugClassPathXmlApplicationContext("org/apache/servicemix/jbi/deployment/SharedLibrary.xml", 74 Arrays.asList(new Object [] { new XBeanProcessor() })); 75 } 76 77 } 78 | Popular Tags |