Commit in servicemix/base/src/test on MAIN
resources/org/servicemix/jbi/deployment/SharedLibrary.xml+20added 1.1
java/org/servicemix/jbi/deployment/SharedLibraryTest.java+77added 1.1
+97
2 added files
added (failing) test case for Shared Library descriptor

servicemix/base/src/test/resources/org/servicemix/jbi/deployment
SharedLibrary.xml added at 1.1
diff -N SharedLibrary.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SharedLibrary.xml	19 Aug 2005 12:54:21 -0000	1.1
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!-- jbi.xml file for a sample shared library. -->
+<jbi
+    version="1.0"
+    xmlns="http://java.sun.com/xml/ns/jbi"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/jbi ./jbi.xsd">
+
+<!-- identification information about this shared library-->
+    <shared-library>
+        <identification>
+            <name>TestSharedLibrary</name>
+            <description>This is a test shared library.</description>
+        </identification>
+        <shared-library-class-path>
+            <path-element>.</path-element>
+            <path-element>test.jar</path-element>
+         </shared-library-class-path>
+    </shared-library>
+</jbi>

servicemix/base/src/test/java/org/servicemix/jbi/deployment
SharedLibraryTest.java added at 1.1
diff -N SharedLibraryTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SharedLibraryTest.java	19 Aug 2005 12:54:21 -0000	1.1
@@ -0,0 +1,77 @@
+/** 
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * Licensed 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.servicemix.jbi.deployment;
+
+import junit.framework.TestCase;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.servicemix.jbi.config.DebugClassPathXmlApplicationContext;
+import org.servicemix.jbi.jaxp.SourceTransformer;
+import org.w3c.dom.DocumentFragment;
+
+import javax.xml.transform.dom.DOMSource;
+import java.util.Arrays;
+import java.io.IOException;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class SharedLibraryTest extends TestCase {
+
+    protected AbstractXmlApplicationContext context;
+    protected SourceTransformer transformer = new SourceTransformer();
+
+    public void testParse() throws Exception {
+
+        // lets force the JBI container to be constructed first
+        Descriptor root = (Descriptor) context.getBean("jbi");
+        assertNotNull("JBI Container not found in spring!", root);
+
+        SharedLibrary sl = root.getSharedLibrary();
+        Identification identification = sl.getIdentification();
+        assertEquals("getName", "TestSharedLibrary", identification.getName());
+        assertEquals("getDescription", "This is a test shared library.", identification.getDescription());
+        
+    }
+
+    protected String toString(Object[] objects) {
+        if (objects == null) {
+            return "null Object[]";
+        }
+        StringBuffer buffer = new StringBuffer("[");
+        for (int i = 0; i < objects.length; i++) {
+            Object object = objects[i];
+            if (i > 0) {
+                buffer.append(", ");
+            }
+            buffer.append(object);
+        }
+        buffer.append("]");
+        return buffer.toString();
+    }
+
+    protected void setUp() throws Exception {
+        context = createBeanFactory();
+        context.setXmlValidating(false);
+    }
+
+    protected AbstractXmlApplicationContext createBeanFactory() throws Exception {
+        return new DebugClassPathXmlApplicationContext("org/servicemix/jbi/deployment/SharedLibrary.xml");
+    }
+
+}
CVSspam 0.2.8



Reply via email to