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 2006/11/16 01:26:01 UTC
svn commit: r475505 [1/2] - in /incubator/tuscany/java/testing/sca: ./
itest/ itest/test-spec/ itest/test-spec/src/ itest/test-spec/src/main/
itest/test-spec/src/main/java/ itest/test-spec/src/main/java/org/
itest/test-spec/src/main/java/org/apache/ it...
Author: rfeng
Date: Wed Nov 15 16:25:59 2006
New Revision: 475505
URL: http://svn.apache.org/viewvc?view=rev&rev=475505
Log:
Apply the patch for JIRA TUSCANY-926 to add test cases for Tuscany
Added:
incubator/tuscany/java/testing/sca/itest/
incubator/tuscany/java/testing/sca/itest/test-spec/ (with props)
incubator/tuscany/java/testing/sca/itest/test-spec/pom.xml
incubator/tuscany/java/testing/sca/itest/test-spec/src/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/default.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myListService.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInComposite.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInRecursive.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleService.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalService.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myservice.scdl
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTest.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTest.java
incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTest.java
Modified:
incubator/tuscany/java/testing/sca/pom.xml
Propchange: incubator/tuscany/java/testing/sca/itest/test-spec/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Nov 15 16:25:59 2006
@@ -0,0 +1,13 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
Added: incubator/tuscany/java/testing/sca/itest/test-spec/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/pom.xml?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/pom.xml (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/pom.xml Wed Nov 15 16:25:59 2006
@@ -0,0 +1,75 @@
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>tuscany-testing-sca</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-test-spec</artifactId>
+ <version>SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r0.95</artifactId>
+ <version>1.0-incubator-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.plugins</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/*Test.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,28 @@
+/*
+ * 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 org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListService {
+ String[] getHolidays();
+
+ String getYear();
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,26 @@
+/*
+ * 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 org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ String[] getHolidays(int year);
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+public interface MyService extends SCAComponentService {
+ Date nextHoliday();
+
+ String getLocation();
+
+ String getYear();
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,28 @@
+/*
+ * 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.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ Date nextHoliday(Date date);
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate {
+
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,28 @@
+/*
+ * 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 org.osoa.sca.CompositeContext;
+
+public interface SCAComponentService {
+ String getComponentName();
+
+ CompositeContext getContext();
+
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,73 @@
+/*
+ * 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.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyListService.class, MyListServiceByYear.class})
+public class MyListServiceImpl implements MyListService, MyListServiceByYear {
+
+ // This is multiplicity=1:n
+ @Reference(name = "myListServiceList", required = true)
+ public List<MyListService> myListServicesList;
+
+ // This is multiplicity=0:n
+ @Reference(name = "myListServiceArray", required = false)
+ public MyListService[] myListServicesArray;
+
+ @Property(name = "serviceYear")
+ protected String year = "2006";
+
+ public String[] getHolidays() {
+ return getHolidays(new Integer(year).intValue());
+ }
+
+ public String[] getHolidays(int year) {
+ MyListService myService;
+ if (myListServicesList != null) {
+ for (int i = 0; i < myListServicesList.size(); i++) {
+ myService = myListServicesList.get(i);
+ if (new Integer(myService.getYear()).intValue() == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ if (myListServicesArray != null) {
+ for (int i = 0; i < myListServicesArray.length; i++) {
+ myService = myListServicesArray[i];
+ if (new Integer(myService.getYear()).intValue() == year) {
+ return myService.getHolidays();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,122 @@
+/*
+ * 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.impl;
+
+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.annotations.ComponentName;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(interfaces = {MyService.class, MyServiceByDate.class, MyListService.class, MyListServiceByYear.class})
+public class MyServiceImpl implements MyService, MyServiceByDate, MyListService, MyListServiceByYear {
+ static String[][] holidays =
+ {
+ {"2006/01/02", "2006/05/29", "2006/07/03", "2006/07/04", "2006/09/04", "2006/11/23", "2006/11/23",
+ "2006/11/24", "2006/12/25"},
+ {"2007/01/01", "2007/05/28", "2007/07/04", "2007/09/03", "2007/11/22", "2007/11/23", "2007/12/25"}};
+
+ @Property(name = "location")
+ protected String location = "RTP";
+
+ @Property(name = "year")
+ protected String year = "2006";
+
+ @ComponentName
+ private String componentName;
+
+ @Context
+ private CompositeContext context;
+
+ public MyServiceImpl() {
+ System.out.println("creating service instance...");
+ }
+
+ public Date nextHoliday() {
+
+ return nextHoliday(new Date());
+ }
+
+ @SuppressWarnings("deprecation")
+ public Date nextHoliday(Date today) {
+ Date d1;
+ String[] days = getHolidays();
+ for (int j = 0; j < days.length; j++) {
+ d1 = new Date(days[j]);
+ if (d1.after(today))
+ return d1;
+ }
+ return null;
+ }
+
+ public String[] getHolidays(int year) {
+ int index = year - 2006;
+ if (index >= 0 && index < holidays.length)
+ return holidays[index];
+ return null;
+ }
+
+ public String[] getHolidays() {
+
+ Integer theYear;
+ if (year == null || year.length() == 0)
+ theYear = new Integer("2006");
+ else
+ theYear = new Integer(year);
+
+ return getHolidays(theYear.intValue());
+ }
+
+ @Init
+ public void start() {
+ System.out.println("Start service..");
+ }
+
+ @Destroy
+ public void stop() {
+ System.out.println("Stop service..");
+
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public CompositeContext getContext() {
+ return context;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getYear() {
+ return year;
+ }
+
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,83 @@
+/*
+ * 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.impl;
+
+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.apache.tuscany.sca.test.spec.MyTotalService;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(MyTotalService.class)
+public class MyTotalServiceImpl implements MyTotalService {
+
+ // This is multiplicity=1:1
+ @Reference(required = true)
+ public MyListService myListService;
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyListServiceByYear myListServiceByYear = new MyServiceImpl();
+
+ // default required==true so it is 1:1
+ @Reference
+ public MyService myService;
+
+ // This is multiplicity=0:1
+ @Reference(required = false)
+ public MyServiceByDate myServiceByDate = new MyServiceImpl();
+
+ public String[] getHolidays() {
+ return myListService.getHolidays();
+ }
+
+ public String[] getHolidays(int year) {
+ return myListServiceByYear.getHolidays(year);
+ }
+
+ public String getComponentName() {
+ return myService.getComponentName();
+ }
+
+ public CompositeContext getContext() {
+ return myService.getContext();
+ }
+
+ public Date nextHoliday(Date date) {
+ return myServiceByDate.nextHoliday(date);
+ }
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+ public Date nextHoliday() {
+ return myService.nextHoliday();
+ }
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/default.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/default.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/default.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,33 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="CompositeTest">
+
+ <include name="myTotalService" scdlLocation="myTotalService.scdl"/>
+ <include name="myListService" scdlLocation="myListService.scdl"/>
+ <include name="mySimpleServiceInRecursive" scdlLocation="mySimpleServiceInRecursive.scdl"/>
+ <include name="myServiceInRecursive" scdlLocation="myServiceInRecursive.scdl"/>
+ <include name="mySimpleServiceInRecursive2" scdlLocation="mySimpleServiceInRecursive2.scdl"/>
+ <include name="MyTotalServiceInRecursive" scdlLocation="MyTotalServiceInRecursive.scdl"/>
+ <include name="MyTotalServiceInRecursiveForReferenceOverride" scdlLocation="MyTotalServiceInRecursiveForReferenceOverride.scdl"/>
+
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myListService.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myListService.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myListService.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myListService.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,32 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyListServiceTest">
+
+ <component name="MyNewListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyListServiceImpl"/>
+ <!--reference name="myListServiceList">MyNCService/MyListService</reference-->
+ <!--reference name="myListServiceArray">MyListServiceFor2006/MyListService</reference-->
+ <property name="serviceYear">2007</property>
+ </component>
+
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInComposite.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInComposite.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInComposite.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInComposite.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,53 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyServiceInCompositeTest">
+
+ <service name="MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MyServiceComponent/MyService</reference>
+ </service>
+
+
+ <service name="MyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ <reference>MyServiceComponent/MyListService</reference>
+ </service>
+
+
+ <service name="MyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ <reference>MyServiceComponent/MyListServiceByYear</reference>
+ </service>
+
+
+ <service name="MyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ <reference>MyServiceComponent/MyServiceByDate</reference>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInRecursive.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInRecursive.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInRecursive.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myServiceInRecursive.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,53 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyServiceInRecursiveTest">
+
+ <service name="MyServiceInRecursiveMyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MyServiceInRecursive/MyService</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ <reference>MyServiceInRecursive/MyListService</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyListServiceByYear">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListServiceByYear"/>
+ <reference>MyServiceInRecursive/MyListServiceByYear</reference>
+ </service>
+
+
+ <service name="MyServiceInRecursiveMyServiceByDate">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyServiceByDate"/>
+ <reference>MyServiceInRecursive/MyServiceByDate</reference>
+ </service>
+
+
+ <component name="MyServiceInRecursive">
+ <implementation.composite scdlLocation="MyServiceInComposite.scdl"/>
+ </component>
+
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleService.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleService.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleService.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleService.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,35 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceTest">
+
+ <service name="MyService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MyServiceComponent/MyService</reference>
+ </service>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,48 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceInRecursiveTest">
+
+ <service name="MySimpleService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursive/MyService</reference>
+ </service>
+
+
+ <service name="MySimpleServiceNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursive/MyService</reference>
+ </service>
+
+ <service name="MySimpleServiceMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursive/MyService</reference>
+ </service>
+
+ <service name="MySimpleServiceMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursive/MyService</reference>
+ </service>
+
+ <component name="MySimpleServiceInRecursive">
+ <implementation.composite scdlLocation="mySimpleService.scdl"/>
+ </component>
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,47 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MySimpleServiceInRecursiveTest">
+
+ <service name="MySimpleServiceDefault">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleService</reference>
+ </service>
+
+ <service name="MySimpleServiceNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceNo</reference>
+ </service>
+
+ <service name="MySimpleServiceMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceMay</reference>
+ </service>
+
+ <service name="MySimpleServiceMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ <reference>MySimpleServiceInRecursiveComponent/MySimpleServiceMust</reference>
+ </service>
+
+ <component name="MySimpleServiceInRecursiveComponent">
+ <implementation.composite scdlLocation="mySimpleServiceInRecursive.scdl"/>
+ </component>
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalService.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalService.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalService.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalService.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,32 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceTest">
+
+ <include name="myservice" scdlLocation="myservice.scdl"/>
+
+ <component name="MyTotalService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService">MyNCService/MyService</reference>
+ <reference name="myListService">MyNCService/MyListService</reference>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,43 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceReferenceOverrideTest">
+
+ <service name="MyTotalService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponent</reference>
+ </service>
+
+ <component name="MyTotalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService">MyServiceRef</reference>
+ <reference name="myListService">MyListServiceRef</reference>
+ </component>
+
+ <reference name="MyServiceRef">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRef">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,81 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceTest">
+
+ <service name="MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentNo</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentNo">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService">MyServiceRefNo</reference>
+ <reference name="myListService">MyListServiceRefNo</reference>
+ </component>
+
+ <reference name="MyServiceRefNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefNo" override="no">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <service name="MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentMay</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentMay">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService">MyServiceRefMay</reference>
+ <reference name="myListService">MyListServiceRefMay</reference>
+ </component>
+
+ <reference name="MyServiceRefMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMay" override="may">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+ <service name="MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceComponentMust</reference>
+ </service>
+
+ <component name="MyTotalServiceComponentMust">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService">MyServiceRefMust</reference>
+ <reference name="myListService">MyListServiceRefMust</reference>
+ </component>
+
+ <reference name="MyServiceRefMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/>
+ </reference>
+
+ <reference name="MyListServiceRefMust" override="must">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/>
+ </reference>
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,62 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceInRecursiveTest">
+
+ <component name="MyServiceInComposite">
+ <implementation.composite scdlLocation="myServiceInComposite.scdl"/>
+ </component>
+
+ <component name="MyTotalServiceFromRecursive">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/>
+ <reference name="myService">MyServiceInComposite/MyService</reference>
+ <reference name="myListService">MyServiceInComposite/MyListService</reference>
+ </component>
+
+ <service name="MyTotalServiceInCompositeWithRecursiveUseService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceInCompositeWithRecursive</reference>
+ </service>
+
+ <service name="MyTotalServiceInCompositeWithComponentServiceUseService">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceInCompositeWithComponentService</reference>
+ </service>
+
+ <component name="MyTotalServiceInCompositeWithRecursive">
+ <implementation.composite scdlLocation="myTotalServiceInComposite.scdl"/>
+ <reference name="MyServiceRef">MyServiceInComposite/MyService</reference>
+ <reference name="MyListServiceRef">MyServiceInComposite/MyListService</reference>
+ </component>
+
+ <component name="MyTotalServiceInCompositeWithComponentService">
+ <implementation.composite scdlLocation="myTotalServiceInComposite.scdl"/>
+ <reference name="MyServiceRef">MyServiceInComponent/MyService</reference>
+ <reference name="MyListServiceRef">MyServiceInComponent/MyListService</reference>
+ </component>
+
+ <component name="MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,55 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyTotalServiceInRecursiveTest">
+
+ <service name="MyTotalServiceNo">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceForReferenceComponent/MyTotalServiceNo</reference>
+ </service>
+
+ <service name="MyTotalServiceMay">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceForReferenceComponent/MyTotalServiceMay</reference>
+ </service>
+
+ <service name="MyTotalServiceMust">
+ <interface.java interface="org.apache.tuscany.sca.test.spec.MyTotalService"/>
+ <reference>MyTotalServiceForReferenceComponent/MyTotalServiceMust</reference>
+ </service>
+
+ <component name="MyTotalServiceForReferenceComponent">
+ <implementation.composite scdlLocation="myTotalServiceInCompositeForReferenceOverride.scdl"/>
+ <reference name="MyServiceRefNo">MyServiceInComposite/MyService</reference>
+ <reference name="MyListServiceRefNo">MyServiceInComposite/MyListService</reference>
+ <reference name="MyServiceRefMay">MyServiceInComposite/MyService</reference>
+ <reference name="MyListServiceRefMay">MyServiceInComposite/MyListService</reference>
+ <reference name="MyServiceRefMust">MyServiceInComposite/MyService</reference>
+ <reference name="MyListServiceRefMust">MyServiceInComposite/MyListService</reference>
+ </component>
+
+ <component name="MyServiceInComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">CARY</property>
+ <property name="year">2007</property>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myservice.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myservice.scdl?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myservice.scdl (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/main/resources/META-INF/sca/myservice.scdl Wed Nov 15 16:25:59 2006
@@ -0,0 +1,51 @@
+<?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"
+ xmlns:foo="http://foo"
+ name="MyServiceComposite">
+
+ <component name="MyService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyNCService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="location">NC</property>
+ <property name="year">2007</property>
+ </component>
+
+ <component name="MyServiceByDate">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListService">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+ <component name="MyListServiceFor2006">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ <property name="year">2006</property>
+ </component>
+
+ <component name="MyListServiceByYear">
+ <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyServiceImpl"/>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTest.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,50 @@
+/*
+ * 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 org.apache.tuscany.sca.test.spec.MyListService;
+import org.apache.tuscany.sca.test.spec.MyListServiceByYear;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import junit.framework.TestCase;
+
+public class ComponentServiceReferenceListTest extends TestCase {
+ private MyListService myListService;
+ private MyListServiceByYear myListServiceByYear;
+
+ private CompositeContext context;
+
+ public void testDefaultProperty() {
+ assertEquals("2007", myListService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidays(2007)[0]);
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ context = CurrentCompositeContext.getContext();
+ myListService = context.locateService(MyListService.class, "MyNewListService");
+ myListServiceByYear = context.locateService(MyListServiceByYear.class, "MyNewListService");
+ }
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTest.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,82 @@
+/*
+ * 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 org.osoa.sca.RequestContext;
+
+import junit.framework.TestCase;
+
+public class ComponentServiceReferenceTest extends TestCase {
+ private MyTotalService myService;
+ private CompositeContext context;
+
+ public void testDefaultProperty() {
+ assertEquals("NC", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotSame(myService.nextHoliday(), myService.nextHoliday(new Date()));
+ assertEquals(myService.getHolidays()[0], myService.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(MyTotalService.class, "MyTotalService");
+ }
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTest.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,107 @@
+/*
+ * 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 ComponentTest extends TestCase {
+ private MyService myService;
+ private MyServiceByDate myServiceByDate;
+ private MyListService myListService;
+ private MyListServiceByYear myListServiceByYear;
+ private MyService myNCService;
+ private MyListService myListServiceFor2006;
+
+ private CompositeContext context;
+
+ public void testDefaultProperty() {
+ assertEquals("RTP", myService.getLocation());
+ assertEquals("2006", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertEquals(myService.nextHoliday(), myServiceByDate.nextHoliday(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidays(2006)[0]);
+
+ }
+
+ public void testOverrideProperty() {
+ assertEquals("NC", myNCService.getLocation());
+ assertEquals("2007", myNCService.getYear());
+ }
+
+ public void testServiceWithOverrideProperty() {
+ assertFalse(myNCService.nextHoliday() == myService.nextHoliday());
+ assertEquals(myListServiceFor2006.getHolidays()[0], myListServiceByYear.getHolidays(2006)[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, "MyService");
+ myServiceByDate = context.locateService(MyServiceByDate.class, "MyServiceByDate");
+ myListService = context.locateService(MyListService.class, "MyListService");
+ myListServiceByYear = context.locateService(MyListServiceByYear.class, "MyListServiceByYear");
+ myNCService = context.locateService(MyService.class, "MyNCService");
+ myListServiceFor2006 = context.locateService(MyListService.class, "MyListServiceFor2006");
+ }
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTest.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,123 @@
+/*
+ * 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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class CompositeOneService2LevelTest extends TestCase {
+ private MyService myService;
+ private MyService myServiceDefault;
+ private MyService myServiceNo;
+ private MyService myServiceMay;
+ private MyService myServiceMust;
+
+ private CompositeContext context;
+
+ public void testPropertyFromComponent() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testPropertyFromServiceDefault() {
+ assertEquals("CARY", myServiceDefault.getLocation());
+ assertEquals("2007", myServiceDefault.getYear());
+
+ }
+
+ public void testServiceDefault() {
+ assertEquals(myService.nextHoliday(), myServiceDefault.nextHoliday());
+ }
+
+ public void testPropertyFromServiceNo() {
+ assertEquals("CARY", myServiceNo.getLocation());
+ assertEquals("2007", myServiceNo.getYear());
+
+ }
+
+ public void testServiceNo() {
+ assertEquals(myService.nextHoliday(), myServiceNo.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMay() {
+ assertEquals("CARY", myServiceMay.getLocation());
+ assertEquals("2007", myServiceMay.getYear());
+
+ }
+
+ public void testServiceMay() {
+ assertEquals(myService.nextHoliday(), myServiceMay.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMust() {
+ assertEquals("CARY", myServiceMust.getLocation());
+ assertEquals("2007", myServiceMust.getYear());
+
+ }
+
+ public void testServiceMust() {
+ assertEquals(myService.nextHoliday(), myServiceMust.nextHoliday());
+ }
+
+ 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, "MySimpleServiceInRecursiveComponent");
+ myServiceDefault = context.locateService(MyService.class, "MySimpleServiceDefault");
+ myServiceNo = context.locateService(MyService.class, "MySimpleServiceNo");
+ myServiceMay = context.locateService(MyService.class, "MySimpleServiceMay");
+ myServiceMust = context.locateService(MyService.class, "MySimpleServiceMust");
+ }
+}
Added: incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java?view=auto&rev=475505
==============================================================================
--- incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java (added)
+++ incubator/tuscany/java/testing/sca/itest/test-spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTest.java Wed Nov 15 16:25:59 2006
@@ -0,0 +1,78 @@
+/*
+ * 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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.test.spec.MyService;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class CompositeOneServiceTest extends TestCase {
+ private MyService myService;
+ private CompositeContext context;
+
+ public void testOverrideProperty() {
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testDefaultService() {
+ assertNotNull(myService.nextHoliday());
+ }
+
+ 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, "MySimpleServiceInRecursive");
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org