From d5f1d093fe6fa491cdec392dca7137639e98d149 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 15 Sep 2008 00:26:00 +0000 Subject: Pulled a recent revision of trunk into the sca-android branch, to apply the android patches from JIRA TUSCANY-2440 to it. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@695318 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/circular/include/DemoClass.java | 27 +++++ .../src/main/java/composite/CompositeClient.java | 42 ++++++++ .../recursive/src/main/java/composite/Source.java | 24 +++++ .../src/main/java/composite/SourceCallback.java | 24 +++++ .../src/main/java/composite/SourceImpl.java | 55 ++++++++++ .../recursive/src/main/java/composite/Target.java | 30 ++++++ .../src/main/java/composite/TargetImpl.java | 41 ++++++++ .../itest/recursive/src/main/java/foo/A.java | 28 +++++ .../itest/recursive/src/main/java/foo/B.java | 36 +++++++ .../itest/recursive/src/main/java/foo/I.java | 23 +++++ .../recursive/src/main/java/policy/Target.java | 26 +++++ .../src/main/java/policy/TargetClientImpl.java | 33 ++++++ .../src/main/java/policy/TargetServiceImpl.java | 29 ++++++ .../src/main/java/sample/ComponentAImpl.java | 41 ++++++++ .../src/main/java/sample/ComponentCImpl.java | 41 ++++++++ .../src/main/java/sample/ComponentEImpl.java | 38 +++++++ .../src/main/java/sample/ComponentFImpl.java | 45 ++++++++ .../recursive/src/main/java/sample/Service1.java | 27 +++++ .../recursive/src/main/java/test/Aggregator.java | 27 +++++ .../src/main/java/test/AggregatorImpl.java | 55 ++++++++++ .../src/main/java/test/InnerSourceImpl.java | 34 +++++++ .../src/main/java/test/OuterSourceImpl.java | 34 +++++++ .../itest/recursive/src/main/java/test/Source.java | 30 ++++++ .../src/main/java/test1/composite/Target.java | 23 +++++ .../src/main/java/test1/composite/TargetOne.java | 29 ++++++ .../src/main/java/test1/composite/TargetTwo.java | 29 ++++++ .../src/main/resources/AComposite.composite | 30 ++++++ .../src/main/resources/BComposite.composite | 45 ++++++++ .../src/main/resources/CComposite.composite | 44 ++++++++ .../src/main/resources/Composite1.composite | 42 ++++++++ .../src/main/resources/Composite2.composite | 43 ++++++++ .../src/main/resources/Composite3.composite | 48 +++++++++ .../src/main/resources/Demo1Composite.composite | 27 +++++ .../src/main/resources/Demo2Composite.composite | 28 +++++ .../recursive/src/main/resources/Inner.composite | 45 ++++++++ .../src/main/resources/InnerComposite.composite | 41 ++++++++ .../src/main/resources/InnerComposite2.composite | 33 ++++++ .../main/resources/META-INF/sca-contribution.xml | 24 +++++ .../recursive/src/main/resources/Outer.composite | 39 +++++++ .../src/main/resources/OuterComposite.composite | 39 +++++++ .../itest/recursive/src/main/resources/foo/foo.png | Bin 0 -> 571816 bytes .../recursive/src/main/resources/foo/o1.composite | 31 ++++++ .../recursive/src/main/resources/foo/o2.composite | 31 ++++++ .../recursive/src/main/resources/foo/o3.composite | 35 +++++++ .../recursive/src/main/resources/foo/o4.composite | 37 +++++++ .../policy/PolicyInnerComposite.composite | 32 ++++++ .../policy/PolicyOuterComposite.composite | 35 +++++++ .../src/main/resources/policy/definitions.xml | 46 +++++++++ .../main/resources/test1/InnerComposite.composite | 39 +++++++ .../main/resources/test1/OuterComposite.composite | 27 +++++ .../circular/include/CircularIncludeTestCase.java | 39 +++++++ .../src/test/java/composite/CompositeTestCase.java | 51 ++++++++++ .../LocateServiceEmbeddedSCADomainTestCase.java | 113 +++++++++++++++++++++ .../composite/LocateServiceSCADomainTestCase.java | 73 +++++++++++++ .../recursive/src/test/java/foo/O2TestCase.java | 32 ++++++ .../recursive/src/test/java/foo/O4TestCase.java | 39 +++++++ .../src/test/java/policy/PolicyTestCase.java | 68 +++++++++++++ .../itest/recursive/src/test/java/sample/C.java | 32 ++++++ .../recursive/src/test/java/sample/CImpl.java | 80 +++++++++++++++ .../src/test/java/sample/NestedTestCase.java | 96 +++++++++++++++++ .../sample/RecursiveCompositeTestCaseFIXME.java | 53 ++++++++++ .../itest/recursive/src/test/java/sample/X.java | 32 ++++++ .../recursive/src/test/java/sample/XImpl.java | 37 +++++++ .../itest/recursive/src/test/java/sample/Y.java | 32 ++++++ .../recursive/src/test/java/sample/YImpl.java | 38 +++++++ .../src/test/java/test/InnerTestCase.java | 51 ++++++++++ .../src/test/java/test/OuterTestCase.java | 53 ++++++++++ .../test1/composite/CompositeClientTestCase.java | 62 +++++++++++ 68 files changed, 2693 insertions(+) create mode 100644 branches/sca-android/itest/recursive/src/main/java/circular/include/DemoClass.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/composite/CompositeClient.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/composite/Source.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/composite/SourceCallback.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/composite/SourceImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/composite/Target.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/composite/TargetImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/foo/A.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/foo/B.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/foo/I.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/policy/Target.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/policy/TargetClientImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/policy/TargetServiceImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/sample/ComponentAImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/sample/ComponentCImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/sample/ComponentEImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/sample/ComponentFImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/sample/Service1.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/test/Aggregator.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/test/AggregatorImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/test/InnerSourceImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/test/OuterSourceImpl.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/test/Source.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/test1/composite/Target.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetOne.java create mode 100644 branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetTwo.java create mode 100644 branches/sca-android/itest/recursive/src/main/resources/AComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/BComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/CComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/Composite1.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/Composite2.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/Composite3.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/Demo1Composite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/Demo2Composite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/Inner.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/InnerComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/InnerComposite2.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/META-INF/sca-contribution.xml create mode 100644 branches/sca-android/itest/recursive/src/main/resources/Outer.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/OuterComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/foo/foo.png create mode 100644 branches/sca-android/itest/recursive/src/main/resources/foo/o1.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/foo/o2.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/foo/o3.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/foo/o4.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/policy/definitions.xml create mode 100644 branches/sca-android/itest/recursive/src/main/resources/test1/InnerComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/main/resources/test1/OuterComposite.composite create mode 100644 branches/sca-android/itest/recursive/src/test/java/circular/include/CircularIncludeTestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/composite/CompositeTestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/foo/O2TestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/foo/O4TestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/policy/PolicyTestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/sample/C.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/sample/CImpl.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/sample/NestedTestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/sample/X.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/sample/XImpl.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/sample/Y.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/sample/YImpl.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/test/InnerTestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/test/OuterTestCase.java create mode 100644 branches/sca-android/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java (limited to 'branches/sca-android/itest/recursive/src') diff --git a/branches/sca-android/itest/recursive/src/main/java/circular/include/DemoClass.java b/branches/sca-android/itest/recursive/src/main/java/circular/include/DemoClass.java new file mode 100644 index 0000000000..fe42911486 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/circular/include/DemoClass.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 circular.include; + +public class DemoClass { + + public String demo() { + return "hello"; + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/composite/CompositeClient.java b/branches/sca-android/itest/recursive/src/main/java/composite/CompositeClient.java new file mode 100644 index 0000000000..5edc305970 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/composite/CompositeClient.java @@ -0,0 +1,42 @@ +/* + * 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 composite; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Simple client program that invokes the components that we wired together. + * + * @version $Rev$ $Date$ + */ +public class CompositeClient { + + public static void main(String[] args) throws Exception { + SCADomain domain = SCADomain.newInstance("OuterComposite.composite"); + + Source source = domain.getService(Source.class, "SourceComponent"); + + System.out.println("Main thread " + Thread.currentThread()); + source.clientMethod("Client.main"); + Thread.sleep(500); + + domain.close(); + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/composite/Source.java b/branches/sca-android/itest/recursive/src/main/java/composite/Source.java new file mode 100644 index 0000000000..d0efcc1df1 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/composite/Source.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 composite; + +public interface Source { + + void clientMethod(String arg); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/composite/SourceCallback.java b/branches/sca-android/itest/recursive/src/main/java/composite/SourceCallback.java new file mode 100644 index 0000000000..baa95a8e39 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/composite/SourceCallback.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 composite; + +public interface SourceCallback { + + void receiveResult(String result); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/composite/SourceImpl.java b/branches/sca-android/itest/recursive/src/main/java/composite/SourceImpl.java new file mode 100644 index 0000000000..b9a0c7ff74 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/composite/SourceImpl.java @@ -0,0 +1,55 @@ +/* + * 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 composite; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + + +@Service(Source.class) +@Scope("COMPOSITE") +public class SourceImpl implements Source, SourceCallback { + + private Target targetReference; + private Target targetReference2; + + @Reference + public void setTargetReference(Target target) { + this.targetReference = target; + } + + @Reference + public void setTargetReference2(Target target) { + this.targetReference2 = target; + } + + public void clientMethod(String arg) { + System.out.println("Source: " + arg + " -> Source.clientMethod"); + targetReference.someMethod(arg + " -> Source.clientMethod"); + + System.out.println("Source: " + arg + " => Source.clientMethod2"); + targetReference2.someMethod(arg + " => Source.clientMethod2"); + } + + public void receiveResult(String result) { + System.out.println("Work thread " + Thread.currentThread()); + System.out.println("Result: " + result); + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/composite/Target.java b/branches/sca-android/itest/recursive/src/main/java/composite/Target.java new file mode 100644 index 0000000000..9a8f68a7fa --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/composite/Target.java @@ -0,0 +1,30 @@ +/* + * 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 composite; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.OneWay; + + +@Callback(SourceCallback.class) +public interface Target { + + @OneWay + void someMethod(String arg); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/composite/TargetImpl.java b/branches/sca-android/itest/recursive/src/main/java/composite/TargetImpl.java new file mode 100644 index 0000000000..86686e9233 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/composite/TargetImpl.java @@ -0,0 +1,41 @@ +/* + * 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 composite; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + + +@Service(Target.class) +@Scope("COMPOSITE") +public class TargetImpl implements Target { + + private SourceCallback sourceCallback; + + @Callback + public void setSourceCallback(SourceCallback sourceCallback) { + this.sourceCallback = sourceCallback; + } + + public void someMethod(String arg) { + System.out.println("Target: " + arg); + sourceCallback.receiveResult(arg + " -> Target.someMethod"); + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/foo/A.java b/branches/sca-android/itest/recursive/src/main/java/foo/A.java new file mode 100644 index 0000000000..e87cbde26d --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/foo/A.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 foo; + +import org.osoa.sca.annotations.Service; + +@Service(I.class) +public class A implements I { + public String get(int i) { + return A.class.getName(); + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/foo/B.java b/branches/sca-android/itest/recursive/src/main/java/foo/B.java new file mode 100644 index 0000000000..9d060cab59 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/foo/B.java @@ -0,0 +1,36 @@ +/* + * 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 foo; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(I.class) +public class B implements I { + protected I i = null; + + @Reference(name = "i", required = true) + public void setC(I c) { + this.i = c; + } + + public String get(int i) { + return this.i.get(i); + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/foo/I.java b/branches/sca-android/itest/recursive/src/main/java/foo/I.java new file mode 100644 index 0000000000..f6d55baef3 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/foo/I.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 foo; + +public interface I { + String get(int i); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/policy/Target.java b/branches/sca-android/itest/recursive/src/main/java/policy/Target.java new file mode 100644 index 0000000000..c77fcea868 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/policy/Target.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 policy; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Target { + String hello(String arg); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/policy/TargetClientImpl.java b/branches/sca-android/itest/recursive/src/main/java/policy/TargetClientImpl.java new file mode 100644 index 0000000000..87e412829e --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/policy/TargetClientImpl.java @@ -0,0 +1,33 @@ +/* + * 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 policy; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(Target.class) +public class TargetClientImpl implements Target { + + @Reference + protected Target targetService; + + public String hello(String arg) { + return "Target: Hello " + targetService.hello(arg) + "!"; + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/policy/TargetServiceImpl.java b/branches/sca-android/itest/recursive/src/main/java/policy/TargetServiceImpl.java new file mode 100644 index 0000000000..e565055252 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/policy/TargetServiceImpl.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 policy; + +import org.osoa.sca.annotations.Service; + +@Service(Target.class) +public class TargetServiceImpl implements Target { + + public String hello(String arg) { + return "Target: Hello " + arg + "!"; + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/sample/ComponentAImpl.java b/branches/sca-android/itest/recursive/src/main/java/sample/ComponentAImpl.java new file mode 100644 index 0000000000..f513949105 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/sample/ComponentAImpl.java @@ -0,0 +1,41 @@ +/* + * 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 sample; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Service1.class) +public class ComponentAImpl implements Service1 { + + @Reference(name = "Reference1", required = false) + protected Service1 ref; + + public String track(String source) { + if (ref != null) { + return ref.track(source + "-->ComponentA"); + } + return source + "-->ComponentA"; + } + +} diff --git a/branches/sca-android/itest/recursive/src/main/java/sample/ComponentCImpl.java b/branches/sca-android/itest/recursive/src/main/java/sample/ComponentCImpl.java new file mode 100644 index 0000000000..586a9ee6a7 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/sample/ComponentCImpl.java @@ -0,0 +1,41 @@ +/* + * 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 sample; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Service1.class) +public class ComponentCImpl implements Service1 { + + @Reference(name = "Reference1", required = false) + protected Service1 ref; + + public String track(String source) { + if (ref != null) { + return ref.track(source + "-->ComponentC"); + } + return source + "-->ComponentC"; + } + +} diff --git a/branches/sca-android/itest/recursive/src/main/java/sample/ComponentEImpl.java b/branches/sca-android/itest/recursive/src/main/java/sample/ComponentEImpl.java new file mode 100644 index 0000000000..dbf2735aa7 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/sample/ComponentEImpl.java @@ -0,0 +1,38 @@ +/* + * 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 sample; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class ComponentEImpl implements Service1 { + @Property(name = "Property1") + protected String prefix; + + @Reference(name = "Reference1") + protected Service1 ref; + + public String track(String source) { + return ref.track(source + "-->ComponentE"); + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/sample/ComponentFImpl.java b/branches/sca-android/itest/recursive/src/main/java/sample/ComponentFImpl.java new file mode 100644 index 0000000000..5e136e536c --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/sample/ComponentFImpl.java @@ -0,0 +1,45 @@ +/* + * 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 sample; + +import org.osoa.sca.annotations.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class ComponentFImpl implements Service1 { + + private Service1 ref; + + public String track(String source) { + if (ref != null) { + return ref.track(source + "-->ComponentF"); + } else { + System.err.println("Reference1 is not wired..."); + return source + "-->ComponentF"; + } + } + + @Reference(name = "Reference1") + public void setComponentA(Service1 ref) { + this.ref = ref; + } + +} diff --git a/branches/sca-android/itest/recursive/src/main/java/sample/Service1.java b/branches/sca-android/itest/recursive/src/main/java/sample/Service1.java new file mode 100644 index 0000000000..81bdce79f1 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/sample/Service1.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 sample; + +/** + * @version $Rev$ $Date$ + */ +public interface Service1 { + String track(String source); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/test/Aggregator.java b/branches/sca-android/itest/recursive/src/main/java/test/Aggregator.java new file mode 100644 index 0000000000..88b3bed1b2 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/test/Aggregator.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 test; + +/** + * @version $Rev$ $Date$ + */ +public interface Aggregator { + String getAggregatedData(); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/test/AggregatorImpl.java b/branches/sca-android/itest/recursive/src/main/java/test/AggregatorImpl.java new file mode 100644 index 0000000000..f6ac6c8741 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/test/AggregatorImpl.java @@ -0,0 +1,55 @@ +/* + * 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 test; + +import java.util.List; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Aggregator.class) +public class AggregatorImpl implements Aggregator { + + @Reference(name = "uniSource") + protected Source source; + + @Reference(name = "multiSource") + protected List sources; + + public String getAggregatedData() { + System.out.println("uniSource: " + source.getData()); + StringBuffer sb = new StringBuffer(); + int i = 0; + for (Source s : sources) { + if (i != 0) { + sb.append(", "); + } else { + sb.append("multiSource: "); + } + sb.append(s.getData()); + i++; + } + return sb.toString(); + } + +} diff --git a/branches/sca-android/itest/recursive/src/main/java/test/InnerSourceImpl.java b/branches/sca-android/itest/recursive/src/main/java/test/InnerSourceImpl.java new file mode 100644 index 0000000000..c8dad5ae35 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/test/InnerSourceImpl.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 test; + +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Source.class) +public class InnerSourceImpl implements Source { + + public String getData() { + return "InnerSource"; + } + +} diff --git a/branches/sca-android/itest/recursive/src/main/java/test/OuterSourceImpl.java b/branches/sca-android/itest/recursive/src/main/java/test/OuterSourceImpl.java new file mode 100644 index 0000000000..11816e82cf --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/test/OuterSourceImpl.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 test; + +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Source.class) +public class OuterSourceImpl implements Source { + + public String getData() { + return "OuterSource"; + } + +} diff --git a/branches/sca-android/itest/recursive/src/main/java/test/Source.java b/branches/sca-android/itest/recursive/src/main/java/test/Source.java new file mode 100644 index 0000000000..9b93740d9d --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/test/Source.java @@ -0,0 +1,30 @@ +/* + * 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 test; + +import org.osoa.sca.annotations.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface Source { + String getData(); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/test1/composite/Target.java b/branches/sca-android/itest/recursive/src/main/java/test1/composite/Target.java new file mode 100644 index 0000000000..4883e12f49 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/test1/composite/Target.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 test1.composite; + +public interface Target { + String hello(String arg); +} diff --git a/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetOne.java b/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetOne.java new file mode 100644 index 0000000000..a7c68f4ffd --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetOne.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 test1.composite; + +import org.osoa.sca.annotations.Service; + +@Service(Target.class) +public class TargetOne implements Target { + + public String hello(String arg) { + return "TargetOne: Hello " + arg + "!"; + } +} diff --git a/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetTwo.java b/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetTwo.java new file mode 100644 index 0000000000..7fff8e2e9b --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/java/test1/composite/TargetTwo.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 test1.composite; + +import org.osoa.sca.annotations.Service; + +@Service(Target.class) +public class TargetTwo implements Target { + + public String hello(String arg) { + return "TargetTwo: Hello " + arg + "!"; + } +} diff --git a/branches/sca-android/itest/recursive/src/main/resources/AComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/AComposite.composite new file mode 100644 index 0000000000..1b5dee8762 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/AComposite.composite @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/BComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/BComposite.composite new file mode 100644 index 0000000000..7d4588eba4 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/BComposite.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/CComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/CComposite.composite new file mode 100644 index 0000000000..6d7b4ec600 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/CComposite.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/Composite1.composite b/branches/sca-android/itest/recursive/src/main/resources/Composite1.composite new file mode 100644 index 0000000000..56fd7c621f --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/Composite1.composite @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + ABC + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/Composite2.composite b/branches/sca-android/itest/recursive/src/main/resources/Composite2.composite new file mode 100644 index 0000000000..54f10673a4 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/Composite2.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + XYZ + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/Composite3.composite b/branches/sca-android/itest/recursive/src/main/resources/Composite3.composite new file mode 100644 index 0000000000..040653493f --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/Composite3.composite @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + 123 + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/Demo1Composite.composite b/branches/sca-android/itest/recursive/src/main/resources/Demo1Composite.composite new file mode 100644 index 0000000000..6b2a964b9b --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/Demo1Composite.composite @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/Demo2Composite.composite b/branches/sca-android/itest/recursive/src/main/resources/Demo2Composite.composite new file mode 100644 index 0000000000..6b8c0a348e --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/Demo2Composite.composite @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/Inner.composite b/branches/sca-android/itest/recursive/src/main/resources/Inner.composite new file mode 100644 index 0000000000..398ebdf6e2 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/Inner.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/InnerComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/InnerComposite.composite new file mode 100644 index 0000000000..3376ac8ff5 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/InnerComposite.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/InnerComposite2.composite b/branches/sca-android/itest/recursive/src/main/resources/InnerComposite2.composite new file mode 100644 index 0000000000..c9eff4fa9d --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/InnerComposite2.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/META-INF/sca-contribution.xml b/branches/sca-android/itest/recursive/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..289b92a3f2 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/branches/sca-android/itest/recursive/src/main/resources/Outer.composite b/branches/sca-android/itest/recursive/src/main/resources/Outer.composite new file mode 100644 index 0000000000..987990d854 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/Outer.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/OuterComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/OuterComposite.composite new file mode 100644 index 0000000000..cb1c1e13d4 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/OuterComposite.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/foo/foo.png b/branches/sca-android/itest/recursive/src/main/resources/foo/foo.png new file mode 100644 index 0000000000..0f2ec78aaf Binary files /dev/null and b/branches/sca-android/itest/recursive/src/main/resources/foo/foo.png differ diff --git a/branches/sca-android/itest/recursive/src/main/resources/foo/o1.composite b/branches/sca-android/itest/recursive/src/main/resources/foo/o1.composite new file mode 100644 index 0000000000..1d31c2f424 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/foo/o1.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-android/itest/recursive/src/main/resources/foo/o2.composite b/branches/sca-android/itest/recursive/src/main/resources/foo/o2.composite new file mode 100644 index 0000000000..4f21c21860 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/foo/o2.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-android/itest/recursive/src/main/resources/foo/o3.composite b/branches/sca-android/itest/recursive/src/main/resources/foo/o3.composite new file mode 100644 index 0000000000..72c732c03e --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/foo/o3.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-android/itest/recursive/src/main/resources/foo/o4.composite b/branches/sca-android/itest/recursive/src/main/resources/foo/o4.composite new file mode 100644 index 0000000000..f8f07eed09 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/foo/o4.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite new file mode 100644 index 0000000000..4a6df023b8 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyInnerComposite.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite new file mode 100644 index 0000000000..25007aebb2 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/policy/PolicyOuterComposite.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/policy/definitions.xml b/branches/sca-android/itest/recursive/src/main/resources/policy/definitions.xml new file mode 100644 index 0000000000..957028e3bd --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/policy/definitions.xml @@ -0,0 +1,46 @@ + + + + + + + Test Intent One + + + + + + + + + + + + \ No newline at end of file diff --git a/branches/sca-android/itest/recursive/src/main/resources/test1/InnerComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/test1/InnerComposite.composite new file mode 100644 index 0000000000..177fa10550 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/test1/InnerComposite.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/main/resources/test1/OuterComposite.composite b/branches/sca-android/itest/recursive/src/main/resources/test1/OuterComposite.composite new file mode 100644 index 0000000000..d05a67f45f --- /dev/null +++ b/branches/sca-android/itest/recursive/src/main/resources/test1/OuterComposite.composite @@ -0,0 +1,27 @@ + + + + + + + diff --git a/branches/sca-android/itest/recursive/src/test/java/circular/include/CircularIncludeTestCase.java b/branches/sca-android/itest/recursive/src/test/java/circular/include/CircularIncludeTestCase.java new file mode 100644 index 0000000000..1f7c35dd91 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/circular/include/CircularIncludeTestCase.java @@ -0,0 +1,39 @@ +/* + * 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 circular.include; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.Test; + +public class CircularIncludeTestCase { + + @Test + public void testCyclicInclude() { + SCADomain scaDomain = SCADomain.newInstance("Demo1Composite.composite"); + + DemoClass demoService = scaDomain.getService(DemoClass.class, "Demo1Component"); + String demo = demoService.demo(); + Assert.assertEquals("hello", demo); + scaDomain.close(); + } + +} diff --git a/branches/sca-android/itest/recursive/src/test/java/composite/CompositeTestCase.java b/branches/sca-android/itest/recursive/src/test/java/composite/CompositeTestCase.java new file mode 100644 index 0000000000..5482e47463 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/composite/CompositeTestCase.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 composite; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class CompositeTestCase extends TestCase { + + private SCADomain domain; + private Source source; + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("OuterComposite.composite"); + source = domain.getService(Source.class, "SourceComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + + public void test() throws Exception { + try { + System.out.println("Main thread " + Thread.currentThread()); + source.clientMethod("Client.main"); + System.out.println("Sleeping ..."); + Thread.sleep(1000); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java b/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java new file mode 100644 index 0000000000..f042113f7a --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java @@ -0,0 +1,113 @@ +/* + * 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 composite; + +import java.io.File; +import java.net.URL; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain; + +public class LocateServiceEmbeddedSCADomainTestCase extends TestCase { + private ClassLoader cl; + private EmbeddedSCADomain domain; + private Contribution contribution; + + @Override + protected void setUp() throws Exception { + // Create a test embedded SCA domain + cl = getClass().getClassLoader(); + domain = new EmbeddedSCADomain(cl, "http://localhost"); + + // Start the domain + domain.start(); + + // Contribute the SCA contribution + ContributionService contributionService = domain.getContributionService(); + + File contribLocation = new File("./target/classes/"); + URL contributionURL = contribLocation.toURL(); + contribution = contributionService.contribute("http://contribution", contributionURL, false); + for (Composite deployable : contribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + // Start Components from my composite + for (Composite deployable : contribution.getDeployables() ) { + domain.getCompositeActivator().activate(deployable); + domain.getCompositeActivator().start(deployable); + } + } + + public void testValidLocateService() throws Exception { + Source source; + try { + source = domain.getService(Source.class, "SourceComponent"); + assertNotNull(source); + } catch (Throwable t) { + fail("Could not locate service"); + } + } + + public void testInvalidLocateService() throws Exception { + Source source; + try { + source = domain.getService(Source.class, "SourceComponentXXX"); + // The source proxy can be created for the remote target but it will throw exception when a method is invoked + source.clientMethod("ABC"); + fail("Expected to generate org.osoa.sca.ServiceRuntimeException but did not when invoking service with async"); + } catch (org.osoa.sca.ServiceRuntimeException e) { + // expected. + } + } + + public void testValidRecursiveLocateService() throws Exception { + Source source; + try { + source = domain.getService(Source.class, "SourceComponent/InnerSourceService"); + assertNotNull(source); + } catch (Throwable t) { + fail("Could not locate service"); + } + } + + @Override + public void tearDown() throws Exception { + ContributionService contributionService = domain.getContributionService(); + + // Remove the contribution from the in-memory repository + contributionService.remove("http://contribution"); + + // Stop Components from my composite + for (Composite deployable : contribution.getDeployables() ) { + domain.getCompositeActivator().stop(deployable); + domain.getCompositeActivator().deactivate(deployable); + } + + domain.stop(); + domain.close(); + } + +} diff --git a/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java b/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java new file mode 100644 index 0000000000..87eb948452 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.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 composite; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class LocateServiceSCADomainTestCase extends TestCase { + + private SCADomain domain; + + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("OuterComposite.composite"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + + public void testValidLocateService() throws Exception { + Source source; + try { + source = domain.getService(Source.class, "SourceComponent"); + assertNotNull(source); + } catch (Throwable t) { + fail("Could not locate service"); + } + } + + public void testInvalidLocateService() throws Exception { + Source source; + try { + source = domain.getService(Source.class, "SourceComponentXXX"); + // The source proxy can be created for the remote target but it will throw exception when a method is invoked + source.clientMethod("ABC"); + fail("Expected to generate org.osoa.sca.ServiceRuntimeException but did not when invoking service with async"); + } catch (org.osoa.sca.ServiceRuntimeException e) { + // expected. + } + } + + public void testValidRecursiveLocateService() throws Exception { + Source source; + try { + source = domain.getService(Source.class, "SourceComponent/InnerSourceService"); + assertNotNull(source); + } catch (Throwable t) { + fail("Could not locate service"); + } + } + +} diff --git a/branches/sca-android/itest/recursive/src/test/java/foo/O2TestCase.java b/branches/sca-android/itest/recursive/src/test/java/foo/O2TestCase.java new file mode 100644 index 0000000000..d617ec8592 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/foo/O2TestCase.java @@ -0,0 +1,32 @@ +/* + * 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 foo; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class O2TestCase extends TestCase { + + public void testGet() throws Exception { + SCADomain sca = SCADomain.newInstance("foo/o2.composite"); + I i = sca.getService(I.class, "O1Component"); + assertEquals("foo.A", i.get(0)); + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/foo/O4TestCase.java b/branches/sca-android/itest/recursive/src/test/java/foo/O4TestCase.java new file mode 100644 index 0000000000..15626c75ac --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/foo/O4TestCase.java @@ -0,0 +1,39 @@ +/* + * 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 foo; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class O4TestCase extends TestCase { + + public void testO3Component() throws Exception { + SCADomain sca = SCADomain.newInstance("foo/o4.composite"); + I i = sca.getService(I.class, "O3Component"); + assertEquals("foo.A", i.get(0)); + } + + public void testO2Component() throws Exception { + SCADomain sca = SCADomain.newInstance("foo/o4.composite"); + I i = sca.getService(I.class, "O2Component"); + assertEquals("foo.A", i.get(0)); + } + +} diff --git a/branches/sca-android/itest/recursive/src/test/java/policy/PolicyTestCase.java b/branches/sca-android/itest/recursive/src/test/java/policy/PolicyTestCase.java new file mode 100644 index 0000000000..c9cc84f7d4 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/policy/PolicyTestCase.java @@ -0,0 +1,68 @@ +/* + * 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 policy; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.impl.CompositeImpl; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PolicyTestCase { + + private SCADomain domain; + private Target targetClient; + + @Before + public void setUp() throws Exception { + domain = SCADomain.newInstance("policy/PolicyOuterComposite.composite"); + targetClient = domain.getService(Target.class, "TargetClientComponent"); + } + + @After + public void tearDown() throws Exception { + domain.close(); + } + + @Test + public void test() throws Exception { + try { + //Check that the implementation policy sets don't flow down to the components + //implementations that are themselves composites (implementation.composite) + Component outerComponent = ((DefaultSCADomain)domain).getComponent("OuterTargetServiceComponent"); + + Assert.assertEquals(0, outerComponent.getPolicySets().size()); + + for (Component component :((CompositeImpl)outerComponent.getImplementation()).getComponents()){ + Assert.assertEquals(0, component.getPolicySets().size()); + } + + // debugging + String result = targetClient.hello("Fred"); + + System.out.println(result); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/sample/C.java b/branches/sca-android/itest/recursive/src/test/java/sample/C.java new file mode 100644 index 0000000000..bf8391348b --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/sample/C.java @@ -0,0 +1,32 @@ +/* + * 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 sample; + +/** + * Simple Service + */ +public interface C { + + /** + * Sample operation + * + * @return A String + */ + String cOp(); +} diff --git a/branches/sca-android/itest/recursive/src/test/java/sample/CImpl.java b/branches/sca-android/itest/recursive/src/test/java/sample/CImpl.java new file mode 100644 index 0000000000..466284983e --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/sample/CImpl.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 sample; + +import junit.framework.Assert; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * Implementation of a simple service + */ +@Service(C.class) +public class CImpl implements C { + + /** + * Reference to X + */ + private X xRef; + + /** + * Reference to Y + */ + private Y yRef; + + /** + * Setter for refX + * + * @param x Reference to X + */ + @Reference(name="refX") + protected void setX(X x) + { + System.out.println("Setting X on CImpl to " + x); + xRef = x; + } + + /** + * Setter for refY + * + * @param y Reference to Y + */ + @Reference(name="refY") + protected void setY(Y y) + { + System.out.println("Setting Y on CImpl to " + y); + yRef = y; + } + + /** + * Simple operation that uses the injected references to X and Y + * + * @return "C:cOp() - xResult = " + xRef.xOP() + " yResult = " + yRef.yOp(); + */ + public String cOp() { + Assert.assertNotNull(xRef); + Assert.assertNotNull(yRef); + + String xResult = xRef.xOp(); + String yResult = yRef.yOp(); + + return "C:cOp() - xResult = " + xResult + " yResult = " + yResult; + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/sample/NestedTestCase.java b/branches/sca-android/itest/recursive/src/test/java/sample/NestedTestCase.java new file mode 100644 index 0000000000..fc5d251460 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/sample/NestedTestCase.java @@ -0,0 +1,96 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package sample; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + + +/** + * Test for implementation.composite using implementation.composite + */ +public class NestedTestCase extends TestCase { + + /** + * Reference to the domain + */ + private SCADomain domain; + + /** + * Tear down the domain + */ + @Override + protected void tearDown() throws Exception { + if (domain != null) { + domain.close(); + } + } + + /** + * This tests having: + * + * AComponent -> implementation.composite(BComposite) + * BComposite -> implementation.composite(CComposite) + * + * This test fails. + * + * @throws Exception Failed + */ + public void testAComponent() throws Exception { + domain = SCADomain.newInstance("AComposite.composite"); + + System.out.println("Deployed names = " + domain.getComponentManager().getComponentNames()); + + C c = domain.getService(C.class, "AComponent"); + + String result = c.cOp(); + System.out.println("Method call returned [" + result + "]"); + Assert.assertNotNull(result); + Assert.assertTrue(result.indexOf("C:cOp()") != -1); + Assert.assertTrue(result.indexOf("X:xOp()") != -1); + Assert.assertTrue(result.indexOf("Y:yOp()") != -1); + } + + + /** + * This tests having: + * + * BComposite -> implementation.composite(CComposite) + * + * This test works. + * + * @throws Exception Failed + */ + public void testBComponent() throws Exception { + domain = SCADomain.newInstance("BComposite.composite"); + + System.out.println("Deployed names = " + domain.getComponentManager().getComponentNames()); + + C c = domain.getService(C.class, "BComponent"); + + String result = c.cOp(); + System.out.println("Method call returned [" + result + "]"); + Assert.assertNotNull(result); + Assert.assertTrue(result.indexOf("C:cOp()") != -1); + Assert.assertTrue(result.indexOf("X:xOp()") != -1); + Assert.assertTrue(result.indexOf("Y:yOp()") != -1); + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java b/branches/sca-android/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java new file mode 100644 index 0000000000..a543add69b --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.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 sample; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +//FIXME Fix this test case +public class RecursiveCompositeTestCaseFIXME extends TestCase { + + private SCADomain domain; + private Service1 tracker, tracker2; + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("http://localhost", "/", "Composite1.composite", "Composite2.composite"); + tracker = domain.getService(Service1.class, "ComponentC"); + tracker2 = domain.getService(Service1.class, "ComponentB"); + + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + + public void test() throws Exception { + try { + System.out.println("Main thread " + Thread.currentThread()); + System.out.println(tracker.track("Client")); + System.out.println(tracker2.track("Client")); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/sample/X.java b/branches/sca-android/itest/recursive/src/test/java/sample/X.java new file mode 100644 index 0000000000..e3a9335068 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/sample/X.java @@ -0,0 +1,32 @@ +/* + * 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 sample; + +/** + * Simple Service + */ +public interface X { + + /** + * Simple Operation + * + * @return A String + */ + String xOp(); +} diff --git a/branches/sca-android/itest/recursive/src/test/java/sample/XImpl.java b/branches/sca-android/itest/recursive/src/test/java/sample/XImpl.java new file mode 100644 index 0000000000..e430807568 --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/sample/XImpl.java @@ -0,0 +1,37 @@ +/* + * 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 sample; + +import org.osoa.sca.annotations.Service; + +/** + * Implementation of a simple service + */ +@Service(X.class) +public class XImpl implements X { + + /** + * Simple operation + * + * @return "X:xOp()" + */ + public String xOp() { + return "X:xOp()"; + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/sample/Y.java b/branches/sca-android/itest/recursive/src/test/java/sample/Y.java new file mode 100644 index 0000000000..c15a4f635a --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/sample/Y.java @@ -0,0 +1,32 @@ +/* + * 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 sample; + +/** + * Simple Service + */ +public interface Y { + + /** + * Simple Operation + * + * @return A String + */ + String yOp(); +} diff --git a/branches/sca-android/itest/recursive/src/test/java/sample/YImpl.java b/branches/sca-android/itest/recursive/src/test/java/sample/YImpl.java new file mode 100644 index 0000000000..994c9eb95f --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/sample/YImpl.java @@ -0,0 +1,38 @@ +/* + * 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 sample; + +import org.osoa.sca.annotations.Service; + +/** + * Implementation of a Simple Service + */ +@Service(Y.class) +public class YImpl implements Y { + + /** + * A simple operation + * + * @return "Y:yOp()" + */ + public String yOp() { + return "Y:yOp()"; + } + +} diff --git a/branches/sca-android/itest/recursive/src/test/java/test/InnerTestCase.java b/branches/sca-android/itest/recursive/src/test/java/test/InnerTestCase.java new file mode 100644 index 0000000000..ebb4bc7acb --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/test/InnerTestCase.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 test; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class InnerTestCase extends TestCase { + + private SCADomain domain; + private Aggregator aggregator; + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("Inner.composite"); + aggregator = domain.getService(Aggregator.class, "Aggregator"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + + public void test() throws Exception { + try { + String result = aggregator.getAggregatedData(); + assertTrue(result.contains("InnerSource")); + assertTrue(result.contains("InnerSource")); + System.out.println(result); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/test/OuterTestCase.java b/branches/sca-android/itest/recursive/src/test/java/test/OuterTestCase.java new file mode 100644 index 0000000000..6e95f5808b --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/test/OuterTestCase.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 test; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +public class OuterTestCase { + + private SCADomain domain; + private Aggregator aggregator; + + @Before + public void setUp() throws Exception { + domain = SCADomain.newInstance("Outer.composite"); + aggregator = domain.getService(Aggregator.class, "Inner"); + } + + @After + public void tearDown() throws Exception { + domain.close(); + } + + @Ignore("TUSCANY-2484") + @Test + public void test() throws Exception { + String result = aggregator.getAggregatedData(); + Assert.assertTrue(result.contains("InnerSource")); + Assert.assertTrue(result.contains("OuterSource")); + System.out.println(result); + } +} diff --git a/branches/sca-android/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java b/branches/sca-android/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java new file mode 100644 index 0000000000..b3abcac06e --- /dev/null +++ b/branches/sca-android/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java @@ -0,0 +1,62 @@ +/* + * 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 test1.composite; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Simple client program that invokes the components that we wired together. + */ +public class CompositeClientTestCase extends TestCase { + + private SCADomain scaDomain; + private Target target; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("test1/OuterComposite.composite"); + target = scaDomain.getService(Target.class, "Test1TargetComponent/Service_Two"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testComposite() throws Exception { + String res = target.hello("Wang Feng"); + assertEquals("TargetTwo: Hello Wang Feng!", res); + } + + // Test for problem in TUSCANY-2010 + public void testURLs() throws Exception { + try { + System.out.println("Component URI: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getURI()); + System.out.println(" Service Name: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getName()); + System.out.println(" Binding Name: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getName()); + System.out.println(" Binding URI: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getURI()); + assertEquals("/Test1TargetComponent/Service_One", scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getURI()); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} -- cgit v1.2.3