summaryrefslogtreecommitdiffstats
path: root/java/sca/itest
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/itest')
-rw-r--r--java/sca/itest/corba/pom.xml215
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/ScenarioFourTestCase.java49
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java5
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourException.java37
-rw-r--r--java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.java12
-rw-r--r--java/sca/itest/corba/src/test/resources/scenariofour.xsd31
6 files changed, 282 insertions, 67 deletions
diff --git a/java/sca/itest/corba/pom.xml b/java/sca/itest/corba/pom.xml
index b1d45f7c32..c79e84b660 100644
--- a/java/sca/itest/corba/pom.xml
+++ b/java/sca/itest/corba/pom.xml
@@ -1,73 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * 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.
+ * 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.
-->
<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-itest</artifactId>
- <version>1.4-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>itest-corba-binding</artifactId>
- <name>Apache Tuscany SCA CORBA Binding Integration Tests</name>
- <dependencies>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-corba-binding</artifactId>
+ <name>Apache Tuscany SCA CORBA Binding Integration Tests</name>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-corba-runtime</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-corba-jdk</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-corba</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+<!--
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.5</version>
+ </dependency>
+ -->
+
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.4-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-corba-runtime</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba-jdk</artifactId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
<version>1.4-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca-corba</artifactId>
- <version>1.4-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.2</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.1-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-scenariofour-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>
+ ${basedir}/src/test/resources/scenariofour.xsd
+ </schemaFile>
+ <javaPackage>
+ org.apache.tuscany.sca.test.corba.scenariofour
+ </javaPackage>
+ <prefix>ScenarioFour</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
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 f47792c5f2..7ab5ca1e14 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
@@ -26,13 +26,17 @@ import junit.framework.Assert;
import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.corba.scenariofour.ScenarioFourFactory;
+import org.apache.tuscany.sca.test.corba.scenariofour.ScenarioFourSdo;
import org.apache.tuscany.sca.test.corba.types.ScenarioFour;
import org.apache.tuscany.sca.test.corba.types.ScenarioFourComponent;
+import org.apache.tuscany.sca.test.corba.types.ScenarioFourException;
import org.apache.tuscany.sca.test.corba.types.ScenarioFourStruct;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+
/**
* Tests SCA default binding over CORBA binding
*/
@@ -42,6 +46,8 @@ public class ScenarioFourTestCase {
private static int ORB_INITIAL_PORT = 5060;
private static SCADomain domain;
private static TransientNameServer server;
+ private static ScenarioFourComponent scenarioFourComponent;
+ private static ScenarioFour scenarioFour;
/**
* Sets up name service, creates and registers traditional CORBA service,
@@ -63,6 +69,8 @@ public class ScenarioFourTestCase {
}
// obtain domain
domain = SCADomain.newInstance("ScenarioFour.composite");
+ scenarioFourComponent = domain.getService(ScenarioFourComponent.class, "ScenarioFour");
+ scenarioFour = scenarioFourComponent.getScenarioFour();
} catch (Exception e) {
e.printStackTrace();
}
@@ -76,16 +84,17 @@ public class ScenarioFourTestCase {
server.stop();
}
+ /**
+ * General tests for passing JAXB objects
+ */
@Test
- public void test_generalTest() {
+ public void test_generalJAXB() {
try {
- ScenarioFourComponent soc = domain.getService(ScenarioFourComponent.class, "ScenarioFour");
- ScenarioFour so = soc.getScenarioFour();
ScenarioFourStruct input = new ScenarioFourStruct();
input.field1 = "Test";
input.field2 = 1;
input.field3 = new double[1];
- ScenarioFourStruct output = so.setStruct(input);
+ ScenarioFourStruct output = scenarioFour.setStruct(input);
assertTrue(input.equals(output));
} catch (Exception e) {
e.printStackTrace();
@@ -93,4 +102,36 @@ public class ScenarioFourTestCase {
}
}
+ /**
+ * Test for JAXB exceptions
+ */
+ @Test
+ public void test_exceptionsJAXB() {
+ try {
+ scenarioFour.exceptionTest();
+ fail();
+ } catch (ScenarioFourException e) {
+ assertTrue(ScenarioFourException.DEFAULT_CONTENT.equals(e.getContent()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
+
+ /**
+ * General test for passing SDO objects
+ */
+ @Test
+ public void test_generalSDO() {
+ try {
+ ScenarioFourSdo scenarioFourSdo = ScenarioFourFactory.INSTANCE.createScenarioFourSdo();
+ scenarioFourSdo.setMessage("Test1");
+ scenarioFourSdo.setSymbol("Test2");
+ ScenarioFourSdo result = scenarioFour.passScenarioFourStruct(scenarioFourSdo);
+ assertTrue(scenarioFourSdo.getMessage().equals(result.getMessage()) && scenarioFourSdo.getSymbol().equals(result.getSymbol()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail();
+ }
+ }
}
diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java
index d1492f85e5..936021719e 100644
--- a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java
+++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFour.java
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.test.corba.types;
+import org.apache.tuscany.sca.test.corba.scenariofour.ScenarioFourSdo;
import org.osoa.sca.annotations.Remotable;
/**
@@ -29,4 +30,8 @@ public interface ScenarioFour {
ScenarioFourStruct setStruct(ScenarioFourStruct struct);
+ void exceptionTest() throws ScenarioFourException;
+
+ ScenarioFourSdo passScenarioFourStruct(ScenarioFourSdo scenarioFourSdo);
+
}
diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourException.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourException.java
new file mode 100644
index 0000000000..1afda33e35
--- /dev/null
+++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourException.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 org.apache.tuscany.sca.test.corba.types;
+
+public class ScenarioFourException extends Exception {
+
+ public static final String DEFAULT_CONTENT = "Test";
+
+ private static final long serialVersionUID = 1L;
+ private String content;
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+}
diff --git a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.java b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.java
index c047fafca4..35c3109ef4 100644
--- a/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.java
+++ b/java/sca/itest/corba/src/test/java/org/apache/tuscany/sca/test/corba/types/ScenarioFourImpl.java
@@ -19,6 +19,8 @@
package org.apache.tuscany.sca.test.corba.types;
+import org.apache.tuscany.sca.test.corba.scenariofour.ScenarioFourSdo;
+
/**
* Implementation of ScenarioFour service
*/
@@ -28,4 +30,14 @@ public class ScenarioFourImpl implements ScenarioFour {
return struct;
}
+ public void exceptionTest() throws ScenarioFourException {
+ ScenarioFourException exception = new ScenarioFourException();
+ exception.setContent(ScenarioFourException.DEFAULT_CONTENT);
+ throw exception;
+ }
+
+ public ScenarioFourSdo passScenarioFourStruct(ScenarioFourSdo scenarioFourSdo) {
+ return scenarioFourSdo;
+ }
+
}
diff --git a/java/sca/itest/corba/src/test/resources/scenariofour.xsd b/java/sca/itest/corba/src/test/resources/scenariofour.xsd
new file mode 100644
index 0000000000..2669b54be3
--- /dev/null
+++ b/java/sca/itest/corba/src/test/resources/scenariofour.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<schema targetNamespace="http://example.com/scenariofour" xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="ScenarioFourSdo">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="string" />
+ <element name="symbol" minOccurs="1" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+</schema>