You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2009/03/17 00:55:30 UTC

svn commit: r755052 - in /tuscany/java/sca/modules/implementation-osgi-runtime/src/test: java/calculator/dosgi/test/ java/org/apache/tuscany/sca/implementation/osgi/test/ resources/OSGI-INF/sca/ resources/calculator/dosgi/ resources/calculator/dosgi/ME...

Author: rfeng
Date: Mon Mar 16 23:55:29 2009
New Revision: 755052

URL: http://svn.apache.org/viewvc?rev=755052&view=rev
Log:
Adjust the generated test bundles

Added:
    tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType
    tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType
Removed:
    tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/sca/
Modified:
    tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java
    tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java
    tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
    tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF

Modified: tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java?rev=755052&r1=755051&r2=755052&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java (original)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java Mon Mar 16 23:55:29 2009
@@ -89,33 +89,41 @@
 
             bundles.add(OSGiTestBundles.createBundle("target/test-classes/calculator-bundle.jar",
                                                      "calculator/dosgi/META-INF/MANIFEST.MF",
-                                                     new String[] {"OSGI-INF/calculator-component.xml",
-                                                                   "OSGI-INF/sca/bundle.componentType",
-                                                                   "calculator/dosgi/calculator.composite"},
+                                                     new String[][] {
+                                                                     {"OSGI-INF/calculator-component.xml", null},
+                                                                     {"calculator/dosgi/bundle.componentType",
+                                                                      "OSGI-INF/sca/bundle.componentType"},
+                                                                     {"calculator/dosgi/calculator.composite",
+                                                                      "OSGI-INF/sca/bundle.composite"}},
                                                      CalculatorService.class,
                                                      CalculatorServiceImpl.class,
                                                      CalculatorServiceDSImpl.class,
                                                      CalculatorActivator.class));
 
-            bundles.add(OSGiTestBundles.createBundle("target/test-classes/operations-bundle.jar",
-                                                     "calculator/dosgi/operations/META-INF/MANIFEST.MF",
-                                                     new String[] {"OSGI-INF/add-component.xml",
-                                                                   "OSGI-INF/subtract-component.xml",
-                                                                   "OSGI-INF/multiply-component.xml",
-                                                                   "OSGI-INF/divide-component.xml",
-                                                                   "calculator/dosgi/operations/operations.composite"},
-                                                     OperationsActivator.class,
-                                                     AddService.class,
-                                                     AddServiceImpl.class,
-                                                     SubtractService.class,
-                                                     SubtractServiceImpl.class,
-                                                     MultiplyService.class,
-                                                     MultiplyServiceImpl.class,
-                                                     DivideService.class,
-                                                     DivideServiceImpl.class));
+            bundles.add(OSGiTestBundles
+                .createBundle("target/test-classes/operations-bundle.jar",
+                              "calculator/dosgi/operations/META-INF/MANIFEST.MF",
+                              new String[][] {
+                                              {"OSGI-INF/add-component.xml", null},
+                                              {"OSGI-INF/subtract-component.xml", null},
+                                              {"OSGI-INF/multiply-component.xml", null},
+                                              {"OSGI-INF/divide-component.xml", null},
+                                              {"calculator/dosgi/operations/bundle.componentType",
+                                               "OSGI-INF/sca/bundle.componentType"},
+                                              {"calculator/dosgi/operations/operations.composite",
+                                               "OSGI-INF/sca/bundle.composite"}},
+                              OperationsActivator.class,
+                              AddService.class,
+                              AddServiceImpl.class,
+                              SubtractService.class,
+                              SubtractServiceImpl.class,
+                              MultiplyService.class,
+                              MultiplyServiceImpl.class,
+                              DivideService.class,
+                              DivideServiceImpl.class));
             host = new EquinoxHost();
             BundleContext context = host.start();
