From 23297fa3b1f66d74325c8352cb8f5aae599a3090 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 11 Aug 2008 07:29:53 +0000 Subject: Start branch for 1.3.1, the only changes in this commit are for the version git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@684661 13f79535-47bb-0310-9956-ffa450edef68 --- .../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 +++++++++ 8 files changed, 400 insertions(+) create mode 100644 branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/C.java create mode 100644 branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/CImpl.java create mode 100644 branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/NestedTestCase.java create mode 100644 branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java create mode 100644 branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/X.java create mode 100644 branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/XImpl.java create mode 100644 branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/Y.java create mode 100644 branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/YImpl.java (limited to 'branches/sca-java-1.3.1/itest/recursive/src/test/java/sample') diff --git a/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/C.java b/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/C.java new file mode 100644 index 0000000000..bf8391348b --- /dev/null +++ b/branches/sca-java-1.3.1/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-java-1.3.1/itest/recursive/src/test/java/sample/CImpl.java b/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/CImpl.java new file mode 100644 index 0000000000..466284983e --- /dev/null +++ b/branches/sca-java-1.3.1/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-java-1.3.1/itest/recursive/src/test/java/sample/NestedTestCase.java b/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/NestedTestCase.java new file mode 100644 index 0000000000..fc5d251460 --- /dev/null +++ b/branches/sca-java-1.3.1/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-java-1.3.1/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java b/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java new file mode 100644 index 0000000000..a543add69b --- /dev/null +++ b/branches/sca-java-1.3.1/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-java-1.3.1/itest/recursive/src/test/java/sample/X.java b/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/X.java new file mode 100644 index 0000000000..e3a9335068 --- /dev/null +++ b/branches/sca-java-1.3.1/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-java-1.3.1/itest/recursive/src/test/java/sample/XImpl.java b/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/XImpl.java new file mode 100644 index 0000000000..e430807568 --- /dev/null +++ b/branches/sca-java-1.3.1/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-java-1.3.1/itest/recursive/src/test/java/sample/Y.java b/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/Y.java new file mode 100644 index 0000000000..c15a4f635a --- /dev/null +++ b/branches/sca-java-1.3.1/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-java-1.3.1/itest/recursive/src/test/java/sample/YImpl.java b/branches/sca-java-1.3.1/itest/recursive/src/test/java/sample/YImpl.java new file mode 100644 index 0000000000..994c9eb95f --- /dev/null +++ b/branches/sca-java-1.3.1/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()"; + } + +} -- cgit v1.2.3