You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/04/19 20:10:58 UTC
svn commit: r530505 - in /incubator/tuscany/java/sca/itest/properties/src:
main/java/org/apache/tuscany/sca/itest/ main/resources/
test/java/org/apache/tuscany/sca/itest/
Author: svkrish
Date: Thu Apr 19 11:10:56 2007
New Revision: 530505
URL: http://svn.apache.org/viewvc?view=rev&rev=530505
Log:
Included Test case for Property Overriding in Nested composite impl.
Added:
incubator/tuscany/java/sca/itest/properties/src/main/resources/OuterPropertyTest.composite
incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
Modified:
incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite
Modified: incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java?view=diff&rev=530505&r1=530504&r2=530505
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java (original)
+++ incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java Thu Apr 19 11:10:56 2007
@@ -21,6 +21,8 @@
import java.util.Collection;
+import org.osoa.sca.annotations.Remotable;
+@Remotable
public interface ABComponent {
String getA();
Added: incubator/tuscany/java/sca/itest/properties/src/main/resources/OuterPropertyTest.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/resources/OuterPropertyTest.composite?view=auto&rev=530505
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/resources/OuterPropertyTest.composite (added)
+++ incubator/tuscany/java/sca/itest/properties/src/main/resources/OuterPropertyTest.composite Thu Apr 19 11:10:56 2007
@@ -0,0 +1,41 @@
+<?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
+ * 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"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="OuterPropertyTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="OuterComponent">
+ <implementation.composite name="foo:PropertyTest"/>
+ <property name="number">125</property>
+ <property name="complex" type="foo:MyComplexType">
+ <foo:MyComplexValue xsi:type="foo:MyComplexType" >
+ <foo:a>Overriden A</foo:a>
+ <foo:b>Overriden B</foo:b>
+ <foo:c>Overriden C</foo:c>
+ <foo:d>Overriden D</foo:d>
+ <foo:x>
+ <foo:y>Overriden Y</foo:y>
+ <foo:z>Overriden Z</foo:z>
+ </foo:x>
+ </foo:MyComplexValue>
+ </property>
+ </component>
+</composite>
+
Modified: incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite?view=diff&rev=530505&r1=530504&r2=530505
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite (original)
+++ incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite Thu Apr 19 11:10:56 2007
@@ -18,7 +18,12 @@
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:foo="http://foo"
+ targetNamespace="http://foo"
name="PropertyTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="ProperterTestService" promote="ABComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.ABComponent"/>
+ </service>
<property name="number" type="xsd:int">1</property>
<property name="complex" type="foo:MyComplexType" >
Added: incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java?view=auto&rev=530505
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java (added)
+++ incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java Thu Apr 19 11:10:56 2007
@@ -0,0 +1,97 @@
+/*
+ * 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 org.apache.tuscany.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.host.embedded.SCARuntime;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.ServiceReference;
+
+public class OuterPropertyTestCase {
+ private static ABComponent outerABService;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ SCARuntime.start("OuterPropertyTest.composite");
+ //outerABService = CurrentCompositeContext.getContext().locateService(ABComponent.class, "OuterComponent/ABComponent");
+
+ ComponentContext context = SCARuntime.getComponentContext("OuterComponent/ABComponent");
+ ServiceReference<ABComponent> service = context.createSelfReference(ABComponent.class);
+ outerABService = service.getService();
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ SCARuntime.stop();
+ }
+
+ @Test
+ public void testOverridenA() {
+ assertEquals("Overriden A", outerABService.getA());
+ }
+
+ @Test
+ public void testOverridenB() {
+ assertEquals("Overriden B", outerABService.getB());
+ }
+
+ @Test
+ public void testOverridenF() {
+ assertEquals("Overriden A", outerABService.getF());
+ }
+
+ @Test
+ public void testOverridenZ() {
+ assertEquals("Overriden Z", outerABService.getZ());
+ }
+
+ @Test
+ public void testOverridenIntValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ @Test
+ public void testDefaultValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = outerABService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ @Test
+ public void testManySimpleIntegerValues() {
+ Iterator<Integer> iterator = outerABService.getManyIntegers().iterator();
+ assertEquals(123, iterator.next().intValue());
+ assertEquals(456, iterator.next().intValue());
+ assertEquals(789, iterator.next().intValue());
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org