diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:28 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:28 +0000 |
commit | 07b7dfd1a70ba222b899d9813f8c449dbf3b785f (patch) | |
tree | ecfc876747e6cfedee0a8533d87c19ac78a2dbd0 /branches/sca-java-1.1/itest/recursive/src/test | |
parent | 6fadbc9cd1fcf03d0b3630f772d91df149b70428 (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835124 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.1/itest/recursive/src/test')
9 files changed, 0 insertions, 501 deletions
diff --git a/branches/sca-java-1.1/itest/recursive/src/test/java/composite/CompositeTestCase.java b/branches/sca-java-1.1/itest/recursive/src/test/java/composite/CompositeTestCase.java deleted file mode 100644 index 5482e47463..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/composite/CompositeTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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-java-1.1/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java b/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java deleted file mode 100644 index f042113f7a..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java +++ /dev/null @@ -1,113 +0,0 @@ -/*
- * 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-java-1.1/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java b/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java deleted file mode 100644 index 87eb948452..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java +++ /dev/null @@ -1,73 +0,0 @@ -/*
- * 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-java-1.1/itest/recursive/src/test/java/foo/O2TestCase.java b/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O2TestCase.java deleted file mode 100644 index d617ec8592..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O2TestCase.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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-java-1.1/itest/recursive/src/test/java/foo/O4TestCase.java b/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O4TestCase.java deleted file mode 100644 index 15626c75ac..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O4TestCase.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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-java-1.1/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java b/branches/sca-java-1.1/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java deleted file mode 100644 index a543add69b..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.1/itest/recursive/src/test/java/test/InnerTestCase.java b/branches/sca-java-1.1/itest/recursive/src/test/java/test/InnerTestCase.java deleted file mode 100644 index ebb4bc7acb..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/test/InnerTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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-java-1.1/itest/recursive/src/test/java/test/OuterTestCase.java b/branches/sca-java-1.1/itest/recursive/src/test/java/test/OuterTestCase.java deleted file mode 100644 index 17de5ca4a8..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/test/OuterTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 OuterTestCase extends TestCase { - - private SCADomain domain; - private Aggregator aggregator; - - @Override - protected void setUp() throws Exception { - domain = SCADomain.newInstance("Outer.composite"); - aggregator = domain.getService(Aggregator.class, "Inner"); - } - - @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("OuterSource")); - System.out.println(result); - } catch (Throwable t) { - t.printStackTrace(); - } - } -} diff --git a/branches/sca-java-1.1/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java b/branches/sca-java-1.1/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java deleted file mode 100644 index ab3e625ae5..0000000000 --- a/branches/sca-java-1.1/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 { - - public void testComposite() throws Exception { - SCADomain scaDomain = SCADomain.newInstance("test1/OuterComposite.composite"); - Target target = scaDomain.getService(Target.class, "TargetComponent/Service_Two"); - String res = target.hello("Wang Feng"); - assertEquals("TargetTwo: Hello Wang Feng!", res); - scaDomain.close(); - } -} |