servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r430433 - in /incubator/servicemix/trunk/servicemix-common/src/test: java/org/apache/servicemix/common/xbean/ resources/xbean/
Date Thu, 10 Aug 2006 16:37:42 GMT
Author: gnodet
Date: Thu Aug 10 09:37:41 2006
New Revision: 430433

URL: http://svn.apache.org/viewvc?rev=430433&view=rev
Log:
Add a test case for using xbean properties on deployment

Added:
    incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/
    incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanDeployerTest.java
    incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanEndpoint.java
    incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/
    incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.properties
    incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.xml

Added: incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanDeployerTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanDeployerTest.java?rev=430433&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanDeployerTest.java
(added)
+++ incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanDeployerTest.java
Thu Aug 10 09:37:41 2006
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.common.xbean;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.servicemix.common.BaseComponent;
+import org.apache.servicemix.common.ServiceUnit;
+
+import junit.framework.TestCase;
+
+public class XBeanDeployerTest extends TestCase {
+
+    protected void setUp() throws Exception {
+        
+    }
+    
+    protected void tearDown() throws Exception {
+        
+    }
+    
+    public void testDeployWithProperties() throws Exception {
+        MyXBeanDeployer deployer = new MyXBeanDeployer(new BaseComponent() { });
+        ServiceUnit su = deployer.deploy("xbean", getServiceUnitPath("xbean"));
+        assertNotNull(su);
+        assertEquals(1, su.getEndpoints().size());
+        XBeanEndpoint ep = (XBeanEndpoint) su.getEndpoints().iterator().next();
+        assertEquals("value", ep.getProp());
+    }
+    
+    public static class MyXBeanDeployer extends AbstractXBeanDeployer {
+
+        public MyXBeanDeployer(BaseComponent component) {
+            super(component);
+        }
+        
+    }
+    
+    protected String getServiceUnitPath(String name) {
+        URL url = getClass().getClassLoader().getResource(name + "/xbean.xml");
+        File path = new File(url.getFile());
+        path = path.getParentFile();
+        return path.getAbsolutePath();
+    }
+}

Added: incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanEndpoint.java?rev=430433&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanEndpoint.java
(added)
+++ incubator/servicemix/trunk/servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanEndpoint.java
Thu Aug 10 09:37:41 2006
@@ -0,0 +1,40 @@
+package org.apache.servicemix.common.xbean;
+
+import javax.jbi.messaging.MessageExchange.Role;
+
+import org.apache.servicemix.common.Endpoint;
+import org.apache.servicemix.common.ExchangeProcessor;
+
+public class XBeanEndpoint extends Endpoint {
+
+    private String prop;
+    
+    /**
+     * @return the prop
+     */
+    public String getProp() {
+        return prop;
+    }
+
+    /**
+     * @param prop the prop to set
+     */
+    public void setProp(String prop) {
+        this.prop = prop;
+    }
+
+    public void activate() throws Exception {
+    }
+
+    public void deactivate() throws Exception {
+    }
+
+    public ExchangeProcessor getProcessor() {
+        return null;
+    }
+
+    public Role getRole() {
+        return null;
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.properties
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.properties?rev=430433&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.properties
(added)
+++ incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.properties
Thu Aug 10 09:37:41 2006
@@ -0,0 +1 @@
+prop = value

Added: incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.xml?rev=430433&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.xml (added)
+++ incubator/servicemix/trunk/servicemix-common/src/test/resources/xbean/xbean.xml Thu Aug
10 09:37:41 2006
@@ -0,0 +1,9 @@
+<beans>
+
+  <bean class="org.apache.servicemix.common.xbean.XBeanEndpoint">
+    <property name="service" value="service"/>
+    <property name="endpoint" value="endpoint" />
+    <property name="prop" value="${prop}" />
+  </bean>
+
+</beans>
\ No newline at end of file



Mime
View raw message