Added: 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java?view=auto&rev=475505
==============================================================================
--- 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java
 (added)
+++ 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java
 Wed Nov 15 16:25:59 2006
@@ -0,0 +1,79 @@
+/*
+ * 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.test.spec;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyTotalService;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import junit.framework.TestCase;
+
+public class CompositeServiceReferenceForRefOverrideTest extends TestCase {
+    private MyTotalService myService1;
+    private MyTotalService myService2;
+    private MyTotalService myService3;
+    private CompositeContext context;
+
+    public void testPropertyWithServiceFromReferenceNo() {
+        assertEquals("CARY", myService1.getLocation());
+        assertEquals("2007", myService1.getYear());
+    }
+
+    public void testPropertyWithServiceFromReferenceMay() {
+        assertEquals("CARY", myService2.getLocation());
+        assertEquals("2007", myService2.getYear());
+
+    }
+
+    public void testPropertyWithServiceFromReferenceMust() {
+        assertEquals("CARY", myService3.getLocation());
+        assertEquals("2007", myService3.getYear());
+    }
+
+    public void testServiceFromReferenceNo() {
+        System.out.println("nextHolday()" + myService1.nextHoliday());
+        System.out.println("nextHolday(Date)" + myService1.nextHoliday(new 
Date()));
+        System.out.println("myService1.getHolidays()[0]" + 
myService1.getHolidays()[0]);
+        System.out.println("myService1.getHolidays(2007)[0]" + 
myService1.getHolidays(2007)[0]);
+        assertNotSame(myService1.nextHoliday(), myService1.nextHoliday(new 
Date()));
+        assertEquals(myService1.getHolidays()[0], 
myService1.getHolidays(2007)[0]);
+    }
+
+    public void testServiceFromReferenceMay() {
+        assertEquals(myService2.getHolidays()[0], 
myService2.getHolidays(2007)[0]);
+        assertNotSame(myService2.nextHoliday(), myService2.nextHoliday(new 
Date()));
+
+    }
+
+    public void testServiceFromReferenceMust() {
+        assertEquals(myService3.getHolidays()[0], 
myService3.getHolidays(2007)[0]);
+        assertNotSame(myService3.nextHoliday(), myService3.nextHoliday(new 
Date()));
+
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        context = CurrentCompositeContext.getContext();
+        myService1 = context.locateService(MyTotalService.class, 
"MyTotalServiceNo");
+        myService2 = context.locateService(MyTotalService.class, 
"MyTotalServiceMay");
+        myService3 = context.locateService(MyTotalService.class, 
"MyTotalServiceMust");
+    }
+}

Added: 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java?view=auto&rev=475505
==============================================================================
--- 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java
 (added)
+++ 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java
 Wed Nov 15 16:25:59 2006
@@ -0,0 +1,91 @@
+/*
+ * 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.test.spec;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyTotalService;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import junit.framework.TestCase;
+
+public class CompositeServiceReferenceTest extends TestCase {
+    private MyTotalService myService1;
+    private MyTotalService myService2;
+    private MyTotalService myService3;
+    private MyTotalService myService4;
+    private MyTotalService myService5;
+    private CompositeContext context;
+
+    public void testPropertyWithServiceFromRecursive() {
+        assertEquals("CARY", myService1.getLocation());
+        assertEquals("2007", myService1.getYear());
+    }
+
+    public void testPropertyWithServiceInCompositeFromRecursive() {
+        assertEquals("CARY", myService2.getLocation());
+        assertEquals("2007", myService2.getYear());
+
+    }
+
+    public void testPropertyWithServiceInCompositeFromComponent() {
+        assertEquals("CARY", myService3.getLocation());
+        assertEquals("2007", myService3.getYear());
+    }
+
+    public void testServiceFromRecursive() {
+        assertNotSame(myService1.nextHoliday(), myService1.nextHoliday(new 
Date()));
+        assertEquals(myService1.getHolidays()[0], 
myService1.getHolidays(2007)[0]);
+
+    }
+
+    public void testServiceReferenceFromRecursive() {
+        assertEquals(myService2.getHolidays()[0], 
myService2.getHolidays(2007)[0]);
+        assertNotSame(myService2.nextHoliday(), myService2.nextHoliday(new 
Date()));
+
+    }
+
+    public void testServiceReferenceFromRecursiveUseService() {
+        assertNotSame(myService4.nextHoliday(), myService4.nextHoliday(new 
Date()));
+        assertEquals(myService4.getHolidays()[0], 
myService4.getHolidays(2007)[0]);
+    }
+
+    public void testServiceReferenceFromComponent() {
+        assertEquals(myService3.getHolidays()[0], 
myService3.getHolidays(2007)[0]);
+        assertNotSame(myService3.nextHoliday(), myService3.nextHoliday(new 
Date()));
+
+    }
+
+    public void testServiceReferenceFromComponentUseService() {
+        assertNotSame(myService5.nextHoliday(), myService5.nextHoliday(new 
Date()));
+        assertEquals(myService5.getHolidays()[0], 
myService5.getHolidays(2007)[0]);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        context = CurrentCompositeContext.getContext();
+        myService1 = context.locateService(MyTotalService.class, 
"MyTotalServiceFromRecursive");
+        myService2 = context.locateService(MyTotalService.class, 
"MyTotalServiceInCompositeWithRecursive");
+        myService3 = context.locateService(MyTotalService.class, 
"MyTotalServiceInCompositeWithComponentService");
+        myService4 = context.locateService(MyTotalService.class, 
"MyTotalServiceInCompositeWithRecursiveUseService");
+        myService5 =
+            context.locateService(MyTotalService.class, 
"MyTotalServiceInCompositeWithComponentServiceUseService");
+    }
+}

Added: 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java?view=auto&rev=475505
==============================================================================
--- 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java
 (added)
+++ 
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java
 Wed Nov 15 16:25:59 2006
@@ -0,0 +1,93 @@
+/*
+ * 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.test.spec;
+
+import java.util.Date;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.apache.tuscany.sca.test.spec.MyServiceByDate;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+import junit.framework.TestCase;
+
+public class CompositeTest extends TestCase {
+    private MyService myService;
+    private MyServiceByDate myServiceByDate;
+    private MyListService myListService;
+    private MyListServiceByYear myListServiceByYear;
+
+    private CompositeContext context;
+
+    public void testOverrideProperty() {
+        assertEquals("CARY", myService.getLocation());
+        assertEquals("2007", myService.getYear());
+
+    }
+
+    public void testDefaultService() {
+        assertEquals(myService.nextHoliday(), myServiceByDate.nextHoliday(new 
Date()));
+        assertEquals(myListService.getHolidays()[0], 
myListServiceByYear.getHolidays(2007)[0]);
+
+    }
+
+    public void testContext() {
+        assertNotNull("Service component name is null", 
myService.getComponentName());
+        assertNotNull("service context is null", myService.getContext());
+
+        System.out.println("Service component name :" + 
myService.getComponentName());
+        System.out.println("service context :" + myService.getContext());
+
+        test(context);
+
+    }
+
+    private void test(CompositeContext context) {
+        assertNotNull("composite name is null", context.getCompositeName());
+        assertNotNull("composite URI is null", context.getCompositeURI());
+
+        System.out.println("composite name :" + context.getCompositeName());
+        System.out.println("composite URI:" + context.getCompositeURI());
+
+        if (context.getRequestContext() == null)
+            System.out.println("Request context:" + 
context.getRequestContext());
+        else
+            display(context.getRequestContext());
+    }
+
+    private void display(RequestContext context) {
+        System.out.println("\tService name:" + context.getServiceName());
+        System.out.println("\tSecurity subject:" + 
context.getSecuritySubject());
+        System.out.println("\tService reference:" + 
context.getServiceReference());
+
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        context = CurrentCompositeContext.getContext();
+        myService = context.locateService(MyService.class, 
"MyServiceInRecursiveMyService");
+        myServiceByDate = context.locateService(MyServiceByDate.class, 
"MyServiceInRecursiveMyServiceByDate");
+        myListService = context.locateService(MyListService.class, 
"MyServiceInRecursiveMyListService");
+        myListServiceByYear =
+            context.locateService(MyListServiceByYear.class, 
"MyServiceInRecursiveMyListServiceByYear");
+    }
+}

Modified: incubator/tuscany/java/testing/sca/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/pom.xml?view=diff&rev=475505&r1=475504&r2=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/pom.xml (original)
+++ incubator/tuscany/java/testing/sca/pom.xml Wed Nov 15 16:25:59 2006
@@ -1,21 +1,21 @@
 <?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.    
+    * 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.    
 -->
 <project>
     <parent>
@@ -28,13 +28,21 @@
     <artifactId>tuscany-testing-sca</artifactId>
     <version>1.0-incubator-SNAPSHOT</version>
     <packaging>pom</packaging>
-    <name>Tuscany SCA tests </name>
+    <name>Tuscany SCA tests</name>
     <properties>
         <sca.version>1.0-incubator-SNAPSHOT</sca.version>
         <sdo.version>1.0-incubator-SNAPSHOT</sdo.version>
         <testing.version>1.0-incubator-SNAPSHOT</testing.version>
     </properties>
 
+    <modules>
+        <module>itest/test-spec</module>
+<!--
+        <module>interop</module>
+-->
+    </modules>
+
+<!--
     <dependencies>
         <dependency>
             <groupId>org.osoa</groupId>
@@ -45,31 +53,31 @@
             <groupId>org.apache.tuscany.sca.kernel</groupId>
             <artifactId>core</artifactId>
             <version>${sca.version}</version>
-  <scope>runtime</scope>
+            <scope>runtime</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.tuscany.sca.services.bindings</groupId>
             <artifactId>axis2</artifactId>
             <version>${sca.version}</version>
-  <scope>runtime</scope>
+            <scope>runtime</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.tuscany.sca.services.databinding</groupId>
             <artifactId>databinding-sdo</artifactId>
             <version>${sca.version}</version>
-  <scope>compile</scope>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.tuscany.sca.services.databinding</groupId>
             <artifactId>databinding-axiom</artifactId>
             <version>${sca.version}</version>
-  <scope>runtime</scope>
+            <scope>runtime</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.tuscany.sca.services.idl</groupId>
             <artifactId>wsdl</artifactId>
-             <version>${sca.version}</version>
-  <scope>runtime</scope>
+            <version>${sca.version}</version>
+            <scope>runtime</scope>
         </dependency>
         <dependency>
             <groupId>junit</groupId>
@@ -84,8 +92,9 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+-->
+
 
-    
     <build>
         <defaultGoal>install</defaultGoal>
         <pluginManagement>
@@ -189,7 +198,4 @@
             </plugins>
         </pluginManagement>
     </build>
-    <modules>
-      <module>interop</module>
-    </modules>
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to