1 17 package org.apache.servicemix.common.xbean; 18 19 import java.io.File ; 20 import java.net.URL ; 21 22 import org.apache.servicemix.common.BaseComponent; 23 import org.apache.servicemix.common.ServiceUnit; 24 25 import junit.framework.TestCase; 26 27 public class XBeanDeployerTest extends TestCase { 28 29 protected void setUp() throws Exception { 30 31 } 32 33 protected void tearDown() throws Exception { 34 35 } 36 37 public void testDeployWithProperties() throws Exception { 38 MyXBeanDeployer deployer = new MyXBeanDeployer(new BaseComponent() { }); 39 ServiceUnit su = deployer.deploy("xbean", getServiceUnitPath("xbean")); 40 assertNotNull(su); 41 assertEquals(1, su.getEndpoints().size()); 42 XBeanEndpoint ep = (XBeanEndpoint) su.getEndpoints().iterator().next(); 43 assertEquals("value", ep.getProp()); 44 } 45 46 public static class MyXBeanDeployer extends AbstractXBeanDeployer { 47 48 public MyXBeanDeployer(BaseComponent component) { 49 super(component); 50 } 51 52 } 53 54 protected String getServiceUnitPath(String name) { 55 URL url = getClass().getClassLoader().getResource(name + "/xbean.xml"); 56 File path = new File (url.getFile()); 57 path = path.getParentFile(); 58 return path.getAbsolutePath(); 59 } 60 } 61 | Popular Tags |