From e5b7380c874745c989d1816b8f552504f038e1bc Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 26 Sep 2013 20:33:20 +0000 Subject: 2.0 branch for possible maintenance release git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1526672 13f79535-47bb-0310-9956-ffa450edef68 --- .../branches/2.0/testing/itest/services/pom.xml | 40 +++++++ .../tuscany/sca/itest/services/AComponent.java | 27 +++++ .../tuscany/sca/itest/services/AComponentImpl.java | 28 +++++ .../tuscany/sca/itest/services/BComponent.java | 25 ++++ .../tuscany/sca/itest/services/BComponentImpl.java | 31 +++++ .../tuscany/sca/itest/services/CComponent.java | 27 +++++ .../tuscany/sca/itest/services/CComponentImpl.java | 28 +++++ .../tuscany/sca/itest/services/D1Component.java | 24 ++++ .../tuscany/sca/itest/services/DComponent.java | 24 ++++ .../tuscany/sca/itest/services/DComponentImpl.java | 34 ++++++ .../sca/itest/services/SubGenericsService.java | 25 ++++ .../itest/services/SubGenericsServiceClient.java | 27 +++++ .../services/SubGenericsServiceClientImpl.java | 51 +++++++++ .../sca/itest/services/SubGenericsServiceImpl.java | 29 +++++ .../sca/itest/services/SuperGenericsService.java | 28 +++++ .../itest/services/SuperGenericsServiceImpl.java | 29 +++++ .../main/resources/META-INF/sca-contribution.xml | 23 ++++ .../src/main/resources/ServicesTest.composite | 81 +++++++++++++ .../sca/itest/services/ServicesTestCase.java | 127 +++++++++++++++++++++ 19 files changed, 708 insertions(+) create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsService.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClient.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClientImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsService.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsServiceImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/main/resources/ServicesTest.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java (limited to 'sca-java-2.x/branches/2.0/testing/itest/services') diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/services/pom.xml new file mode 100644 index 0000000000..8a3b16c1a5 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/pom.xml @@ -0,0 +1,40 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-services + Apache Tuscany SCA iTest Services + + + + org.apache.tuscany.sca + tuscany-base-runtime-pom + pom + 2.0 + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java new file mode 100644 index 0000000000..26e58dc530 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.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.itest.services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface AComponent { + String foo(); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java new file mode 100644 index 0000000000..627ff4976f --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.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.itest.services; + +public class AComponentImpl implements AComponent { + + public String foo() { + return "AComponent"; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java new file mode 100644 index 0000000000..d04bd1b985 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.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.itest.services; + +public interface BComponent { + + String foo(); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java new file mode 100644 index 0000000000..01df89a8fa --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.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.itest.services; + +import org.oasisopen.sca.annotation.Service; + +@Service(BComponent.class) +public class BComponentImpl implements BComponent { + + public String foo() { + return "BComponent"; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java new file mode 100644 index 0000000000..07397e4502 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.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.itest.services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CComponent { + String foo(); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java new file mode 100644 index 0000000000..8713e5ab22 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.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.itest.services; + +public class CComponentImpl implements CComponent { + + public String foo() { + return "CComponent"; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java new file mode 100644 index 0000000000..842a85e000 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.services; + +public interface D1Component { + String foo1(); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java new file mode 100644 index 0000000000..8a3923b351 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.services; + +public interface DComponent { + String foo(); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java new file mode 100644 index 0000000000..e52692fbf4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.services; + +import org.oasisopen.sca.annotation.Service; + +@Service({DComponent.class, D1Component.class}) +public class DComponentImpl implements DComponent, D1Component { + + public String foo() { + return "DComponent"; + } + + public String foo1() { + return "DComponent"; + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsService.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsService.java new file mode 100644 index 0000000000..2cc6cde689 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsService.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.itest.services; + +public interface SubGenericsService extends SuperGenericsService { + + void print(); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClient.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClient.java new file mode 100644 index 0000000000..8a156b6ee9 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClient.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.itest.services; + +public interface SubGenericsServiceClient { + + void print(); + + T doIt(T anything); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClientImpl.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClientImpl.java new file mode 100644 index 0000000000..63c4c195ec --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClientImpl.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.services; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(SubGenericsServiceClient.class) +public class SubGenericsServiceClientImpl implements SubGenericsServiceClient { + + private SubGenericsService subGenericsService; + + public String doIt(String anything) { + return subGenericsService.doIt(anything); + } + + public void print() { + subGenericsService.print(); + + } + + public SubGenericsService getSubGenericsService() { + return subGenericsService; + } + + @Reference + public void setSubGenericsService(SubGenericsService subGenericsService) { + this.subGenericsService = subGenericsService; + } + + + + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceImpl.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceImpl.java new file mode 100644 index 0000000000..6b2ddfbe8c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceImpl.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.itest.services; + + +public class SubGenericsServiceImpl extends SuperGenericsServiceImpl + implements SubGenericsService{ + + public void print(){ + System.out.println("I am print."); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsService.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsService.java new file mode 100644 index 0000000000..9a3e0f0925 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsService.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.itest.services; + +/** + * The interface for SuperGenericsService. + * + */ +public interface SuperGenericsService { + + T doIt(T anything); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsServiceImpl.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsServiceImpl.java new file mode 100644 index 0000000000..cce2a5d355 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsServiceImpl.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.itest.services; + + +public abstract class SuperGenericsServiceImpl implements SuperGenericsService{ + + public T doIt(T anything){ + return anything; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a687b3481a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/main/resources/ServicesTest.composite b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/resources/ServicesTest.composite new file mode 100644 index 0000000000..94c7fd33e4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/main/resources/ServicesTest.composite @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java new file mode 100644 index 0000000000..05f1c98bc7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java @@ -0,0 +1,127 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.services; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.ServiceRuntimeException; + +public class ServicesTestCase { + private static Node node; + + @BeforeClass + public static void init() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("ServicesTest.composite"); + node = NodeFactory.newInstance().createNode("ServicesTest.composite", new Contribution("c1", location)); + node.start(); + } + + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + @Test + public void testAService() { + AComponent a1 = node.getService(AComponent.class, "AComponent1"); + assertEquals("AComponent", a1.foo()); + + AComponent a2 = node.getService(AComponent.class, "AComponent2/AComponent"); + assertEquals("AComponent", a2.foo()); + } + + @Test + public void testBService() { + BComponent a1 = node.getService(BComponent.class, "BComponent1"); + assertEquals("BComponent", a1.foo()); + + BComponent a2 = node.getService(BComponent.class, "BComponent2/BComponent"); + assertEquals("BComponent", a2.foo()); + } + + @Test + public void testCService() { + CComponent a1 = node.getService(CComponent.class, "CComponent1"); + assertEquals("CComponent", a1.foo()); + + CComponent a2 = node.getService(CComponent.class, "CComponent2/CComponent"); + assertEquals("CComponent", a2.foo()); + } + + @Test + public void testDService() { + DComponent a1 = node.getService(DComponent.class, "DComponent1/DComponent"); + assertEquals("DComponent", a1.foo()); + + D1Component a2 = node.getService(D1Component.class, "DComponent1/D1Component"); + assertEquals("DComponent", a2.foo1()); + + try { + node.getService(DComponent.class, "DComponent1"); + Assert.fail("The service name is required"); + } catch (ServiceRuntimeException e) { + Assert.assertTrue("The service name is required", true); + } + + DComponent a3 = node.getService(DComponent.class, "DComponent2/DComponent"); + assertEquals("DComponent", a3.foo()); + + D1Component a4 = node.getService(D1Component.class, "DComponent2/D1Component"); + assertEquals("DComponent", a4.foo1()); + + } + + + @Test + public void testSCASubGenericsServiceDoIt() throws Exception{ + @SuppressWarnings("unchecked") + SubGenericsServiceClient subGenericsServiceClient = node.getService(SubGenericsServiceClient.class, "SubGenericsServiceClientSCAComponent"); + String actual = "noting"; + String expected = subGenericsServiceClient.doIt(actual); + Assert.assertEquals(actual, expected); + } + + @Test + public void testSCASubGenericsServicePrint() throws Exception{ + @SuppressWarnings("unchecked") + SubGenericsServiceClient subGenericsServiceClient = node.getService(SubGenericsServiceClient.class, "SubGenericsServiceClientSCAComponent"); + subGenericsServiceClient.print(); + } + + public static void main(String[] args) throws Exception { + ServicesTestCase.init(); + ServicesTestCase tester = new ServicesTestCase(); + tester.testAService(); + tester.testBService(); + tester.testCService(); + tester.testDService(); + tester.testSCASubGenericsServiceDoIt(); + tester.testSCASubGenericsServicePrint(); + ServicesTestCase.destroy(); + } +} -- cgit v1.2.3