tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcombell...@apache.org
Subject svn commit: r618447 - in /incubator/tuscany/java/sca/itest/recursive/src: main/resources/ test/java/sample/
Date Mon, 04 Feb 2008 21:30:45 GMT
Author: mcombellack
Date: Mon Feb  4 13:30:42 2008
New Revision: 618447

URL: http://svn.apache.org/viewvc?rev=618447&view=rev
Log:
TUSCANY-2027 Added itest for a implementation.composite referring to an implementation.composite
with promoted references

Added:
    incubator/tuscany/java/sca/itest/recursive/src/main/resources/AComposite.composite
    incubator/tuscany/java/sca/itest/recursive/src/main/resources/BComposite.composite
    incubator/tuscany/java/sca/itest/recursive/src/main/resources/CComposite.composite
    incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/C.java
    incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/CImpl.java
    incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/NestedTestCase.java
    incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/X.java
    incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/XImpl.java
    incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/Y.java
    incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/YImpl.java

Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/AComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/AComposite.composite?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/AComposite.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/AComposite.composite Mon
Feb  4 13:30:42 2008
@@ -0,0 +1,30 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+    targetNamespace="http://sample"
+    xmlns:sample="http://sample"
+    name="AComposite">
+
+    <component name="AComponent">
+        <implementation.composite name="sample:BComposite"/>
+    </component>
+
+</composite>
+

Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/BComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/BComposite.composite?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/BComposite.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/BComposite.composite Mon
Feb  4 13:30:42 2008
@@ -0,0 +1,45 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+    targetNamespace="http://sample"
+    xmlns:sample="http://sample"
+    name="BComposite">
+
+    <service name="BService" promote="BComponent">
+        <interface.java interface="sample.C"/>
+    </service>
+
+    <component name="BComponent">
+        <implementation.composite name="sample:CComposite"/>
+
+        <reference name="PromotedRefX" target="XComponent"/>
+        <reference name="PromotedRefY" target="YComponent"/>
+    </component>
+
+    <component name="XComponent">
+		<implementation.java class="sample.XImpl"/>
+    </component>
+
+    <component name="YComponent">
+        <implementation.java class="sample.YImpl"/>
+    </component>
+
+</composite>
+

Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/CComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/CComposite.composite?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/CComposite.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/CComposite.composite Mon
Feb  4 13:30:42 2008
@@ -0,0 +1,44 @@
+<?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://www.osoa.org/xmlns/sca/1.0"
+    targetNamespace="http://sample"
+    xmlns:sample="http://sample"
+    name="CComposite">
+
+    <service name="CService" promote="CComponent">
+        <interface.java interface="sample.C"/>
+    </service>
+
+    <reference name="PromotedRefX" promote="CComponent/refX">
+        <interface.java interface="sample.X"/>
+    </reference>
+
+    <reference name="PromotedRefY" promote="CComponent/refY">
+        <interface.java interface="sample.Y"/>
+    </reference>
+
+    <component name="CComponent">
+        <implementation.java class="sample.CImpl"/>
+        <reference name="refX"/>
+        <reference name="refY"/>
+    </component>
+
+</composite>
+

Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/C.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/C.java?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/C.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/C.java Mon Feb  4 13:30:42
2008
@@ -0,0 +1,32 @@
+/*
+ * 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.    
+ */
+package sample;
+
+/**
+ * Simple Service
+ */
+public interface C {
+
+    /**
+     * Sample operation
+     * 
+     * @return A String
+     */
+    String cOp();
+}

Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/CImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/CImpl.java?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/CImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/CImpl.java Mon Feb  4
13:30:42 2008
@@ -0,0 +1,80 @@
+/*
+ * 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.    
+ */
+package sample;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a simple service
+ */
+@Service(C.class)
+public class CImpl implements C {
+
+    /**
+     * Reference to X
+     */
+    private X xRef;
+    
+    /**
+     * Reference to Y
+     */
+    private Y yRef;
+
+    /**
+     * Setter for refX
+     * 
+     * @param x Reference to X
+     */
+    @Reference(name="refX")
+    protected void setX(X x)
+    {
+        System.out.println("Setting X on CImpl to " + x);
+        xRef = x;
+    }
+    
+    /**
+     * Setter for refY
+     * 
+     * @param y Reference to Y
+     */
+    @Reference(name="refY")
+    protected void setY(Y y)
+    {
+        System.out.println("Setting Y on CImpl to " + y);
+        yRef = y;
+    }
+    
+    /**
+     * Simple operation that uses the injected references to X and Y
+     * 
+     * @return "C:cOp() - xResult = " + xRef.xOP() + " yResult = " + yRef.yOp();
+     */
+    public String cOp() {
+        Assert.assertNotNull(xRef);
+        Assert.assertNotNull(yRef);
+        
+        String xResult = xRef.xOp();
+        String yResult = yRef.yOp();
+        
+        return "C:cOp() - xResult = " + xResult + " yResult = " + yResult;
+    }
+}

Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/NestedTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/NestedTestCase.java?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/NestedTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/NestedTestCase.java Mon
Feb  4 13:30:42 2008
@@ -0,0 +1,96 @@
+/*
+ * 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.    
+ */
+package sample;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+/**
+ * Test for implementation.composite using implementation.composite
+ */
+public class NestedTestCase extends TestCase {
+
+    /**
+     * Reference to the domain
+     */
+    private SCADomain domain; 
+
+    /**
+     * Tear down the domain
+     */
+    @Override
+    protected void tearDown() throws Exception {
+        if (domain != null) {
+            domain.close();
+        }
+    }
+
+    /**
+     * This tests having:
+     * 
+     *   AComponent -> implementation.composite(BComposite)
+     *   BComposite -> implementation.composite(CComposite)
+     *   
+     * This test fails.
+     * 
+     * @throws Exception Failed
+     */
+    public void testAComponent() throws Exception {
+        domain = SCADomain.newInstance("AComposite.composite");
+        
+        System.out.println("Deployed names = " + domain.getComponentManager().getComponentNames());
+        
+        C c = domain.getService(C.class, "AComponent");
+
+        String result = c.cOp();
+        System.out.println("Method call returned [" + result + "]");
+        Assert.assertNotNull(result);
+        Assert.assertTrue(result.indexOf("C:cOp()") != -1);
+        Assert.assertTrue(result.indexOf("X:xOp()") != -1);
+        Assert.assertTrue(result.indexOf("Y:yOp()") != -1);
+    }
+
+
+    /**
+     * This tests having:
+     * 
+     *   BComposite -> implementation.composite(CComposite)
+     * 
+     * This test works.
+     * 
+     * @throws Exception Failed
+     */
+    public void testBComponent() throws Exception {
+        domain = SCADomain.newInstance("BComposite.composite");
+        
+        System.out.println("Deployed names = " + domain.getComponentManager().getComponentNames());
+          
+        C c = domain.getService(C.class, "BComponent");
+        
+        String result = c.cOp();
+        System.out.println("Method call returned [" + result + "]");
+        Assert.assertNotNull(result);
+        Assert.assertTrue(result.indexOf("C:cOp()") != -1);
+        Assert.assertTrue(result.indexOf("X:xOp()") != -1);
+        Assert.assertTrue(result.indexOf("Y:yOp()") != -1);
+    }
+}

Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/X.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/X.java?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/X.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/X.java Mon Feb  4 13:30:42
2008
@@ -0,0 +1,32 @@
+/*
+ * 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.    
+ */
+package sample;
+
+/**
+ * Simple Service
+ */
+public interface X {
+
+    /**
+     * Simple Operation
+     * 
+     * @return A String
+     */
+    String xOp();
+}

Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/XImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/XImpl.java?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/XImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/XImpl.java Mon Feb  4
13:30:42 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.    
+ */
+package sample;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a simple service
+ */
+@Service(X.class)
+public class XImpl implements X {
+
+    /**
+     * Simple operation
+     * 
+     * @return "X:xOp()"
+     */
+    public String xOp() {
+        return "X:xOp()";
+    }
+}

Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/Y.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/Y.java?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/Y.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/Y.java Mon Feb  4 13:30:42
2008
@@ -0,0 +1,32 @@
+/*
+ * 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.    
+ */
+package sample;
+
+/**
+ * Simple Service
+ */
+public interface Y {
+
+    /**
+     * Simple Operation
+     * 
+     * @return A String
+     */
+    String yOp();
+}

Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/YImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/YImpl.java?rev=618447&view=auto
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/YImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/sample/YImpl.java Mon Feb  4
13:30:42 2008
@@ -0,0 +1,38 @@
+/*
+ * 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.    
+ */
+package sample;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a Simple Service
+ */
+@Service(Y.class)
+public class YImpl implements Y {
+
+    /**
+     * A simple operation
+     * 
+     * @return "Y:yOp()"
+     */
+    public String yOp() {
+        return "Y:yOp()";
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message