diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:13:31 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:13:31 +0000 |
commit | 3caf8614f25d6b1962e20331fdf423c863bc02f3 (patch) | |
tree | 069fa30b63dd4804846385d8571928bdaa7b73ad /sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src | |
parent | 6d0e93c68d3aeaeb4bb6d96ac0460eec40ef786e (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835144 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src')
30 files changed, 1867 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java new file mode 100644 index 0000000000..7fe9fa4909 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java @@ -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();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java new file mode 100644 index 0000000000..a381fc62dc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java @@ -0,0 +1,27 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyListServiceByYear {
+ //FIXME renaming method due to TUSCANY-1173. Original name getHolidays
+ String[] getHolidaysByYear(int year);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java new file mode 100644 index 0000000000..fbb2161df3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java @@ -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();
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java new file mode 100644 index 0000000000..98490c4e3d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java @@ -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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface MyServiceByDate {
+ //FIXME renaming method due to TUSCANY-1173. Original name nextHoliday
+ Date nextHolidayByDate(Date date);
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java new file mode 100644 index 0000000000..6a4cfc1f79 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java @@ -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 {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java new file mode 100644 index 0000000000..2b54ce2740 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java @@ -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();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java new file mode 100644 index 0000000000..5170c32cd2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java @@ -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 = false)
+ 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 getHolidaysByYear(new Integer(year).intValue());
+ }
+
+ public String[] getHolidaysByYear(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;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java new file mode 100644 index 0000000000..7e8575a0a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java @@ -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 nextHolidayByDate(new Date());
+ }
+
+ @SuppressWarnings("deprecation")
+ public Date nextHolidayByDate(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[] getHolidaysByYear(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 getHolidaysByYear(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;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java new file mode 100644 index 0000000000..9d382341e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java @@ -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[] getHolidaysByYear(int year) {
+ return myListServiceByYear.getHolidaysByYear(year);
+ }
+
+ public String getComponentName() {
+ return myService.getComponentName();
+ }
+
+ public CompositeContext getContext() {
+ return myService.getContext();
+ }
+
+ public Date nextHolidayByDate(Date date) {
+ return myServiceByDate.nextHolidayByDate(date);
+ }
+
+ public String getLocation() {
+ return myService.getLocation();
+ }
+
+ public String getYear() {
+ return myService.getYear();
+ }
+
+ public Date nextHoliday() {
+ return myService.nextHoliday();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/CompositeTest.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/CompositeTest.composite new file mode 100644 index 0000000000..fdaa23379c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/CompositeTest.composite @@ -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.composite"/> + <include name="myListService" scdlLocation="myListService.composite"/> + <include name="mySimpleServiceInRecursive" scdlLocation="mySimpleServiceInRecursive.composite"/> + <include name="myServiceInRecursive" scdlLocation="myServiceInRecursive.composite"/> + <include name="mySimpleServiceInRecursive2" scdlLocation="mySimpleServiceInRecursive2.composite"/> + <include name="MyTotalServiceInRecursive" scdlLocation="myTotalServiceInRecursive.composite"/> + <include name="MyTotalServiceInRecursiveForReferenceOverride" scdlLocation="myTotalServiceInRecursiveForReferenceOverride.composite"/> + + +</composite> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite new file mode 100644 index 0000000000..0094d119e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myListService.composite @@ -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" target="MyNCService/MyListService"></reference> + <reference name="myListServiceArray" target="MyListServiceFor2006/MyListService"></reference> + <property name="serviceYear">2007</property> + </component> + + +</composite> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInComposite.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInComposite.composite new file mode 100644 index 0000000000..0d689e2c9c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInComposite.composite @@ -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> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInRecursive.composite new file mode 100644 index 0000000000..59341c9f8a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myServiceInRecursive.composite @@ -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.composite"/> + </component> + + +</composite> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleService.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleService.composite new file mode 100644 index 0000000000..65140fced8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleService.composite @@ -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> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive.composite new file mode 100644 index 0000000000..e6925ee7f8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive.composite @@ -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.composite"/> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive2.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive2.composite new file mode 100644 index 0000000000..4895691c00 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/mySimpleServiceInRecursive2.composite @@ -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.composite"/> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite new file mode 100644 index 0000000000..d01558cdfe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalService.composite @@ -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.composite"/> + + <component name="MyTotalService"> + <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/> + <reference name="myService" target="MyNCService/MyService"></reference> + <reference name="myListService" target="MyNCService/MyListService"></reference> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite new file mode 100644 index 0000000000..2359323058 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInComposite.composite @@ -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"></reference> + <reference name="myListService"></reference> + </component> + + <reference name="MyServiceRef" promote="MyTotalServiceComponent/myService"> + <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/> + </reference> + + <reference name="MyListServiceRef" promote="MyTotalServiceComponent/myListService"> + <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/> + </reference> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite new file mode 100644 index 0000000000..96a8f00740 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite @@ -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"></reference> + <reference name="myListService"></reference> + </component> + + <reference name="MyServiceRefNo" override="no" promote="MyTotalServiceComponentNo/myService"> + <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/> + </reference> + + <reference name="MyListServiceRefNo" promote="MyTotalServiceComponentNo/myListService" 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"></reference> + <reference name="myListService"></reference> + </component> + + <reference name="MyServiceRefMay" override="may" promote="MyTotalServiceComponentMay/myService"> + <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/> + </reference> + + <reference name="MyListServiceRefMay" override="may" promote="MyTotalServiceComponentMay/myListService"> + <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"></reference> + <reference name="myListService"></reference> + </component> + + <reference name="MyServiceRefMust" override="must" promote="MyTotalServiceComponentMust/myService"> + <interface.java interface="org.apache.tuscany.sca.test.spec.MyService"/> + </reference> + + <reference name="MyListServiceRefMust" override="must" promote="MyTotalServiceComponentMust/myListService"> + <interface.java interface="org.apache.tuscany.sca.test.spec.MyListService"/> + </reference> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite new file mode 100644 index 0000000000..36802c75a6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursive.composite @@ -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.composite"/> + </component> + + <component name="MyTotalServiceFromRecursive"> + <implementation.java class="org.apache.tuscany.sca.test.spec.impl.MyTotalServiceImpl"/> + <reference name="myService" target="MyServiceInComposite/MyService"></reference> + <reference name="myListService" target="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.composite"/> + <reference name="MyServiceRef" target="MyServiceInComposite/MyService"></reference> + <reference name="MyListServiceRef" target="MyServiceInComposite/MyListService"></reference> + </component> + + <component name="MyTotalServiceInCompositeWithComponentService"> + <implementation.composite scdlLocation="myTotalServiceInComposite.composite"/> + <reference name="MyServiceRef" target="MyServiceInComponent/MyService"></reference> + <reference name="MyListServiceRef" target="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> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite new file mode 100644 index 0000000000..4eccde41f4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite @@ -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.composite"/> + <reference name="MyServiceRefNo" target="MyServiceInComposite/MyService"></reference> + <reference name="MyListServiceRefNo" target="MyServiceInComposite/MyListService"></reference> + <reference name="MyServiceRefMay" target="MyServiceInComposite/MyService"></reference> + <reference name="MyListServiceRefMay" target="MyServiceInComposite/MyListService"></reference> + <reference name="MyServiceRefMust" target="MyServiceInComposite/MyService"></reference> + <reference name="MyListServiceRefMust" target="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> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myservice.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myservice.composite new file mode 100644 index 0000000000..1e5f9edbd7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/main/resources/myservice.composite @@ -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> diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCase.java new file mode 100644 index 0000000000..fe2780ed9d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCase.java @@ -0,0 +1,53 @@ +/*
+ * 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.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class ComponentServiceReferenceListTestCase 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.getHolidaysByYear(2007)[0]);
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myListService = context.locateService(MyListService.class, "MyNewListService");
+ myListServiceByYear = context.locateService(MyListServiceByYear.class, "MyNewListService");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java new file mode 100644 index 0000000000..087f77c950 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java @@ -0,0 +1,88 @@ +/*
+ * 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 junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class ComponentServiceReferenceTestCase 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.nextHolidayByDate(new Date()));
+ assertEquals(myService.getHolidays()[0], myService.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ 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.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ 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 {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService = context.locateService(MyTotalService.class, "MyTotalService");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java new file mode 100644 index 0000000000..ca3ed8051d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java @@ -0,0 +1,110 @@ +/*
+ * 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 junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class ComponentTestCase 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.nextHolidayByDate(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(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.getHolidaysByYear(2006)[0]);
+
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ 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.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ 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:" + (Object)context.getServiceReference());
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ 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");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java new file mode 100644 index 0000000000..ad89590600 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCase.java @@ -0,0 +1,191 @@ +/*
+ * 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.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+@SuppressWarnings("deprecation")
+public class CompositeOneService2LevelTestCase extends TestCase {
+ private static MyService myService;
+ private static MyService myServiceDefault;
+ private static MyService myServiceNo;
+ private static MyService myServiceMay;
+ private static MyService myServiceMust;
+
+ static private CompositeContext context;
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite();
+
+ suite.addTestSuite(CompositeOneService2LevelTestCase.class);
+ TestSetup wrapper = new TestSetup(suite) {
+ public void setUp() {
+ setupStatic();
+ }
+
+ public void tearDown() {
+ tearDownStatic();
+ }
+
+ };
+ return wrapper;
+ }
+
+ public static void setupStatic() {
+ if (null != context)
+ return;
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ myService = context.locateService(MyService.class, "MySimpleServiceInRecursiveComponent/MySimpleService");
+ myServiceDefault = context.locateService(MyService.class, "MySimpleServiceDefault");
+ myServiceNo = context.locateService(MyService.class, "MySimpleServiceNo");
+ myServiceMay = context.locateService(MyService.class, "MySimpleServiceMay");
+ myServiceMust = context.locateService(MyService.class, "MySimpleServiceMust");
+
+ }
+
+ public static void tearDownStatic() {
+ if (context != null) {
+
+ context = null;
+ SCARuntime.stop();
+ }
+ }
+
+ public void setUp() {
+ setupStatic();
+ }
+
+ static Object foo = new Object() {
+ public void finalize() throws Throwable {
+ foo = null;
+ tearDownStatic();
+ }
+
+ };
+
+ public void testPropertyFromComponent() {
+
+ assertNotNull(myService);
+ assertEquals("CARY", myService.getLocation());
+ assertEquals("2007", myService.getYear());
+
+ }
+
+ public void testPropertyFromServiceDefault() {
+
+ assertNotNull(myServiceDefault);
+ assertEquals("CARY", myServiceDefault.getLocation());
+ assertEquals("2007", myServiceDefault.getYear());
+
+ }
+
+ public void testServiceDefault() {
+
+ assertNotNull(myService);
+ assertEquals(myService.nextHoliday(), myServiceDefault.nextHoliday());
+ }
+
+ public void testPropertyFromServiceNo() {
+
+ assertNotNull(myServiceNo);
+ assertEquals("CARY", myServiceNo.getLocation());
+ assertEquals("2007", myServiceNo.getYear());
+
+ }
+
+ public void testServiceNo() {
+
+ assertNotNull(myService);
+ assertEquals(myService.nextHoliday(), myServiceNo.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMay() {
+
+ assertNotNull(myServiceMay);
+ assertEquals("CARY", myServiceMay.getLocation());
+ assertEquals("2007", myServiceMay.getYear());
+
+ }
+
+ public void testServiceMay() {
+
+ assertNotNull(myService);
+ assertEquals(myService.nextHoliday(), myServiceMay.nextHoliday());
+ }
+
+ public void testPropertyFromServiceMust() {
+
+ assertNotNull(myServiceMust);
+ assertEquals("CARY", myServiceMust.getLocation());
+ assertEquals("2007", myServiceMust.getYear());
+
+ }
+
+ public void testServiceMust() {
+
+ assertNotNull(myService);
+ assertEquals(myService.nextHoliday(), myServiceMust.nextHoliday());
+ }
+
+ public void testContext() {
+ // FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ * 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.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ 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:" +
+ // (Object)context.getServiceReference());
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java new file mode 100644 index 0000000000..1b41672700 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java @@ -0,0 +1,84 @@ +/*
+ * 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.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class CompositeOneServiceTestCase 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() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ 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.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ 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 {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService = context.locateService(MyService.class, "MySimpleServiceInRecursive");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java new file mode 100644 index 0000000000..7023d7981c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java @@ -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;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CompositeServiceReferenceForRefOverrideTestCase 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.nextHolidayByDate(new Date()));
+ System.out.println("myService1.getHolidays()[0]" + myService1.getHolidays()[0]);
+ System.out.println("myService1.getHolidays(2007)[0]" + myService1.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService1.nextHoliday(), myService1.nextHolidayByDate(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidaysByYear(2007)[0]);
+ }
+
+ public void testServiceFromReferenceMay() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceFromReferenceMust() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHolidayByDate(new Date()));
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ context = CurrentCompositeContext.getContext();
+ myService1 = context.locateService(MyTotalService.class, "MyTotalServiceNo");
+ myService2 = context.locateService(MyTotalService.class, "MyTotalServiceMay");
+ myService3 = context.locateService(MyTotalService.class, "MyTotalServiceMust");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java new file mode 100644 index 0000000000..6128d108ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java @@ -0,0 +1,95 @@ +/*
+ * 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 junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+public class CompositeServiceReferenceTestCase 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.nextHolidayByDate(new Date()));
+ assertEquals(myService1.getHolidays()[0], myService1.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testServiceReferenceFromRecursive() {
+ assertEquals(myService2.getHolidays()[0], myService2.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService2.nextHoliday(), myService2.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceReferenceFromRecursiveUseService() {
+ assertNotSame(myService4.nextHoliday(), myService4.nextHolidayByDate(new Date()));
+ assertEquals(myService4.getHolidays()[0], myService4.getHolidaysByYear(2007)[0]);
+ }
+
+ public void testServiceReferenceFromComponent() {
+ assertEquals(myService3.getHolidays()[0], myService3.getHolidaysByYear(2007)[0]);
+ assertNotSame(myService3.nextHoliday(), myService3.nextHolidayByDate(new Date()));
+
+ }
+
+ public void testServiceReferenceFromComponentUseService() {
+ assertNotSame(myService5.nextHoliday(), myService5.nextHolidayByDate(new Date()));
+ assertEquals(myService5.getHolidays()[0], myService5.getHolidaysByYear(2007)[0]);
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ 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");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java new file mode 100644 index 0000000000..7c50a90e60 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/spec/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java @@ -0,0 +1,96 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.test.spec;
+
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+import org.osoa.sca.RequestContext;
+
+public class CompositeTestCase 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.nextHolidayByDate(new Date()));
+ assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]);
+
+ }
+
+ public void testContext() {
+ //FIXME TUSCANY-1174 - Need support for @ComponentName
+ /*
+ 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.getName());
+ assertNotNull("composite URI is null", context.getURI());
+
+ System.out.println("composite name :" + context.getName());
+ System.out.println("composite URI:" + context.getURI());
+
+ 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:" + (Object)context.getServiceReference());
+
+ }
+
+ protected void setUp() throws Exception {
+ SCARuntime.start("CompositeTest.composite");
+ 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");
+ }
+
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
|