From 2bf6abaee42cd687a15095274961c6c265ee9326 Mon Sep 17 00:00:00 2001 From: wjaniszewski Date: Sun, 3 Aug 2008 20:03:45 +0000 Subject: In added configuration option to allow creating name server by Tuscany, new test scenario in itest/corba. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@682203 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/test/corba/ScenarioFiveTestCase.java | 51 ++++++++++++++++++++++ .../sca/test/corba/ScenarioFourTestCase.java | 15 ++++--- .../tuscany/sca/test/corba/types/ScenarioFive.java | 32 ++++++++++++++ .../test/corba/types/ScenarioFiveComponent.java | 40 +++++++++++++++++ .../sca/test/corba/types/ScenarioFiveImpl.java | 31 +++++++++++++ .../src/test/resources/ScenarioFive.composite | 41 +++++++++++++++++ 6 files changed, 203 insertions(+), 7 deletions(-) create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.java create mode 100644 java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.java create mode 100644 java/sca/itest/corba/src/test/resources/ScenarioFive.composite (limited to 'java/sca/itest') diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.java new file mode 100644 index 0000000000..2704186386 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.test.corba; + +import static org.junit.Assert.fail; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.test.corba.types.ScenarioFive; +import org.apache.tuscany.sca.test.corba.types.ScenarioFiveComponent; +import org.junit.Test; + +/** + * Tests usage of "provideNameServer" attribute in + */ +public class ScenarioFiveTestCase { + + /** + * Tests binding with provided name server + */ + @Test + public void test_providedNameServer() { + try { + // just make sure we can obtain and use the reference with success + SCADomain domain = SCADomain.newInstance("ScenarioFive.composite"); + ScenarioFive scenarioFive = + domain.getService(ScenarioFiveComponent.class, "ScenarioFive").getScenarioFive(); + scenarioFive.doNothing(); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java index 2f3e421392..63bb05ca4c 100644 --- a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java @@ -34,7 +34,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; - /** * Tests SCA default binding over CORBA binding */ @@ -85,7 +84,7 @@ public class ScenarioFourTestCase { Assert.fail(e.getMessage()); } } - + /** * Test for JAXB exceptions */ @@ -101,7 +100,7 @@ public class ScenarioFourTestCase { fail(); } } - + /** * General test for passing SDO objects */ @@ -112,20 +111,22 @@ public class ScenarioFourTestCase { scenarioFourSdo.setMessage("Test1"); scenarioFourSdo.setSymbol("Test2"); ScenarioFourSdo result = scenarioFour.passScenarioFourStruct(scenarioFourSdo); - assertTrue(scenarioFourSdo.getMessage().equals(result.getMessage()) && scenarioFourSdo.getSymbol().equals(result.getSymbol())); + assertTrue(scenarioFourSdo.getMessage().equals(result.getMessage()) && scenarioFourSdo.getSymbol() + .equals(result.getSymbol())); } catch (Exception e) { e.printStackTrace(); fail(); } } - + /** - * Tests reusing local name server with multiple bindings + * Tests reusing local name server with multiple bindings */ @Test public void test_nameServerReuse() { try { - ScenarioFour scenarioFour = domain.getService(ScenarioFourComponent.class, "ScenarioFourReuse").getScenarioFour(); + ScenarioFour scenarioFour = + domain.getService(ScenarioFourComponent.class, "ScenarioFourReuse").getScenarioFour(); ScenarioFourStruct struct = new ScenarioFourStruct(); scenarioFour.setStruct(struct); } catch (Exception e) { diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.java new file mode 100644 index 0000000000..a254da205a --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.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 org.apache.tuscany.sca.test.corba.types; + +import org.osoa.sca.annotations.Remotable; + +/** + * Operations for scenario five + */ +@Remotable +public interface ScenarioFive { + + void doNothing(); + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.java new file mode 100644 index 0000000000..577c40d963 --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.test.corba.types; + +import org.osoa.sca.annotations.Reference; + +/** + * Component for obtaining ScenarioFive reference + */ +public class ScenarioFiveComponent { + + private ScenarioFive scenarioFive; + + @Reference + public void setScenarioFive(ScenarioFive scenarioFive) { + this.scenarioFive = scenarioFive; + } + + public ScenarioFive getScenarioFive() { + return scenarioFive; + } + +} diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.java new file mode 100644 index 0000000000..faacdd564f --- /dev/null +++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.test.corba.types; + +/** + * Implementation of ScenarioFive service + */ +public class ScenarioFiveImpl implements ScenarioFive { + + public void doNothing() { + // does nothing + } + +} diff --git a/java/sca/itest/corba/src/test/resources/ScenarioFive.composite b/java/sca/itest/corba/src/test/resources/ScenarioFive.composite new file mode 100644 index 0000000000..3c73e238a5 --- /dev/null +++ b/java/sca/itest/corba/src/test/resources/ScenarioFive.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3