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 2007/07/13 01:53:03 UTC

svn commit: r555821 - in /incubator/tuscany/java/sca/itest/recursive/src: main/java/test/ main/resources/ test/java/test/

Author: rfeng
Date: Thu Jul 12 16:53:02 2007
New Revision: 555821

URL: http://svn.apache.org/viewvc?view=rev&rev=555821
Log:
Add an itest to cover reference binding, promotion and multiplicity

Added:
    incubator/tuscany/java/sca/itest/recursive/src/main/java/test/
    incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Aggregator.java   (with props)
    incubator/tuscany/java/sca/itest/recursive/src/main/java/test/AggregatorImpl.java   (with props)
    incubator/tuscany/java/sca/itest/recursive/src/main/java/test/InnerSourceImpl.java   (with props)
    incubator/tuscany/java/sca/itest/recursive/src/main/java/test/OuterSourceImpl.java   (with props)
    incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Source.java   (with props)
    incubator/tuscany/java/sca/itest/recursive/src/main/resources/Inner.composite
    incubator/tuscany/java/sca/itest/recursive/src/main/resources/Outer.composite
    incubator/tuscany/java/sca/itest/recursive/src/test/java/test/
    incubator/tuscany/java/sca/itest/recursive/src/test/java/test/BindingsTestCase.java   (with props)

Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Aggregator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Aggregator.java?view=auto&rev=555821
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Aggregator.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Aggregator.java Thu Jul 12 16:53:02 2007
@@ -0,0 +1,27 @@
+/*
+ * 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 test;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Aggregator {
+    String getAggregatedData();
+}

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Aggregator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Aggregator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/AggregatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/test/AggregatorImpl.java?view=auto&rev=555821
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/test/AggregatorImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/test/AggregatorImpl.java Thu Jul 12 16:53:02 2007
@@ -0,0 +1,55 @@
+/*
+ * 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 test;
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Aggregator.class)
+public class AggregatorImpl implements Aggregator {
+
+    @Reference(name = "uniSource")
+    protected Source source;
+
+    @Reference(name = "multiSource")
+    protected List<Source> sources;
+
+    public String getAggregatedData() {
+        System.out.println("uniSource: " + source.getData());
+        StringBuffer sb = new StringBuffer();
+        int i = 0;
+        for (Source s : sources) {
+            if (i != 0) {
+                sb.append(", ");
+            } else {
+                sb.append("multiSource: ");
+            }
+            sb.append(s.getData());
+            i++;
+        }
+        return sb.toString();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/AggregatorImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/AggregatorImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/InnerSourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/test/InnerSourceImpl.java?view=auto&rev=555821
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/test/InnerSourceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/test/InnerSourceImpl.java Thu Jul 12 16:53:02 2007
@@ -0,0 +1,34 @@
+/*
+ * 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 test;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Source.class)
+public class InnerSourceImpl implements Source {
+
+    public String getData() {
+        return "InnerSource";
+    }
+
+}

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/InnerSourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/InnerSourceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/OuterSourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/test/OuterSourceImpl.java?view=auto&rev=555821
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/test/OuterSourceImpl.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/test/OuterSourceImpl.java Thu Jul 12 16:53:02 2007
@@ -0,0 +1,34 @@
+/*
+ * 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 test;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Source.class)
+public class OuterSourceImpl implements Source {
+
+    public String getData() {
+        return "OuterSource";
+    }
+
+}

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/OuterSourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/OuterSourceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Source.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Source.java?view=auto&rev=555821
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Source.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Source.java Thu Jul 12 16:53:02 2007
@@ -0,0 +1,30 @@
+/*
+ * 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 test;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Source {
+    String getData();
+}

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Source.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive/src/main/java/test/Source.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/Inner.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/Inner.composite?view=auto&rev=555821
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/Inner.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/Inner.composite Thu Jul 12 16:53:02 2007
@@ -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://test"
+    xmlns:sample="http://test"
+    name="Inner">
+
+    <component name="Aggregator">
+        <implementation.java class="test.AggregatorImpl"/>
+        <reference name="uniSource" target="InnerSource/Source"/>
+        <reference name="multiSource" target="InnerSource/Source"/>
+    </component>
+
+    <component name="InnerSource">
+        <implementation.java class="test.InnerSourceImpl"/>
+    </component>
+    
+    <reference name="uniSource" promote="Aggregator/uniSource">
+        <binding.sca/>
+    </reference>
+
+    <reference name="multiSource" promote="Aggregator/multiSource">
+        <binding.sca/>
+    </reference>
+    
+    <service name="aggregator" promote="Aggregator"/>
+    
+</composite>

Added: incubator/tuscany/java/sca/itest/recursive/src/main/resources/Outer.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/Outer.composite?view=auto&rev=555821
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/Outer.composite (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/Outer.composite Thu Jul 12 16:53:02 2007
@@ -0,0 +1,39 @@
+<?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://test"
+    xmlns:test="http://test"
+    name="Outer">
+
+    <component name="OuterSource">
+        <implementation.java class="test.OuterSourceImpl"/>
+    </component>
+
+    <component name="Inner">
+        <!-- Implemented by Composite3 -->
+        <implementation.composite name="test:Inner"/>
+        
+        <reference name="uniSource" target="OuterSource"/>
+        
+        <reference name="multiSource" target="OuterSource"/>
+
+    </component>
+    
+</composite>

Added: incubator/tuscany/java/sca/itest/recursive/src/test/java/test/BindingsTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/test/BindingsTestCase.java?view=auto&rev=555821
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/test/BindingsTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/test/BindingsTestCase.java Thu Jul 12 16:53:02 2007
@@ -0,0 +1,49 @@
+/*
+ * 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 test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class BindingsTestCase extends TestCase {
+
+    private SCADomain domain;
+    private Aggregator aggregator;
+
+    protected void setUp() throws Exception {
+        domain = SCADomain.newInstance("Outer.composite");
+        aggregator = domain.getService(Aggregator.class, "Inner");
+    }
+
+    protected void tearDown() throws Exception {
+        domain.close();
+    }
+
+    public void test() throws Exception {
+        try {
+            String result = aggregator.getAggregatedData();
+            assertTrue(result.contains("InnerSource"));
+            assertTrue(result.contains("OuterSource"));
+            System.out.println(result);
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
+    }
+}

Propchange: incubator/tuscany/java/sca/itest/recursive/src/test/java/test/BindingsTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/itest/recursive/src/test/java/test/BindingsTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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