tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r951416 - in /tuscany/sca-java-2.x/trunk/modules/domain/src: main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java test/java/org/apache/tuscany/sca/something/DeployerTestCase.java test/resources/helloworld2.composite
Date Fri, 04 Jun 2010 14:23:04 GMT
Author: antelder
Date: Fri Jun  4 14:23:04 2010
New Revision: 951416

URL: http://svn.apache.org/viewvc?rev=951416&view=rev
Log:
Add testcase to add a Deployer Composite as a deployment composite

Added:
    tuscany/sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite
Modified:
    tuscany/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
    tuscany/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java?rev=951416&r1=951415&r2=951416&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain/src/main/java/org/apache/tuscany/sca/something/impl/Section10Impl.java
Fri Jun  4 14:23:04 2010
@@ -168,12 +168,19 @@ public class Section10Impl implements Se
         // 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 Se
     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;
-    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java?rev=951416&r1=951415&r2=951416&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain/src/test/java/org/apache/tuscany/sca/something/DeployerTestCase.java
Fri Jun  4 14:23:04 2010
@@ -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));
     }
 
 }

Added: tuscany/sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite?rev=951416&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite (added)
+++ tuscany/sca-java-2.x/trunk/modules/domain/src/test/resources/helloworld2.composite Fri
Jun  4 14:23:04 2010
@@ -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>



Mime
View raw message