summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-06-04 14:23:04 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-06-04 14:23:04 +0000
commit04b98608b95a8effd457576caeadae02f9f59f0d (patch)
treec9768d221ff67f7c37bf7f62230ef6cf42d99398 /sca-java-2.x/trunk/modules
parent37c624ca7d7bd356aca8e3aabd5103a1c8cf274f (diff)
Add testcase to add a Deployer Composite as a deployment composite
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@951416 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java17
-rw-r--r--sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java15
-rw-r--r--sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite29
3 files changed, 50 insertions, 11 deletions
diff --git a/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java b/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
index c8486d3056..d5357bec60 100644
--- a/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
+++ b/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
@@ -168,12 +168,19 @@ public class Section10Impl implements Section10 {
// TODO Auto-generated method stub
// is this just removeContribution/installContribution?
}
+ public void updateContribution(Contribution contribution) {
+ // TODO Auto-generated method stub
+ }
public String updateDeploymentComposite(String uri, Reader compositeXML) {
// TODO Auto-generated method stub
// is this removeFromDomainLevelComposite/addDeploymentComposite
return null;
}
+ public String updateDeploymentComposite(String uri, Composite composite) {
+ // TODO Auto-generated method stub
+ return null;
+ }
public void shutdown() throws ActivationException {
for (String uri : installedContributions.keySet()) {
@@ -252,14 +259,4 @@ public class Section10Impl implements Section10 {
public Deployer getDeployer() {
return deployer;
}
-
- public void updateContribution(Contribution contribution) {
- // TODO Auto-generated method stub
-
- }
-
- public String updateDeploymentComposite(String uri, Composite composite) {
- // TODO Auto-generated method stub
- return null;
- }
}
diff --git a/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java b/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java
index 33e999b0b4..9cac4a1e28 100644
--- a/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java
+++ b/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java
@@ -23,8 +23,12 @@ import java.net.MalformedURLException;
import java.net.URI;
import java.util.List;
+import javax.xml.stream.XMLStreamException;
+
import junit.framework.Assert;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Artifact;
import org.apache.tuscany.sca.contribution.Contribution;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.deployment.Deployer;
@@ -53,11 +57,20 @@ public class DeployerTestCase {
}
@Test
- public void testAddDeploymentComposite() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException {
+ public void testAddDeploymentComposite() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException, XMLStreamException {
Section10 section10 = Section10Factory.createSection10();
+ section10.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, true);
+
Deployer deployer = section10.getDeployer();
Monitor monitor = deployer.createMonitor();
+ Composite composite = deployer.loadXMLDocument(new File("src/test/resources/helloworld2.composite").toURI().toURL(), monitor);
+ monitor.analyzeProblems();
+ composite.setURI("helloworld2.composite");
+ section10.addDeploymentComposite("foo", composite);
+ List<String> dcs = section10.getDeployedCompostes("foo");
+ Assert.assertEquals(1, dcs.size());
+ Assert.assertEquals("foo/helloworld2.composite", dcs.get(0));
}
}
diff --git a/sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite b/sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite
new file mode 100644
index 0000000000..8c7a789380
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite
@@ -0,0 +1,29 @@
+<?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.
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://sample"
+ name="helloworld2">
+
+ <component name="Helloworld2Component">
+ <implementation.java class="sample.HelloworldImpl"/>
+ </component>
+
+</composite>