From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/0.90-rc1-incubating/itest/spec-api/pom.xml | 45 +++++++++ .../apache/tuscany/sca/test/spec/BasicService.java | 26 +++++ .../apache/tuscany/sca/test/spec/MathService.java | 25 +++++ .../tuscany/sca/test/spec/MyListService.java | 28 ++++++ .../tuscany/sca/test/spec/MyListServiceByYear.java | 27 +++++ .../apache/tuscany/sca/test/spec/MyService.java | 29 ++++++ .../tuscany/sca/test/spec/MyServiceByDate.java | 29 ++++++ .../tuscany/sca/test/spec/MyTotalService.java | 23 +++++ .../tuscany/sca/test/spec/SCAComponentService.java | 25 +++++ .../sca/test/spec/impl/BasicServiceImpl.java | 49 +++++++++ .../sca/test/spec/impl/MathServiceImpl.java | 31 ++++++ .../sca/test/spec/impl/MyListServiceImpl.java | 73 ++++++++++++++ .../tuscany/sca/test/spec/impl/MyServiceImpl.java | 112 +++++++++++++++++++++ .../sca/test/spec/impl/MyTotalServiceImpl.java | 78 ++++++++++++++ .../src/main/resources/BasicService.composite | 30 ++++++ .../src/main/resources/CompositeTest.composite | 33 ++++++ .../src/main/resources/MathService.composite | 29 ++++++ .../src/main/resources/myListService.composite | 33 ++++++ .../main/resources/myServiceInComposite.composite | 50 +++++++++ .../main/resources/myServiceInRecursive.composite | 50 +++++++++ .../src/main/resources/mySimpleService.composite | 35 +++++++ .../resources/mySimpleServiceInRecursive.composite | 45 +++++++++ .../mySimpleServiceInRecursive2.composite | 44 ++++++++ .../src/main/resources/myTotalService.composite | 34 +++++++ .../resources/myTotalServiceInComposite.composite | 45 +++++++++ ...erviceInCompositeForReferenceOverride.composite | 88 ++++++++++++++++ .../resources/myTotalServiceInRecursive.composite | 64 ++++++++++++ ...erviceInRecursiveForReferenceOverride.composite | 56 +++++++++++ .../src/main/resources/myservice.composite | 52 ++++++++++ .../sca/test/spec/ComponentContextTestCase.java | 53 ++++++++++ ...ComponentServiceReferenceListTestCaseFIXME.java | 50 +++++++++ .../spec/ComponentServiceReferenceTestCase.java | 64 ++++++++++++ .../tuscany/sca/test/spec/ComponentTestCase.java | 98 ++++++++++++++++++ .../CompositeOneService2LevelTestCaseFIXME.java | 106 +++++++++++++++++++ .../sca/test/spec/CompositeOneServiceTestCase.java | 60 +++++++++++ ...siteServiceReferenceForRefOverrideTestCase.java | 80 +++++++++++++++ .../spec/CompositeServiceReferenceTestCase.java | 92 +++++++++++++++++ .../tuscany/sca/test/spec/CompositeTestCase.java | 78 ++++++++++++++ 38 files changed, 1969 insertions(+) create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/pom.xml create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/BasicService.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/CompositeTest.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/MathService.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myListService.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myServiceInComposite.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myServiceInRecursive.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleService.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalService.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myservice.composite create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java create mode 100644 tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java (limited to 'tags/java/sca/0.90-rc1-incubating/itest/spec-api') diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/pom.xml b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/pom.xml new file mode 100644 index 0000000000..f45e8a0723 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 0.90-incubating + ../pom.xml + + tuscany-itest-spec-api + Apache Tuscany SCA Spec API Integration Tests + + + + org.apache.tuscany.sca + tuscany-host-embedded + 0.90-incubating + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 0.90-incubating + runtime + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java new file mode 100644 index 0000000000..65e85e5db6 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java @@ -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; + +public interface BasicService { + + int negate(int theInt); + int delegateNegate(int theInt); + +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java new file mode 100644 index 0000000000..db367225ab --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java @@ -0,0 +1,25 @@ +/* + * 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 MathService { + + int negate(int theInt); + +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java new file mode 100644 index 0000000000..7fe9fa4909 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/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/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java new file mode 100644 index 0000000000..a381fc62dc --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/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/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java new file mode 100644 index 0000000000..fbb2161df3 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/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/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java new file mode 100644 index 0000000000..98490c4e3d --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/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/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java new file mode 100644 index 0000000000..6a4cfc1f79 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/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/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java new file mode 100644 index 0000000000..c2d107ef28 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java @@ -0,0 +1,25 @@ +/* + * 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 SCAComponentService { + String getComponentName(); + +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java new file mode 100644 index 0000000000..ea0b59528f --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.test.spec.impl; + +import org.apache.tuscany.sca.test.spec.BasicService; +import org.apache.tuscany.sca.test.spec.MathService; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(BasicService.class) +public class BasicServiceImpl implements BasicService { + + @Context + protected ComponentContext context; + + //The reference anntation is used in lieu of a component type definition + //This makes the call to getService redundant since the reference is injected + //but it serves the purpose to demonstrate that getService is working. + @Reference + protected MathService mathServiceReference; + + public int negate(int theInt) { + return -theInt; + } + + public int delegateNegate(int theInt) { + mathServiceReference = context.getService(MathService.class, "mathServiceReference"); + return mathServiceReference.negate(theInt); + } + +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java new file mode 100644 index 0000000000..8b52a5fe31 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.tuscany.sca.test.spec.MathService; +import org.osoa.sca.annotations.Service; + +@Service(MathService.class) +public class MathServiceImpl implements MathService { + + public int negate(int theInt) { + return -theInt; + } + +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java new file mode 100644 index 0000000000..5170c32cd2 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/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 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/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java new file mode 100644 index 0000000000..b81c2c2120 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java @@ -0,0 +1,112 @@ +/* + * 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.annotations.ComponentName; +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; + + 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 String getLocation() { + return location; + } + + public String getYear() { + return year; + } + +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java new file mode 100644 index 0000000000..11767522d6 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java @@ -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.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.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 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/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/BasicService.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/BasicService.composite new file mode 100644 index 0000000000..d650c8ab42 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/BasicService.composite @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/CompositeTest.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/CompositeTest.composite new file mode 100644 index 0000000000..c01c6845e7 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/CompositeTest.composite @@ -0,0 +1,33 @@ + + + + + + + foo:mySimpleServiceInRecursive + foo:myServiceInRecursive + foo:mySimpleServiceInRecursive2 + foo:myTotalServiceInRecursive + foo:myTotalServiceInRecursiveForReferenceOverride + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/MathService.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/MathService.composite new file mode 100644 index 0000000000..59f8fa6981 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/MathService.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myListService.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myListService.composite new file mode 100644 index 0000000000..819c399a7e --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myListService.composite @@ -0,0 +1,33 @@ + + + + + + + + + 2007 + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myServiceInComposite.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myServiceInComposite.composite new file mode 100644 index 0000000000..38e58f31a7 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myServiceInComposite.composite @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + CARY + 2007 + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myServiceInRecursive.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myServiceInRecursive.composite new file mode 100644 index 0000000000..4b54f430b9 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myServiceInRecursive.composite @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleService.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleService.composite new file mode 100644 index 0000000000..2281149b19 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleService.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + CARY + 2007 + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite new file mode 100644 index 0000000000..82b022b4d8 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite new file mode 100644 index 0000000000..0547ac977f --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalService.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalService.composite new file mode 100644 index 0000000000..eb00da6c76 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalService.composite @@ -0,0 +1,34 @@ + + + + + foo:myservice + + + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite new file mode 100644 index 0000000000..87ca0641af --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite new file mode 100644 index 0000000000..9354da4d9c --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite new file mode 100644 index 0000000000..b5083feaa6 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CARY + 2007 + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite new file mode 100644 index 0000000000..b1b47530a4 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CARY + 2007 + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myservice.composite b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myservice.composite new file mode 100644 index 0000000000..a4f57a58b0 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/main/resources/myservice.composite @@ -0,0 +1,52 @@ + + + + + + + + + + + NC + 2007 + + + + + + + + + + + + + 2006 + + + + + + + diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java new file mode 100644 index 0000000000..3853b1ff85 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.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 static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ComponentContextTestCase { + + private SCADomain domain; + + @Test + public void simpleLocate() { + BasicService service = domain.getService(BasicService.class, "BasicServiceComponent"); + assertEquals(-99, service.negate(99)); + } + + @Test + public void delegateViaDefinedReference() { + BasicService service = domain.getService(BasicService.class, "BasicServiceComponent"); + assertEquals(-99, service.delegateNegate(99)); + } + + @Before + public void init() throws Exception { + domain = SCADomain.newInstance("http://localhost", "/", "BasicService.composite", "MathService.composite"); + } + + @After + public void destroy() throws Exception { + domain.close(); + } +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java new file mode 100644 index 0000000000..a39cbbbbca --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java @@ -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 junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class ComponentServiceReferenceListTestCaseFIXME extends TestCase { + private MyListService myListService; + private MyListServiceByYear myListServiceByYear; + + private SCADomain domain; + + public void testDefaultProperty() { + assertEquals("2007", myListService.getYear()); + + } + + public void testDefaultService() { + assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]); + + } + + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CompositeTest.composite"); + myListService = domain.getService(MyListService.class, "MyNewListService"); + myListServiceByYear = domain.getService(MyListServiceByYear.class, "MyNewListService"); + } + + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java new file mode 100644 index 0000000000..b5c6a0d7b5 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java @@ -0,0 +1,64 @@ +/* + * 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.sca.host.embedded.SCADomain; + +public class ComponentServiceReferenceTestCase extends TestCase { + private MyTotalService myService; + private SCADomain domain; + + 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); + */ + } + + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CompositeTest.composite"); + myService = domain.getService(MyTotalService.class, "MyTotalService"); + } + + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java new file mode 100644 index 0000000000..d136530412 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java @@ -0,0 +1,98 @@ +/* + * 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 static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertFalse; + +import java.util.Date; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ComponentTestCase { + private static MyService myService; + private static MyServiceByDate myServiceByDate; + private static MyListService myListService; + private static MyListServiceByYear myListServiceByYear; + private static MyService myNCService; + private static MyListService myListServiceFor2006; + + private static SCADomain domain; + + @Test + public void testDefaultProperty() { + assertEquals("RTP", myService.getLocation()); + assertEquals("2006", myService.getYear()); + + } + + @Test + public void testDefaultService() { + assertEquals(myService.nextHoliday(), myServiceByDate.nextHolidayByDate(new Date())); + assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2006)[0]); + + } + + @Test + public void testOverrideProperty() { + assertEquals("NC", myNCService.getLocation()); + assertEquals("2007", myNCService.getYear()); + } + + @Test + public void testServiceWithOverrideProperty() { + assertFalse(myNCService.nextHoliday() == myService.nextHoliday()); + assertEquals(myListServiceFor2006.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2006)[0]); + + } + + @Test + 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); + */ + } + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("CompositeTest.composite"); + myService = domain.getService(MyService.class, "MyService"); + myServiceByDate = domain.getService(MyServiceByDate.class, "MyServiceByDate"); + myListService = domain.getService(MyListService.class, "MyListService"); + myListServiceByYear = domain.getService(MyListServiceByYear.class, "MyListServiceByYear"); + myNCService = domain.getService(MyService.class, "MyNCService"); + myListServiceFor2006 = domain.getService(MyListService.class, "MyListServiceFor2006"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java new file mode 100644 index 0000000000..38a98e01e2 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java @@ -0,0 +1,106 @@ +/* + * 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.host.embedded.SCADomain; + +@SuppressWarnings("deprecation") +public class CompositeOneService2LevelTestCaseFIXME extends TestCase { + private MyService myService; + private MyService myServiceDefault; + private MyService myServiceNo; + private MyService myServiceMay; + private MyService myServiceMust; + + private SCADomain domain; + + 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() { + //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); + */ + } + + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CompositeTest.composite"); + myService = domain.getService(MyService.class, "MySimpleServiceInRecursiveComponent"); + myServiceDefault = domain.getService(MyService.class, "MySimpleServiceDefault"); + myServiceNo = domain.getService(MyService.class, "MySimpleServiceNo"); + myServiceMay = domain.getService(MyService.class, "MySimpleServiceMay"); + myServiceMust = domain.getService(MyService.class, "MySimpleServiceMust"); + } + + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java new file mode 100644 index 0000000000..c29e9e72b3 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java @@ -0,0 +1,60 @@ +/* + * 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.host.embedded.SCADomain; + +public class CompositeOneServiceTestCase extends TestCase { + private MyService myService; + private SCADomain domain; + + 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); + */ + } + + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CompositeTest.composite"); + myService = domain.getService(MyService.class, "MySimpleServiceInRecursive"); + } + + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java new file mode 100644 index 0000000000..eb846ddb71 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java @@ -0,0 +1,80 @@ +/* + * 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.sca.host.embedded.SCADomain; + +public class CompositeServiceReferenceForRefOverrideTestCase extends TestCase { + private MyTotalService myService1; + private MyTotalService myService2; + private MyTotalService myService3; + private SCADomain domain; + + 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 { + domain = SCADomain.newInstance("CompositeTest.composite"); + myService1 = domain.getService(MyTotalService.class, "MyTotalServiceNo"); + myService2 = domain.getService(MyTotalService.class, "MyTotalServiceMay"); + myService3 = domain.getService(MyTotalService.class, "MyTotalServiceMust"); + } + + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java new file mode 100644 index 0000000000..60ee8b2011 --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java @@ -0,0 +1,92 @@ +/* + * 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.sca.host.embedded.SCADomain; + +public class CompositeServiceReferenceTestCase extends TestCase { + private MyTotalService myService1; + private MyTotalService myService2; + private MyTotalService myService3; + private MyTotalService myService4; + private MyTotalService myService5; + private SCADomain domain; + + public void FIXMEtestPropertyWithServiceFromRecursive() { + 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 FIXMEtestServiceFromRecursive() { + 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 { + domain = SCADomain.newInstance("CompositeTest.composite"); + myService1 = domain.getService(MyTotalService.class, "MyTotalServiceFromRecursive"); + myService2 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithRecursive"); + myService3 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithComponentService"); + myService4 = domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithRecursiveUseService"); + myService5 = + domain.getService(MyTotalService.class, "MyTotalServiceInCompositeWithComponentServiceUseService"); + } + + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java new file mode 100644 index 0000000000..d9c2a73f7e --- /dev/null +++ b/tags/java/sca/0.90-rc1-incubating/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java @@ -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 static junit.framework.Assert.assertEquals; + +import java.util.Date; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CompositeTestCase { + private static MyService myService; + private static MyServiceByDate myServiceByDate; + private static MyListService myListService; + private static MyListServiceByYear myListServiceByYear; + + private static SCADomain domain; + + @Test + public void testOverrideProperty() { + assertEquals("CARY", myService.getLocation()); + assertEquals("2007", myService.getYear()); + + } + + @Test + public void testDefaultService() { + assertEquals(myService.nextHoliday(), myServiceByDate.nextHolidayByDate(new Date())); + assertEquals(myListService.getHolidays()[0], myListServiceByYear.getHolidaysByYear(2007)[0]); + + } + + @Test + 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); + */ + } + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("CompositeTest.composite"); + myService = domain.getService(MyService.class, "MyServiceInRecursiveMyService"); + myServiceByDate = domain.getService(MyServiceByDate.class, "MyServiceInRecursiveMyServiceByDate"); + myListService = domain.getService(MyListService.class, "MyServiceInRecursiveMyListService"); + myListServiceByYear = domain.getService(MyListServiceByYear.class, + "MyServiceInRecursiveMyListServiceByYear"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } +} -- cgit v1.2.3