-            for(URL loc: bundles) {
+            for (URL loc : bundles) {
                 host.installBundle(loc, null);
             }
             for (Bundle b : context.getBundles()) {

Modified: tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java?rev=755052&r1=755051&r2=755052&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java (original)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java Mon Mar 16 23:55:29 2009
@@ -72,27 +72,38 @@
 
         bundles.add(OSGiTestBundles.createBundle("target/test-classes/calculator-bundle.jar",
                                                  "calculator/dosgi/META-INF/MANIFEST.MF",
-                                                 new String[] {"OSGI-INF/calculator-component.xml"},
+                                                 new String[][] {
+                                                                 {"OSGI-INF/calculator-component.xml", null},
+                                                                 {"calculator/dosgi/bundle.componentType",
+                                                                  "OSGI-INF/sca/bundle.componentType"},
+                                                                 {"calculator/dosgi/calculator.composite",
+                                                                  "OSGI-INF/sca/bundle.composite"}},
                                                  CalculatorService.class,
                                                  CalculatorServiceImpl.class,
                                                  CalculatorServiceDSImpl.class,
                                                  CalculatorActivator.class));
 
-        bundles.add(OSGiTestBundles.createBundle("target/test-classes/operations-bundle.jar",
-                                                 "calculator/dosgi/operations/META-INF/MANIFEST.MF",
-                                                 new String[] {"OSGI-INF/add-component.xml",
-                                                               "OSGI-INF/subtract-component.xml",
-                                                               "OSGI-INF/multiply-component.xml",
-                                                               "OSGI-INF/divide-component.xml"},
-                                                 OperationsActivator.class,
-                                                 AddService.class,
-                                                 AddServiceImpl.class,
-                                                 SubtractService.class,
-                                                 SubtractServiceImpl.class,
-                                                 MultiplyService.class,
-                                                 MultiplyServiceImpl.class,
-                                                 DivideService.class,
-                                                 DivideServiceImpl.class));
+        bundles.add(OSGiTestBundles
+            .createBundle("target/test-classes/operations-bundle.jar",
+                          "calculator/dosgi/operations/META-INF/MANIFEST.MF",
+                          new String[][] {
+                                          {"OSGI-INF/add-component.xml", null},
+                                          {"OSGI-INF/subtract-component.xml", null},
+                                          {"OSGI-INF/multiply-component.xml", null},
+                                          {"OSGI-INF/divide-component.xml", null},
+                                          {"calculator/dosgi/operations/bundle.componentType",
+                                           "OSGI-INF/sca/bundle.componentType"},
+                                          {"calculator/dosgi/operations/operations.composite",
+                                           "OSGI-INF/sca/bundle.composite"}},
+                          OperationsActivator.class,
+                          AddService.class,
+                          AddServiceImpl.class,
+                          SubtractService.class,
+                          SubtractServiceImpl.class,
+                          MultiplyService.class,
+                          MultiplyServiceImpl.class,
+                          DivideService.class,
+                          DivideServiceImpl.class));
         try {
             host = new EquinoxHost(bundles);
             BundleContext context = host.start();
@@ -179,7 +190,7 @@
         if ((s & Bundle.ACTIVE) != 0) {
             sb.append(" ACTIVE");
         }
-    
+
         if (verbose) {
             sb.append(" ").append(bundle.getLocation());
             sb.append(" ").append(bundle.getHeaders());

Modified: tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java?rev=755052&r1=755051&r2=755052&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java (original)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java Mon Mar 16 23:55:29 2009
@@ -49,7 +49,7 @@
         return index == -1 ? "" : name.substring(0, index);
     }
 
-    public static URL createBundle(String jarName, String mfFile, String[] resources, Class<?>... classes)
+    public static URL createBundle(String jarName, String mfFile, String[][] resources, Class<?>... classes)
         throws IOException {
         InputStream is = OSGiTestBundles.class.getClassLoader().getResourceAsStream(mfFile);
         Manifest manifest = new Manifest(is);
@@ -63,8 +63,8 @@
         }
 
         if (resources != null) {
-            for (String resource : resources) {
-                addResource(jarOut, OSGiTestBundles.class.getClassLoader(), resource);
+            for (String resource[] : resources) {
+                addResource(jarOut, OSGiTestBundles.class.getClassLoader(), resource[0], resource[1]);
             }
         }
 
@@ -137,7 +137,7 @@
 
         if (resources != null) {
             for (String resource : resources) {
-                addResource(jarOut, OSGiTestBundles.class.getClassLoader(), resource);
+                addResource(jarOut, OSGiTestBundles.class.getClassLoader(), resource, null);
             }
         }
 
@@ -158,10 +158,13 @@
         addEntry(jarOut, url, classFile);
     }
 
-    private static void addResource(JarOutputStream jarOut, ClassLoader cl, String resourceName) throws IOException,
-        FileNotFoundException {
+    private static void addResource(JarOutputStream jarOut, ClassLoader cl, String resourceName, String entryName)
+        throws IOException, FileNotFoundException {
         URL url = cl.getResource(resourceName);
-        addEntry(jarOut, url, resourceName);
+        if (entryName == null) {
+            entryName = resourceName;
+        }
+        addEntry(jarOut, url, entryName);
     }
 
     private static void addEntry(JarOutputStream jarOut, URL url, String resourceName) throws IOException,

Modified: tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF?rev=755052&r1=755051&r2=755052&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF Mon Mar 16 23:55:29 2009
@@ -16,4 +16,4 @@
 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
 Bundle-DocURL: http://www.apache.org/
 Service-Component: OSGI-INF/calculator-component.xml
-SCA-Composite: calculator/dosgi/calculator.composite
+

Added: tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType?rev=755052&view=auto
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType (added)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType Mon Mar 16 23:55:29 2009
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" 
+               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+               xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1">
+    <!-- The service elment defines an SCA view of the OSGi service -->
+    <service name="Calculator">
+        <!-- The interface will be mapped into the OSGi service class -->
+        <interface.java interface="calculator.dosgi.CalculatorService"/>
+        <!-- The list of OSGi properties -->
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </service>
+    
+    <!-- The reference elment defines an SCA proxy to a remote OSGi service -->
+    <reference name="addService">
+        <interface.java interface="calculator.dosgi.operations.AddService"/>
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </reference>
+    <reference name="subtractService">
+        <interface.java interface="calculator.dosgi.operations.SubtractService"/>
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </reference>
+    <reference name="multiplyService">
+        <interface.java interface="calculator.dosgi.operations.MultiplyService"/>
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </reference>
+    <reference name="divideService">
+        <interface.java interface="calculator.dosgi.operations.DivideService"/>
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </reference>
+    
+</componentType>

Modified: tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF?rev=755052&r1=755051&r2=755052&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF Mon Mar 16 23:55:29 2009
@@ -17,4 +17,4 @@
  OSGI-INF/subtract-component.xml,
  OSGI-INF/multiply-component.xml,
  OSGI-INF/divide-component.xml
-SCA-Composite: calculator/dosgi/operations/operations.composite
+

Added: tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType?rev=755052&view=auto
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType (added)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType Mon Mar 16 23:55:29 2009
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" 
+               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+               xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1">
+
+    
+    <!-- The service elment defines an SCA proxy to a remote OSGi service -->
+    <service name="AddService">
+        <interface.java interface="calculator.dosgi.operations.AddService"/>
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </service>
+    <service name="SubtractService">
+        <interface.java interface="calculator.dosgi.operations.SubtractService"/>
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </service>
+    <service name="MultiplyService">
+        <interface.java interface="calculator.dosgi.operations.MultiplyService"/>
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </service>
+    <service name="DivideService">
+        <interface.java interface="calculator.dosgi.operations.DivideService"/>
+        <t:osgi.property name="prop1">1</t:osgi.property>
+        <t:osgi.property name="prop2">ABC</t:osgi.property>
+    </service>
+    
+</componentType>