summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java48
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java45
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java17
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF2
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType (renamed from java/sca/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/sca/bundle.componentType)0
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF2
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType47
7 files changed, 115 insertions, 46 deletions
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java b/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java
index 04341bcd3f..b04a08f2f5 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java
+++ b/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiNodeTestCase.java
@@ -89,33 +89,41 @@ public class CalculatorOSGiNodeTestCase {
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()) {
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java b/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java
index d3d67d72b8..8f9162c749 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java
+++ b/java/sca/modules/implementation-osgi-runtime/src/test/java/calculator/dosgi/test/CalculatorOSGiTestCase.java
@@ -72,27 +72,38 @@ public class CalculatorOSGiTestCase {
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 @@ public class CalculatorOSGiTestCase {
if ((s & Bundle.ACTIVE) != 0) {
sb.append(" ACTIVE");
}
-
+
if (verbose) {
sb.append(" ").append(bundle.getLocation());
sb.append(" ").append(bundle.getHeaders());
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java b/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
index 6d55f6b7ec..aad5772037 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
+++ b/java/sca/modules/implementation-osgi-runtime/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
@@ -49,7 +49,7 @@ public class OSGiTestBundles {
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 @@ public class OSGiTestBundles {
}
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 @@ public class OSGiTestBundles {
if (resources != null) {
for (String resource : resources) {
- addResource(jarOut, OSGiTestBundles.class.getClassLoader(), resource);
+ addResource(jarOut, OSGiTestBundles.class.getClassLoader(), resource, null);
}
}
@@ -158,10 +158,13 @@ public class OSGiTestBundles {
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,
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF
index 5973372d7c..5a4db21087 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF
+++ b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/META-INF/MANIFEST.MF
@@ -16,4 +16,4 @@ Eclipse-LazyStart: true
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
+
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/sca/bundle.componentType b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType
index 7860094626..7860094626 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/test/resources/OSGI-INF/sca/bundle.componentType
+++ b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/bundle.componentType
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF
index d353e7edb6..eb15e778b1 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF
+++ b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/META-INF/MANIFEST.MF
@@ -17,4 +17,4 @@ Service-Component: OSGI-INF/add-component.xml,
OSGI-INF/subtract-component.xml,
OSGI-INF/multiply-component.xml,
OSGI-INF/divide-component.xml
-SCA-Composite: calculator/dosgi/operations/operations.composite
+
diff --git a/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType
new file mode 100644
index 0000000000..6f6f4bdce6
--- /dev/null
+++ b/java/sca/modules/implementation-osgi-runtime/src/test/resources/calculator/dosgi/operations/bundle.componentType
@@ -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>