summaryrefslogtreecommitdiffstats
path: root/java/sca/itest/corba/src
diff options
context:
space:
mode:
authorwjaniszewski <wjaniszewski@13f79535-47bb-0310-9956-ffa450edef68>2008-08-03 20:03:45 +0000
committerwjaniszewski <wjaniszewski@13f79535-47bb-0310-9956-ffa450edef68>2008-08-03 20:03:45 +0000
commit2bf6abaee42cd687a15095274961c6c265ee9326 (patch)
treec6638c113bd037a8245d1e076cd9ba713b464af6 /java/sca/itest/corba/src
parent67615a0c52a827e4efb342dd5cce6be8dd3e3e97 (diff)
In <binding.corba> 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
Diffstat (limited to 'java/sca/itest/corba/src')
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFiveTestCase.java51
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java15
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFive.java32
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveComponent.java40
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFiveImpl.java31
-rw-r--r--java/sca/itest/corba/src/test/resources/ScenarioFive.composite41
6 files changed, 203 insertions, 7 deletions
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 <binding.corba>
+ */
+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 @@
+<!--
+ * 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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Corba">
+
+ <component name="ScenarioFiveService">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioFiveImpl" />
+ </component>
+ <service name="ScenarioFive" promote="ScenarioFiveService">
+ <interface.java interface="org.apache.tuscany.sca.test.corba.types.ScenarioFive"/>
+ <binding.sca uri="corbaname::localhost:5090#ScenarioFive"/>
+ </service>
+
+ <component name="ScenarioFive">
+ <implementation.java class="org.apache.tuscany.sca.test.corba.types.ScenarioFiveComponent" />
+ <reference name="scenarioFive">
+ <binding.sca uri="corbaname::localhost:5090#ScenarioFive"/>
+ </reference>
+ </component>
+
+</composite>