diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2012-02-20 14:36:06 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2012-02-20 14:36:06 +0000 |
commit | b5ba62cdcf6af33bfd3807f77f8714bba1ef73f8 (patch) | |
tree | 32039b9f6e88583175ac7d3b1649b7291aaa3993 /sca-java-2.x/trunk/testing/itest | |
parent | 005ecc6b09c01be18cf558dfda84b316af6bb4b0 (diff) |
TUSCANY-2735 - add Rodolfo's generics testing patch.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1291283 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/testing/itest')
8 files changed, 219 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsService.java b/sca-java-2.x/trunk/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/trunk/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<String> { + + void print(); +} diff --git a/sca-java-2.x/trunk/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClient.java b/sca-java-2.x/trunk/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/trunk/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<T> { + + void print(); + + T doIt(T anything); +} diff --git a/sca-java-2.x/trunk/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceClientImpl.java b/sca-java-2.x/trunk/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/trunk/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<String> { + + 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/trunk/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SubGenericsServiceImpl.java b/sca-java-2.x/trunk/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/trunk/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<String> + implements SubGenericsService{ + + public void print(){ + System.out.println("I am print."); + } +} diff --git a/sca-java-2.x/trunk/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsService.java b/sca-java-2.x/trunk/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/trunk/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> { + + T doIt(T anything); +} diff --git a/sca-java-2.x/trunk/testing/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/SuperGenericsServiceImpl.java b/sca-java-2.x/trunk/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/trunk/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<T> implements SuperGenericsService<T>{ + + public T doIt(T anything){ + return anything; + } + +} diff --git a/sca-java-2.x/trunk/testing/itest/services/src/main/resources/ServicesTest.composite b/sca-java-2.x/trunk/testing/itest/services/src/main/resources/ServicesTest.composite index 49fdf02f4b..94c7fd33e4 100644 --- a/sca-java-2.x/trunk/testing/itest/services/src/main/resources/ServicesTest.composite +++ b/sca-java-2.x/trunk/testing/itest/services/src/main/resources/ServicesTest.composite @@ -67,4 +67,15 @@ </service> </component> + + <!-- Component used to implement SubGenericsService --> + <component name="SubGenericsServiceComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.services.SubGenericsServiceImpl"/> + </component> + + <!-- A SubGenericsServiceClientImpl component that uses SCA binding to invoke SubGenericsService service --> + <component name="SubGenericsServiceClientSCAComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.services.SubGenericsServiceClientImpl" /> + <reference name="subGenericsService" target="SubGenericsServiceComponent"/> + </component> </composite>
\ No newline at end of file diff --git a/sca-java-2.x/trunk/testing/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java b/sca-java-2.x/trunk/testing/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java index da779b2c54..05f1c98bc7 100644 --- a/sca-java-2.x/trunk/testing/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java +++ b/sca-java-2.x/trunk/testing/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java @@ -95,6 +95,23 @@ public class ServicesTestCase { assertEquals("DComponent", a4.foo1()); } + + + @Test + public void testSCASubGenericsServiceDoIt() throws Exception{ + @SuppressWarnings("unchecked") + SubGenericsServiceClient<String> 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<String> subGenericsServiceClient = node.getService(SubGenericsServiceClient.class, "SubGenericsServiceClientSCAComponent"); + subGenericsServiceClient.print(); + } public static void main(String[] args) throws Exception { ServicesTestCase.init(); @@ -103,6 +120,8 @@ public class ServicesTestCase { tester.testBService(); tester.testCService(); tester.testDService(); + tester.testSCASubGenericsServiceDoIt(); + tester.testSCASubGenericsServicePrint(); ServicesTestCase.destroy(); } } |