diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.1/itest')
834 files changed, 50259 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/pom.xml new file mode 100644 index 0000000000..849a39b0cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/pom.xml @@ -0,0 +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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-bpel</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <artifactId>itest-bpel-helloworld</artifactId> + <name>Apache Tuscany SCA HelloWorld BPEL iTest</name> + + <repositories> + <repository> + <id>apache.incubator</id> + <url>http://people.apache.org/repo/m2-incubating-repository</url> + </repository> + </repositories> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-bpel</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-impl</artifactId> + <version>1.0-incubating</version> + </dependency> + + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.8.0</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <!-- http://jira.codehaus.org/browse/SUREFIRE-322 --> + <version>2.3.1</version> + <configuration> + <useFile>false</useFile> + <trimStackTrace>false</trimStackTrace> + <useSystemClassLoader>true</useSystemClassLoader> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>unpack</id> + <phase>test-compile</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.ode</groupId> + <artifactId>ode-dao-jpa-ojpa-derby</artifactId> + <version>1.1</version> + <type>zip</type> + <overWrite>true</overWrite> + <outputDirectory>${project.build.directory}/test-classes/</outputDirectory> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-plugin</artifactId> + <version>1.0-incubating</version> + <executions> + <execution> + <id>generate-bpel-helloworld</id> + <phase>generate-sources</phase> + <configuration> + <schemaFile>${basedir}/src/test/resources/helloworld/helloworld.wsdl</schemaFile> + <targetDirectory>${basedir}/target/wsdl2java-source</targetDirectory> + <prefix>HelloWorld</prefix> + <noNotification>true</noNotification> + <noContainer>true</noContainer> + <noUnsettable>true</noUnsettable> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-wsdl2java</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <configuration> + <wsdlFiles> + <wsdlFile> + <fileName>${basedir}/src/test/resources/helloworld/helloworld.wsdl</fileName> + </wsdlFile> + </wsdlFiles> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java new file mode 100644 index 0000000000..eb1cf21bdb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java @@ -0,0 +1,45 @@ +/* + * 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 helloworld; + +import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.osoa.sca.annotations.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class HelloWorld { + private HelloPortType helloService; + + public HelloWorld() { + super(); + } + + @Reference + public void setHelloService(HelloPortType helloService){ + this.helloService = helloService; + } + + public String hello(String hello) { + System.out.println(">>> Invoking helloService.hello with : " + hello); + return this.helloService.hello(hello); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java new file mode 100644 index 0000000000..d4fc74981f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java @@ -0,0 +1,63 @@ +/* + * 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 helloworld; + +import junit.framework.TestCase; + +import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Tests the BPEL Helloworld Service + * + * @version $Rev$ $Date$ + */ +public class HelloWorldTestCase extends TestCase { + + private SCADomain scaDomain; + + /** + * @throws java.lang.Exception + */ + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("helloworld/helloworld.composite"); + } + + /** + * @throws java.lang.Exception + */ + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testServiceInvocation() { + HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldService"); + String response = bpelService.hello("Hello"); + assertEquals("Hello World", response); + } + + public void testReferenceInvocation() { + HelloWorld bpelService = scaDomain.getService(HelloWorld.class, "BPELHelloWorld"); + String response = bpelService.hello("Hello"); + assertEquals("Hello World", response); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml new file mode 100644 index 0000000000..571aa37d58 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/deploy.xml @@ -0,0 +1,30 @@ +<!-- + ~ 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. + --> +<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" + xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld" + xmlns:wns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"> + + + <process name="tns:HelloWorld"> + <active>true</active> + <provide partnerLink="helloPartnerLink"> + <service name="wns:HelloService" port="HelloPort"/> + </provide> + </process> +</deploy> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel new file mode 100644 index 0000000000..8cf91adc2c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel @@ -0,0 +1,66 @@ +<!-- + ~ 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. + --> +<process name="HelloWorld" + targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld" + xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl" + queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" + expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"> + + <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" + namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/> + + <partnerLinks> + <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" /> + </partnerLinks> + + <variables> + <variable name="helloMessage" messageType="test:HelloMessage"/> + <variable name="tmpVar" type="xsd:string"/> + </variables> + + <sequence> + <receive + name="start" + partnerLink="helloPartnerLink" + portType="test:HelloPortType" + operation="hello" + variable="helloMessage" + createInstance="yes"/> + + <assign name="assign1"> + <copy> + <from variable="helloMessage" part="TestPart"/> + <to variable="tmpVar"/> + </copy> + <copy> + <from>concat($tmpVar,' World')</from> + <to variable="helloMessage" part="TestPart"/> + </copy> + </assign> + <reply name="end" + partnerLink="helloPartnerLink" + portType="test:HelloPortType" + operation="hello" + variable="helloMessage"/> + </sequence> +</process> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType new file mode 100644 index 0000000000..121064a475 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.componentType @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * 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. +--> +<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <service name="HelloService"> + <interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" /> + </service> + +</componentType> +
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite new file mode 100644 index 0000000000..f6b12fb14b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite @@ -0,0 +1,36 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://bpel" + xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld" + name="helloworld"> + + <component name="BPELHelloWorld"> + <implementation.java class="helloworld.HelloWorld"/> + <reference name="helloService" target="BPELHelloWorldService"> + <!-- Workaround for databinding issue --> + <!-- interface.wsdl interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl#wsdl.interface(HelloPortType)" / --> + </reference> + </component> + + <component name="BPELHelloWorldService"> + <implementation.bpel process="hns:HelloWorld"/> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl new file mode 100644 index 0000000000..610bda3cc4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl @@ -0,0 +1,82 @@ +<?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. + --> + +<wsdl:definitions name="helloworld" + targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" + xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> + + <wsdl:types> + <schema elementFormDefault="qualified" + targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl" + xmlns="http://www.w3.org/2001/XMLSchema"> + + <element name="hello"> + <complexType> + <sequence> + <element name="message" type="xsd:string"/> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + + <wsdl:message name="HelloMessage"> + <wsdl:part element="tns:hello" name="TestPart"/> + </wsdl:message> + + <wsdl:portType name="HelloPortType"> + <wsdl:operation name="hello"> + <wsdl:input message="tns:HelloMessage" name="TestIn"/> + <wsdl:output message="tns:HelloMessage" name="TestOut"/> + </wsdl:operation> + </wsdl:portType> + + + <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="hello"> + <wsdlsoap:operation soapAction=""/> + <wsdl:input name="TestIn"> + <wsdlsoap:body use="literal"/> + </wsdl:input> + <wsdl:output name="TestOut"> + <wsdlsoap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + + <wsdl:service name="HelloService"> + <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding"> + <soap:address location="http://localhost:8085/ode/processes/helloWorld"/> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="HelloPartnerLinkType"> + <plnk:role name="me" portType="tns:HelloPortType"/> + <plnk:role name="you" portType="tns:HelloPortType"/> + </plnk:partnerLinkType> +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/log4j.properties b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/log4j.properties new file mode 100644 index 0000000000..01bf8d8bf5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/helloworld/src/test/resources/log4j.properties @@ -0,0 +1,33 @@ +# +# 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. +# + +# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=OFF, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.mortbay=OFF
+log4j.category.org.hibernate.type=OFF
+log4j.category.org.objectweb=OFF
+log4j.category.org.apache.ode.axis2=OFF
+log4j.category.org.apache.ode.bpel.engine=OFF
+log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
+log4j.category.org.apache.ode.bpel.epr=OFF
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/bpel/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/pom.xml new file mode 100644 index 0000000000..4fd4b28ff6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/bpel/pom.xml @@ -0,0 +1,35 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-bpel</artifactId> + <packaging>pom</packaging> + <name>Apache Tuscany SCA BPEL Integration Tests</name> + + <modules> + <module>helloworld</module> + </modules> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/pom.xml new file mode 100644 index 0000000000..3a76017169 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/pom.xml @@ -0,0 +1,59 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-callablereferences-ws</artifactId>
+ <name>Apache Tuscany Test for Callable References over Web Services</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java new file mode 100644 index 0000000000..ecf1ac27e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java @@ -0,0 +1,26 @@ +/*
+ * 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 com.example;
+
+public interface ExampleClient {
+
+ void runTest();
+
+ void sayHello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java new file mode 100644 index 0000000000..c46087d865 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java @@ -0,0 +1,59 @@ +/*
+ * 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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ExampleClient.class)
+@Scope("COMPOSITE")
+public class ExampleClientImpl implements ExampleClient {
+
+ private ExampleService myService;
+
+ @Context
+ protected ComponentContext context;
+
+ @Reference
+ public void setMyService(ExampleService myService) {
+ this.myService = myService;
+ }
+
+ public void runTest() {
+ ServiceReference<ExampleClient> ref = context.createSelfReference(ExampleClient.class);
+ ref.getService().sayHello("Jack");
+ CallableReference result = myService.hello("Jill", ref);
+ if (result != null) {
+ ((CallableReference<ExampleClient>)result).getService().sayHello("John");
+ }
+ result = myService.hello("Jane", null);
+ if (result != null) {
+ ((CallableReference<ExampleClient>)result).getService().sayHello("Jim");
+ }
+ }
+
+ public void sayHello(String name) {
+ System.out.println("Hello, client " + name + "!");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java new file mode 100644 index 0000000000..670c145cc3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java @@ -0,0 +1,30 @@ +/*
+ * 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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExampleService {
+
+ CallableReference hello(String name, ServiceReference ref);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java new file mode 100644 index 0000000000..eb4d647a22 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java @@ -0,0 +1,33 @@ +/*
+ * 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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+public class ExampleServiceImpl implements ExampleService {
+
+ public CallableReference hello(String name, ServiceReference ref) {
+ if (ref != null) {
+ ((ServiceReference<ExampleClient>)ref).getService().sayHello(name);
+ }
+ return (CallableReference)ref;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/resources/example.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/resources/example.composite new file mode 100644 index 0000000000..ea0819a32e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/main/resources/example.composite @@ -0,0 +1,40 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.example.com"
+ xmlns:hw="http://www.example.com"
+ name="example">
+
+ <component name="ExampleClientComponent">
+ <implementation.java class="com.example.ExampleClientImpl" />
+ <reference name="myService">
+ <interface.java interface="com.example.ExampleService" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </reference>
+ </component>
+
+ <component name="ExampleComponent">
+ <implementation.java class="com.example.ExampleServiceImpl"/>
+ <service name="ExampleService">
+ <interface.java interface="com.example.ExampleService" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java new file mode 100644 index 0000000000..310e31fb02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java @@ -0,0 +1,44 @@ +/*
+ * 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 com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClient client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClient.class, "ExampleClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/pom.xml new file mode 100644 index 0000000000..6de454c5fc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/pom.xml @@ -0,0 +1,81 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-callablereferences</artifactId> + <name>Apache Tuscany SCA Callable References Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node-impl</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-domain-impl</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-tomcat</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-sca-axis2</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java new file mode 100644 index 0000000000..d6b3807d31 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponent.java @@ -0,0 +1,39 @@ +/* + * 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.itest.callableref; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface AComponent { + String foo(); + + String fooB(); + String fooB1(); + + String fooC(); + String fooC1(); + + String fooStringD(); + String fooD(); + + String fooBC(); + + DComponent getDReference(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java new file mode 100644 index 0000000000..65c9bdad35 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/AComponentImpl.java @@ -0,0 +1,116 @@ +/* + * 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.itest.callableref; + +import java.io.ByteArrayOutputStream; +import java.io.Externalizable; +import java.io.ObjectOutputStream; + +import org.apache.tuscany.sca.core.context.CallableReferenceImpl; +import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary; +import org.osoa.sca.CallableReference; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(AComponent.class) +public class AComponentImpl implements AComponent { + + @Context + protected ComponentContext componentContext; + + @Reference(name = "bReference") + protected BComponent b; + + @Reference + protected CComponent cReference; + + @Reference + protected ServiceReference<CComponent> cServiceReference; + + @Reference(required=false) + protected DComponent dReference; + + protected DComponent dReference1; + + @Reference(name = "dReference1") + public void setDReference(DComponent dReference) { + this.dReference1 = dReference; + } + + public String foo() { + return "AComponent"; + } + + public String fooB() { + return b.foo(); + } + + public String fooB1() { + CallableReference<BComponent> bRef = componentContext.cast(b); + return bRef.getService().foo(); + } + + public String fooC() { + return cReference.foo(); + } + + public String fooC1() { + return cServiceReference.getService().foo(); + } + + public String fooBC() { + CallableReference<CComponent> cReference = componentContext.getServiceReference(CComponent.class, "cReference"); + return b.fooC(cReference); + } + + public String fooD() { + CallableReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class); + return dReference1.foo(aReference); + } + + /** + * A test case to work out what needs to be done in a transformer to get the + * callable reference across the wire. Let here for interest in case anyone + * is looking for how to get at the innards of callable references + */ + public String fooStringD() { + CallableReference<AComponent> aReference = componentContext.createSelfReference(AComponent.class); + ByteArrayOutputStream bos = null; + + try { + bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(aReference); + } catch (Exception ex) { + System.out.println(ex.toString()); + return null; + } + + String aReferenceString = Base64Binary.encode(bos.toByteArray()); + return dReference1.fooString(aReferenceString); + } + + public DComponent getDReference() { + return dReference; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java new file mode 100644 index 0000000000..ade672b0ab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponent.java @@ -0,0 +1,30 @@ +/* + * 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.itest.callableref; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface BComponent { + + String foo(); + + String fooC(CallableReference<CComponent> cComponent); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.java new file mode 100644 index 0000000000..518e77d3a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/BComponentImpl.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 org.apache.tuscany.sca.itest.callableref; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.annotations.Service; + +@Service(BComponent.class) +public class BComponentImpl implements BComponent { + + public BComponentImpl() { + } + + public String foo() { + return "BComponent"; + } + + public String fooC(CallableReference<CComponent> cReference) { + return "B" + cReference.getService().foo(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java new file mode 100644 index 0000000000..fdf80cc1c8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponent.java @@ -0,0 +1,27 @@ +/* + * 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.itest.callableref; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CComponent { + + String foo(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java new file mode 100644 index 0000000000..cc8ec8f000 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/CComponentImpl.java @@ -0,0 +1,30 @@ +/* + * 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.itest.callableref; + +import org.osoa.sca.annotations.Service; + +@Service(CComponent.class) +public class CComponentImpl implements CComponent { + + public String foo() { + return "CComponent"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java new file mode 100644 index 0000000000..eb8cbbf280 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponent.java @@ -0,0 +1,35 @@ +/* + * 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.itest.callableref; + +import java.io.Externalizable; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.sca.core.context.CallableReferenceImpl; +import org.osoa.sca.CallableReference; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface DComponent { + + String foo(CallableReference<AComponent> aReference); + + String fooString(String aReferenceString); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java new file mode 100644 index 0000000000..8117ed9235 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/java/org/apache/tuscany/sca/itest/callableref/DComponentImpl.java @@ -0,0 +1,67 @@ +/* + * 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.itest.callableref; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.Externalizable; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import org.apache.tuscany.sca.core.context.CallableReferenceImpl; +import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary; +import org.osoa.sca.CallableReference; +import org.osoa.sca.RequestContext; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Service; + +@Service(DComponent.class) +public class DComponentImpl implements DComponent { + + @Context + protected RequestContext requestContext; + + public String foo(CallableReference<AComponent> aReference) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(aReference); + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())); + Object obj = ois.readObject(); + aReference = (CallableReference<AComponent>) obj; + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("Invoking service: " + requestContext.getServiceName()); + return "D" + aReference.getService().foo(); + } + + public String fooString(String aReferenceString) { + CallableReference<AComponent> aReference = null; + try { + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64Binary.decode(aReferenceString))); + Object obj = ois.readObject(); + aReference = (CallableReference<AComponent>) obj; + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("Invoking service: " + requestContext.getServiceName()); + return "D" + aReference.getService().foo(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/CallableReferenceTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/CallableReferenceTest.composite new file mode 100644 index 0000000000..49b75f56e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/CallableReferenceTest.composite @@ -0,0 +1,45 @@ +<?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
+ * 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:foo="http://foo" targetNamespace="http://foo"
+ name="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callableref.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="cServiceReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite new file mode 100644 index 0000000000..facbe45f50 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeA/CompositeA.composite @@ -0,0 +1,47 @@ +<?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
+ * 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:foo="http://foo" targetNamespace="http://foo"
+ name="CompositeA" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponentService" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.callableref.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="cServiceReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ </component>
+
+ <!--
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+ -->
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..95021f72a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeA/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo"> + <deployable composite="foo:CompositeA" /> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite new file mode 100644 index 0000000000..2849400be4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeB/CompositeB.composite @@ -0,0 +1,34 @@ +<?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
+ * 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:foo="http://foo" targetNamespace="http://foo"
+ name="CompositeB" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.callableref.DComponentImpl" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..2edda61601 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/main/resources/nodeB/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo"> + <deployable composite="foo:CompositeB" /> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java new file mode 100644 index 0000000000..cc1024f921 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java @@ -0,0 +1,142 @@ +/*
+ * 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.itest.callableref;
+
+
+import static junit.framework.Assert.assertEquals;
+
+import javax.xml.namespace.QName;
+
+
+import junit.framework.Assert;
+
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class CallableReferenceRemoteTestCase {
+
+ private static SCADomain domain;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+
+ private static AComponent acomponent;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain= domainFactory.createSCADomain("http://localhost:9999");
+
+ System.out.println("Setting up nodes");
+
+ ClassLoader cl = CallableReferenceRemoteTestCase.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA", "http://localhost:9999");
+ nodeA.addContribution("nodeA", cl.getResource("nodeA/"));
+ nodeA.addToDomainLevelComposite(new QName("http://foo", "CompositeA"));
+
+
+ nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB", "http://localhost:9999");
+ nodeB.addContribution("nodeB", cl.getResource("nodeB/"));
+ nodeB.addToDomainLevelComposite(new QName("http://foo", "CompositeB"));
+
+ domain.start();
+
+ // get a reference to the calculator service from domainA
+ // which will be running this component
+ acomponent = nodeA.getDomain().getService(AComponent.class, "AComponent/AComponent");
+ } catch (Exception ex) {
+ System.out.println(ex.toString());
+ }
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the nodes and hence the domains they contain
+ nodeA.destroy();
+ nodeB.destroy();
+ }
+
+ //@Test
+ public void testKeepServerRunning1() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+ @Test
+ public void testBReference() {
+ assertEquals("BComponent", acomponent.fooB());
+ }
+
+ @Test
+ public void testBCast() {
+ assertEquals("BComponent", acomponent.fooB1());
+ }
+
+ @Test
+ public void testCReference() {
+ assertEquals("CComponent", acomponent.fooC());
+ }
+
+ @Test
+ public void testCServiceReference() {
+ assertEquals("CComponent", acomponent.fooC1());
+ }
+
+ @Test
+ public void testDReferenceString() {
+ assertEquals("DAComponent", acomponent.fooStringD());
+ }
+
+ @Test
+ public void testDReference() {
+ assertEquals("DAComponent", acomponent.fooD());
+ }
+
+
+ @Test
+ public void testBCReference() {
+ assertEquals("BCComponent", acomponent.fooBC());
+ }
+
+ @Test
+ public void testRequiredFalseReference() {
+ try {
+ acomponent.getDReference().foo(null);
+ } catch (Exception e) {
+ Assert.assertTrue(true);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java new file mode 100644 index 0000000000..2b7750b443 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceTestCase.java @@ -0,0 +1,83 @@ +/* + * 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.itest.callableref; + +import static junit.framework.Assert.assertEquals; +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CallableReferenceTestCase { + private static SCADomain domain; + private static AComponent acomponent; + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("CallableReferenceTest.composite"); + acomponent = domain.getService(AComponent.class, "AComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } + + @Test + public void testBReference() { + assertEquals("BComponent", acomponent.fooB()); + } + + @Test + public void testBCast() { + assertEquals("BComponent", acomponent.fooB1()); + } + + @Test + public void testCReference() { + assertEquals("CComponent", acomponent.fooC()); + } + + @Test + public void testCServiceReference() { + assertEquals("CComponent", acomponent.fooC1()); + } + + @Test + public void testDReference() { + assertEquals("DAComponent", acomponent.fooD()); + } + + @Test + public void testBCReference() { + assertEquals("BCComponent", acomponent.fooBC()); + } + + @Test + public void testRequiredFalseReference() { + try { + acomponent.getDReference().foo(null); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/pom.xml new file mode 100644 index 0000000000..96da3b2c12 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-callback-api</artifactId> + <name>Apache Tuscany SCA Callback API Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java new file mode 100644 index 0000000000..e03bc1bda8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java @@ -0,0 +1,33 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +/** + * + */ +public interface CallBackApiCallBack { + + public void callBackMessage(String aString); + + public void callBackIncrement(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java new file mode 100644 index 0000000000..3e7c840e15 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java @@ -0,0 +1,28 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CallBackApiClient { + + public void run(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java new file mode 100644 index 0000000000..521464b4a2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java @@ -0,0 +1,159 @@ +/* + * 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; + +import junit.framework.Assert; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(CallBackApiClient.class) +public class CallBackApiClientImpl implements CallBackApiClient, CallBackApiCallBack { + + @Reference + protected CallBackApiService aCallBackService; + + private static String returnMessage = null; + private static int callBackCount = 0; + private static Object monitor = new Object(); + + public void run() { + + // This tests basic callback patterns. + + // Test3a is the basic callback where the target calls back prior to + // returning to the client. + test3a(); + + test3a1(); + + // Test3b is where the target does not call back to the client. + test3b(); + + // Test3c is where the target calls back multiple times to the client. + test3c(); + + return; + } + + private void test3a() { + aCallBackService.knockKnock("Knock Knock"); + int count = 0; + + // + // If we cant get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage()); + + } + + private void test3a1() { + aCallBackService.knockKnockByRef("Knock Knock"); + int count = 0; + + // + // If we cant get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage()); + + } + + private void test3b() { + aCallBackService.noCallBack("No Reply Desired"); + Assert.assertEquals("CallBackApiITest - test3b", 1, 1); + return; + } + + private void test3c() { + aCallBackService.multiCallBack("Call me back 3 times"); + int count = 0; + + // + // If we cant get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (this.getCallBackCount() < 3 && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackApiITest - test3c", 3, this.getCallBackCount()); + return; + } + + public String getReturnMessage() { + return returnMessage; + } + + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + public int getCallBackCount() { + return callBackCount; + } + + public void incrementCallBackCount() { + callBackCount++; + } + + public void callBackMessage(String aString) { + System.out.println("Entering callback callBackMessage: " + aString); + synchronized (monitor) { + this.setReturnMessage(aString); + monitor.notify(); + } + } + + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + synchronized (monitor) { + this.incrementCallBackCount(); + monitor.notify(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java new file mode 100644 index 0000000000..4e15e97c8d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.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; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(CallBackApiCallBack.class) +/** + * + */ +public interface CallBackApiService { + + public void knockKnock(String aString); + public void knockKnockByRef(String aString); + public void noCallBack(String aString); + + public void multiCallBack(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java new file mode 100644 index 0000000000..d51904d2ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java @@ -0,0 +1,91 @@ +/* + * 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; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.RequestContext; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Service; + +@Service(CallBackApiService.class) +public class CallBackApiServiceImpl implements CallBackApiService { + + @Context + protected ComponentContext componentContext; + + private CallBackApiCallBack callback; + + @Callback + protected CallableReference<CallBackApiCallBack> callbackRef; + + public void knockKnock(String aString) { + + System.out.println("CallBackApiServiceImpl message received: " + aString); + callback = this.getCallBackInterface(); + callback.callBackMessage("Who's There"); + System.out.println("CallBackApiServiceImpl response sent"); + return; + + } + + public void knockKnockByRef(String aString) { + + System.out.println("CallBackApiServiceImpl message received: " + aString); + callbackRef.getService().callBackMessage("Who's There"); + System.out.println("CallBackApiServiceImpl response sent"); + return; + + } + + public void multiCallBack(String aString) { + + callback = this.getCallBackInterface(); + + System.out.println("CallBackApiServiceImpl message received: " + aString); + callback.callBackIncrement("Who's There 1"); + System.out.println("CallBackApiServiceImpl response sent"); + callback.callBackIncrement("Who's There 2"); + System.out.println("CallBackApiServiceImpl response sent"); + callback.callBackIncrement("Who's There 3"); + System.out.println("CallBackApiServiceImpl response sent"); + return; + + } + + public void noCallBack(String aString) { + + System.out.println("CallBackApiServiceImpl message received: " + aString); + + return; + + } + + private CallBackApiCallBack getCallBackInterface() { + System.out.println("CallBackApiServiceImpl getting request context"); + RequestContext rc = componentContext.getRequestContext(); + System.out.println("CallBackApiServiceImpl getting callback from request context"); + callback = rc.getCallback(); + System.out.println("CallBackApiServiceImpl returning callback"); + return callback; + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/resources/CallBackApiTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/resources/CallBackApiTest.composite new file mode 100644 index 0000000000..946c4862ee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/main/resources/CallBackApiTest.composite @@ -0,0 +1,33 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://callback" + name="CallBackApiTest"> + + <component name="CallBackApiClient"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackApiClientImpl"/> + <reference name="aCallBackService" target="CallBackApiService"/> + </component> + + <component name="CallBackApiService"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackApiServiceImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java new file mode 100644 index 0000000000..6d6ca66ab8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java @@ -0,0 +1,46 @@ +/* + * 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; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class CallBackApiTestCase extends TestCase { + + private SCADomain domain; + private CallBackApiClient aCallBackClient; + + public void testCallBackBasic() { + aCallBackClient.run(); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CallBackApiTest.composite"); + + aCallBackClient = domain.getService(CallBackApiClient.class, "CallBackApiClient"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/pom.xml new file mode 100644 index 0000000000..b20d4be85d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-callback-basic</artifactId> + <name>Apache Tuscany SCA Callback Basic Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java new file mode 100644 index 0000000000..5e9d3d6821 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java @@ -0,0 +1,33 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +/** + * + */ +public interface CallBackBasicCallBack { + + public void callBackMessage(String aString); + + public void callBackIncrement(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java new file mode 100644 index 0000000000..9f4019f28c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java @@ -0,0 +1,28 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CallBackBasicClient { + + public void run(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java new file mode 100644 index 0000000000..1bb2dc22b7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java @@ -0,0 +1,135 @@ +/* + * 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; + +import junit.framework.Assert; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(CallBackBasicClient.class) +public class CallBackBasicClientImpl implements CallBackBasicClient, CallBackBasicCallBack { + + @Reference + protected CallBackBasicService aCallBackService; + private static String returnMessage = null; + private static int callBackCount = 0; + private static Object monitor = new Object(); + + public void run() { + + // This tests basic callback patterns. + + // Test1 is the basic callback where the target calls back prior to + // returning to the client. + test1a(); + + // Test2 is where the target does not call back to the client. + test1b(); + + // Test3 is where the target calls back multiple times to the client. + test1c(); + + return; + } + + private void test1a() { + aCallBackService.knockKnock("Knock Knock"); + int count = 0; + + // + // If we cant get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test1a", "Who's There", this.getReturnMessage()); + + } + + private void test1b() { + aCallBackService.noCallBack("No Reply Desired"); + Assert.assertEquals("CallBackBasicITest - test1b", 1, 1); + + return; + } + + private void test1c() { + aCallBackService.multiCallBack("Call me back 3 times"); + int count = 0; + + // + // If we cant get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (this.getCallBackCount() < 3 && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test1c", 3, this.getCallBackCount()); + return; + } + + public String getReturnMessage() { + return returnMessage; + } + + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + public int getCallBackCount() { + return callBackCount; + } + + public void incrementCallBackCount() { + callBackCount++; + } + + public void callBackMessage(String aString) { + System.out.println("Entering callback callBackMessage: " + aString); + synchronized (monitor) { + this.setReturnMessage(aString); + monitor.notify(); + } + } + + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + synchronized (monitor) { + this.incrementCallBackCount(); + monitor.notify(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java new file mode 100644 index 0000000000..bd41fa7037 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.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; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(CallBackBasicCallBack.class) +/** + * + */ +public interface CallBackBasicService { + + public void knockKnock(String aString); + + public void noCallBack(String aString); + + public void multiCallBack(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java new file mode 100644 index 0000000000..4ca2dc9af9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java @@ -0,0 +1,59 @@ +/* + * 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; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Service; + +@Service(CallBackBasicService.class) +public class CallBackBasicServiceImpl implements CallBackBasicService { + + @Callback + protected CallBackBasicCallBack callback; + + public void knockKnock(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + callback.callBackMessage("Who's There"); + System.out.println("CallBackBasicServiceImpl response sent"); + return; + + } + + public void multiCallBack(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + callback.callBackIncrement("Who's There 1"); + System.out.println("CallBackBasicServiceImpl response sent"); + callback.callBackIncrement("Who's There 2"); + System.out.println("CallBackBasicServiceImpl response sent"); + callback.callBackIncrement("Who's There 3"); + System.out.println("CallBackBasicServiceImpl response sent"); + return; + + } + + public void noCallBack(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + // System.out.println("CallBackBasicServiceImpl No response desired"); + return; + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/resources/CallBackBasicTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/resources/CallBackBasicTest.composite new file mode 100644 index 0000000000..c506956088 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/main/resources/CallBackBasicTest.composite @@ -0,0 +1,33 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://callback" + name="CallBackBasicTest"> + + <component name="CallBackBasicClient"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackBasicClientImpl"/> + <reference name="aCallBackService" target="CallBackBasicService"/> + </component> + + <component name="CallBackBasicService"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackBasicServiceImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java new file mode 100644 index 0000000000..177c4bcd18 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java @@ -0,0 +1,47 @@ +/* + * 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; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class CallBackBasicTestCase extends TestCase { + + private SCADomain domain; + private CallBackBasicClient aCallBackClient; + + public void testCallBackBasic() { + aCallBackClient.run(); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CallBackBasicTest.composite"); + aCallBackClient = domain.getService(CallBackBasicClient.class, "CallBackBasicClient"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/pom.xml new file mode 100644 index 0000000000..df96d843d4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-callback-complex-type</artifactId> + <name>Apache Tuscany SCA Callback Complex Type Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java new file mode 100644 index 0000000000..9fddb850ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java @@ -0,0 +1,33 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +/** + * + */ +public interface CallBackCTypeCallBack { + + public void callBackMessage(String aString); + + public void callBackIncrement(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java new file mode 100644 index 0000000000..739983c277 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java @@ -0,0 +1,28 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CallBackCTypeClient { + + public void run(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java new file mode 100644 index 0000000000..188b1f2c01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java @@ -0,0 +1,142 @@ +/* + * 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; + +import junit.framework.Assert; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(CallBackCTypeClient.class) +public class CallBackCTypeClientImpl implements CallBackCTypeClient, CallBackCTypeCallBack { + + @Reference + protected CallBackCTypeService aCallBackService; + private static String returnMessage = null; + private static int callBackCount = 0; + private static Object monitor = new Object(); + + public CallBackCTypeClientImpl() { + } + + public void run() { + + // This test is the same as the Basic Callback except it uses a + // componentType side file. + // This test currently fails because the integration test environment + // does not properly copy + // the componentType files to the target folder. This is documented in + // Tuscany-967. + + // Test12a is the basic callback where the target calls back prior to + // returning to the client. + test12a(); + + // Test12b is where the target does not call back to the client. + test12b(); + + // Test12c is where the target calls back multiple times to the client. + test12c(); + + return; + } + + private void test12a() { + aCallBackService.knockKnock("Knock Knock"); + int count = 0; + + // + // If we cant get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test12a -", "Who's There", this.getReturnMessage()); + + } + + private void test12b() { + aCallBackService.noCallBack("No Reply Desired"); + Assert.assertEquals("CallBackBasicITest - test12b -", 1, 1); + return; + } + + private void test12c() { + aCallBackService.multiCallBack("Call me back 3 times"); + int count = 0; + + // + // If we cant get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (this.getCallBackCount() < 3 && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test12c -", 3, this.getCallBackCount()); + return; + } + + public String getReturnMessage() { + return returnMessage; + } + + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + public int getCallBackCount() { + return callBackCount; + } + + public void incrementCallBackCount() { + callBackCount++; + } + + public void callBackMessage(String aString) { + System.out.println("Entering callback callBackMessage: " + aString); + synchronized (monitor) { + this.setReturnMessage(aString); + monitor.notify(); + } + } + + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + synchronized (monitor) { + this.incrementCallBackCount(); + monitor.notify(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java new file mode 100644 index 0000000000..ffbf4f35fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java @@ -0,0 +1,36 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +// @Callback(CallBackCTypeCallBack.class) +/** + * + */ +public interface CallBackCTypeService { + + public void knockKnock(String aString); + + public void noCallBack(String aString); + + public void multiCallBack(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java new file mode 100644 index 0000000000..dc31ed156b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java @@ -0,0 +1,62 @@ +/* + * 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; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Service; + +@Service(CallBackCTypeService.class) +public class CallBackCTypeServiceImpl implements CallBackCTypeService { + + @Callback + protected CallBackCTypeCallBack callback; + + public CallBackCTypeServiceImpl() { + } + + public void knockKnock(String aString) { + + System.out.println("CallBackCTypeServiceImpl message received: " + aString); + callback.callBackMessage("Who's There"); + System.out.println("CallBackCTypeServiceImpl response sent"); + return; + + } + + public void multiCallBack(String aString) { + + System.out.println("CallBackCTypeServiceImpl message received: " + aString); + callback.callBackIncrement("Who's There 1"); + System.out.println("CallBackCTypeServiceImpl response sent"); + callback.callBackIncrement("Who's There 2"); + System.out.println("CallBackCTypeServiceImpl response sent"); + callback.callBackIncrement("Who's There 3"); + System.out.println("CallBackCTypeServiceImpl response sent"); + return; + + } + + public void noCallBack(String aString) { + + System.out.println("CallBackCTypeServiceImpl message received: " + aString); + System.out.println("CallBackCTypeServiceImpl No response desired"); + return; + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite new file mode 100644 index 0000000000..3f48f16389 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite @@ -0,0 +1,33 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://callback" + name="CallBackCTypeTest"> + + <component name="CallBackCTypeClient"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeClientImpl"/> + <reference name="aCallBackService" target="CallBackCTypeService"/> + </component> + + <component name="CallBackCTypeService"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeServiceImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType new file mode 100644 index 0000000000..ff38134df5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" > +
+ <service name="CallBackCTypeService">
+ <interface.java interface="org.apache.tuscany.sca.test.CallBackCTypeService"
+ callbackInterface="org.apache.tuscany.sca.test.CallBackCTypeCallBack"/>
+ </service>
+ +</componentType>
+
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java new file mode 100644 index 0000000000..33d1afaecd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCaseFIXME.java @@ -0,0 +1,48 @@ +/* + * 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; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +//FIXME Fix this test case +public class CallBackCTypeTestCaseFIXME extends TestCase { + + private SCADomain domain; + private CallBackCTypeClient aCallBackClient; + + public void testCallBackBasic() { + aCallBackClient.run(); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CallBackCTypeClient.composite"); + + aCallBackClient = + domain.getService(CallBackCTypeClient.class, "CallBackCTypeClient"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/pom.xml new file mode 100644 index 0000000000..b393dab039 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-callback-id</artifactId> + <name>Apache Tuscany SCA Callback ID Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java new file mode 100644 index 0000000000..b14560a8c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +/** + * + */ +public interface CallBackIdCallBack { + + public void callBackMessage(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java new file mode 100644 index 0000000000..a9e551f8b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java @@ -0,0 +1,28 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CallBackIdClient { + + public void run(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java new file mode 100644 index 0000000000..fef0eb50b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java @@ -0,0 +1,147 @@ +/* + * 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; + +import junit.framework.Assert; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.RequestContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(CallBackIdClient.class) +public class CallBackIdClientImpl implements CallBackIdClient, CallBackIdCallBack { + + @Context + protected ComponentContext componentContext; + + @Reference + protected ServiceReference<CallBackIdService> aCallBackService; + + private static String returnMessage = null; + private static Object monitor = new Object(); + private static Object callBackId; + + public void run() { + + // This tests the use of the set/get callbackId API both SCA generated + // and client specified. + + // Test1 uses a SCA generated callback ID and compare that with the + // callbackID returned during callback. + test11a(); + + // Test2 uses a Client specified callback ID and compare that with the + // callbackID returned during callback. + test11b(); + + return; + } + + private void test11a() { + + // Retrieve this services callback ID and save it. Once the callback is + // received the callback ID will be compared with the one + // returned. Equal is good. + + Object origCallBackId = aCallBackService.getCallbackID(); + aCallBackService.getService().knockKnock("Knock Knock - Test1"); + int count = 0; + + // + // If we cannot get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackIdITest - test11a - SCA Generated Id", origCallBackId, this.getCallBackId()); + + } + + private void test11b() { + + // Set the services callback ID and save it. Once the callback is + // received the callback ID will be compared with the one + // returned. Equal is good. + + String origCallBackId = "CallBackId1"; + aCallBackService.setCallbackID(origCallBackId); + + aCallBackService.getService().knockKnock("Knock Knock - Test2"); + int count = 0; + + // + // If we cant get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert + .assertEquals("CallBackIdITest - 11b - Client Specified Id", origCallBackId, (String)this.getCallBackId()); + + } + + public String getReturnMessage() { + return returnMessage; + } + + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + public void callBackMessage(String aString) { + + System.out.println("Entering callback callBackMessage: " + aString); + RequestContext rc = componentContext.getRequestContext(); + Object callBackId = rc.getServiceReference().getCallbackID(); + + synchronized (monitor) { + this.setReturnMessage(aString); + this.setCallBackId(callBackId); + monitor.notify(); + } + } + + protected Object getCallBackId() { + return callBackId; + } + + protected void setCallBackId(Object aCallBackId) { + callBackId = aCallBackId; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java new file mode 100644 index 0000000000..18c592a1c1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java @@ -0,0 +1,33 @@ +/* + * 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; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(CallBackIdCallBack.class) +/** + * + */ +public interface CallBackIdService { + + public void knockKnock(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java new file mode 100644 index 0000000000..8b0a4b69cf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java @@ -0,0 +1,48 @@ +/* + * 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; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.RequestContext; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Service; + +@Service(CallBackIdService.class) +public class CallBackIdServiceImpl implements CallBackIdService { + + @Callback + protected CallBackIdCallBack callback; + @Context + protected ComponentContext compositeContext; + + public void knockKnock(String aString) { + + System.out.println("CallBackIdServiceImpl message received: " + aString); + RequestContext rc = compositeContext.getRequestContext(); + Object callBackId = rc.getServiceReference().getCallbackID(); + System.out.println("CallBackIdServiceImpl callbackID: " + callBackId); + + callback.callBackMessage("Who's There"); + System.out.println("CallBackIdServiceImpl response sent"); + return; + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/resources/CallBackIdClient.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/resources/CallBackIdClient.composite new file mode 100644 index 0000000000..c9a6ba6258 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/main/resources/CallBackIdClient.composite @@ -0,0 +1,33 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://callback" + name="CallBackIdTest"> + + <component name="CallBackIdClient"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackIdClientImpl"/> + <reference name="aCallBackService" target="CallBackIdService"/> + </component> + + <component name="CallBackIdService"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackIdServiceImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java new file mode 100644 index 0000000000..771fbb8ff7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTestCase.java @@ -0,0 +1,45 @@ +/* + * 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; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class CallBackIdTestCase extends TestCase { + + private SCADomain domain; + private CallBackIdClient aCallBackClient; + + public void testCallBackBasic() { + aCallBackClient.run(); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CallBackIdClient.composite"); + + aCallBackClient = domain.getService(CallBackIdClient.class, "CallBackIdClient"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/pom.xml new file mode 100644 index 0000000000..7eb5cfaef9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-callback-multiple-wires</artifactId> + <name>Apache Tuscany SCA Callback With Mutiple Wires Test</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java new file mode 100644 index 0000000000..7c80d222fc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java @@ -0,0 +1,27 @@ +/* + * 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.callback; + +/** + * The client interface + */ +public interface MyClient { + + void aClientMethod(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java new file mode 100644 index 0000000000..df91f3d268 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java @@ -0,0 +1,49 @@ +/* + * 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.callback; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * Demonstrates a component-to-component callback invocation + */ +@Service(MyClient.class) +@Scope("COMPOSITE") +public class MyClientImpl1 implements MyClient, MyServiceCallback { + + private MyService myService; + static String result; + + @Reference + public void setMyService(MyService myService) { + this.myService = myService; + } + + public void aClientMethod() { + myService.someMethod("-> someMethod1"); + } + + public void receiveResult(String result) { + System.out.println("Work thread " + Thread.currentThread()); + System.out.println("Result: " + result); + MyClientImpl1.result = result; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java new file mode 100644 index 0000000000..a0a9564002 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java @@ -0,0 +1,49 @@ +/* + * 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.callback; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * Demonstrates a component-to-component callback invocation + */ +@Service(MyClient.class) +@Scope("COMPOSITE") +public class MyClientImpl2 implements MyClient, MyServiceCallback { + + private MyService myService; + static String result; + + @Reference + public void setMyService(MyService myService) { + this.myService = myService; + } + + public void aClientMethod() { + myService.someMethod("-> someMethod2"); + } + + public void receiveResult(String result) { + System.out.println("Work thread " + Thread.currentThread()); + System.out.println("Result: " + result); + MyClientImpl2.result = result; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java new file mode 100644 index 0000000000..cfd601f546 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.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.callback; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.OneWay; + +/** + * This service that will be invoked in a non-blocking fashion + */ +@Callback(MyServiceCallback.class) +public interface MyService { + + @OneWay + void someMethod(String arg); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java new file mode 100644 index 0000000000..f198efae51 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java @@ -0,0 +1,27 @@ +/* + * 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.callback; + +/** + * The callback interface for {@link MyService}. + */ +public interface MyServiceCallback { + + void receiveResult(String result); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java new file mode 100644 index 0000000000..08ab7ca56d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.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.callback; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * This class implements MyService and uses a callback. + */ +@Service(MyService.class) +@Scope("COMPOSITE") +public class MyServiceImpl implements MyService { + + private MyServiceCallback myServiceCallback; + + /** + * The setter used by the runtime to set the callback reference + * @param myServiceCallback + */ + @Callback + public void setMyServiceCallback(MyServiceCallback myServiceCallback) { + this.myServiceCallback = myServiceCallback; + } + + public void someMethod(String arg) { + // invoke the callback + try { + myServiceCallback.receiveResult(arg + " -> receiveResult"); + } catch(RuntimeException e) { + System.out.println("RuntimeException invoking receiveResult: " + e.toString()); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite new file mode 100644 index 0000000000..3dae3ca3a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite @@ -0,0 +1,38 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://callback"
+ name="CallbackMultiWireTest">
+
+ <component name="MyClientComponent1">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyClientImpl1"/>
+ <reference name="myService" target="MyServiceComponent"/>
+ </component>
+
+ <component name="MyClientComponent2">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyClientImpl2"/>
+ <reference name="myService" target="MyServiceComponent"/>
+ </component>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.callback.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java new file mode 100644 index 0000000000..41ba766697 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java @@ -0,0 +1,55 @@ +/* + * 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.callback; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * A testcase that demonstrates resolving the client service and initiating the callback sequence + */ +public class CallbackMultiWireTestCase extends TestCase { + + private SCADomain scaDomain; + private MyClient myClient1; + private MyClient myClient2; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("CallbackMultiWireTest.composite"); + myClient1 = scaDomain.getService(MyClient.class, "MyClientComponent1"); + myClient2 = scaDomain.getService(MyClient.class, "MyClientComponent2"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + System.out.println("Main thread " + Thread.currentThread()); + myClient1.aClientMethod(); + myClient2.aClientMethod(); + System.out.println("Sleeping ..."); + Thread.sleep(300); + assertEquals("-> someMethod1 -> receiveResult", MyClientImpl1.result); + assertEquals("-> someMethod2 -> receiveResult", MyClientImpl2.result); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/pom.xml new file mode 100644 index 0000000000..00abbd3437 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-callback-set-callback</artifactId> + <name>Apache Tuscany SCA Set Callback Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java new file mode 100644 index 0000000000..3b9599f53f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java @@ -0,0 +1,34 @@ +/* + * 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; + +import org.osoa.sca.annotations.Callback; + +// @Remotable +@Callback(CallBackSetCallbackCallback.class) +/** + * + */ +public interface CallBackSetCalbackService { + + public void knockKnock(String aString); + + public boolean setCallbackIllegally(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java new file mode 100644 index 0000000000..48752f2ea1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.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 org.apache.tuscany.sca.test; + +import junit.framework.Assert; + +public class CallBackSetCallbackBadCallback { + + public CallBackSetCallbackBadCallback() { + super(); + } + + public void callback(String aString) { + // + // This callback method should never be called. + // + System.out.println("CallBackSetCallbackBadCallback: callback called"); + Assert.fail("CallBackSetCallbackBadCallback: callback called"); + return; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java new file mode 100644 index 0000000000..ad0e0603a3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.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; + +// @Remotable +/** + * + */ +public interface CallBackSetCallbackCallback { + + public void callBackMessage(String aString); + + public void callBackIncrement(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java new file mode 100644 index 0000000000..0a22b0e01f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java @@ -0,0 +1,66 @@ +/* + * 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; + +import java.io.File; + +import org.osoa.sca.annotations.Service; + +@Service(CallBackSetCallbackCallback.class) +public class CallBackSetCallbackCallbackImpl implements CallBackSetCallbackCallback { + + private static String returnMessage = null; + private static int callBackCount = 0; + + public String getReturnMessage() { + return returnMessage; + } + + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + public int getCallBackCount() { + return callBackCount; + } + + public void incrementCallBackCount() { + callBackCount++; + } + + public void callBackMessage(String aString) { + + System.out.println("Entering CallBackSetCallbackCallbackImpl callBackMessage: " + aString); + + File aFile = new File("target/test4_marker"); + try { + aFile.createNewFile(); + } catch (Exception ex) { + System.out.println("Error Creating target/test4_marker marker file"); + ex.printStackTrace(); + } + + } + + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + this.incrementCallBackCount(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java new file mode 100644 index 0000000000..94cb6aa73b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java @@ -0,0 +1,28 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CallBackSetCallbackClient { + + public void run(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java new file mode 100644 index 0000000000..ee14467de0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java @@ -0,0 +1,190 @@ +/* + * 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; + +import java.io.File; + +import junit.framework.Assert; + +import org.osoa.sca.NoRegisteredCallbackException; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(CallBackSetCallbackClient.class) +public class CallBackSetCallbackClientImpl implements CallBackSetCallbackClient { + + @Reference + protected ServiceReference<CallBackSetCalbackService> aCallBackService; + @Reference + protected ServiceReference<CallBackSetCallbackCallback> callBack; + + public void run() { + + // This test various aspects of the setCallback() API in a stateless + // scope. + + /* + * test4 Client does not implement the callback interface but calls + * setCallback with a service reference before invoking the target, + * Verify successful executon. + */ + + test4(); + + /* + * test5 The client does not implement the callback interface and does + * not call setCallback() before invoking the target. Verify a + * NoRegisteredCallbackException is thrown. + */ + + test5(); + + /* + * test6() The client calls setCallback() with an object that is not a + * service reference and the callback interface is stateless. Verify + * that an appropriate exception is thrown. When calling setCallback + * with an object the interface must be stateful. Stateless interfaces + * require a service Reference. + */ + + test6(); + + /* + * test10 The target calls setCallback() on its own service reference, + * e.g. getRequestContext().getServiceReference().getCallback(). Verify + * an appropriate exeception occurs. + */ + + test10(); + + return; + } + + private void test4() { + + // + // Since callbacks do not synchronously return and this test results in + // a callback to a component other + // than this client I am using a marker file to determine the outcome. + // The presence of the marker + // file will be used for the Assertion test. If it exists then the + // callback occurred and all is good. + // + + // Make sure the marker file is not present before starting the test. + File aFile = new File("target/test4_marker"); + if (aFile.exists()) + aFile.delete(); + + aCallBackService.setCallback(callBack); + + aCallBackService.getService().knockKnock("Knock Knock"); + + // Lets give the callback a little time to complete.... + + int count = 0; + long timeout = 1000; + + while (count++ < 30 && (aFile.exists() == false)) { + try { + Thread.sleep(timeout); + } catch (InterruptedException ie) { + } + } + + Assert.assertEquals("CallBackSetCallback - Test4", true, aFile.exists()); + + aCallBackService.setCallback(null); // leave this in the default state for next test + + } + + private void test5() { + + boolean correctException = false; + + // + // The backend service is expecting a callback reference to be set. This + // test will not + // set one so an exception is expected. According to the spec if a + // client calls a method on + // a service reference prior to calling setCallback() then a + // NoRegisteredCallbackException + // will be thrown on the client. + // + + try { + aCallBackService.getService().knockKnock("Knock Knock"); + } catch (NoRegisteredCallbackException NotRegEx) { + correctException = true; + } catch (Exception ex) { + ex.printStackTrace(); + } + + Assert.assertEquals("CallBackSetCallback - Test5", true, correctException); + + } + + private void test6() { + + boolean correctException = false; + + // + // This test is to specify an Object that is not a service reference + // that does implement + // the callback interface. However because this callback service is + // stateless the expected + // result is an appropriate exception. + // + + try { + aCallBackService.setCallback(new CallBackSetCallbackObjectCallback()); + aCallBackService.getService().knockKnock("Knock Knock"); + } + // + // This should catch an appropriate exception. + // + catch (IllegalArgumentException goodEx) { + correctException = true; + } catch (Exception ex) { + ex.printStackTrace(); + } + + Assert.assertEquals("CallBackSetCallback - Test6", true, correctException); + + } + + private void test10() { + + // + // The appropriate exception should be thrown and caught on the service side. + // If this happens, the setCallbackIllegally() method will return true. + // If not, this method will return false. + // + + aCallBackService.setCallback(callBack); // ensure no client-side exception + + boolean result = aCallBackService.getService().setCallbackIllegally + ("Try to set callback on your own service reference"); + + Assert.assertEquals("CallBackSetCallback - Test10", true, result); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java new file mode 100644 index 0000000000..afedcdf7f1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java @@ -0,0 +1,44 @@ +/* + * 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; + +public class CallBackSetCallbackObjectCallback implements CallBackSetCallbackCallback { + + private int callBackCount = 0; + + public CallBackSetCallbackObjectCallback() { + super(); + } + + public void incrementCallBackCount() { + callBackCount++; + } + + public void callBackMessage(String aString) { + + System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString); + + } + + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + this.incrementCallBackCount(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java new file mode 100644 index 0000000000..8093093968 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java @@ -0,0 +1,75 @@ +/* + * 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; + +import java.io.File; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.RequestContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Service; + +@Service(CallBackSetCalbackService.class) +public class CallBackSetCallbackServiceImpl implements CallBackSetCalbackService { + + @Callback + protected CallBackSetCallbackCallback callback; + @Context + protected ComponentContext context; + + public void knockKnock(String aString) { + + try { + System.out.println("CallBackBasicServiceImpl message received: " + aString); + callback.callBackMessage("Who's There"); + System.out.println("CallBackBasicServiceImpl response sent"); + return; + } catch (Exception ex) { + ex.printStackTrace(); + } + + } + + public boolean setCallbackIllegally(String aString) { + + System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString); + + boolean exceptionProduced = false; + RequestContext requestContext = null; + ServiceReference serviceRef = null; + + try { + requestContext = context.getRequestContext(); + serviceRef = (ServiceReference) requestContext.getServiceReference(); + serviceRef.setCallback(serviceRef); + } catch (ClassCastException goodEx) { + exceptionProduced = true; + System.out.println("Test10 appropriate exception caught during setCallback to own service reference"); + } catch (Exception badEx) { + System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + badEx.toString()); + badEx.printStackTrace(); + } + + // Return a flag indicating whether we got the exception we are looking for + return exceptionProduced; + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite new file mode 100644 index 0000000000..3552ddecab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite @@ -0,0 +1,37 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://callback" + name="CallBackSetCallbackTest"> + + <component name="CallBackSetCallbackClient"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackClientImpl"/> + <reference name="aCallBackService" target="CallBackSetCallbackService"/> + <reference name="callBack" target="CallBackSetCallbackCallback"/> + </component> + + <component name="CallBackSetCallbackCallback"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackCallbackImpl"/> + </component> + + <component name="CallBackSetCallbackService"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackServiceImpl"/> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java new file mode 100644 index 0000000000..496ae0b1a5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTestCase.java @@ -0,0 +1,49 @@ +/* + * 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; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +//FIXME Fix this test case +public class CallBackSetCallbackTestCase extends TestCase { + + private SCADomain domain; + private CallBackSetCallbackClient aCallBackClient; + + public void testCallBackSetCallback() { + aCallBackClient.run(); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CallBackSetCallbackTest.composite"); + + aCallBackClient = + domain.getService(CallBackSetCallbackClient.class, + "CallBackSetCallbackClient"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/pom.xml new file mode 100644 index 0000000000..e001b50c78 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-callback-set-conversation</artifactId> + <name>Apache Tuscany SCA Callback Set Conversation Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java new file mode 100644 index 0000000000..eb840a006d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.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 org.apache.tuscany.sca.test; + +import junit.framework.Assert; + +public class CallBackSetCallbackConvBadCallback { + + public CallBackSetCallbackConvBadCallback() { + super(); + } + + public void callback(String aString) { + // + // This callback method should never be called. + // + System.out.println("CallBackSetCallbackBadCallback: callback called"); + Assert.fail("CallBackSetCallbackConvBadCallback: callback called"); + return; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java new file mode 100644 index 0000000000..a704fd0ece --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java @@ -0,0 +1,34 @@ +/* + * 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; + +import org.osoa.sca.annotations.Conversational; + +// @Remotable +@Conversational +/** + * + */ +public interface CallBackSetCallbackConvCallback { + + public void callBackMessage(String aString); + + public void callBackIncrement(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java new file mode 100644 index 0000000000..013424bf5e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java @@ -0,0 +1,28 @@ +/* + * 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; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CallBackSetCallbackConvClient { + + public void run(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java new file mode 100644 index 0000000000..475d7fc96d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java @@ -0,0 +1,174 @@ +/* + * 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; + +import junit.framework.Assert; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.NoRegisteredCallbackException; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(CallBackSetCallbackConvClient.class) +@Scope("CONVERSATION") +public class CallBackSetCallbackConvClientImpl implements CallBackSetCallbackConvClient, + //FIXME: remove the following hack, needed to get around current JavaImplementationInvoker limitation + CallBackSetCallbackConvCallback { + + @Context + protected ComponentContext componentContext; + @Reference + protected CallBackSetCallbackConvService aCallBackService; + private CallBackSetCallbackConvObjectCallback aCallbackObject = null; + + public void run() { + + // This tests aspects of the setCallback() API within a conversational + // scope. + + /* + * test7 The client calls setCallback() with an object that is not a + * service reference and the callback interface is stateful. Verify + * successful execution. + */ + test7(); + + /* + * test8() The client calls setCallback() with an object that does not + * implement the callback interface. Verify an appropriate exception is + * thrown. This requires a STATEFUL interface. + */ + test8(); + + /* + * test9 The client calls setCallback() with an object that is not + * serializable. Verify an appropriate exception is thrown. This + * requires a STATEFUL callback interface. Move from the stateless test + * case. + */ + test9(); + + return; + } + + private void test7() { + + // + // This test is to specify an Object that is not a service reference + // that does implement + // the callback interface and is Serializeable. Verify successful + // execution. + // + + aCallbackObject = new CallBackSetCallbackConvObjectCallback(); + aCallbackObject.incrementCallBackCount(); + + ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef + = componentContext.cast(aCallBackService); + aCallBackServiceRef.setCallback(aCallbackObject); + aCallBackService.knockKnock("Knock Knock"); + + Assert.assertEquals("CallBackSetCallbackConv - Test7", 2, aCallbackObject.getCount()); + + } + + private void test8() { + + boolean correctException = false; + + // + // This test is to specify an Object that is not a service reference + // that does not implement + // the callback interface. The expected result is an appropriate + // exception. + // + + try { + ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef + = componentContext.cast(aCallBackService); + aCallBackServiceRef.setCallback(new CallBackSetCallbackConvBadCallback()); + aCallBackService.knockKnock("Knock Knock"); + } + + // + // This should catch an appropriate exception. + // + + catch (IllegalArgumentException goodEx) + { + System.out.println("correct exception " + goodEx); + correctException = true; + } + + catch (Exception ex) { + // This means an inappropriate exception occurred + ex.printStackTrace(); + } + + Assert.assertEquals("CallBackSetCallbackConv - Test8", true, correctException); + + } + + private void test9() { + + boolean correctException = false; + + // + // This test is to specify an Object that is not a service reference + // that does implement + // the callback interface but does not implement Serializeable. Verify + // an appropriate exception + // is thrown. + // + + try { + ServiceReference<CallBackSetCallbackConvService> aCallBackServiceRef + = componentContext.cast(aCallBackService); + aCallBackServiceRef.setCallback(new CallBackSetCallbackConvNonSerCallback()); + aCallBackService.knockKnock("Knock Knock"); + } + // + // This should catch an appropriate exception. + // + catch (IllegalArgumentException goodEx) + { + System.out.println("correct exception " + goodEx); + correctException = true; + } catch (Exception ex) { + ex.printStackTrace(); + } + + Assert.assertEquals("CallBackSetCallbackConv - Test9", true, correctException); + + } + + //FIXME: remove the following methods, needed to get around current JavaImplementationInvoker limitation + + public void callBackMessage(String aString) { + throw new IllegalStateException("CallbackSetCallbackConvClientImpl.callbackMessage called"); + } + + public void callBackIncrement(String aString) { + throw new IllegalStateException("CallbackSetCallbackConvClientImpl.callbackIncrement called"); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java new file mode 100644 index 0000000000..789e04e907 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java @@ -0,0 +1,58 @@ +/* + * 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; + +public class CallBackSetCallbackConvNonSerCallback implements CallBackSetCallbackConvCallback { + + private int callBackCount = 0; + private Object monitor; + + public CallBackSetCallbackConvNonSerCallback() { + super(); + } + + public synchronized void incrementCallBackCount() { + callBackCount++; + } + + public synchronized int getCount() { + return callBackCount; + } + + public void setMonitor(Object anObject) { + monitor = anObject; + } + + public void callBackMessage(String aString) { + + System.out.println("Entering CallBackSetCallbackConvNonSerCallback callBackMessage: " + aString); + + } + + public void callBackIncrement(String aString) { + + System.out.println("Entering callback increment: " + aString); + + synchronized (monitor) { + this.incrementCallBackCount(); + monitor.notify(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java new file mode 100644 index 0000000000..9b998df045 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java @@ -0,0 +1,54 @@ +/* + * 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; + + +public class CallBackSetCallbackConvObjectCallback + //FIXME: remove the following hack, needed to get around current JavaImplementationInvoker limitation + extends CallBackSetCallbackConvClientImpl + //implements CallBackSetCallbackConvCallback +{ + private int callBackCount = 0; + + public CallBackSetCallbackConvObjectCallback() { + super(); + } + + public synchronized void incrementCallBackCount() { + callBackCount++; + } + + public synchronized int getCount() { + return callBackCount; + } + + public void callBackMessage(String aString) { + + System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString); + + } + + public void callBackIncrement(String aString) { + + System.out.println("Entering callback increment: " + aString); + + this.incrementCallBackCount(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java new file mode 100644 index 0000000000..692b6dfc35 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java @@ -0,0 +1,36 @@ +/* + * 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; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Conversational; + +// @Remotable +@Conversational +@Callback(CallBackSetCallbackConvCallback.class) +/** + * + */ +public interface CallBackSetCallbackConvService { + + public void knockKnock(String aString); + + public void setCallbackIllegally(String aString); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java new file mode 100644 index 0000000000..bca94ce407 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java @@ -0,0 +1,98 @@ +/* + * 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; + +import java.io.File; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.RequestContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(CallBackSetCallbackConvService.class) +@Scope("CONVERSATION") +public class CallBackSetCallbackConvServiceImpl implements CallBackSetCallbackConvService { + + @Callback + protected CallBackSetCallbackConvCallback callback; + @Context + protected ComponentContext context; + + public void knockKnock(String aString) { + + System.out.println("CallBackSetCallbackConvServiceImpl message received: " + aString); + callback.callBackMessage("Who's There"); + callback.callBackIncrement("This should do it"); + System.out.println("CallBackSetCallbackConvServiceImpl response sent"); + + } + + public void setCallbackIllegally(String aString) { + + System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString); + + boolean exceptionProduced = false; + RequestContext requestContext = null; + ServiceReference serviceRef = null; + + // Context is not working properly so we can't trust that this is + // working..... + try { + requestContext = context.getRequestContext(); + serviceRef = (ServiceReference) requestContext.getServiceReference(); + } catch (Exception ex) { + System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + ex.toString()); + ex.printStackTrace(); + return; + } + + // Ok, call setCallback with my own service reference. + try { + serviceRef.setCallback(serviceRef); + } catch (NullPointerException npe) { + // This is not an appropriate exception. + System.out.println("Test10 NPE exception during setCallback to own service reference"); + npe.printStackTrace(); + return; + } + // This needs to catch the appropriate exception, once we figure out + // what is needs to be! + catch (Exception ex) { + exceptionProduced = true; + System.out.println("Test10 appropriate exception caught during setCallback to own service reference"); + } + ; + + // If we get the exception we are looking for then create the marker + // file. + if (exceptionProduced == true) { + File aFile = new File("target/test10_marker"); + try { + aFile.createNewFile(); + } catch (Exception ex) { + System.out.println("Error Creating target/test10_marker marker file"); + ex.printStackTrace(); + } + } + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite new file mode 100644 index 0000000000..ce73417f94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite @@ -0,0 +1,33 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://callback" + name="CallBackSetCallbackConvTest"> + + <component name="CallBackSetCallbackConvClient"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackConvClientImpl"/> + <reference name="aCallBackService" target="CallBackSetCallbackConvService"/> + </component> + + + <component name="CallBackSetCallbackConvService"> + <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackConvServiceImpl"/> + </component> +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java new file mode 100644 index 0000000000..45bdaea9ab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTestCase.java @@ -0,0 +1,48 @@ +/* + * 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; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class CallBackSetCallbackConvTestCase extends TestCase { + + private SCADomain domain; + private CallBackSetCallbackConvClient aCallBackClient; + + public void testCallBackSetCallback() { + aCallBackClient.run(); + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("CallBackSetCallbackConvTest.composite"); + + aCallBackClient = + domain.getService(CallBackSetCallbackConvClient.class, + "CallBackSetCallbackConvClient"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/pom.xml new file mode 100644 index 0000000000..7219916685 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/pom.xml @@ -0,0 +1,46 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-component-type</artifactId> + <name>Apache Tuscany SCA Component Type Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..188451ebac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * 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 calculator; + +/** + * The Add service interface + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..8b6fe066a6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,30 @@ +/* + * 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 calculator; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + return n1 + n2; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..08afd922b3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,45 @@ +/* + * 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 calculator; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); + + CalculatorService calculatorService = + scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorService"); + + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + scaDomain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..031fa8b912 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * 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 calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..f14ee506df --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,67 @@ +/* + * 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 calculator; + +import org.osoa.sca.annotations.Reference; + + + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + public void setAddService(AddService addService) { + this.addService = addService; + } + + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..30d248208b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * 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 calculator; + +/** + * The divide service interface + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..f7ac0b7287 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/* + * 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 calculator; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * 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 calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..b7dca792b2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/* + * 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 calculator; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..bf0d1882b6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * 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 calculator; + +/** + * The interface for the multiply service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..77b128ab8d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,30 @@ +/* + * 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 calculator; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..b229787657 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/Calculator.composite @@ -0,0 +1,49 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent/AddService"/>
+ <reference name="subtractService" target="SubtractServiceComponent/SubtractService"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent/MultiplyService"/>
+ <reference name="divideService" target="DivideServiceComponent/DivideService"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType new file mode 100644 index 0000000000..00c48e5a35 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ + <service name="AddService">
+ <interface.java interface="calculator.AddService"/>
+ </service>
+ +</componentType>
+
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType new file mode 100644 index 0000000000..74bedc0a98 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ + <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <reference name="addService">
+ <interface.java interface="calculator.AddService"/>
+ </reference>
+
+ <reference name="subtractService">
+ <interface.java interface="calculator.SubtractService"/>
+ </reference>
+
+ <reference name="multiplyService">
+ <interface.java interface="calculator.MultiplyService"/>
+ </reference>
+
+ <reference name="divideService">
+ <interface.java interface="calculator.DivideService"/>
+ </reference>
+ +</componentType>
+
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType new file mode 100644 index 0000000000..289fcc3e11 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ + <service name="DivideService">
+ <interface.java interface="calculator.DivideService"/>
+ </service>
+ +</componentType>
+
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType new file mode 100644 index 0000000000..2d8a879cda --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ + <service name="MultiplyService">
+ <interface.java interface="calculator.MultiplyService"/>
+ </service>
+ +</componentType>
+
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType new file mode 100644 index 0000000000..6214955141 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ + <service name="SubtractService">
+ <interface.java interface="calculator.SubtractService"/>
+ </service>
+ +</componentType>
+
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/test/java/calculator/CalculatorTestCase.java new file mode 100644 index 0000000000..08fc8e33bf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/component-type/src/test/java/calculator/CalculatorTestCase.java @@ -0,0 +1,52 @@ +/* + * 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 calculator; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This shows how to test the Calculator service component. + */ +public class CalculatorTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("Calculator.composite"); + calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorService"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testCalculator() throws Exception { + // Calculate + assertEquals(calculatorService.add(3, 2), 5.0); + assertEquals(calculatorService.subtract(3, 2), 1.0); + assertEquals(calculatorService.multiply(3, 2), 6.0); + assertEquals(calculatorService.divide(3, 2), 1.5); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/build-jar.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/build-jar.xml new file mode 100644 index 0000000000..299ce6864f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/build-jar.xml @@ -0,0 +1,39 @@ +<?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. +--> +<project name="JarCreator"> + + <target name="create-jar"> + + <mkdir dir="${jar.dir}"/> + + <copy file="target/classes/META-INF/${sca.contribution}" tofile="target/classes/META-INF/sca-contribution.xml"/> + + + <jar jarfile="${jar.dir}/${jar.file.name}" > + <fileset dir="${files.dir}" includes="${files.list}"> + <!-- include name="${files.list}"/--> + </fileset> + </jar> + + <delete file="target/classes/META-INF/sca-contribution.xml"/> + </target> + + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/pom.xml new file mode 100644 index 0000000000..f4ed689256 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/pom.xml @@ -0,0 +1,203 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-contribution-classloader-classes</artifactId> + <name>Apache Tuscany Contribution ClassLoader Test : Contribution Classes</name> + +<dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>itest-contribution-classloader-classes</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.1</version> + + <dependencies> + <dependency> + <groupId>ant</groupId> + <artifactId>ant-trax</artifactId> + <version>1.6.5</version> + </dependency> + </dependencies> + + <executions> + <execution> + <id>create-jar</id> + <phase>generate-test-sources</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="SupplyChain.jar" /> + <property name="sca.contribution" value="supplychain-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/supplychain.composite \ + supplychain/warehouse/JavaWarehouseComponentImpl.componentType \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="CompleteSupplyChain.jar" /> + <property name="sca.contribution" value="complete-supplychain-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/supplychain.composite \ + supplychain/customer/* \ + supplychain/retailer/* \ + supplychain/warehouse/* \ + supplychain/shipper/* \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="Customer.jar" /> + <property name="sca.contribution" value="customer-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/customer/* \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="Retailer.jar" /> + <property name="sca.contribution" value="retailer-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/retailer/* \ + META-INF/sca-contribution.xml" /> + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="Shipper.jar" /> + <property name="sca.contribution" value="shipper-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/shipper/* \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="Warehouse.jar" /> + <property name="sca.contribution" value="warehouse-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/warehouse/* \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="IllegalSupplyChain1.jar" /> + <property name="sca.contribution" value="illegal1-supplychain-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/illegalsupplychain.composite \ + supplychain/warehouse/JavaWarehouseComponentImpl.componentType \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="IllegalSupplyChain2.jar" /> + <property name="sca.contribution" value="illegal2-supplychain-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/illegalsupplychain.composite \ + supplychain/warehouse/JavaWarehouseComponentImpl.componentType \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="IllegalCustomer.jar" /> + <property name="sca.contribution" value="illegal-customer-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/customer/* \ + supplychain/illegal/* \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="CustomerInterface.jar" /> + <property name="sca.contribution" value="customer-interface-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/customer/Customer.class \ + META-INF/sca-contribution.xml" /> + + </ant> + <ant antfile="./build-jar.xml" target="create-jar"> + <property name="jar.dir" value="target/classes" /> + <property name="files.dir" value="target/classes" /> + <property name="jar.file.name" value="CustomerImpl.jar" /> + <property name="sca.contribution" value="customer-impl-sca-contribution.xml" /> + <property name="files.list" + value="supplychain/customer/JavaCustomerComponentImpl.class \ + META-INF/sca-contribution.xml" /> + + </ant> + </tasks> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java new file mode 100644 index 0000000000..814c38777a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/Customer.java @@ -0,0 +1,35 @@ +/* + * 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 supplychain.customer; + +import org.osoa.sca.annotations.OneWay; + +/** + * This is the business interface of the Customer service component. + */ +public interface Customer { + + public void purchaseGoods(); + + @OneWay + public void notifyShipment(String order); + + public int outstandingOrderCount(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java new file mode 100644 index 0000000000..e4daf0ec02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java @@ -0,0 +1,63 @@ +/* + * 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 supplychain.customer; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import supplychain.retailer.Retailer; + +/** + * This class implements the Customer service component (POJO implementation). + */ +@Service(Customer.class) +@Scope("COMPOSITE") +public class JavaCustomerComponentImpl implements Customer { + + private static int outstandingOrderCount; + + private Retailer retailer; + + public JavaCustomerComponentImpl() { + System.out.println("Created " + this.getClass().getName() + + " using: " + this.getClass().getClassLoader()); + } + + @Reference + public void setRetailer(Retailer retailer) { + this.retailer = retailer; + } + + public void purchaseGoods() { + outstandingOrderCount++; + retailer.submitOrder("Order"); + } + + public void notifyShipment(String order) { + outstandingOrderCount--; + System.out.print("Work thread " + Thread.currentThread() + " - "); + System.out.println(order); + } + + public int outstandingOrderCount() { + return outstandingOrderCount; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java new file mode 100644 index 0000000000..e4b3bc7048 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/illegal/JavaCustomerComponentImpl.java @@ -0,0 +1,74 @@ +/* + * 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 supplychain.illegal; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import supplychain.customer.Customer; +import supplychain.retailer.JavaRetailerComponentImpl; +import supplychain.retailer.Retailer; +import supplychain.warehouse.JavaWarehouseComponentImpl; +import supplychain.warehouse.Warehouse; + +/** + * This class implements the Customer service component (POJO implementation). + */ +@Service(Customer.class) +@Scope("COMPOSITE") +public class JavaCustomerComponentImpl implements Customer { + + private static int outstandingOrderCount; + + private Retailer retailer; + + public JavaCustomerComponentImpl() { + System.out.println("Created " + this.getClass().getName() + + " using: " + this.getClass().getClassLoader()); + } + + @Reference + public void setRetailer(Retailer retailer) { + this.retailer = retailer; + } + + public void purchaseGoods() { + + Retailer retailerImpl = new JavaRetailerComponentImpl(); + System.out.println("Created a retailer from Customer " + retailerImpl); + + Warehouse warehouseImpl = new JavaWarehouseComponentImpl(); + System.out.println("Created a warehouse from Customer " + warehouseImpl); + + outstandingOrderCount++; + retailer.submitOrder("Order"); + } + + public void notifyShipment(String order) { + outstandingOrderCount--; + System.out.print("Work thread " + Thread.currentThread() + " - "); + System.out.println(order); + } + + public int outstandingOrderCount() { + return outstandingOrderCount; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java new file mode 100644 index 0000000000..698aa2aa5d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java @@ -0,0 +1,61 @@ +/* + * 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 supplychain.retailer; + + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import supplychain.warehouse.Warehouse; + +/** + * This class implements the Retailer service component (POJO implementation). + */ +@Service(Retailer.class) +@Scope("STATELESS") +public class JavaRetailerComponentImpl implements Retailer { + + private Warehouse warehouse; + + public JavaRetailerComponentImpl() { + System.out.println("Created " + this.getClass().getName() + + " using: " + this.getClass().getClassLoader()); + } + + @Reference + public void setWarehouse(Warehouse warehouse) { + this.warehouse = warehouse; + } + + + public Warehouse getWarehouse() { + return warehouse; + } + + public void submitOrder(String order) { + + warehouse.fulfillOrder(order + ", submitted"); + + } + + + + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java new file mode 100644 index 0000000000..1e87d59af1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/retailer/Retailer.java @@ -0,0 +1,28 @@ +/* + * 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 supplychain.retailer; + +/** + * This is the business interface of the Retailer service component. + */ +public interface Retailer { + + public void submitOrder(String order); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java new file mode 100644 index 0000000000..9e01f00a79 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java @@ -0,0 +1,52 @@ +/* + * 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 supplychain.shipper; + + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import supplychain.customer.Customer; + +/** + * This class implements the Shipper service component (POJO implementation). + */ +@Service(Shipper.class) +@Scope("COMPOSITE") +public class JavaShipperComponentImpl implements Shipper { + + private Customer customer; + + public JavaShipperComponentImpl() { + System.out.println("Created " + this.getClass().getCanonicalName() + + " using: " + this.getClass().getClassLoader()); + } + + @Reference + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public void processShipment(String order) { + customer.notifyShipment(order + ", shipped"); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java new file mode 100644 index 0000000000..2514928c10 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/shipper/Shipper.java @@ -0,0 +1,28 @@ +/* + * 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 supplychain.shipper; + +/** + * This is the business interface of the Shipper service component. + */ +public interface Shipper { + + public void processShipment(String order); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java new file mode 100644 index 0000000000..cdd12d589d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java @@ -0,0 +1,47 @@ +/* + * 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 supplychain.warehouse; + +import org.osoa.sca.annotations.Scope; + +import supplychain.shipper.Shipper; + +/** + * This class implements the Warehouse service component (POJO implementation). + */ +@Scope("STATELESS") +public class JavaWarehouseComponentImpl implements Warehouse { + + private Shipper shipper; + + public JavaWarehouseComponentImpl() { + System.out.println("Created " + this.getClass().getCanonicalName() + + " using: " + this.getClass().getClassLoader()); + } + + public void setShipper(Shipper shipper) { + this.shipper = shipper; + } + + public void fulfillOrder(String order) { + shipper.processShipment(order + ", fulfilled"); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java new file mode 100644 index 0000000000..6f1f6b8730 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/java/supplychain/warehouse/Warehouse.java @@ -0,0 +1,28 @@ +/* + * 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 supplychain.warehouse; + +/** + * This is the business interface of the Warehouse service component. + */ +public interface Warehouse { + + public void fulfillOrder(String order); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml new file mode 100644 index 0000000000..714d1826e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/complete-supplychain-sca-contribution.xml @@ -0,0 +1,26 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + + <deployable composite="supplychain:supplychain"/> + +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml new file mode 100644 index 0000000000..7f7dc969e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-impl-sca-contribution.xml @@ -0,0 +1,26 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <export.java package="supplychain.customer"/> + <import.java package="supplychain.customer"/> + <import.java package="supplychain.retailer"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml new file mode 100644 index 0000000000..7f7dc969e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-interface-sca-contribution.xml @@ -0,0 +1,26 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <export.java package="supplychain.customer"/> + <import.java package="supplychain.customer"/> + <import.java package="supplychain.retailer"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml new file mode 100644 index 0000000000..8a2bec308f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/customer-sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <export.java package="supplychain.customer"/> + <import.java package="supplychain.retailer"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml new file mode 100644 index 0000000000..c77c4c1c7e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal-customer-sca-contribution.xml @@ -0,0 +1,26 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <export.java package="supplychain.customer"/> + <export.java package="supplychain.illegal"/> + <import.java package="supplychain.retailer"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml new file mode 100644 index 0000000000..210a68011f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal1-supplychain-sca-contribution.xml @@ -0,0 +1,24 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <deployable composite="supplychain:supplychain"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml new file mode 100644 index 0000000000..d118cceef9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/illegal2-supplychain-sca-contribution.xml @@ -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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <deployable composite="supplychain:supplychain"/> + + <import.java package="supplychain.customer"/> + <import.java package="supplychain.illegal"/> + <import.java package="supplychain.retailer"/> + <import.java package="supplychain.warehouse"/> + <import.java package="supplychain.shipper"/> + +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml new file mode 100644 index 0000000000..d37b6659da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/retailer-sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <export.java package="supplychain.retailer"/> + <import.java package="supplychain.warehouse"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml new file mode 100644 index 0000000000..77b28d9023 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/shipper-sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <export.java package="supplychain.shipper"/> + <import.java package="supplychain.customer"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml new file mode 100644 index 0000000000..8ec290a831 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/supplychain-sca-contribution.xml @@ -0,0 +1,30 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + + <deployable composite="supplychain:supplychain"/> + + <import.java package="supplychain.customer"/> + <import.java package="supplychain.retailer"/> + <import.java package="supplychain.warehouse"/> + <import.java package="supplychain.shipper"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml new file mode 100644 index 0000000000..1398416978 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/META-INF/warehouse-sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://supplychain" + xmlns:supplychain="http://supplychain"> + <export.java package="supplychain.warehouse"/> + <import.java package="supplychain.shipper"/> +</contribution> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite new file mode 100644 index 0000000000..db1f0d34e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/illegalsupplychain.composite @@ -0,0 +1,48 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.illegal.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite new file mode 100644 index 0000000000..5be79b741a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/supplychain.composite @@ -0,0 +1,48 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ targetNamespace="http://supplychain"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.customer.JavaCustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent" />
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.retailer.JavaRetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.warehouse.JavaWarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent" />
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.shipper.JavaShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent" />
+ </component>
+
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType new file mode 100644 index 0000000000..a76fae8090 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-classes/src/main/resources/supplychain/warehouse/JavaWarehouseComponentImpl.componentType @@ -0,0 +1,28 @@ +<?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. +--> +<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"> + <service name="JavaWarehouseComponentImpl"> + <interface.java interface="supplychain.warehouse.Warehouse"/> + </service> + + <reference name="shipper"> + <interface.java interface="supplychain.shipper.Shipper"/> + </reference> +</componentType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/pom.xml new file mode 100644 index 0000000000..7dbf248016 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/pom.xml @@ -0,0 +1,53 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-contribution-classloader-test</artifactId> + <name>Apache Tuscany Contribution Classloader tests</name> + +<dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java new file mode 100644 index 0000000000..a2ef51a83c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionTestCase.java @@ -0,0 +1,369 @@ +/* + * 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.contribution; + + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URLClassLoader; + +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.resolver.ClassReference; +import org.apache.tuscany.sca.contribution.service.ContributionResolveException; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/* + * + * Contribution classloading integration tests + */ + +public class ContributionTestCase { + + private SupplyChain supplyChain; + + + @Before + public void setUp() throws Exception { + supplyChain = new SupplyChain(); + } + + + @After + public void tearDown() throws Exception { + + supplyChain.tearDown(); + + } + + + /** + * Test static classloading for classes that are visible from contribution + * + * @throws Exception + */ + public void staticClassLoadingTestForVisibleClasses() throws Exception { + + Contribution customerContribution = supplyChain.getContribution("Customer"); + ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer"); + customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef); + Class customerClass = customerClassRef.getJavaClass(); + + Class customerClassFromContribution = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer"); + Assert.assertEquals(customerClass, customerClassFromContribution); + + Object customer = supplyChain.getCustomer(customerClass); + + Method m = customerClass.getMethod("purchaseGoods"); + m.invoke(customer); + + + m = customerClass.getMethod("outstandingOrderCount"); + + int retries = 10; + int outstandingCount = 1; + while (retries-- > 0) { + + outstandingCount = (int)(Integer)m.invoke(customer); + if (outstandingCount == 0) + break; + else + Thread.sleep(100); + } + Assert.assertEquals(0, outstandingCount); + + + } + + + /** + * Test dynamic classloading for classes that are visible from contribution + * + * @throws Exception + */ + public void dynamicClassLoadingTestForVisibleClasses() throws Exception { + + Contribution customerContribution = supplyChain.getContribution("Customer"); + Contribution retailerContribution = supplyChain.getContribution("Retailer"); + Contribution warehouseContribution = supplyChain.getContribution("Warehouse"); + Contribution shipperContribution = supplyChain.getContribution("Shipper"); + Contribution supplyChainContribution = supplyChain.getContribution("SupplyChain"); + + ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer"); + customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef); + Class customerClass = customerClassRef.getJavaClass(); + + Class customerClassFromContribution = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer"); + Assert.assertEquals(customerClass, customerClassFromContribution); + + Object customer = supplyChain.getCustomer(customerClass); + Assert.assertTrue(customerClass.isInstance(customer)); + + ClassReference retailerClassRef = new ClassReference("supplychain.retailer.Retailer"); + retailerClassRef = retailerContribution.getModelResolver().resolveModel(ClassReference.class, retailerClassRef); + Class retailerClass = retailerClassRef.getJavaClass(); + + Class retailerClassFromContribution = retailerContribution.getClassLoader().loadClass("supplychain.retailer.Retailer"); + Assert.assertEquals(retailerClass, retailerClassFromContribution); + + Class retailerClassFromCustomer = customerContribution.getClassLoader().loadClass("supplychain.retailer.Retailer"); + Assert.assertEquals(retailerClass, retailerClassFromCustomer); + + ClassReference warehouseClassRef = new ClassReference("supplychain.warehouse.Warehouse"); + warehouseClassRef = warehouseContribution.getModelResolver().resolveModel(ClassReference.class, warehouseClassRef); + Class warehouseClass = warehouseClassRef.getJavaClass(); + + Class warehouseClassFromContribution = warehouseContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse"); + Assert.assertEquals(warehouseClass, warehouseClassFromContribution); + + Class warehouseClassFromRetailer = retailerContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse"); + Assert.assertEquals(warehouseClass, warehouseClassFromRetailer); + + ClassReference shipperClassRef = new ClassReference("supplychain.shipper.Shipper"); + shipperClassRef = shipperContribution.getModelResolver().resolveModel(ClassReference.class, shipperClassRef); + Class shipperClass = shipperClassRef.getJavaClass(); + + Class shipperClassFromContribution = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper"); + Assert.assertEquals(shipperClass, shipperClassFromContribution); + + Class shipperClassFromWarehouse = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper"); + Assert.assertEquals(shipperClass, shipperClassFromWarehouse); + + Class customerClassFromShipper = shipperContribution.getClassLoader().loadClass("supplychain.customer.Customer"); + Assert.assertEquals(customerClass, customerClassFromShipper); + + Class customerClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.customer.Customer"); + Assert.assertEquals(customerClass, customerClassFromSupplyChain); + Class retailerClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.retailer.Retailer"); + Assert.assertEquals(retailerClass, retailerClassFromSupplyChain); + Class warehouseClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.warehouse.Warehouse"); + Assert.assertEquals(warehouseClass, warehouseClassFromSupplyChain); + Class shipperClassFromSupplyChain = supplyChainContribution.getClassLoader().loadClass("supplychain.shipper.Shipper"); + Assert.assertEquals(shipperClass, shipperClassFromSupplyChain); + + } + + /** + * Test dynamic classloading for classes that are visible from contribution + * + * @throws Exception + */ + public void dynamicClassLoadingTestForNonImportedClasses() throws Exception { + + Contribution customerContribution = supplyChain.getContribution("Customer"); + Contribution shipperContribution = supplyChain.getContribution("Shipper"); + + Class customerClass = customerContribution.getClassLoader().loadClass("supplychain.customer.Customer"); + Class shipperClass = shipperContribution.getClassLoader().loadClass("supplychain.shipper.Shipper"); + + try { + customerClass.getClassLoader().loadClass("supplychain.warehouse.Warehouse"); + Assert.fail("Non-imported class loaded incorrectly"); + } catch (ClassNotFoundException e) { + } + try { + customerClass.getClassLoader().loadClass("supplychain.shipper.JavaShipperComponentImpl"); + Assert.fail("Non-imported class loaded incorrectly"); + } catch (ClassNotFoundException e) { + } + + try { + Class.forName("supplychain.warehouse.Warehouse", true, customerClass.getClassLoader()); + Assert.fail("Non-imported class loaded incorrectly"); + } catch (ClassNotFoundException e) { + } + try { + Class.forName("supplychain.shipper.JavaShipperComponentImpl", true, customerClass.getClassLoader()); + Assert.fail("Non-imported class loaded incorrectly"); + } catch (ClassNotFoundException e) { + } + + try { + shipperClass.getClassLoader().loadClass("supplychain.warehouse.JavaWarehouseComponentImpl"); + Assert.fail("Non-imported class loaded incorrectly"); + } catch (ClassNotFoundException e) { + } + try { + shipperClass.getClassLoader().loadClass("supplychain.retailer.Retailer"); + Assert.fail("Non-imported class loaded incorrectly"); + } catch (ClassNotFoundException e) { + } + + try { + Class.forName("supplychain.warehouse.JavaWarehouseComponentImpl", true, shipperClass.getClassLoader()); + Assert.fail("Non-imported class loaded incorrectly"); + } catch (ClassNotFoundException e) { + } + try { + Class.forName("supplychain.retailer.Retailer", true, shipperClass.getClassLoader()); + Assert.fail("Non-imported class loaded incorrectly"); + } catch (ClassNotFoundException e) { + } + + + } + + + /** + * This test ensures that classes from imported packages can be statically loaded + * from other contributions even though the classes are not on CLASSPATH or on the + * parent classloader, or the thread context classloader. + * + * @throws Exception + */ + @Test + public void testValidStaticClassLoading() throws Exception { + + supplyChain.setUp(this.getClass().getClassLoader()); + + staticClassLoadingTestForVisibleClasses(); + } + + /** + * This test ensures that all imported classes are loaded from the exporting contributions + * rather than the parent classLoader. If any of the interface classes were incorrectly loaded + * through the parent classloader, LinkageError should result. + * + * @throws Exception + */ + @Test + public void testValidStaticClassLoadingWithContributionsInParentClassLoader() throws Exception { + + + URLClassLoader parentClassLoader = new URLClassLoader( + supplyChain.getContributionURLs(), + this.getClass().getClassLoader()); + + supplyChain.setUp(parentClassLoader); + + staticClassLoadingTestForVisibleClasses(); + } + + + /** + * This test ensures that classes from imported packages can be dynamically loaded from + * other contributions even though the classes are not on CLASSPATH or on the + * parent classloader, or the thread context classloader. + * + * @throws Exception + */ + @Test + public void testValidDynamicClassLoading() throws Exception { + + supplyChain.setUp(this.getClass().getClassLoader()); + + dynamicClassLoadingTestForVisibleClasses(); + } + + /** + * This test ensures that all imported classes are dynamically loaded from the exporting + * contributions rather than the parent classLoader. If any of the interface classes were + * incorrectly loaded through the parent, NoClassDefFoundError or LinkageError should result. + * + * @throws Exception + */ + @Test + public void testValidDynamicClassLoadingWithContributionsInParentClassLoader() throws Exception { + + + URLClassLoader parentClassLoader = new URLClassLoader( + supplyChain.getContributionURLs(), + this.getClass().getClassLoader()); + + supplyChain.setUp(parentClassLoader); + + dynamicClassLoadingTestForVisibleClasses(); + } + + @Test + public void testIllegalStaticClassLoading1() throws Exception { + + try { + supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_ILLEGAL_1); + + Assert.fail("Composite containing unresolved references resolved incorrectly"); + } catch (ContributionResolveException e) { + } + } + + @Test + public void testIllegalStaticClassLoading2() throws Exception { + + supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_ILLEGAL_2); + + Contribution customerContribution = supplyChain.getContribution("Customer"); + ClassReference customerClassRef = new ClassReference("supplychain.customer.Customer"); + customerClassRef = customerContribution.getModelResolver().resolveModel(ClassReference.class, customerClassRef); + Class customerClass = customerClassRef.getJavaClass(); + + Object customer = supplyChain.getCustomer(customerClass); + + try { + Method m = customerClass.getMethod("purchaseGoods"); + m.invoke(customer); + + Assert.fail("Classloading exception not thrown as expected"); + } catch (InvocationTargetException e) { + + Throwable cause = e.getCause(); + Assert.assertTrue(cause instanceof NoClassDefFoundError); + Assert.assertTrue(cause.getMessage().indexOf("JavaWarehouseComponentImpl") > -1); } + + } + + /** + * This test ensures that classes from imported packages can be dynamically loaded from + * other contributions even though the classes are not on CLASSPATH or on the + * parent classloader, or the thread context classloader. + * + * @throws Exception + */ + @Test + public void testIllegalDynamicClassLoading() throws Exception { + + supplyChain.setUp(this.getClass().getClassLoader()); + + dynamicClassLoadingTestForNonImportedClasses(); + } + + + /** + * Self-contained contribution containing composites, componentType files and implementations + * should not require import/export statements for these files to find each other or for Tuscany + * to load these files. + * @throws Exception + */ + @Test + public void testSelfContainedContribution() throws Exception { + + supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_SELFCONTAINED); + + staticClassLoadingTestForVisibleClasses(); + } + + @Test + public void testContributionsWithSplitPackage() throws Exception { + + supplyChain.setUp(this.getClass().getClassLoader(), SupplyChain.SUPPLYCHAIN_SPLITPACKAGE); + + staticClassLoadingTestForVisibleClasses(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java new file mode 100644 index 0000000000..096a1ed5b6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/SupplyChain.java @@ -0,0 +1,231 @@ +/* + * 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.contribution; + + +import java.io.File; +import java.net.URL; +import java.util.Hashtable; + +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; +import org.junit.Assert; + +/* + * + * Contribution classloading integration tests + */ + +public class SupplyChain { + + public static final int SUPPLYCHAIN = 0; + public static final int SUPPLYCHAIN_ILLEGAL_1 = 1; + public static final int SUPPLYCHAIN_ILLEGAL_2 = 2; + public static final int SUPPLYCHAIN_SELFCONTAINED = 3; + public static final int SUPPLYCHAIN_SPLITPACKAGE = 4; + + private String folderName = "../contribution-classes/target/classes"; + + private String customerJarName = "Customer"; + private String retailerJarName = "Retailer"; + private String warehouseJarName = "Warehouse"; + private String shipperJarName = "Shipper"; + private String supplychainJarName = "SupplyChain"; + private String illegalSupplyChain1JarName = "IllegalSupplyChain1"; + private String illegalSupplyChain2JarName = "IllegalSupplyChain2"; + private String illegalCustomerJarName = "IllegalCustomer"; + private String completeSupplychainJarName = "CompleteSupplyChain"; + private String customerInterfaceJarName = "CustomerInterface"; + private String customerImplJarName = "CustomerImpl"; + + + private EmbeddedSCADomain domain; + private ContributionService contributionService; + private int supplyChainVersion; + + private Hashtable<String, Contribution> contributions = new Hashtable<String, Contribution>(); + + private URL customerContribURL; + private URL retailerContribURL; + private URL warehouseContribURL; + private URL shipperContribURL; + private URL supplyChainContribURL; + private URL illegalSupplyChain1ContribURL; + private URL illegalSupplyChain2ContribURL; + private URL illegalCustomerContribURL; + private URL completeSupplyChainContribURL; + private URL customerInterfaceContribURL; + private URL customerImplContribURL; + + public SupplyChain() throws Exception { + + customerContribURL = new File(folderName + "/" + customerJarName + ".jar").toURL(); + retailerContribURL = new File(folderName + "/" + retailerJarName + ".jar").toURL(); + warehouseContribURL = new File(folderName + "/" + warehouseJarName + ".jar").toURL(); + shipperContribURL = new File(folderName + "/" + shipperJarName + ".jar").toURL(); + supplyChainContribURL = new File(folderName + "/" + supplychainJarName + ".jar").toURL(); + illegalSupplyChain1ContribURL = new File(folderName + "/" + illegalSupplyChain1JarName + ".jar").toURL(); + illegalSupplyChain2ContribURL = new File(folderName + "/" + illegalSupplyChain2JarName + ".jar").toURL(); + illegalCustomerContribURL = new File(folderName + "/" + illegalCustomerJarName + ".jar").toURL(); + completeSupplyChainContribURL = new File(folderName + "/" + completeSupplychainJarName + ".jar").toURL(); + customerInterfaceContribURL = new File(folderName + "/" + customerInterfaceJarName + ".jar").toURL(); + customerImplContribURL = new File(folderName + "/" + customerImplJarName + ".jar").toURL(); + } + + public void setUp(ClassLoader parentClassLoader) throws Exception { + this.setUp(parentClassLoader, SUPPLYCHAIN); + } + + public void setUp(ClassLoader parentClassLoader, int supplyChainVersion) throws Exception { + + this.supplyChainVersion = supplyChainVersion; + + Thread.currentThread().setContextClassLoader(parentClassLoader); + + //Create an embedded SCA domain + domain = new EmbeddedSCADomain(parentClassLoader, "http://localhost"); + + //Start the domain + domain.start(); + + this.contributionService = domain.getContributionService(); + + addContributions(supplyChainVersion); + } + + protected void addContributions(int supplyChainVersion) throws Exception { + + Contribution contribution; + + if (supplyChainVersion != SUPPLYCHAIN_SELFCONTAINED) { + contribution = contributionService.contribute("Shipper", shipperContribURL, true); + contributions.put("Shipper", contribution); + contribution = contributionService.contribute("Warehouse", warehouseContribURL, true); + contributions.put("Warehouse", contribution); + contribution = contributionService.contribute("Retailer", retailerContribURL, true); + contributions.put("Retailer", contribution); + } + + switch (supplyChainVersion) { + case SUPPLYCHAIN: + contribution = contributionService.contribute("Customer", customerContribURL, true); + contributions.put("Customer", contribution); + + contribution = contributionService.contribute("SupplyChain", supplyChainContribURL, true); + contributions.put("SupplyChain", contribution); + break; + case SUPPLYCHAIN_ILLEGAL_1: + contribution = contributionService.contribute("Customer", customerContribURL, true); + contributions.put("Customer", contribution); + + contribution = contributionService.contribute("SupplyChain", illegalSupplyChain1ContribURL, true); + contributions.put("SupplyChain", contribution); + break; + case SUPPLYCHAIN_ILLEGAL_2: + contribution = contributionService.contribute("Customer", illegalCustomerContribURL, true); + contributions.put("Customer", contribution); + + contribution = contributionService.contribute("SupplyChain", illegalSupplyChain2ContribURL, true); + contributions.put("SupplyChain", contribution); + break; + case SUPPLYCHAIN_SELFCONTAINED: + contribution = contributionService.contribute("SupplyChain", completeSupplyChainContribURL, true); + contributions.put("SupplyChain", contribution); + break; + case SUPPLYCHAIN_SPLITPACKAGE: + contribution = contributionService.contribute("Customer", customerInterfaceContribURL, true); + contributions.put("Customer", contribution); + + contribution = contributionService.contribute("CustomerImpl", customerImplContribURL, true); + contributions.put("CustomerImpl", contribution); + + contribution = contributionService.contribute("SupplyChain", supplyChainContribURL, true); + contributions.put("SupplyChain", contribution); + break; + } + + // SUPPLYCHAIN_ILLEGAL_1 should throw an exception when the composite is resolved, and hence + // should not get this far. + Assert.assertTrue(supplyChainVersion != SUPPLYCHAIN_ILLEGAL_1); + + + for (Contribution c : contributions.values()) { + + for (Composite deployable : c.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + } + + // Start Components from my composite + for (Composite deployable : contributions.get("SupplyChain").getDeployables() ) { + domain.getCompositeActivator().activate(deployable); + domain.getCompositeActivator().start(deployable); + } + } + + public void tearDown() throws Exception { + + if (domain == null) + return; + + for (String contributionURI : contributions.keySet()) { + contributionService.remove(contributionURI); + } + + + if (contributions.get("SupplyChain") != null) { + // Stop Components from my composite + for (Composite deployable : contributions.get("SupplyChain").getDeployables() ) { + domain.getCompositeActivator().stop(deployable); + domain.getCompositeActivator().deactivate(deployable); + } + } + + domain.stop(); + + domain.close(); + } + + public Contribution getContribution(String uri) { + if (supplyChainVersion == SUPPLYCHAIN_SELFCONTAINED) + return contributions.get("SupplyChain"); + else + return contributions.get(uri); + } + + public Object getCustomer(Class<?> customerClass) { + return domain.getService(customerClass, "CustomerComponent"); + } + + public URL[] getContributionURLs() { + return new URL[] { + customerContribURL, + retailerContribURL, + warehouseContribURL, + shipperContribURL, + supplyChainContribURL + }; + } + + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCase.java new file mode 100644 index 0000000000..264cb99da9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/contribution-test/src/test/java/org/apache/tuscany/sca/test/contribution/TuscanyClassloadingTestCase.java @@ -0,0 +1,477 @@ +/*
+ * 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.contribution;
+
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.util.ServiceDiscovery;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.osoa.sca.ServiceReference;
+
+/*
+ *
+ * Contribution classloading integration tests
+ */
+
+public class TuscanyClassloadingTestCase {
+
+// private static final int SCA_API = 1;
+// private static final int TUSCANY_CORE_SPI = 2;
+// private static final int TUSCANY_RUNTIME = 3;
+// private static final int TUSCANY_EXTENSIONS = 4;
+// private static final int TUSCANY_DEPENDENCIES = 0;
+
+
+
+ private static final String[] scaApiJars = {
+ "sca-api"
+ };
+ private static final String[] tuscanyCoreSpiJars = {
+ "core-spi",
+ "interface",
+ "interface-java",
+ "interface-wsdl",
+ "assembly",
+ "policy",
+ "databinding",
+ "contribution",
+ "definitions"
+ };
+ private static final String[] tuscanyRuntimeJars = {
+
+ "binding-sca-xml",
+ "binding-sca",
+ "assembly-java-dsl",
+ "assembly-xml",
+ "assembly-xsd",
+ "contribution-impl",
+ "contribution-java",
+ "contribution-namespace",
+ "core-databinding",
+ "core-spring",
+ "core",
+ "definitions-xml",
+ "domain-api",
+ "domain-impl",
+ "domain",
+ "extension-helper",
+ "host-embedded",
+ "interface-java-xml",
+ "interface-wsdl-xml",
+ "java2wsdl",
+ "node-api",
+ "node-impl",
+ "node",
+ "osgi-runtime",
+ "policy-logging",
+ "policy-security",
+ "policy-transaction",
+ "policy-xml",
+ "wsdl2java"
+ };
+ private static final String[] tuscanyExtensionJars = {
+ "binding-dwr",
+ "binding-ejb",
+ "binding-feed",
+ "binding-http",
+ "binding-jms",
+ "binding-jsonrpc",
+ "binding-notification",
+ "binding-rmi",
+ "binding-sca-axis2",
+ "binding-ws-axis2",
+ "binding-ws-xml",
+ "binding-ws",
+ "databinding-axiom",
+ "databinding-fastinfoset",
+ "databinding-jaxb",
+ "databinding-json",
+ "databinding-saxon",
+ "databinding-sdo-axiom",
+ "databinding-sdo",
+ "databinding-xmlbeans",
+ "host-http",
+ "host-jetty",
+ "host-rmi",
+ "host-tomcat",
+ "host-webapp",
+ "implementation-das.jar",
+ "implementation-data.jar",
+ "implementation-java-runtime",
+ "implementation-java-xml",
+ "implementation-java",
+ "implementation-node-runtime",
+ "implementation-node-xml",
+ "implementation-node",
+ "implementation-notification",
+ "implementation-osgi",
+ "implementation-resource",
+ "implementation-script",
+ "implementation-spring",
+ "implementation-xquery",
+ "contribution-osgi"
+ };
+
+
+ private Class<?> embeddedDomainClass;
+ Object domain;
+
+ @Before
+ public void setUp() throws Exception {
+
+ embeddedDomainClass = getEmbeddedDomainClass();
+
+ Constructor c = embeddedDomainClass.getConstructor(ClassLoader.class, String.class);
+ // Create an embedded domain
+ domain = c.newInstance(embeddedDomainClass.getClassLoader(), "http://localhost");
+
+ // Start the domain
+ invokeNoArgsMethod(domain, "start");
+
+
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+
+
+ // Stop the domain
+ invokeNoArgsMethod(domain, "stop");
+
+ }
+
+
+ /**
+ * Create a classloader hierarchy for Tuscany runtime
+ * Dependencies <- SCA-API <- Core-SPI+ Runtime <- Extensions
+ * Load the embedded SCA domain class using the runtime classloader
+ *
+ * @return embedded SCA domain class
+ * @throws Exception
+ */
+ private Class<?> getEmbeddedDomainClass()
+ throws Exception {
+
+ URL[] scaApiUrls;
+ URL[] runtimeUrls;
+ URL[] extensionUrls;
+ URL[] dependencyUrls;
+
+ // When the test is run under Eclipse, the classloader for the test is
+ // sun.misc.Launcher$AppClassLoader. The first code path is taken.
+ // When the test is run under maven, the classloader for the test is
+ // org.apache.maven.surefire.booter.IsolatedClassLoader, which is a subclass
+ // of URLClassLoader. The second code path is taken.
+ if (!(this.getClass().getClassLoader() instanceof URLClassLoader)) {
+ String classPath = System.getProperty("java.class.path");
+ String[] classPathEntries = classPath.split(System.getProperty("path.separator"));
+ HashSet<String> dependentJars = new HashSet<String>();
+ for (int i = 0; i < classPathEntries.length; i++) {
+ dependentJars.add(classPathEntries[i]);
+ }
+
+ scaApiUrls = getTuscanyClassLoaderURLs(
+ classPathEntries, dependentJars, scaApiJars);
+ runtimeUrls = getTuscanyClassLoaderURLs(
+ classPathEntries, dependentJars, tuscanyCoreSpiJars, tuscanyRuntimeJars );
+ extensionUrls = getTuscanyClassLoaderURLs(
+ classPathEntries, dependentJars, tuscanyExtensionJars);
+ dependencyUrls = getTuscanyClassLoaderURLs(
+ classPathEntries, dependentJars);
+ }
+ else {
+ HashSet<URL> dependentJars = new HashSet<URL>();
+ URL[] classPathEntries = ((URLClassLoader)this.getClass().getClassLoader()).getURLs();
+ for (int i = 0; i < classPathEntries.length; i++) {
+ dependentJars.add(classPathEntries[i]);
+ }
+ scaApiUrls = getTuscanyClassLoaderURLs(
+ classPathEntries, dependentJars, scaApiJars);
+ runtimeUrls = getTuscanyClassLoaderURLs(
+ classPathEntries, dependentJars, tuscanyCoreSpiJars, tuscanyRuntimeJars );
+ extensionUrls = getTuscanyClassLoaderURLs(
+ classPathEntries, dependentJars, tuscanyExtensionJars);
+ dependencyUrls = getTuscanyClassLoaderURLs(
+ classPathEntries, dependentJars);
+
+ }
+
+ boolean useSingleClassLoader =
+ (scaApiUrls == null || scaApiUrls.length == 0) ||
+ (runtimeUrls == null || runtimeUrls.length == 0) ||
+ (extensionUrls == null || extensionUrls.length == 0) ||
+ (dependencyUrls == null || dependencyUrls.length == 0);
+
+ if (useSingleClassLoader) {
+ return EmbeddedSCADomain.class;
+ }
+ else {
+
+ ClassLoader dependencyLoader = new URLClassLoader(dependencyUrls, null);
+ ClassLoader scaApiLoader = new URLClassLoader(scaApiUrls, dependencyLoader);
+ ClassLoader runtimeClassLoader = new URLClassLoader(runtimeUrls, scaApiLoader);
+ ClassLoader extensionClassLoader = new URLClassLoader(extensionUrls, runtimeClassLoader);
+
+ Class<?> serviceDiscoveryClass = runtimeClassLoader.loadClass(ServiceDiscovery.class.getName());
+ Method getInstanceMethod = serviceDiscoveryClass.getMethod("getInstance");
+ Object serviceDiscoveryObj = getInstanceMethod.invoke(null);
+ Method registerClassLoaderMethod = serviceDiscoveryClass.getMethod("registerClassLoader", ClassLoader.class);
+ registerClassLoaderMethod.invoke(serviceDiscoveryObj, extensionClassLoader);
+
+ Thread.currentThread().setContextClassLoader(extensionClassLoader);
+
+ return runtimeClassLoader.loadClass(EmbeddedSCADomain.class.getName());
+
+ }
+
+ }
+
+
+ /**
+ * From the list of entries in the test classloader, match
+ * Tuscany jars corresponding to a classloader, and return the list
+ * of matching entries as URLs.
+ * This method is used when the test is run under eclipse, using CLASSPATH
+ * based application classloader.
+ *
+ * @param classPathEntries List of entries on CLASSPATH
+ * @param dependentJars Complete set of jars, remove jars corresponding to this
+ * classloader from the set.
+ * @param jars List of Tuscany jars corresponding to this classloader
+ * @return Matching URLs for the classloader
+ * @throws IOException
+ */
+ private URL[] getTuscanyClassLoaderURLs(
+ String[] classPathEntries,
+ HashSet<String> dependentJars,
+ String[]... jars)
+ throws IOException {
+
+ String pathSeparator = System.getProperty("file.separator");
+ HashSet<String> classPathEntrySet;
+
+ if (jars.length == 0)
+ classPathEntrySet = dependentJars;
+ else {
+ classPathEntrySet = new HashSet<String>();
+
+ for (int i = 0; i < classPathEntries.length; i++) {
+
+ String classPathEntry = classPathEntries[i];
+ for (int j = 0; j < jars.length; j++) {
+ String[] jarList = jars[j];
+ if (jarList != null) {
+ for (int k = 0; k < jarList.length; k++) {
+ String jarName = "tuscany-" + jarList[k];
+ String alternateJarName = "modules" + pathSeparator + jarList[k];
+ if (classPathEntry.indexOf(jarName) >= 0 ||
+ classPathEntry.indexOf(alternateJarName) >=0) {
+ classPathEntrySet.add(classPathEntry);
+ dependentJars.remove(classPathEntry);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ ArrayList<URL> urls = new ArrayList<URL>();
+
+ for (String fileName : classPathEntrySet) {
+ File file = new File((String)fileName);
+ if (!file.exists()) {
+ throw new FileNotFoundException(fileName);
+
+ }
+ else {
+ urls.add(file.toURL());
+
+ }
+ }
+
+ return (URL [])urls.toArray(new URL[urls.size()]);
+ }
+
+ /**
+ * From the list of URLs of the test classloader, match
+ * Tuscany jars corresponding to a classloader, and return the matching URLs
+ * This method is used when the test is run under maven. The test classloader is
+ * org.apache.maven.surefire.booter.IsolatedClassLoader, which is a subclass
+ * of URLClassLoader
+ *
+ * @param classPathEntries List of URLs from the test classloader
+ * @param dependentJars Complete set of jars, remove jars corresponding to this
+ * classloader from the set.
+ * @param jars List of Tuscany jars corresponding to this classloader
+ * @return Matching URLs for the classloader
+ * @throws IOException
+ */
+ private URL[] getTuscanyClassLoaderURLs(
+ URL[] classPathEntries,
+ HashSet<URL> dependentJars,
+ String[]... jars)
+ throws IOException {
+
+ String pathSeparator = System.getProperty("file.separator");
+ HashSet<URL> classPathEntrySet;
+
+ if (jars.length == 0)
+ classPathEntrySet = dependentJars;
+ else {
+ classPathEntrySet = new HashSet<URL>();
+
+ for (int i = 0; i < classPathEntries.length; i++) {
+
+ URL classPathEntry = classPathEntries[i];
+ String classPathEntryStr = classPathEntry.getPath();
+ for (int j = 0; j < jars.length; j++) {
+ String[] jarList = jars[j];
+ if (jarList != null) {
+ for (int k = 0; k < jarList.length; k++) {
+ String jarName = "tuscany-" + jarList[k];
+ String alternateJarName = "modules" + pathSeparator + jarList[k];
+ if (classPathEntryStr.indexOf(jarName) >= 0 ||
+ classPathEntryStr.indexOf(alternateJarName) >=0) {
+ classPathEntrySet.add(classPathEntry);
+ dependentJars.remove(classPathEntry);
+ }
+ }
+ }
+ }
+ }
+
+ }
+ return (URL [])classPathEntrySet.toArray(new URL[classPathEntrySet.size()]);
+ }
+
+ private Object invokeNoArgsMethod(Object obj, String methodName)
+ throws Exception {
+
+ return obj.getClass().getMethod(methodName).invoke(obj);
+ }
+
+
+ private Object invokeOneArgMethod(Object obj, String methodName,
+ Class argType, Object arg) throws Exception {
+
+ return obj.getClass().getMethod(methodName, argType).invoke(obj, arg);
+ }
+
+ /**
+ *
+ * Load Tuscany runtime using multiple classloaders, and run supplychain
+ * test.
+ *
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void test() throws Exception {
+
+ ClassLoader runtimeClassloader = embeddedDomainClass.getClassLoader();
+
+ if (runtimeClassloader == this.getClass().getClassLoader()) {
+ System.out.println("Runtime and test loaded using the same classloader " + runtimeClassloader);
+ }
+ else {
+ System.out.println("Running test using separate Tuscany classloaders, runtime classloader=" + runtimeClassloader);
+ ClassLoader apiClassLoader = runtimeClassloader.loadClass(ServiceReference.class.getName()).getClassLoader();
+ Assert.assertTrue(apiClassLoader != runtimeClassloader);
+
+ try {
+ runtimeClassloader.loadClass("org.apache.tuscany.sca.implementation.java.JavaImplementation");
+ Assert.fail("Loaded extension class incorrectly from runtimeClassLoader");
+ } catch (ClassNotFoundException e) {
+ }
+
+
+ }
+
+ // Contribute supplychain (as single contribution)
+ Object contributionService = invokeNoArgsMethod(domain, "getContributionService");
+ Method contributeMethod = contributionService.getClass().getMethod("contribute",
+ String.class, URL.class, boolean.class);
+
+ String folderName = "../contribution-classes/target/classes";
+ String supplychainJarName = "CompleteSupplyChain";
+ URL supplyChainContribURL = new File(folderName + "/" + supplychainJarName + ".jar").toURL();
+ Object contribution = contributeMethod.invoke(contributionService,
+ "SupplyChain", supplyChainContribURL, true);
+
+ Object composite = ((List)invokeNoArgsMethod(contribution, "getDeployables")).get(0);
+ Object domainComposite = invokeNoArgsMethod(domain, "getDomainComposite");
+ List includes = (List)invokeNoArgsMethod(domainComposite, "getIncludes");
+ includes.add(composite);
+ //Object compositeBuilder = invokeNoArgsMethod(domain, "getCompositeBuilder");
+ Object compositeActivator = invokeNoArgsMethod(domain, "getCompositeActivator");
+
+ Class compositeClass = embeddedDomainClass.getClassLoader().loadClass(Composite.class.getName());
+ invokeOneArgMethod(domain, "buildComposite", compositeClass, composite);
+ invokeOneArgMethod(compositeActivator, "activate", compositeClass, composite);
+ invokeOneArgMethod(compositeActivator, "start", compositeClass, composite);
+
+ // Get customer service
+ Method getClassLoaderMethod = contribution.getClass().getMethod("getClassLoader");
+ ClassLoader classLoader = (ClassLoader)getClassLoaderMethod.invoke(contribution);
+
+ Class customerClass = classLoader.loadClass("supplychain.customer.Customer");
+ Method getServiceMethod = embeddedDomainClass.getMethod("getService",
+ Class.class, String.class);
+ Object customer = getServiceMethod.invoke(domain, customerClass, "CustomerComponent");
+
+ // Invoke purchaseGoods
+ Method m = customerClass.getMethod("purchaseGoods");
+ m.invoke(customer);
+
+ m = customerClass.getMethod("outstandingOrderCount");
+
+ int retries = 10;
+ int outstandingCount = 1;
+ while (retries-- > 0) {
+
+ outstandingCount = (int)(Integer)m.invoke(customer);
+ if (outstandingCount == 0)
+ break;
+ else
+ Thread.sleep(100);
+ }
+ Assert.assertEquals(0, outstandingCount);
+
+
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/pom.xml new file mode 100644 index 0000000000..ce7786b4f2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-classloader/pom.xml @@ -0,0 +1,51 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-contribution-classloader</artifactId> + <packaging>pom</packaging> + <name>Apache Tuscany Contribution ClassLoader Integration Tests</name> + + <modules> + <module>contribution-classes</module> + <module>contribution-test</module> + </modules> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-contribution-impl</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + </dependencies> +</project>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/pom.xml new file mode 100644 index 0000000000..71888343c0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/pom.xml @@ -0,0 +1,67 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-composite</artifactId>
+ <name>Apache Tuscany SCA Contribution Export Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java new file mode 100644 index 0000000000..e65422136f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java @@ -0,0 +1,30 @@ +/*
+ * 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 hello;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the Hello service.
+ */
+@Remotable
+public interface Hello {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java new file mode 100644 index 0000000000..5369c18497 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java @@ -0,0 +1,33 @@ +/*
+ * 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 hello;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(Hello.class)
+public class HelloImpl implements Hello {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3c14560a56 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello">
+ <deployable composite="hello:hello"/>
+ <export namespace="http://hello"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/resources/hello.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/resources/hello.composite new file mode 100644 index 0000000000..636b7111d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/main/resources/hello.composite @@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://hello"
+ xmlns:hello="http://hello"
+ name="hello">
+
+ <service name="HelloService" promote="HelloServiceComponent"/>
+
+ <component name="HelloServiceComponent">
+ <implementation.java class="hello.HelloImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java new file mode 100644 index 0000000000..a41907a171 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.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 org.apache.tuscany.sca.test.contribution;
+
+import hello.Hello;
+
+import java.io.File;
+import java.io.IOException;
+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.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+
+ @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();
+
+ ModelResolver helloResolver = new ModelResolverImpl(cl);
+ File helloContrib = new File("./target/classes/");
+ URL helloURL = helloContrib.toURL();
+ Contribution consumerContribution =
+ contributionService.contribute("http://import-export/hello", helloURL, helloResolver, false);
+ Composite consumerComposite = consumerContribution.getDeployables().get(0);
+ domain.getDomainComposite().getIncludes().add(consumerComposite);
+ domain.buildComposite(consumerComposite);
+
+ // Start Components from my composite
+ domain.getCompositeActivator().activate(consumerComposite);
+ domain.getCompositeActivator().start(consumerComposite);
+ }
+
+ public void testHello() throws IOException {
+ Hello hello = domain.getService(Hello.class, "HelloServiceComponent");
+ assertNotNull(hello);
+ assertEquals(hello.getGreetings("lresende"), "Hello lresende");
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/pom.xml new file mode 100644 index 0000000000..c68fb4127a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/pom.xml @@ -0,0 +1,67 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-java</artifactId>
+ <name>Apache Tuscany SCA Contribution Java Export Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..74d22ed830 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/*
+ * 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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..dc33dfa560 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <export.java package="helloworld"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/pom.xml new file mode 100644 index 0000000000..518d193850 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/pom.xml @@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-export-wsdl</artifactId>
+ <name>Apache Tuscany SCA Contribution WSDL Export Integration Tests</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b7394ec14b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <export namespace="http://helloworld"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl new file mode 100644 index 0000000000..9b31363e1a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl @@ -0,0 +1,76 @@ +<?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.
+-->
+
+<wsdl:definitions targetNamespace="http://helloworld"
+ xmlns:tns="http://helloworld"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns2="http://helloworld2"
+ targetNamespace="http://helloworld"
+ elementFormDefault="qualified">
+
+ <xsd:import namespace="http://helloworld2" schemaLocation="helloworld.xsd" />
+
+ <element name="getGreetings" type="tns2:getGreetingsType"/>
+ <element name="getGreetingsResponse" type="tns2:getGreetingsResponseType"/>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd new file mode 100644 index 0000000000..d3c83b08c6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd @@ -0,0 +1,35 @@ +<?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://helloworld2"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://helloworld2">
+
+ <complexType name="getGreetingsType">
+ <sequence>
+ <element name="name" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="getGreetingsResponseType">
+ <sequence>
+ <element name="getGreetingsReturn" type="string"/>
+ </sequence>
+ </complexType>
+</schema>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/pom.xml new file mode 100644 index 0000000000..bfe927c301 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/pom.xml @@ -0,0 +1,73 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-composite</artifactId>
+ <name>Apache Tuscany SCA Contribution Import Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-composite</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..966f56d7d5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.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 helloworld;
+
+import hello.Hello;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+ @Reference
+ protected Hello helloServiceRef;
+
+ public String getGreetings(String name) {
+ return helloServiceRef.getGreetings(name);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..3d43290380 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,46 @@ +/*
+ * 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 helloworld;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..74d22ed830 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/*
+ * 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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..9f3f5be452 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,27 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello">
+ <deployable composite="helloworld:helloworldws"/>
+ <import namespace="http://hello"/>
+ <!-- import namespace="http://hello" location="http://import-export/contrib-composite"/ -->
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl new file mode 100644 index 0000000000..9b31363e1a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl @@ -0,0 +1,76 @@ +<?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.
+-->
+
+<wsdl:definitions targetNamespace="http://helloworld"
+ xmlns:tns="http://helloworld"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="helloworld">
+
+ <wsdl:types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns2="http://helloworld2"
+ targetNamespace="http://helloworld"
+ elementFormDefault="qualified">
+
+ <xsd:import namespace="http://helloworld2" schemaLocation="helloworld.xsd" />
+
+ <element name="getGreetings" type="tns2:getGreetingsType"/>
+ <element name="getGreetingsResponse" type="tns2:getGreetingsResponseType"/>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetingsRequest">
+ <wsdl:part element="tns:getGreetings" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
+ <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getGreetings">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetingsRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetingsResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="HelloWorldService">
+ <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd new file mode 100644 index 0000000000..d3c83b08c6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd @@ -0,0 +1,35 @@ +<?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://helloworld2"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://helloworld2">
+
+ <complexType name="getGreetingsType">
+ <sequence>
+ <element name="name" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="getGreetingsResponseType">
+ <sequence>
+ <element name="getGreetingsReturn" type="string"/>
+ </sequence>
+ </complexType>
+</schema>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..e2f852ff7e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite @@ -0,0 +1,39 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ xmlns:hello="http://hello"
+ name="helloworldws">
+
+ <component name="SourceHelloServiceComponent">
+ <implementation.composite name="hello:hello"/>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ <reference name="helloServiceRef" target="SourceHelloServiceComponent/HelloService"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..4d842796ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java @@ -0,0 +1,111 @@ +/*
+ * 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.test.contribution;
+
+import helloworld.HelloWorldService;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.Socket;
+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;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase {
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloWorldContribution;
+ private Contribution compositeContribution;
+
+ @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 compositeContribLocation = new File("../export-composite/target/classes");
+ URL compositeContribURL = compositeContribLocation.toURL();
+ compositeContribution =
+ contributionService.contribute("http://import-export/export-composite", compositeContribURL, false);
+ for (Composite deployable : compositeContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ File helloWorldContribLocation = new File("./target/classes/");
+ URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ helloWorldContribution =
+ contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService =
+ domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-composite");
+
+ //Stop Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables()) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/pom.xml new file mode 100644 index 0000000000..72aaf060ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/pom.xml @@ -0,0 +1,73 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-java</artifactId>
+ <name>Apache Tuscany SCA Contribution Java Import Java Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>itest-contribution-export-java</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..4cdcc1fd0b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/*
+ * 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 helloworld;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e5d14f51d4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <deployable composite="helloworld:helloworldws"/>
+ <import.java package="helloworld"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..023b2b6aff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite @@ -0,0 +1,32 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" />
+ </service>
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..98579f6b12 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java @@ -0,0 +1,110 @@ +/*
+ * 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.contribution;
+
+import helloworld.HelloWorldService;
+
+import java.io.File;
+import java.io.IOException;
+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;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase{
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution helloWorldContribution;
+ private Contribution javaContribution;
+
+ @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 javaContribLocation = new File("../export-java/target/classes");
+ URL javaContribURL = javaContribLocation.toURL();
+ javaContribution = contributionService.contribute("http://import-export/export-java", javaContribURL, false);
+ for (Composite deployable : javaContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ File helloWorldContribLocation = new File("./target/classes/");
+ URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ helloWorldContribution = contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : helloWorldContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testPing() throws IOException {
+ HelloWorldService helloWorldService = domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+ assertEquals("Hello test", helloWorldService.getGreetings("test"));
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService = domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-java");
+
+ // Stop Components from my composite
+ for (Composite deployable : helloWorldContribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/pom.xml new file mode 100644 index 0000000000..398e3da826 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/pom.xml @@ -0,0 +1,67 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-wsdl</artifactId>
+ <name>Apache Tuscany SCA Contribution WSDL Import Integration Tests</name>
+
+<dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..4cdcc1fd0b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/*
+ * 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 helloworld;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..3d43290380 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,46 @@ +/*
+ * 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 helloworld;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..74d22ed830 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/*
+ * 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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d46fe0b57c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:helloworld="http://helloworld">
+ <deployable composite="helloworld:helloworldws"/>
+ <import namespace="http://helloworld" location="http://import-export/export-wsdl"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..5008a2ea5b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite @@ -0,0 +1,33 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService"/>
+ </service>
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..021605316d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java @@ -0,0 +1,109 @@ +/*
+ * 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.contribution;
+
+import helloworld.HelloWorldService;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.Socket;
+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;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase extends TestCase{
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private Contribution wsdlContribution;
+ private Contribution consumerContribution;
+
+ @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 wsdlContribLocation = new File("../export-wsdl/target/classes");
+ URL wsdlContribURL = wsdlContribLocation.toURL();
+ wsdlContribution = contributionService.contribute("http://import-export/export-wsdl", wsdlContribURL, false);
+ for (Composite deployable : wsdlContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ File helloWorldContribLocation = new File("./target/classes/");
+ URL helloWorldContribURL = helloWorldContribLocation.toURL();
+ consumerContribution = contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false);
+ for (Composite deployable : consumerContribution.getDeployables() ) {
+ domain.getDomainComposite().getIncludes().add(deployable);
+ domain.buildComposite(deployable);
+ }
+
+ // Start Components from my composite
+ for (Composite deployable : consumerContribution.getDeployables() ) {
+ domain.getCompositeActivator().activate(deployable);
+ domain.getCompositeActivator().start(deployable);
+ }
+ }
+
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ public void testServiceCall() throws IOException {
+ HelloWorldService helloWorldService = domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+ assertNotNull(helloWorldService);
+
+ assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ ContributionService contributionService = domain.getContributionService();
+
+ // Remove the contribution from the in-memory repository
+ contributionService.remove("http://import-export/helloworld");
+ contributionService.remove("http://import-export/export-wsdl");
+
+ // Stop Components from my composite
+ for (Composite deployable : consumerContribution.getDeployables() ) {
+ domain.getCompositeActivator().stop(deployable);
+ domain.getCompositeActivator().deactivate(deployable);
+ }
+
+ domain.stop();
+
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/pom.xml new file mode 100644 index 0000000000..bc4f13bccc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-import-export/pom.xml @@ -0,0 +1,54 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution-import-export</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Contribution Import/Export Integration Tests</name>
+
+ <modules>
+ <module>export-wsdl</module>
+ <module>import-wsdl</module>
+ <module>export-composite</module>
+ <module>import-composite</module>
+ <module>export-java</module>
+ <module>import-java</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/pom.xml new file mode 100644 index 0000000000..d789aa55a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/pom.xml @@ -0,0 +1,51 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-contribution-multiple</artifactId> + <name>Apache Tuscany SCA Multiple Contribution Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-contribution-impl</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/hello/Hello.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/hello/Hello.java new file mode 100644 index 0000000000..313a58a0bf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/hello/Hello.java @@ -0,0 +1,29 @@ +/* + * 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 hello; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the Hello service. + */ +public interface Hello { + + public String getGreetings(String name); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/hello/HelloImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/hello/HelloImpl.java new file mode 100644 index 0000000000..ff9f6e75f3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/hello/HelloImpl.java @@ -0,0 +1,33 @@ +/* + * 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 hello; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(Hello.class) +public class HelloImpl implements Hello { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c062afaed0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/helloworld/HelloWorldImpl.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 helloworld; + +import hello.Hello; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + @Reference + protected Hello helloServiceRef; + + public String getGreetings(String name) { + return helloServiceRef.getGreetings(name); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..a84a578344 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/helloworld/HelloWorldService.java @@ -0,0 +1,29 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +public interface HelloWorldService { + + public String getGreetings(String name); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java new file mode 100644 index 0000000000..6e4dd3945a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/java/test/ContributionTestCase.java @@ -0,0 +1,116 @@ +/* + * 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 helloworld.HelloWorldService; + +import java.io.IOException; +import java.net.URL; + +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; + +import junit.framework.TestCase; + +/** + * Test multiple contributio scenario + * Contributed by TUSCANY-1756 + */ +public class ContributionTestCase extends TestCase { + + private String helloContribution_dir = "target/test-classes/contribution-export"; + private String helloWorldContribution_one_dir = "target/test-classes/contribution-import-one"; + + private ClassLoader cl; + private EmbeddedSCADomain domain; + private Contribution helloContribution; + private Contribution helloWorldContribution_one; + + protected void setUp() throws Exception { + URL helloContribution_URL = new java.io.File(helloContribution_dir).toURL(); + URL helloWorldContribution_one_URL = new java.io.File(helloWorldContribution_one_dir).toURL(); + + // 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(); + + helloContribution = + contributionService.contribute("http://import-export/export-composite", helloContribution_URL, false); + + for (Composite deployable : helloContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + for (Composite deployable : helloContribution.getDeployables()) { + domain.getCompositeActivator().activate(deployable); + domain.getCompositeActivator().start(deployable); + } + + helloWorldContribution_one = + contributionService.contribute("http://import-export/helloworld_one", helloWorldContribution_one_URL, false); + for (Composite deployable : helloWorldContribution_one.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + for (Composite deployable : helloWorldContribution_one.getDeployables()) { + domain.getCompositeActivator().activate(deployable); + domain.getCompositeActivator().start(deployable); + } + + } + + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService_one = + domain.getService(HelloWorldService.class, "HelloWorldServiceComponent_one/HelloWorldService"); + assertNotNull(helloWorldService_one); + + assertEquals("Hello Smith", helloWorldService_one.getGreetings("Smith")); + + } + + public void tearDown() throws Exception { + ContributionService contributionService = domain.getContributionService(); + + // Remove the contribution from the in-memory repository + contributionService.remove("http://import-export/export-composite"); + contributionService.remove("http://import-export/helloworld_one"); + + // Stop Components from my composite + for (Composite deployable : helloWorldContribution_one.getDeployables()) { + domain.getCompositeActivator().stop(deployable); + domain.getCompositeActivator().deactivate(deployable); + } + for (Composite deployable : helloContribution.getDeployables()) { + domain.getCompositeActivator().stop(deployable); + domain.getCompositeActivator().deactivate(deployable); + } + // domain.stop(); + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..bea6f39932 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-export/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://hello" + xmlns:hello="http://hello"> + <deployable composite="hello:hello"/> + <export namespace="http://hello"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite new file mode 100644 index 0000000000..aeeab337fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-export/hello.composite @@ -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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://hello" + xmlns:hello="http://hello" + name="hello"> + + <service name="HelloService" promote="HelloServiceComponent"/> + + <component name="HelloServiceComponent"> + <implementation.java class="hello.HelloImpl" /> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..bfbf74373a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-import-one/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://helloworld" + xmlns:helloworld="http://helloworld" + xmlns:hello="http://hello"> + <deployable composite="helloworld:helloworld_one"/> + <import namespace="http://hello"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite new file mode 100644 index 0000000000..45cb504ea4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution-multiple/src/test/resources/contribution-import-one/helloworld_one.composite @@ -0,0 +1,35 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://helloworld" + xmlns:helloworld="http://helloworld" + xmlns:hello="http://hello" + name="helloworld_one"> + + <component name="SourceHelloServiceComponent_one"> + <implementation.composite name="hello:hello"/> + </component> + + <component name="HelloWorldServiceComponent_one"> + <implementation.java class="helloworld.HelloWorldImpl" /> + <reference name="helloServiceRef" target="SourceHelloServiceComponent_one/HelloService"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/pom.xml new file mode 100644 index 0000000000..9bc6521d8f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/pom.xml @@ -0,0 +1,45 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-contribution</artifactId>
+ <name>Apache Tuscany SCA Contribution Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..6392676e76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/AddService.java @@ -0,0 +1,25 @@ +/*
+ * 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 calculator;
+
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..e9c635e3c8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,30 @@ +/*
+ * 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 calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..40ca4d9b0f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,46 @@ +/*
+ * 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 calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain domain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService = domain.getService(CalculatorService.class,
+ "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ domain.close();
+
+ }
+
+}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..ad87375529 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/*
+ * 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 calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..ae4ed12b7b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,70 @@ +/*
+ * 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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..3158458b5e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/DivideService.java @@ -0,0 +1,25 @@ +/*
+ * 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 calculator;
+
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..8c33862f6d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/*
+ * 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 calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..62db05175e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,25 @@ +/*
+ * 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 calculator;
+
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..c7fbc73c00 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/*
+ * 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 calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..309f88f098 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/SubtractService.java @@ -0,0 +1,25 @@ +/*
+ * 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 calculator;
+
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..1a7f145ad8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,30 @@ +/*
+ * 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 calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/ContributionTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/ContributionTest.composite new file mode 100644 index 0000000000..d814e439e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/ContributionTest.composite @@ -0,0 +1,24 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:foo="http://foo" + name="ContributionTest"> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/calculator/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/calculator/Calculator.composite new file mode 100644 index 0000000000..657a2f95d8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/calculator/Calculator.composite @@ -0,0 +1,51 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"></reference>
+ <reference name="subtractService" target="SubtractServiceComponent"></reference>
+ <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
+ <reference name="divideService" target="DivideServiceComponent"></reference>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/calculator/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/calculator/sca-contribution.xml new file mode 100644 index 0000000000..e95796d83a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/main/resources/calculator/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java new file mode 100644 index 0000000000..946f505ead --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java @@ -0,0 +1,175 @@ +/*
+ * 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.contribution;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+
+/**
+ * This is more intended to be a integration test then a unit test. *
+ */
+public class ContributionServiceTestCase extends TestCase {
+ private static final String CONTRIBUTION_001_ID = "contribution001/";
+ private static final String CONTRIBUTION_002_ID = "contribution002/";
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+ private static final String FOLDER_CONTRIBUTION = "target/classes/";
+
+ private ClassLoader cl;
+ private EmbeddedSCADomain domain;
+ private ContributionService contributionService;
+
+ @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();
+
+ //get a reference to the contribution service
+ contributionService = domain.getContributionService();
+ }
+
+ public void testContributeJAR() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ //URL contributionLocation = new URL("file:/D:/dev/Opensource/Apache/Tuscany/source/java/sca/samples/calculator/target/sample-calculator.jar");
+ String contributionId = CONTRIBUTION_001_ID;
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId, contributionLocation, resolver, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+ }
+
+ public void testStoreContributionPackageInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId, contributionLocation, resolver, true);
+
+ assertTrue(FileHelper.toFile(new URL(contributionService.getContribution(contributionId).getLocation()))
+ .exists());
+
+ assertNotNull(contributionId);
+
+ Contribution contributionModel = contributionService.getContribution(contributionId);
+
+ File contributionFile = FileHelper.toFile(new URL(contributionModel.getLocation()));
+ assertTrue(contributionFile.exists());
+ }
+
+ public void testStoreContributionStreamInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+
+ InputStream contributionStream = contributionLocation.openStream();
+ try {
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId, contributionLocation, contributionStream, resolver);
+ } finally {
+ IOHelper.closeQuietly(contributionStream);
+ }
+
+ assertTrue(FileHelper.toFile(new URL(contributionService.getContribution(contributionId).getLocation()))
+ .exists());
+
+ assertNotNull(contributionId);
+
+ Contribution contributionModel = contributionService.getContribution(contributionId);
+
+ File contributionFile = FileHelper.toFile(new URL(contributionModel.getLocation()));
+ assertTrue(contributionFile.exists());
+ }
+
+ public void testStoreDuplicatedContributionInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId1 = CONTRIBUTION_001_ID;
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId1, contributionLocation, resolver, true);
+ assertNotNull(contributionService.getContribution(contributionId1));
+ String contributionId2 = CONTRIBUTION_002_ID;
+ ModelResolver resolver2 = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId2, contributionLocation, resolver2, true);
+ assertNotNull(contributionService.getContribution(contributionId2));
+ }
+
+ public void testContributeFolder() throws Exception {
+ File rootContributionFolder = new File(FOLDER_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ //first rename the sca-contribution metadata file
+ //File calculatorMetadataFile = new File("target/classes/calculator/sca-contribution.xml");
+ //File metadataDirectory = new File("target/classes/META-INF/");
+ //if (!metadataDirectory.exists()) {
+ // FileHelper.forceMkdir(metadataDirectory);
+ //}
+ //FileHelper.copyFileToDirectory(calculatorMetadataFile, metadataDirectory);
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId, rootContributionFolder.toURL(), resolver, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+ }
+
+ public void testAddDeploymentComposites() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ Contribution contribution = contributionService.contribute(contributionId, contributionLocation, resolver, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+
+ String artifactId = "contributionComposite.composite";
+ Composite composite = (new DefaultAssemblyFactory()).createComposite();
+ composite.setName(new QName(null, "contributionComposite"));
+ composite.setURI("contributionComposite.composite");
+
+ contributionService.addDeploymentComposite(contribution, composite);
+
+ List deployables = contributionService.getContribution(contributionId).getDeployables();
+ Composite composite1 = (Composite)deployables.get(deployables.size() - 1);
+ assertEquals("contributionComposite", composite1.getName().toString());
+
+ DeployedArtifact artifact = null;
+ contribution = contributionService.getContribution(contributionId);
+ String id = artifactId.toString();
+ for (DeployedArtifact a : contribution.getArtifacts()) {
+ if (id.equals(a.getURI())) {
+ artifact = a;
+ break;
+ }
+ }
+ Composite composite2 = (Composite)artifact.getModel();
+ assertEquals("contributionComposite", composite2.getName().toString());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/resources/deployables/sample-calculator.jar Binary files differnew file mode 100644 index 0000000000..0ca3a1b781 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/resources/deployables/sample-calculator.jar diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/resources/repository/sample-calculator.jar b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/resources/repository/sample-calculator.jar Binary files differnew file mode 100644 index 0000000000..0ca3a1b781 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/contribution/src/test/resources/repository/sample-calculator.jar diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/pom.xml new file mode 100644 index 0000000000..84822c2292 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/pom.xml @@ -0,0 +1,64 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-conversations-ws</artifactId>
+ <name>Apache Tuscany SCA Conversations Over binding.ws Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java new file mode 100644 index 0000000000..9cd88620e3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/BusinessException.java @@ -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.
+ */
+package org.apache.tuscany.sca.itest.conversational;
+
+public class BusinessException extends Exception {
+
+ private String message;
+
+ public BusinessException() {
+ super();
+ }
+
+ public BusinessException(String message) {
+ super(message);
+ setMessage(message);
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java new file mode 100644 index 0000000000..53dadc3dc7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java @@ -0,0 +1,29 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+public interface ConversationIdService {
+
+ String getCIDField();
+ String getCIDSetter();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java new file mode 100644 index 0000000000..c2c30db505 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java @@ -0,0 +1,50 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ // public void init();
+
+ // public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java new file mode 100644 index 0000000000..7a4c733fb0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.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.itest.conversational;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromInjectedReference2();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public String runConversationCallingEndedConversationCheckConversationId();
+ public String runConversationCallingEndedConversationCallbackCheckConversationId();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java new file mode 100644 index 0000000000..8f008fa711 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java @@ -0,0 +1,36 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java new file mode 100644 index 0000000000..1e36ce6917 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java @@ -0,0 +1,58 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ //public void businessException() throws BusinessException;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ //public void businessExceptionCallback() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java new file mode 100644 index 0000000000..b4d3fe3d71 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java @@ -0,0 +1,59 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(NonConversationalCallback.class)
+public interface ConversationalServiceNonConversationalCallback {
+
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws BusinessException;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java new file mode 100644 index 0000000000..05cafb119e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java @@ -0,0 +1,44 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface NonConversationalCallback {
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws BusinessException;
+
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java new file mode 100644 index 0000000000..1603916cca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java @@ -0,0 +1,76 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="1 seconds")
+public class ConversationAgeComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws BusinessException {
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java new file mode 100644 index 0000000000..accc1eee27 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java @@ -0,0 +1,48 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationIdService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationIdService.class)
+@Scope("CONVERSATION")
+public class ConversationIdComponentImpl implements ConversationIdService {
+
+ @ConversationID
+ public String cid;
+
+ private String setterCid;
+
+ public String getCIDField() {
+ return cid;
+ }
+ public String getCIDSetter() {
+ return setterCid;
+ }
+
+
+ @ConversationID
+ public void setCID(String cid) {
+ this.setterCid = cid;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java new file mode 100644 index 0000000000..90f6de86ac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java @@ -0,0 +1,76 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxIdleTime="1 seconds")
+public class ConversationMaxIdleComponentImpl implements ConversationalService {
+
+ private int count;
+
+ public void businessException() throws BusinessException {
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ }
+
+ public void destroy() {
+ }
+
+ public String endConversation() {
+ return null;
+ }
+
+ public String endConversationCallback() {
+ return null;
+ }
+
+ public void incrementCount() {
+ }
+
+ public void incrementCountCallback() {
+ }
+
+ public void init() {
+ }
+
+ public void initializeCount(int count) {
+ this.count = count;
+ }
+
+ public void initializeCountCallback(int count) {
+ }
+
+ public int retrieveCount() {
+ return count;
+ }
+
+ public int retrieveCountCallback() {
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java new file mode 100644 index 0000000000..3f7a90b3dc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java @@ -0,0 +1,322 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConversationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConversationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConversationId;
+ }
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java new file mode 100644 index 0000000000..ab91498132 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java @@ -0,0 +1,311 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulNonConversationalCallbackImpl implements ConversationalClient, NonConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java new file mode 100644 index 0000000000..e4f83656de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java @@ -0,0 +1,318 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ // now test the second reference
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConfersationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConfersationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConfersationId;
+ }
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+// conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+// conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java new file mode 100644 index 0000000000..8fe7c5b6ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java @@ -0,0 +1,43 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java new file mode 100644 index 0000000000..9f4857f703 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java @@ -0,0 +1,124 @@ +/*
+ * 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.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("REQUEST")
+public class ConversationalServiceRequestImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java new file mode 100644 index 0000000000..4b06251414 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java @@ -0,0 +1,119 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws BusinessException {
+ calls.append("businessException,");
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java new file mode 100644 index 0000000000..be039748fc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java @@ -0,0 +1,118 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalServiceNonConversationalCallback.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulNonConversationalCallbackImpl implements ConversationalServiceNonConversationalCallback {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected NonConversationalCallback nonConversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ nonConversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ nonConversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return nonConversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ nonConversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return nonConversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java new file mode 100644 index 0000000000..cce4d6ea57 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java @@ -0,0 +1,123 @@ +/*
+ * 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.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java new file mode 100644 index 0000000000..a852aeda56 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java @@ -0,0 +1,94 @@ +/*
+ * 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.itest.conversational.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.conversational.BusinessException;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessScopeImpl implements ConversationalService {
+
+ @ConversationID
+ protected String cid;
+
+ static Map<String, Integer> state = new HashMap<String, Integer>();
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String endConversation() {
+ state.remove(cid);
+ return cid;
+ }
+
+ public String endConversationCallback() {
+ // TODO Auto-generated method stub
+ return null;
+
+ }
+
+ public void incrementCount() {
+ state.put(cid, Integer.valueOf(state.get(cid)+1));
+ }
+
+ public void businessException() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public void incrementCountCallback() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initializeCount(int count) {
+ state.put(cid, Integer.valueOf(count));
+ }
+
+ public void initializeCountCallback(int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void businessExceptionCallback() throws BusinessException {
+ throw new BusinessException("Business Exception");
+ }
+
+ public int retrieveCount() {
+ return state.get(cid);
+ }
+
+ public int retrieveCountCallback() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d5a1ff7410 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/Conversational/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:conv="http://conversations">
+ <deployable composite="conv:ConversationalITest" />
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/Conversational/conversational.composite b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/Conversational/conversational.composite new file mode 100644 index 0000000000..b1885bd772 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/Conversational/conversational.composite @@ -0,0 +1,169 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatelessClientRequestService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceRequest">
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceRequest">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalStatefulClientNonConversationalCallbackStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl"/>
+ <reference name="conversationalService" target="ConversationalServiceStatefulNonConversationalCallback">
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStatefulNonConversationalCallback">
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessScopeImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatelessSL">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceRequest">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl"/>
+ <service name="ConversationalService">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalService"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.ConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+ <component name="ConversationalServiceStatefulNonConversationalCallback">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl"/>
+ <service name="ConversationalServiceNonConversationalCallback">
+ <interface.java interface="org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback"
+ callbackInterface="org.apache.tuscany.sca.itest.conversational.NonConversationalCallback" />
+ <binding.ws/>
+ <callback>
+ <binding.ws/>
+ </callback>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl new file mode 100644 index 0000000000..20a92c9dc7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/ConversationalServiceStateful.wsdl @@ -0,0 +1,383 @@ +<?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.
+-->
+<wsdl:definitions targetNamespace="http://conversational.itest.sca.tuscany.apache.org"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns0="http://conversational.itest.sca.tuscany.apache.org"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:ns1="http://org.apache.axis2/xsd">
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://conversational.itest.sca.tuscany.apache.org" xmlns:ns="http://conversational.itest.sca.tuscany.apache.org">
+ <xs:element name="retrieveCountResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ </xs:element>
+ <xs:element name="retrieveCountCallbackResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="endConversationResponse">
+
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="endConversationCallbackResponse">
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="initializeCount">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" type="xs:int"/>
+ </xs:sequence>
+
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="initializeCountCallback">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="retrieveCount"><xs:complexType/></xs:element><xs:element name="endConversation"><xs:complexType/></xs:element><xs:element name="endConversationCallback"><xs:complexType/></xs:element><xs:element name="incrementCountCallback"><xs:complexType/></xs:element><xs:element name="incrementCountCallbackResponse"><xs:complexType/></xs:element><xs:element name="incrementCount"><xs:complexType/></xs:element><xs:element name="incrementCountResponse"><xs:complexType/></xs:element><xs:element name="initializeCountCallbackResponse"><xs:complexType/></xs:element><xs:element name="initializeCountResponse"><xs:complexType/></xs:element><xs:element name="retrieveCountCallback"><xs:complexType/></xs:element></xs:schema>
+ </wsdl:types>
+ <wsdl:message name="initializeCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:initializeCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:retrieveCountCallback">
+ </wsdl:part>
+
+ </wsdl:message>
+ <wsdl:message name="incrementCountRequest">
+ <wsdl:part name="parameters" element="ns0:incrementCount">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:incrementCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="retrieveCountCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:retrieveCountCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountResponse">
+ <wsdl:part name="parameters" element="ns0:retrieveCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationResponse">
+
+ <wsdl:part name="parameters" element="ns0:endConversationResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:endConversationCallback">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:incrementCountCallback">
+
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="retrieveCountRequest">
+ <wsdl:part name="parameters" element="ns0:retrieveCount">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="initializeCountRequest">
+ <wsdl:part name="parameters" element="ns0:initializeCount">
+ </wsdl:part>
+
+ </wsdl:message>
+ <wsdl:message name="initializeCountResponse">
+ <wsdl:part name="parameters" element="ns0:initializeCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="endConversationCallbackResponse">
+ <wsdl:part name="parameters" element="ns0:endConversationCallbackResponse">
+ </wsdl:part>
+ </wsdl:message>
+
+ <wsdl:message name="endConversationRequest">
+ <wsdl:part name="parameters" element="ns0:endConversation">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="initializeCountCallbackRequest">
+ <wsdl:part name="parameters" element="ns0:initializeCountCallback">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="incrementCountResponse">
+
+ <wsdl:part name="parameters" element="ns0:incrementCountResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="ConversationalServicePortType">
+ <wsdl:operation name="retrieveCount">
+ <wsdl:input message="ns0:retrieveCountRequest" wsaw:Action="urn:retrieveCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:retrieveCountResponse" wsaw:Action="urn:retrieveCountResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <wsdl:input message="ns0:endConversationRequest" wsaw:Action="urn:endConversation">
+ </wsdl:input>
+ <wsdl:output message="ns0:endConversationResponse" wsaw:Action="urn:endConversationResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <wsdl:input message="ns0:endConversationCallbackRequest" wsaw:Action="urn:endConversationCallback">
+
+ </wsdl:input>
+ <wsdl:output message="ns0:endConversationCallbackResponse" wsaw:Action="urn:endConversationCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <wsdl:input message="ns0:incrementCountCallbackRequest" wsaw:Action="urn:incrementCountCallback">
+ </wsdl:input>
+ <wsdl:output message="ns0:incrementCountCallbackResponse" wsaw:Action="urn:incrementCountCallbackResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <wsdl:input message="ns0:incrementCountRequest" wsaw:Action="urn:incrementCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:incrementCountResponse" wsaw:Action="urn:incrementCountResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <wsdl:input message="ns0:initializeCountCallbackRequest" wsaw:Action="urn:initializeCountCallback">
+
+ </wsdl:input>
+ <wsdl:output message="ns0:initializeCountCallbackResponse" wsaw:Action="urn:initializeCountCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <wsdl:input message="ns0:initializeCountRequest" wsaw:Action="urn:initializeCount">
+ </wsdl:input>
+ <wsdl:output message="ns0:initializeCountResponse" wsaw:Action="urn:initializeCountResponse">
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <wsdl:input message="ns0:retrieveCountCallbackRequest" wsaw:Action="urn:retrieveCountCallback">
+ </wsdl:input>
+ <wsdl:output message="ns0:retrieveCountCallbackResponse" wsaw:Action="urn:retrieveCountCallbackResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ConversationalServiceSOAP11Binding" type="ns0:ConversationalServicePortType">
+
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="retrieveCount">
+ <soap:operation soapAction="urn:retrieveCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <soap:operation soapAction="urn:endConversation" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <soap:operation soapAction="urn:endConversationCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <soap:operation soapAction="urn:incrementCountCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <soap:operation soapAction="urn:incrementCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <soap:operation soapAction="urn:initializeCountCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <soap:operation soapAction="urn:initializeCount" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <soap:operation soapAction="urn:retrieveCountCallback" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ConversationalServiceHttpBinding" type="ns0:ConversationalServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="retrieveCount">
+ <http:operation location="ConversationalService/retrieveCount"/>
+ <wsdl:input>
+ <mime:content part="retrieveCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="retrieveCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversation">
+ <http:operation location="ConversationalService/endConversation"/>
+ <wsdl:input>
+ <mime:content part="endConversation" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="endConversation" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="endConversationCallback">
+ <http:operation location="ConversationalService/endConversationCallback"/>
+ <wsdl:input>
+ <mime:content part="endConversationCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="endConversationCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCountCallback">
+ <http:operation location="ConversationalService/incrementCountCallback"/>
+ <wsdl:input>
+ <mime:content part="incrementCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="incrementCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="incrementCount">
+ <http:operation location="ConversationalService/incrementCount"/>
+ <wsdl:input>
+ <mime:content part="incrementCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="incrementCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCountCallback">
+ <http:operation location="ConversationalService/initializeCountCallback"/>
+ <wsdl:input>
+ <mime:content part="initializeCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="initializeCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="initializeCount">
+ <http:operation location="ConversationalService/initializeCount"/>
+ <wsdl:input>
+ <mime:content part="initializeCount" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="initializeCount" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="retrieveCountCallback">
+ <http:operation location="ConversationalService/retrieveCountCallback"/>
+ <wsdl:input>
+ <mime:content part="retrieveCountCallback" type="text/xml"/>
+ </wsdl:input>
+
+ <wsdl:output>
+ <mime:content part="retrieveCountCallback" type="text/xml"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ConversationalService">
+ <wsdl:port name="ConversationalServiceSOAP11port_http" binding="ns0:ConversationalServiceSOAP11Binding">
+ <soap:address location="http://localhost:8085/ConversationalServiceStateful"/>
+ </wsdl:port>
+
+ <wsdl:port name="ConversationalServiceHttpport" binding="ns0:ConversationalServiceHttpBinding">
+ <http:address location="http://localhost:8085/ConversationalServiceStateful"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..73d078674c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:conv="http://conversations">
+ <deployable composite="conv:ConversationalWSDLITest" />
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite new file mode 100644 index 0000000000..93bf866712 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/main/resources/ConversationalWSDL/conversationalWSDL.composite @@ -0,0 +1,48 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationalWSDLITest">
+
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.binding(ConversationalServiceSOAP11Binding)"/>
+ </reference>
+ <reference name="conversationalService2" target="ConversationalServiceStateful">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.binding(ConversationalServiceSOAP11Binding)"/>
+ </reference>
+ </component>
+
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ <service name="ConversationalService">
+ <binding.ws wsdlElement="http://conversational.itest.sca.tuscany.apache.org#wsdl.binding(ConversationalServiceSOAP11Binding)"/>
+ </service>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java new file mode 100644 index 0000000000..1d4c975112 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java @@ -0,0 +1,75 @@ +/*
+ * 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.itest.conversational;
+
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.impl.SCANodeFactoryImpl;
+import org.apache.tuscany.sca.node.util.SCAContributionUtil;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConversationWSDLTestCase {
+
+ private SCANode node;
+ private ConversationalClient conversationalStatelessClientStatefulService;
+
+ @Before
+ public void setUp() throws Exception {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ ConversationWSDLTestCase.class.getResource("/ConversationalWSDL/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalWSDLITest"));
+ node.start();
+
+ conversationalStatelessClientStatefulService = node.getDomain().getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ node.destroy();
+ conversationalStatelessClientStatefulService = null;
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testKeepServerRunning() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCaseOff.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCaseOff.java new file mode 100644 index 0000000000..43e384f037 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCaseOff.java @@ -0,0 +1,610 @@ +/*
+ * 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.itest.conversational;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ConversationalTestCaseOff {
+
+ private static SCADomain domain;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client request scope service tests
+ // ============================================
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference2();
+ Assert.assertEquals(1, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromServiceReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientRequestService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientRequestService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceRequestImpl.calls = new StringBuffer();
+ conversationalStatelessClientRequestService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,",
+ ConversationalServiceRequestImpl.calls.toString());
+ //init,initializeCount,init,incrementCount,init,retrieveCount,init,endConversation,
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ int count = conversationalStatelessClientRequestService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessRequestConversationHavingPassedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessException() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client non conversational callback stateful service tests
+ // ==================================================================
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals("MyConversation3", id);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java new file mode 100644 index 0000000000..7153cd5b50 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java @@ -0,0 +1,202 @@ +/*
+ * 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.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NonConversationalCallbackTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client non conversational callback stateful service tests
+ // ==================================================================
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals("MyConversation3", id);
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java new file mode 100644 index 0000000000..a3be2eea01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java @@ -0,0 +1,211 @@ +/*
+ * 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.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RequestScopeTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client request scope service tests
+ // ============================================
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference2();
+ Assert.assertEquals(1, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromServiceReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientRequestService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientRequestService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceRequestImpl.calls = new StringBuffer();
+ conversationalStatelessClientRequestService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,",
+ ConversationalServiceRequestImpl.calls.toString());
+ //init,initializeCount,init,incrementCount,init,retrieveCount,init,endConversation,
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ int count = conversationalStatelessClientRequestService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessRequestConversationHavingPassedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessException() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java new file mode 100644 index 0000000000..25b654a5d7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java @@ -0,0 +1,197 @@ +/*
+ * 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.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.apache.tuscany.sca.node.util.SCAContributionUtil;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatefulStatefulTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java new file mode 100644 index 0000000000..44ddf1f15b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java @@ -0,0 +1,196 @@ +/*
+ * 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.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatefulStatelessTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java new file mode 100644 index 0000000000..650aa9ef55 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java @@ -0,0 +1,209 @@ +/*
+ * 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.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatelessStatefulTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java new file mode 100644 index 0000000000..5b09f7a693 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java @@ -0,0 +1,196 @@ +/*
+ * 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.itest.conversational;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StatelessStatelessTestCase {
+
+ private static SCADomain domain;
+ private static SCANode node;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ StatefulStatefulTestCase.class.getResource("/Conversational/."));
+ node.addToDomainLevelComposite(new QName("http://conversations", "ConversationalITest"));
+ node.start();
+ domain = node.getDomain();
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ node.destroy();
+ domain = null;
+ conversationalStatelessClientStatelessService = null;
+ conversationalStatelessClientStatefulService = null;
+ conversationalStatefulClientStatelessService = null;
+ conversationalStatefulClientStatefulService = null;
+ conversationalStatelessClientRequestService = null;
+ conversationalStatefulClientNonConversationalCallbackStatelessService = null;
+ }
+
+ private static void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+
+ // stateless client stateless service tests
+ // ========================================
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/pom.xml new file mode 100644 index 0000000000..481485efeb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-conversations</artifactId> + <name>Apache Tuscany SCA Conversations Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java new file mode 100644 index 0000000000..e7583c339a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/AService.java @@ -0,0 +1,56 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Conversational
+public interface AService {
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ String getState();
+
+ /**
+ * Returns the state for the other service that this service is using
+ *
+ * @return The state for the other service that this service is using
+ */
+ String getStateOnB();
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ void setState(String aState);
+
+ /**
+ * Sets the state for the other service that this service is using
+ *
+ * @param aState The state for the other service that this service is using
+ */
+ void setStateOnB(String aState);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java new file mode 100644 index 0000000000..77d7f4c007 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/BService.java @@ -0,0 +1,42 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+/**
+ * Simple conversational Service
+ */
+@Conversational
+public interface BService {
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ String getState();
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ void setState(String aState);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java new file mode 100644 index 0000000000..3f04e9f09e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/Constants.java @@ -0,0 +1,25 @@ +/*
+ * 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.itest.conversational;
+
+public interface Constants {
+
+ String A_INITIAL_VALUE = "Initial Value of A";
+ String B_INITIAL_VALUE = "Initial Value of B";
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java new file mode 100644 index 0000000000..53dadc3dc7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationIdService.java @@ -0,0 +1,29 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+
+@Conversational
+public interface ConversationIdService {
+
+ String getCIDField();
+ String getCIDSetter();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java new file mode 100644 index 0000000000..640ec22a4f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalCallback.java @@ -0,0 +1,50 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+public interface ConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.java new file mode 100644 index 0000000000..7a4c733fb0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalClient.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.itest.conversational;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client for the conversational itest. Is implemented by clients
+ * offering both stateless and stateful callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalClient {
+
+ public int runConversationFromInjectedReference();
+ public int runConversationFromInjectedReference2();
+ public int runConversationFromServiceReference();
+ public int runConversationWithUserDefinedConversationId();
+ public String runConversationCheckUserDefinedConversationId();
+ public int runConversationCheckingScope();
+ public int runConversationWithCallback();
+ public int runConversationHavingPassedReference();
+ public String runConversationBusinessException();
+ public String runConversationBusinessExceptionCallback();
+ public int runConversationCallingEndedConversation();
+ public int runConversationCallingEndedConversationCallback();
+ public String runConversationCallingEndedConversationCheckConversationId();
+ public String runConversationCallingEndedConversationCallbackCheckConversationId();
+ public int runConversationAgeTimeout();
+ public int runConversationIdleTimeout();
+ public int runConversationPrincipleError();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java new file mode 100644 index 0000000000..8f008fa711 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalReferenceClient.java @@ -0,0 +1,36 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The client that calls into an existing conversation by accepting
+ * a reference to that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Remotable
+public interface ConversationalReferenceClient {
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java new file mode 100644 index 0000000000..546382cfd1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalService.java @@ -0,0 +1,62 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(ConversationalCallback.class)
+public interface ConversationalService {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java new file mode 100644 index 0000000000..f1a21cc18f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/ConversationalServiceNonConversationalCallback.java @@ -0,0 +1,62 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+@Conversational
+@Callback(NonConversationalCallback.class)
+public interface ConversationalServiceNonConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public void initializeCountCallback(int count);
+
+ public void incrementCountCallback();
+
+ public int retrieveCountCallback();
+
+ public void businessExceptionCallback() throws Exception;
+
+ @EndsConversation
+ public String endConversation();
+
+ public String endConversationCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java new file mode 100644 index 0000000000..a9f264da56 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallback.java @@ -0,0 +1,48 @@ +/*
+ * 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.itest.conversational;
+
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The callback interface used when testing caonversational callbacks
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface NonConversationalCallback {
+
+ public void init();
+
+ public void destroy();
+
+ public void initializeCount(int count);
+
+ public void incrementCount();
+
+ public int retrieveCount();
+
+ public void businessException() throws Exception;
+
+ public String endConversation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java new file mode 100644 index 0000000000..95c9c7ae6e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/AServiceImpl.java @@ -0,0 +1,111 @@ +/*
+ * 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.itest.conversational.impl;
+
+import java.lang.reflect.Proxy;
+import org.apache.tuscany.sca.core.invocation.JDKInvocationHandler;
+
+import org.apache.tuscany.sca.itest.conversational.AService;
+import org.apache.tuscany.sca.itest.conversational.BService;
+import org.apache.tuscany.sca.itest.conversational.Constants;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service that uses another Conversational Service
+ */
+@Service(AService.class)
+@Scope("CONVERSATION")
+public class AServiceImpl implements AService {
+
+ /**
+ * The state
+ */
+ private String state = Constants.A_INITIAL_VALUE;
+
+ /**
+ * The reference to the other service
+ */
+ private BService b;
+
+ /**
+ * Constructor
+ *
+ */
+ public AServiceImpl() {
+ System.out.println("---> AServiceImpl constructor for " + this);
+ }
+
+ /**
+ * Inject the reference to the other service
+ * @param aB The other service.
+ */
+ @Reference(name="b")
+ public void setB(BService aB) {
+ System.out.println("---> Setting reference to B on " + this + " to " + aB);
+ this.b = aB;
+ }
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Returns the state for the other service that this service is using
+ *
+ * @return The state for the other service that this service is using
+ */
+ public String getStateOnB() {
+ return b.getState();
+ }
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ public void setState(String aState) {
+ this.state = aState;
+ }
+
+ /**
+ * Sets the state for the other service that this service is using
+ *
+ * @param aState The state for the other service that this service is using
+ */
+ public void setStateOnB(String aState) {
+ b.setState(aState);
+ }
+
+ /**
+ * Sets the conversation ID for this service
+ * @param id The Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(String id) {
+ System.out.println("Conversation ID for " + this + " is set to " + id);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java new file mode 100644 index 0000000000..c1e27641ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/BServiceImpl.java @@ -0,0 +1,73 @@ +/*
+ * 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.itest.conversational.impl;
+
+
+import org.apache.tuscany.sca.itest.conversational.BService;
+import org.apache.tuscany.sca.itest.conversational.Constants;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Simple conversational Service
+ */
+@Service(BService.class)
+@Scope("CONVERSATION")
+public class BServiceImpl implements BService {
+
+ /**
+ * The state for this service
+ */
+ private String state = Constants.B_INITIAL_VALUE;
+
+ /**
+ * Constructor
+ */
+ public BServiceImpl() {
+ System.out.println("---> BServiceImpl constructor for " + this);
+ }
+
+ /**
+ * Returns the state for this service.
+ *
+ * @return The state for this service
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the state for this service.
+ *
+ * @param aState The state for this service
+ */
+ public void setState(String aState) {
+ this.state = aState;
+ }
+
+ /**
+ * Sets the conversation ID for this service
+ * @param id The Conversation ID
+ */
+ @ConversationID
+ public void setConversationID(String id) {
+ System.out.println("Conversation ID for " + this + " is set to " + id);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java new file mode 100644 index 0000000000..9deef312ac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationAgeComponentImpl.java @@ -0,0 +1,75 @@ +/* + * 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.itest.conversational.impl; + +import org.apache.tuscany.sca.itest.conversational.ConversationalService; +import org.osoa.sca.annotations.ConversationAttributes; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ConversationalService.class) +@Scope("CONVERSATION") +@ConversationAttributes(maxAge="1 seconds") +public class ConversationAgeComponentImpl implements ConversationalService { + + private int count; + + public void businessException() throws Exception { + } + + public void businessExceptionCallback() throws Exception { + } + + public void destroy() { + } + + public String endConversation() { + return null; + } + + public String endConversationCallback() { + return null; + } + + public void incrementCount() { + } + + public void incrementCountCallback() { + } + + public void init() { + } + + public void initializeCount(int count) { + this.count = count; + } + + public void initializeCountCallback(int count) { + } + + public int retrieveCount() { + return count; + } + + public int retrieveCountCallback() { + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java new file mode 100644 index 0000000000..cffa76186a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationIdComponentImpl.java @@ -0,0 +1,48 @@ +/* + * 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.itest.conversational.impl; + +import org.apache.tuscany.sca.itest.conversational.ConversationIdService; +import org.osoa.sca.annotations.ConversationID; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ConversationIdService.class) +@Scope("CONVERSATION") +public class ConversationIdComponentImpl implements ConversationIdService { + + @ConversationID + public String cid; + + private String setterCid; + + public String getCIDField() { + return cid; + } + public String getCIDSetter() { + return setterCid; + } + + + @ConversationID + public void setCID(String cid) { + this.setterCid = cid; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java new file mode 100644 index 0000000000..1272c7ab7f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationMaxIdleComponentImpl.java @@ -0,0 +1,75 @@ +/* + * 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.itest.conversational.impl; + +import org.apache.tuscany.sca.itest.conversational.ConversationalService; +import org.osoa.sca.annotations.ConversationAttributes; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ConversationalService.class) +@Scope("CONVERSATION") +@ConversationAttributes(maxIdleTime="1 seconds") +public class ConversationMaxIdleComponentImpl implements ConversationalService { + + private int count; + + public void businessException() throws Exception { + } + + public void businessExceptionCallback() throws Exception { + } + + public void destroy() { + } + + public String endConversation() { + return null; + } + + public String endConversationCallback() { + return null; + } + + public void incrementCount() { + } + + public void incrementCountCallback() { + } + + public void init() { + } + + public void initializeCount(int count) { + this.count = count; + } + + public void initializeCountCallback(int count) { + } + + public int retrieveCount() { + return count; + } + + public int retrieveCountCallback() { + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java new file mode 100644 index 0000000000..847b038881 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulImpl.java @@ -0,0 +1,321 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConversationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConversationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConversationId;
+ }
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java new file mode 100644 index 0000000000..b77e4c0194 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatefulNonConversationalCallbackImpl.java @@ -0,0 +1,310 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalClientStatefulNonConversationalCallbackImpl implements ConversationalClient, NonConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ return callableReference.endConversation();
+
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ callbackCount = 2;
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount += count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java new file mode 100644 index 0000000000..5b3906fc2c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalClientStatelessImpl.java @@ -0,0 +1,317 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The client for the conversational itest which presents a stateful
+ * callback interface
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalClient.class})
+public class ConversationalClientStatelessImpl implements ConversationalClient, ConversationalCallback {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ @Reference
+ protected ConversationalService conversationalService;
+
+ @Reference
+ protected ConversationalService conversationalService2;
+
+ @Reference
+ protected ConversationalReferenceClient conversationalReferenceClient;
+
+ private int clientCount = 0;
+ private int callbackCount = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ // From ConversationalClient
+ public int runConversationFromInjectedReference(){
+ calls.append("runConversationFromInjectedReference,");
+ conversationalService.initializeCount(1);
+ conversationalService.incrementCount();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromInjectedReference2(){
+ calls.append("runConversationFromInjectedReference2,");
+
+ // now test the second reference
+ conversationalService2.initializeCount(1);
+ conversationalService2.incrementCount();
+
+ // stick in a call to the first reference to
+ // make sure the two references don't clash
+ conversationalService.initializeCount(1);
+
+ clientCount = conversationalService2.retrieveCount();
+ conversationalService2.endConversation();
+
+ // end the conversation through the first reference
+ conversationalService.endConversation();
+
+ return clientCount;
+ }
+ public int runConversationFromServiceReference(){
+ calls.append("runConversationFromServiceReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public int runConversationWithUserDefinedConversationId(){
+ calls.append("runConversationWithUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation1");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ // serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+ public String runConversationCheckUserDefinedConversationId(){
+ calls.append("runConversationCheckUserDefinedConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation2");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+
+ String clientConversationId = serviceReference.getConversationID().toString();
+ String serverConfersationId = callableReference.endConversation();
+
+ if (clientConversationId.equals("MyConversation2") &&
+ serverConfersationId.equals("MyConversation2") ) {
+ return clientConversationId;
+ } else {
+ return "client = " + clientConversationId +
+ "server = " + serverConfersationId;
+ }
+ }
+ public int runConversationCheckingScope(){
+ calls.append("runConversationCheckingScope,");
+ // run a conversation
+ return runConversationFromInjectedReference();
+
+ // test will then use a static method to find out how many times
+ // init/destroy were called
+ }
+ public int runConversationWithCallback(){
+ calls.append("runConversationWithCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.incrementCountCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+
+ return clientCount;
+ }
+
+ public int runConversationHavingPassedReference(){
+ calls.append("runConversationHavingPassedReference,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ conversationalReferenceClient.incrementCount(serviceReference);
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ serviceReference.getConversation().end();
+
+ return clientCount;
+ }
+
+ public String runConversationBusinessException(){
+ calls.append("runConversationbusinessException,");
+ try {
+ conversationalService.initializeCount(1);
+ conversationalService.businessException();
+ clientCount = conversationalService.retrieveCount();
+ conversationalService.endConversation();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public String runConversationBusinessExceptionCallback(){
+ calls.append("runConversationbusinessExceptionCallback,");
+ try {
+ conversationalService.initializeCountCallback(1);
+ conversationalService.businessExceptionCallback();
+ clientCount = conversationalService.retrieveCountCallback();
+ conversationalService.endConversationCallback();
+ } catch(Exception ex) {
+ return ex.getMessage();
+ }
+
+ return "No Exception Returned";
+ }
+
+ public int runConversationCallingEndedConversation(){
+ calls.append("runConversationCallingEndedConversation,");
+ conversationalService.initializeCount(1);
+ conversationalService.endConversation();
+ return conversationalService.retrieveCount();
+ }
+
+ public int runConversationCallingEndedConversationCallback(){
+ calls.append("runConversationCallingEndedConversationCallback,");
+ conversationalService.initializeCountCallback(1);
+ conversationalService.endConversationCallback();
+ return conversationalService.retrieveCountCallback();
+ }
+
+ public String runConversationCallingEndedConversationCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversation();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public String runConversationCallingEndedConversationCallbackCheckConversationId(){
+ calls.append("runConversationCallingEndedConversationCallbackCheckConversationId,");
+ ServiceReference<ConversationalService> serviceReference = componentContext.getServiceReference(ConversationalService.class,
+ "conversationalService");
+ serviceReference.setConversationID("MyConversation3");
+
+ ConversationalService callableReference = serviceReference.getService();
+
+ callableReference.initializeCount(1);
+ callableReference.incrementCount();
+ clientCount = callableReference.retrieveCount();
+ callableReference.endConversationCallback();
+
+ if (serviceReference.getConversation() ==null ) {
+ return null;
+ } else {
+ return serviceReference.getConversation().getConversationID().toString();
+ }
+ }
+
+ public int runConversationAgeTimeout(){
+ calls.append("runConversationAgeTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationIdleTimeout(){
+ calls.append("runConversationIdleTimeout,");
+ // done in other testing
+ return clientCount;
+ }
+ public int runConversationPrincipleError(){
+ calls.append("runConversationPrincipleError,");
+ // TODO - when policy framework is done
+ return clientCount;
+ }
+
+
+ // From ConversationalCallback
+ @Init
+ public void init(){
+ calls.append("init,");
+
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ callbackCount = 0;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ callbackCount++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return callbackCount;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ callbackCount = 0;
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java new file mode 100644 index 0000000000..8fe7c5b6ba --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalReferenceClientImpl.java @@ -0,0 +1,43 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalReferenceClient;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * A client component that accepts a reference to an ongoing conversation
+ * and takes part in that conversation
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+@Service(interfaces={ConversationalReferenceClient.class})
+public class ConversationalReferenceClientImpl implements ConversationalReferenceClient{
+
+ public void incrementCount(CallableReference<ConversationalService> conversationalService){
+ ConversationalService callableReference = conversationalService.getService();
+
+ callableReference.incrementCount();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java new file mode 100644 index 0000000000..9a25f0f59a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceRequestImpl.java @@ -0,0 +1,123 @@ +/*
+ * 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.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("REQUEST")
+public class ConversationalServiceRequestImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java new file mode 100644 index 0000000000..efcbdff06f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulImpl.java @@ -0,0 +1,117 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java new file mode 100644 index 0000000000..8454b3846b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatefulNonConversationalCallbackImpl.java @@ -0,0 +1,117 @@ +/*
+ * 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.itest.conversational.impl;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalServiceNonConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.NonConversationalCallback;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalServiceNonConversationalCallback.class)
+@Scope("CONVERSATION")
+@ConversationAttributes(maxAge="10 minutes",
+ maxIdleTime="5 minutes",
+ singlePrincipal=false)
+public class ConversationalServiceStatefulNonConversationalCallbackImpl implements ConversationalServiceNonConversationalCallback {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected NonConversationalCallback nonConversationalCallback;
+
+ // local count - accumulates during the conversation
+ private int count = 0;
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ this.count = count;
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ count++;
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ return count;
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ this.count = count;
+ nonConversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ count++;
+ nonConversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return nonConversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ nonConversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ count = 0;
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return nonConversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java new file mode 100644 index 0000000000..a7b5b1aff5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessImpl.java @@ -0,0 +1,122 @@ +/*
+ * 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.itest.conversational.impl;
+
+import java.util.HashMap;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalCallback;
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * The service used when testing stateful conversations
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessImpl implements ConversationalService {
+
+ @ConversationID
+ protected String conversationId;
+
+ @Callback
+ protected ConversationalCallback conversationalCallback;
+
+ // static area in which to hold conversational data
+ private static HashMap<String, Integer> conversationalState = new HashMap<String, Integer>();
+
+ // a static member variable that records the number of times this service is called
+ public static StringBuffer calls = new StringBuffer();
+
+ @Init
+ public void init(){
+ calls.append("init,");
+ }
+
+ @Destroy
+ public void destroy(){
+ calls.append("destroy,");
+ }
+
+ public void initializeCount(int count){
+ calls.append("initializeCount,");
+ Integer conversationalCount = new Integer(count);
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public void incrementCount(){
+ calls.append("incrementCount,");
+ Integer conversationalCount = conversationalState.get(conversationId);
+ conversationalCount++;
+ conversationalState.put(conversationId, conversationalCount);
+ }
+
+ public int retrieveCount(){
+ calls.append("retrieveCount,");
+ Integer count = conversationalState.get(conversationId);
+ if (count != null){
+ return count.intValue();
+ } else {
+ return -999;
+ }
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void initializeCountCallback(int count){
+ calls.append("initializeCountCallback,");
+ initializeCount(count);
+ conversationalCallback.initializeCount(count);
+ }
+
+ public void incrementCountCallback(){
+ calls.append("incrementCountCallback,");
+ incrementCount();
+ conversationalCallback.incrementCount();
+ }
+
+ public int retrieveCountCallback(){
+ calls.append("retrieveCountCallback,");
+ return conversationalCallback.retrieveCount();
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ calls.append("businessExceptionCallback,");
+ conversationalCallback.businessException();
+ }
+
+ public String endConversation(){
+ calls.append("endConversation,");
+ conversationalState.remove(conversationId);
+ return conversationId;
+ }
+
+ public String endConversationCallback(){
+ calls.append("endConversationCallback,");
+ return conversationalCallback.endConversation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java new file mode 100644 index 0000000000..344aa99dff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/java/org/apache/tuscany/sca/itest/conversational/impl/ConversationalServiceStatelessScopeImpl.java @@ -0,0 +1,93 @@ +/*
+ * 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.itest.conversational.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.itest.conversational.ConversationalService;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Service;
+
+@Service(ConversationalService.class)
+public class ConversationalServiceStatelessScopeImpl implements ConversationalService {
+
+ @ConversationID
+ protected String cid;
+
+ static Map<String, Integer> state = new HashMap<String, Integer>();
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String endConversation() {
+ state.remove(cid);
+ return cid;
+ }
+
+ public String endConversationCallback() {
+ // TODO Auto-generated method stub
+ return null;
+
+ }
+
+ public void incrementCount() {
+ state.put(cid, Integer.valueOf(state.get(cid)+1));
+ }
+
+ public void businessException() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public void incrementCountCallback() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void init() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void initializeCount(int count) {
+ state.put(cid, Integer.valueOf(count));
+ }
+
+ public void initializeCountCallback(int count) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void businessExceptionCallback() throws Exception {
+ throw new Exception("Business Exception");
+ }
+
+ public int retrieveCount() {
+ return state.get(cid);
+ }
+
+ public int retrieveCountCallback() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/ConversationAge.composite b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/ConversationAge.composite new file mode 100644 index 0000000000..abd1c35ced --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/ConversationAge.composite @@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ConversationalIdTest">
+
+ <component name="ConversationAgeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationAgeComponentImpl"/>
+ </component>
+
+ <component name="ConversationIdleComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationMaxIdleComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/conversationId.composite b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/conversationId.composite new file mode 100644 index 0000000000..e61eb08194 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/conversationId.composite @@ -0,0 +1,27 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ConversationalIdTest">
+
+ <component name="ConversationIdComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationIdComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/conversational.composite b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/conversational.composite new file mode 100644 index 0000000000..4da3ce74d5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/main/resources/conversational.composite @@ -0,0 +1,99 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://conversations"
+ name="ConversationalITest">
+
+ <component name="ConversationalStatelessClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatelessClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ <reference name="conversationalService2" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatelessService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatelessSL"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatelessSL"/>
+ </component>
+
+ <component name="ConversationalStatefulClientStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStateful"/>
+ <reference name="conversationalService2" target="ConversationalServiceStateful"/>
+ </component>
+
+ <component name="ConversationalStatelessClientRequestService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceRequest"/>
+ <reference name="conversationalService2" target="ConversationalServiceRequest"/>
+ </component>
+
+ <component name="ConversationalStatefulClientNonConversationalCallbackStatefulService">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl"/>
+ <reference name="conversationalReferenceClient" target="ConversationalReferenceClient"/>
+ <reference name="conversationalService" target="ConversationalServiceStatefulNonConversationalCallback"/>
+ <reference name="conversationalService2" target="ConversationalServiceStatefulNonConversationalCallback"/>
+ </component>
+
+ <component name="ConversationalReferenceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalReferenceClientImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateful">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStateless">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessScopeImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatelessSL">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl"/>
+ </component>
+
+ <component name="ConversationalServiceRequest">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl"/>
+ </component>
+
+ <component name="ConversationalServiceStatefulNonConversationalCallback">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl"/>
+ </component>
+
+ <component name="ConversationalAComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.AServiceImpl"/>
+ <reference name="b" target="ConversationalBComponent" />
+ </component>
+
+ <component name="ConversationalBComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.conversational.impl.BServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java new file mode 100644 index 0000000000..3e750bdd1e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationIdTestCase.java @@ -0,0 +1,54 @@ +/* + * 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.itest.conversational; + + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class ConversationIdTestCase { + + private SCADomain domain; + + @Before + public void setUp() throws Exception { + domain = SCADomain.newInstance("conversationId.composite"); + + } + + @After + public void tearDown() throws Exception { + if (domain != null) { + domain.close(); + } + } + + @Test + public void testConversationId() { + ConversationIdService service = + domain.getService(ConversationIdService.class, "ConversationIdComponent"); + Assert.assertNotNull(service.getCIDField()); + Assert.assertNotNull(service.getCIDSetter()); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java new file mode 100644 index 0000000000..cc31c77873 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalAgeTestCase.java @@ -0,0 +1,103 @@ +/* + * 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.itest.conversational; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.osoa.sca.ConversationEndedException; + +public class ConversationalAgeTestCase { + + private SCADomain domain; + + @Before + public void setUp() throws Exception { + System.setProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval", "2"); + domain = SCADomain.newInstance("ConversationAge.composite"); + + } + + @After + public void tearDown() throws Exception { + System.clearProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.ReaperInterval"); + if (domain != null) { + domain.close(); + } + } + + @Test + public void testMaxAge() throws InterruptedException { + + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationAgeComponent"); + + Assert.assertEquals(0, conversationalService.retrieveCount()); + conversationalService.initializeCount(42); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Thread.sleep(500); + try { + Assert.assertEquals(42, conversationalService.retrieveCount()); + } catch (ConversationEndedException e) { + Assert.fail(); + } + } + + @Test + public void testAgeExpired() throws InterruptedException { + + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationAgeComponent"); + + Assert.assertEquals(0, conversationalService.retrieveCount()); + conversationalService.initializeCount(42); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Thread.sleep(1100); + try { + Assert.assertEquals(0, conversationalService.retrieveCount()); + Assert.fail(); + } catch (ConversationEndedException e) { + // expected + } + } + + @Test + public void testMaxIdle() throws InterruptedException { + + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationIdleComponent"); + + Assert.assertEquals(0, conversationalService.retrieveCount()); + conversationalService.initializeCount(42); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Assert.assertEquals(42, conversationalService.retrieveCount()); + Thread.sleep(1100); + try { + Assert.assertEquals(0, conversationalService.retrieveCount()); + } catch (ConversationEndedException e) { + // expected + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java new file mode 100644 index 0000000000..8480e04028 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalJ2SETestCase.java @@ -0,0 +1,84 @@ +/* + * 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.itest.conversational; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class ConversationalJ2SETestCase { + + private SCADomain domain; + + @Before + public void setUp() throws Exception { + domain = SCADomain.newInstance("conversational.composite"); + + } + + @After + public void tearDown() throws Exception { + if (domain != null) { + domain.close(); + } + } + + @Test + public void testStatefulConversation() { + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationalServiceStateful"); + + conversationalService.initializeCount(1); + Assert.assertEquals(1, conversationalService.retrieveCount()); + conversationalService.incrementCount(); + Assert.assertEquals(2, conversationalService.retrieveCount()); + conversationalService.endConversation(); + + Assert.assertEquals(0, conversationalService.retrieveCount()); + + conversationalService.initializeCount(4); + Assert.assertEquals(4, conversationalService.retrieveCount()); + conversationalService.incrementCount(); + Assert.assertEquals(5, conversationalService.retrieveCount()); + conversationalService.endConversation(); + + } + + @Test + public void testStatelessConversation() { + ConversationalService conversationalService = + domain.getService(ConversationalService.class, "ConversationalServiceStateless"); + + conversationalService.initializeCount(1); + Assert.assertEquals(1, conversationalService.retrieveCount()); + conversationalService.incrementCount(); + Assert.assertEquals(2, conversationalService.retrieveCount()); + conversationalService.endConversation(); + + conversationalService.initializeCount(4); + Assert.assertEquals(4, conversationalService.retrieveCount()); + conversationalService.incrementCount(); + Assert.assertEquals(5, conversationalService.retrieveCount()); + conversationalService.endConversation(); + + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java new file mode 100644 index 0000000000..cae09ce5a5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/conversations/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationalTestCase.java @@ -0,0 +1,651 @@ +/*
+ * 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.itest.conversational;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceRequestImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
+import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ConversationalTestCase {
+
+ private static SCADomain domain;
+ private static ConversationalClient conversationalStatelessClientStatelessService;
+ private static ConversationalClient conversationalStatelessClientStatefulService;
+ private static ConversationalClient conversationalStatefulClientStatelessService;
+ private static ConversationalClient conversationalStatefulClientStatefulService;
+ private static ConversationalClient conversationalStatelessClientRequestService;
+ private static ConversationalClient conversationalStatefulClientNonConversationalCallbackStatelessService;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ try {
+ domain = SCADomain.newInstance("conversational.composite");
+
+ conversationalStatelessClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatelessService");
+
+ conversationalStatelessClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientStatefulService");
+
+ conversationalStatefulClientStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatelessService");
+
+ conversationalStatefulClientStatefulService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientStatefulService");
+ conversationalStatelessClientRequestService = domain.getService(ConversationalClient.class,
+ "ConversationalStatelessClientRequestService");
+ conversationalStatefulClientNonConversationalCallbackStatelessService = domain.getService(ConversationalClient.class,
+ "ConversationalStatefulClientNonConversationalCallbackStatefulService");
+
+ } catch(Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ domain.close();
+ }
+
+ private void resetCallStack() {
+
+ // reset the place where we record the sequence of calls passing
+ // through each component instance
+ ConversationalServiceStatelessImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ ConversationalClientStatefulImpl.calls = new StringBuffer();
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls = new StringBuffer();
+
+ }
+
+ // stateless client stateful service tests
+ // =======================================
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessException() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientStatefulService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client stateless service tests
+ // ========================================
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationFromServiceReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+ @Test
+ public void testStatelessStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatelessClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatelessClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+ //@Test
+ public void testStatelessStatelessConversationHavingPassedReference() {
+ int count = conversationalStatelessClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateful service tests
+ // ======================================
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatefulService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatefulService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatefulService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatefulService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatefulService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatefulService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client stateless service tests
+ // =======================================
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationFromServiceReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalServiceStatelessImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulStatelessConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientStatelessService.runConversationWithCallback();
+ Assert.assertEquals(4, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalClientStatefulImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulStatelessConversationHavingPassedReference() {
+ int count = conversationalStatefulClientStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulStatelessConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateless client request scope service tests
+ // ============================================
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromInjectedReference2() {
+ int count = conversationalStatelessClientRequestService.runConversationFromInjectedReference2();
+ Assert.assertEquals(1, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationFromServiceReference() {
+ int count = conversationalStatelessClientRequestService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithUserDefinedConversationId() {
+ int count = conversationalStatelessClientRequestService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatelessClientRequestService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCheckingScope() {
+ resetCallStack();
+ ConversationalServiceRequestImpl.calls = new StringBuffer();
+ conversationalStatelessClientRequestService.runConversationCheckingScope();
+ Assert.assertEquals("initializeCount,incrementCount,retrieveCount,endConversation,",
+ ConversationalServiceRequestImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatelessRequestConversationWithCallback() {
+ resetCallStack();
+ ConversationalClientStatelessImpl.calls = new StringBuffer();
+ int count = conversationalStatelessClientRequestService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,destroy,",
+ ConversationalClientStatelessImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatelessRequestConversationHavingPassedReference() {
+ int count = conversationalStatelessClientRequestService.runConversationHavingPassedReference();
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationBusinessException() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessException();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationBusinessExceptionCallback() {
+ String message = conversationalStatelessClientRequestService.runConversationBusinessExceptionCallback();
+ Assert.assertEquals("Business Exception", message);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversation() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversation();
+ Assert.assertEquals(-999, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCallback() {
+ int count = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatelessRequestConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ //@Test
+ public void testStatelessRequestConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatelessClientRequestService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ // stateful client non conversational callback stateful service tests
+ // ==================================================================
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromInjectedReference2() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromInjectedReference2();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationFromServiceReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationFromServiceReference();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithUserDefinedConversationId() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithUserDefinedConversationId();
+ Assert.assertEquals(2, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckUserDefinedConversationId() {
+ String conversationId = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckUserDefinedConversationId();
+ Assert.assertEquals("MyConversation2", conversationId);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCheckingScope() {
+ resetCallStack();
+ conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCheckingScope();
+ Assert.assertEquals("init,initializeCount,incrementCount,retrieveCount,endConversation,destroy,",
+ ConversationalServiceStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationWithCallback() {
+ resetCallStack();
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationWithCallback();
+ Assert.assertEquals(0, count);
+
+ Assert.assertEquals("init,runConversationWithCallback,init,initializeCount,destroy,init,incrementCount,destroy,init,retrieveCount,destroy,init,endConversation,destroy,",
+ ConversationalClientStatefulNonConversationalCallbackImpl.calls.toString());
+ }
+
+ //@Test
+ public void testStatefulNonConversationalCallbackStatefulConversationHavingPassedReference() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationHavingPassedReference();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversation() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversation();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallback() {
+ int count = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallback();
+ Assert.assertEquals(0, count);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCheckConversationId();
+ Assert.assertEquals(null, id);
+ }
+
+ @Test
+ public void testStatefulNonConversationalCallbackStatefulConversationCallingEndedConversationCallbackCheckConversationId() {
+ String id = conversationalStatefulClientNonConversationalCallbackStatelessService.runConversationCallingEndedConversationCallbackCheckConversationId();
+ Assert.assertEquals("MyConversation3", id);
+ }
+
+ private static final String NEW_A_VALUE = "First Instance - TestCode Set state on A";
+ private static final String NEW_B_VALUE = "First Instance - TestCode Set state on B";
+ private static final String SECOND_NEW_A_VALUE = "Second Instance - TestCode Set state on A";
+ private static final String SECOND_NEW_B_VALUE = "Second Instance - TestCode Set state on B";
+
+ @Test
+ public void testMultipleConversations() {
+ //////////
+ // Tests on first instance
+ //////////
+ System.out.println("========= First instance tests =========");
+ AService aService = domain.getService(AService.class, "ConversationalAComponent");
+
+ // Make sure initial values are correct
+ Assert.assertEquals(Constants.A_INITIAL_VALUE, aService.getState());
+ Assert.assertEquals(Constants.B_INITIAL_VALUE, aService.getStateOnB());
+
+ // Set some new values
+ aService.setState(NEW_A_VALUE);
+ aService.setStateOnB(NEW_B_VALUE);
+
+ // Verify the set worked
+ Assert.assertEquals(NEW_A_VALUE, aService.getState());
+ Assert.assertEquals(NEW_B_VALUE, aService.getStateOnB());
+
+
+ //////////
+ // Tests on second instance
+ //////////
+ System.out.println("========= Second instance tests =========");
+
+ // Do another look up
+ AService aService2 = domain.getService(AService.class, "ConversationalAComponent");
+
+ // Make sure initial values are correct on the second instance
+ Assert.assertEquals(Constants.A_INITIAL_VALUE, aService2.getState());
+ Assert.assertEquals(Constants.B_INITIAL_VALUE, aService2.getStateOnB());
+
+ // Set some new values on the second instance
+ aService2.setState(SECOND_NEW_A_VALUE);
+ aService2.setStateOnB(SECOND_NEW_B_VALUE);
+
+ // Verify the set worked on the second instance
+ Assert.assertEquals(SECOND_NEW_A_VALUE, aService2.getState());
+ Assert.assertEquals(SECOND_NEW_B_VALUE, aService2.getStateOnB());
+
+ // Verify the values have not been changed on the first instance
+ Assert.assertEquals(NEW_A_VALUE, aService.getState());
+ Assert.assertEquals(NEW_B_VALUE, aService.getStateOnB());
+
+ System.out.println("========= Done instance tests =========");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/pom.xml new file mode 100644 index 0000000000..43d5d07ff4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/pom.xml @@ -0,0 +1,126 @@ +<?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. +--> +<project> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + + <artifactId>itest-databindings-common</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Apache Tuscany SCA Databinding Common Integration Tests</name> + + <repositories> + <repository> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>http://download.java.net/maven/1</url> + <layout>legacy</layout> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>http://download.java.net/maven/1</url> + <layout>legacy</layout> + </pluginRepository> + </pluginRepositories> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-tools</artifactId> + <version>1.0-incubating</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.4</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-test-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.0-incubating</version> + <executions> + <execution> + <id>generate-sdo</id> + <phase>generate-sources</phase> + <configuration> + <schemaFiles> + <configuration> + <fileName>${basedir}/src/main/resources/generate/generate.xsd</fileName> + </configuration> + </schemaFiles> + <noNotification>true</noNotification> + <noContainment>true</noContainment> + <noUnsettable>true</noUnsettable> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java new file mode 100644 index 0000000000..c1deba5cc2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java @@ -0,0 +1,177 @@ +/* + * 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.itest.generate; + +import java.io.FileInputStream; +import java.io.FileWriter; +import java.util.List; +import java.util.Properties; + +import org.apache.tuscany.generate.GenerateFactory; +import org.apache.tuscany.generate.GenerateType; +import org.apache.tuscany.generate.InputFileType; +import org.apache.tuscany.generate.TemplateType; +import org.apache.tuscany.sdo.generate.XSD2JavaGenerator; +import org.apache.tuscany.sdo.util.SDOUtil; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; + +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.XMLDocument; + +/** + * Generates test files based on the information in a configuration files (generate.xml) + * and a set of velocity templates. The process is + * + * for each template + * for each xsd file + * generate SDOs + * include the factory into the composite + * for each type + * add client iface method + * add client impl method + * add service iface method + * add service impl method + * add test method + * add wsdl type and method + * + * @version $Rev$ $Date$ + */ +public class Generate { + + /** + * Does all the hard work of running the velocity templates against the + * the list of types to test. Both the list of templates and the list of + * XSD files is held in the configuration file (generate.xsd) which lives in the + * resources/generate directory of the project being generated. + * + * @param projectBuildDir the path to the target dir of the project being generated. + */ + public static void generate(String projectBuildDir) { + System.out.println(">> Building project from dir: " + projectBuildDir); + FileInputStream fis = null; + + try { + // Load the config file into a stream + fis = new FileInputStream(projectBuildDir + "/classes/generate/generate.xml"); + + // Load the stream into SDO + // We are just using SDO as a convenient way to parse the XML config file + HelperContext scope = SDOUtil.createHelperContext(); + GenerateFactory.INSTANCE.register(scope); + XMLDocument xmlDoc = scope.getXMLHelper().load(fis); + GenerateType generateType = (GenerateType)xmlDoc.getRootObject(); + + // Get the file list. This is the list of XSD that is passed into the + // the velocity templates. Each configured file holds a list of types + // that the velocity templates expand into appropriate methods and method calls + List fileList = generateType.getInputFile(); + + //Intialise velocity ready to generate the various files + Properties p = new Properties(); + p.setProperty("file.resource.loader.path", projectBuildDir + "/classes/generate"); + Velocity.init(p); + VelocityContext context = new VelocityContext(); + context.put("fileList", fileList); + + List templateList = generateType.getTemplate(); + + // For each velocity template in the template list pass in the XSD file list + for ( Object item: templateList){ + TemplateType template = (TemplateType)item; + context.put("template", template); + String tmp = template.getTemplateName(); + String filename = projectBuildDir + "/" + template.getTemplateTargetDir() + "/" + tmp.substring(0,tmp.length() - 3); + FileWriter fw = new FileWriter(filename); + System.out.println(">> Processing " + template.getTemplateName() + " to " + filename); + Velocity.mergeTemplate(template.getTemplateName(), context, fw ); + fw.flush(); + fw.close(); + } + + + } catch (Exception e) { + System.out.println("Exception : " + e.toString()); + e.printStackTrace(); + return; + } + } + + /** + * The SDO generator tool does all of the hard work + * + * @param projectBuildDir the path to the target dir of the project being generated. + */ + public static void generateSDO(String projectBuildDir) { + System.out.println(">> Building SDOs from dir: " + projectBuildDir); + FileInputStream fis = null; + + try { + // Load the config file into a stream + fis = new FileInputStream(projectBuildDir + "/classes/generate/generate.xml"); + + // Load the stream into SDO + // We are just using SDO as a convenient way to parse the XML config file + HelperContext scope = SDOUtil.createHelperContext(); + GenerateFactory.INSTANCE.register(scope); + XMLDocument xmlDoc = scope.getXMLHelper().load(fis); + GenerateType generateType = (GenerateType)xmlDoc.getRootObject(); + + // Get the file list. This is the list of XSD that is passed into the + // the velocity templates. Each configured file holds a list of types + // that the velocity templates expand into appropriate methods and method calls + List fileList = generateType.getInputFile(); + + // for each XSD in the XSD file list generate an SDO. + XSD2JavaGenerator generator = new XSD2JavaGenerator(); + + for ( Object item : fileList){ + InputFileType file = (InputFileType)item; + + XSD2JavaGenerator.generateFromXMLSchema(projectBuildDir + "/classes/xsd/" + file.getFileName(), + file.getNamespace(), + projectBuildDir + "/sdo-source", + file.getJavaPackage(), + null, //file.getPrefix(), + XSD2JavaGenerator.OPTION_NO_CONTAINMENT | XSD2JavaGenerator.OPTION_NO_NOTIFICATION | XSD2JavaGenerator.OPTION_NO_UNSETTABLE); + + } + + } catch (Exception e) { + System.out.println("Exception : " + e.toString()); + e.printStackTrace(); + return; + } + } + + /** + * The mainline + * + * @param args the target directory where project in which files are being generated + */ + public static void main(String[] args) { + + Generate.generate(args[0]); + + if (args.length > 1){ + Generate.generateSDO(args[0]); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm new file mode 100644 index 0000000000..b2346aa973 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm @@ -0,0 +1,112 @@ +/* + * 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 $template.getJavaPackage(); + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ServiceReference; + +import ${template.getJavaPackage()}.GreeterService; + +// Data types +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) +import $file.getJavaPackage().$typeInstance.getTypeName(); +import $file.getJavaPackage().$file.getFactory(); +#end +#end + +/** + * Automatically generated test case. Calls the greeter client for a number of + * bindings and a number of data types. + * + * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $ + */ +public class DatabindingTestCase extends TestCase { + + private SCADomain domain; + private GreeterService greeterClient; + + /** + * Runs before each test method + */ + protected void setUp() throws Exception { + domain = SCADomain.newInstance("greeter.composite"); + super.setUp(); + } + + /** + * Runs after each test method + */ + protected void tearDown() { + domain.close(); + } + + /** + * Finds the SCA component that relates to the protocol being tested. This test + * always connects locally to the client component but the client component will + * connect to the back end component using the appropriate protocol + * + * @param ext the protcol required + */ + private void setUpClient(String ext) throws Exception { + greeterClient = domain.getService(GreeterService.class, ext + "GreeterServiceClient"); + } + + /** + * Invokes the SDO Greet service using web service bindings with SDO payload + */ + public void testWSGreet() throws Exception { + setUpClient("WS"); + greet(); + } + + /** + * Invokes the SDO Greet service using default bindings with SDO payload + */ + public void testDefaultGreet() throws Exception { + setUpClient("Default"); + greet(); + } + + /** + * A generic method which, regarless of which client is connected, sends out a + * series of requrests passing different data types. + */ + public void greet() { +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + + // test $typeInstance.getTypeName() + { + $typeInstance.getTypeName() param = null; + $typeInstance.getCreateTypeCode() + $typeInstance.getTypeName() result = greeterClient.greet$typeInstance.getTypeName()(param); + $typeInstance.getResultComparison() + } +#end +#end + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm new file mode 100644 index 0000000000..88616cc997 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm @@ -0,0 +1,103 @@ +<?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. +--> +<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services" + xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="Greeter"> + + <wsdl:types> + <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" +#foreach($file in $fileList) + xmlns:$file.getPrefix()="$file.getNamespace()" +#end + targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services" + elementFormDefault="qualified"> + +#foreach($file in $fileList) + <xsd:import namespace="$file.getNamespace()" + schemaLocation="../xsd/$file.getFileName()" /> +#end + +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <element name="greet$typeInstance.getTypeName()"> + <complexType> + <sequence> + <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" /> + </sequence> + </complexType> + </element> +#end +#end + </xsd:schema> + </wsdl:types> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + + <wsdl:message name="$typeInstance.getTypeName()Request"> + <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" /> + </wsdl:message> + <wsdl:message name="$typeInstance.getTypeName()Response"> + <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" /> + </wsdl:message> +#end +#end + + <wsdl:portType name="GreeterPortType"> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <wsdl:operation name="greet$typeInstance.getTypeName()"> + <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" /> + <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" /> + </wsdl:operation> +#end +#end + </wsdl:portType> + + <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <wsdl:operation name="greet$typeInstance.getTypeName()"> + <wsdlsoap:operation soapAction="" /> + <wsdl:input name="$typeInstance.getTypeName()RequestMsg"> + <wsdlsoap:body use="literal" /> + </wsdl:input> + <wsdl:output name="$typeInstance.getTypeName()ResponseMsg"> + <wsdlsoap:body use="literal" /> + </wsdl:output> + </wsdl:operation> +#end +#end + </wsdl:binding> + + <wsdl:service name="GreeterService"> + <wsdl:port name="GreeterPort" binding="tns:GreeterBinding"> + <wsdlsoap:address location="http://localhost:8085/services/GreeterServiceWebServiceBinding" /> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm new file mode 100644 index 0000000000..b0e298b823 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm @@ -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 $template.getJavaPackage(); + +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) +import $file.getJavaPackage().$typeInstance.getTypeName(); +#end +#end + +import org.osoa.sca.annotations.Remotable; + +/** + * The automcatically generated interface to the service that reflects data objects + * that are sent to it + * + * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $ + */ +@Remotable +public interface GreeterService { + +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + /** + * Take the provided data object, change it slightly and return it + * + * @param param the data object to be changed and returned + * @return the change data object + */ + $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param); +#end +#end + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm new file mode 100644 index 0000000000..ee73db6152 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm @@ -0,0 +1,42 @@ +/* + * 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 $template.getJavaPackage(); + +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) +import $file.getJavaPackage().$typeInstance.getTypeName(); +#end +#end + +import org.osoa.sca.annotations.AllowsPassByReference; + +/** + * GreeterServiceClient + */ +@AllowsPassByReference +public interface GreeterServiceClient { +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param); +#end +#end +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm new file mode 100644 index 0000000000..57827d27b9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm @@ -0,0 +1,65 @@ +/* + * 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 $template.getJavaPackage(); + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) +import $file.getJavaPackage().$typeInstance.getTypeName(); +#end +#end + +/** + * The automcatically generated service that simply forwards data objects on to + * the GreeterService and passes back the responses + * + * @version $Rev: 508831 $ $Date: 2007-02-18 00:12:31 +0000 (Sun, 18 Feb 2007) $ + */ +@Service(GreeterService.class) +public class GreeterServiceClientImpl implements GreeterService { + + /** + * the reference the the GreeterService that will + * change each data object slightly and return it + */ + private GreeterService service; + + @Reference + public void setGreeterService(GreeterService service) { + this.service = service; + } +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.itest.sdodatabinding.GreeterService#greet$typeInstance.getTypeName()($typeInstance.getTypeName() param) + */ + public $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param) { + return service.greet$typeInstance.getTypeName()(param); + } +#end +#end +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm new file mode 100644 index 0000000000..1fd7509667 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm @@ -0,0 +1,55 @@ +/* + * 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 $template.getJavaPackage(); + +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) +import $file.getJavaPackage().$typeInstance.getTypeName(); +#end +#end + +import org.osoa.sca.annotations.Service; + +/** + * The automcatically generated service implementation that reflects data objects + * that are sent to it + * + * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $ + */ +@Service(GreeterService.class) +public class GreeterServiceImpl implements GreeterService { +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + + /** + * Take the provided data object, change it slightly and return it + * + * @param param the data object to be changed and returned + * @return the change data object + */ + public $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param) { + $typeInstance.getModifyTypeCode() + return param; + } +#end +#end +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/generate.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/generate.xsd new file mode 100644 index 0000000000..1fabedf55f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/generate/generate.xsd @@ -0,0 +1,61 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/generate" + xmlns:tns="http://www.apache.org/tuscany/generate"> + + <complexType name="TypeType"> + <sequence> + <element name="TypeName" type="string"/> + <element name="CreateTypeCode" type="string"/> + <element name="ModifyTypeCode" type="string"/> + <element name="ResultComparison" type="string"/> + </sequence> + </complexType> + + <complexType name="InputFileType"> + <sequence> + <element name="FileName" type="string"/> + <element name="FilePath" type="string"/> + <element name="JavaPackage" type="string"/> + <element name="Factory" type="string"/> + <element name="Namespace" type="string"/> + <element name="Prefix" type="string"/> + <element name="Type" type="tns:TypeType" maxOccurs="unbounded"/> + </sequence> + </complexType> + + <complexType name="TemplateType"> + <sequence> + <element name="TemplateName" type="string"/> + <element name="TemplateTargetDir" type="string"/> + <element name="JavaPackage" type="string"/> + </sequence> + </complexType> + + <complexType name="GenerateType"> + <sequence> + <element name="Template" type="tns:TemplateType" maxOccurs="unbounded"/> + <element name="InputFile" type="tns:InputFileType" maxOccurs="unbounded"/> + </sequence> + </complexType> + + <element name="Generate" type="tns:GenerateType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/wsdl/Dummy.txt b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/wsdl/Dummy.txt new file mode 100644 index 0000000000..8927d725b6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/wsdl/Dummy.txt @@ -0,0 +1,4 @@ +A dummy file that causes the target/classes/wsdl dir to be created in the generated test project. This is +required because the test generator must run in the process-resource phase, after generate.xml has been copied +into target. The generator needs to write out target/classes/wsdl and will fail the directory isn't there. So +this file just gets unpacked and forces the directory to be created. diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Annotation.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Annotation.xml new file mode 100644 index 0000000000..f1f4346e58 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Annotation.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:Annotation xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop Annotation.xsd"> + <SimpleTypeWithNameElement>SimpleTypeWithName</SimpleTypeWithNameElement> +</tns:Annotation> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Annotation.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Annotation.xsd new file mode 100644 index 0000000000..1fae43eb09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Annotation.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <annotation> + <appinfo>SDO 2.0.1</appinfo> + <documentation> + A schema that tests the presence of annotations in schema read by SDO + </documentation> + </annotation> + + <complexType name="AnnotationComplexType"> + <sequence> + <element name="SimpleTypeWithNameElement" type="string"/> + </sequence> + </complexType> + + <element name="Annotation" type="tns:AnnotationComplexType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Attribute.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Attribute.xml new file mode 100644 index 0000000000..c20c80b658 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Attribute.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:Attribute xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop Attribute.xsd "> + <AttributeElement Attribute="Attribute"/> +</tns:Attribute> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Attribute.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Attribute.xsd new file mode 100644 index 0000000000..bd3db2e030 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Attribute.xsd @@ -0,0 +1,39 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeType"> + <sequence> + </sequence> + <attribute name="Attribute" type="string"/> + </complexType> + + <complexType name="AttributeComplexType"> + <sequence> + <element name="AttributeElement" type="tns:AttributeType"/> + </sequence> + </complexType> + + <element name="Attribute" type="tns:AttributeComplexType"/> + +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml new file mode 100644 index 0000000000..30e4979dca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeReference xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeReference.xsd "> + <AttributeReferenceElement tns:ReferencedAttribute="AttributeReference"/> +</tns:AttributeReference> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd new file mode 100644 index 0000000000..e7738dcff7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd @@ -0,0 +1,40 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <attribute name="ReferencedAttribute" type="string"/> + + <complexType name="AttributeReferenceComplexType"> + <sequence> + </sequence> + <attribute ref="tns:ReferencedAttribute"/> + </complexType> + + <element name="AttributeReference"> + <complexType> + <sequence> + <element name="AttributeReferenceElement" type="tns:AttributeReferenceComplexType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml new file mode 100644 index 0000000000..9552421e2d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeWithDefaultValueElement xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithDefaultValue.xsd "> + <AttributeWithDefaultValueElement AttributeWithDefaultValue="AttributeWithDefaultValueDefaultValue"/> +</tns:AttributeWithDefaultValueElement> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd new file mode 100644 index 0000000000..c7b9655749 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeWithDefaultValueType"> + <sequence> + </sequence> + <attribute name="AttributeWithDefaultValue" type="string" default="AttributeWithDefaultValueDefaultValue"/> + </complexType> + + <element name="AttributeWithDefaultValueElement"> + <complexType> + <sequence> + <element name="AttributeWithDefaultValueElement" type="tns:AttributeWithDefaultValueType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml new file mode 100644 index 0000000000..5e5e7fbd55 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeWithFixedValueType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithFixedValue.xsd "> + <AttributeWithFixedValueElement AttributeWithFixedValue="AttributeWithFixedValueFixedValue"/> +</tns:AttributeWithFixedValueType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd new file mode 100644 index 0000000000..5c455c2ab5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeWithFixedValueType"> + <sequence> + </sequence> + <attribute name="AttributeWithFixedValue" type="string" fixed="AttributeWithFixedValueFixedValue"/> + </complexType> + + <element name="AttributeWithFixedValueType"> + <complexType> + <sequence> + <element name="AttributeWithFixedValueElement" type="tns:AttributeWithFixedValueType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml new file mode 100644 index 0000000000..635e851632 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOAliasName.xsd "> + <AttributeWithSDOAliasNameElement AttributeWithSDOAliasName="AttributeWithSDOAliasName"/> +</tns:AttributeWithSDOAliasName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd new file mode 100644 index 0000000000..004dab4fbb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeWithSDOAliasNameType"> + <sequence> + </sequence> + <attribute name="AttributeWithSDOAliasName" sdo:aliasName="AttributeWithSDOAliasNameSDOAliasName" type="string"/> + </complexType> + + <element name="AttributeWithSDOAliasName"> + <complexType> + <sequence> + <element name="AttributeWithSDOAliasNameElement" type="tns:AttributeWithSDOAliasNameType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml new file mode 100644 index 0000000000..136092951b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeWithSDODataType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDODataType.xsd "> + <AttributeWithSDODataTypeTypeElement AttributeWithSDODataType="AttributeWithSDODataType"/> +</tns:AttributeWithSDODataType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd new file mode 100644 index 0000000000..796f08e1cf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeWithSDODataTypeType"> + <sequence> + </sequence> + <attribute name="AttributeWithSDODataType" sdo:dataType="string" type="string"/> + </complexType> + + <element name="AttributeWithSDODataType"> + <complexType> + <sequence> + <element name="AttributeWithSDODataTypeTypeElement" type="tns:AttributeWithSDODataTypeType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml new file mode 100644 index 0000000000..927b94885c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOName.xsd "> + <AttributeWithSDONameElement AttributeWithSDOName="AttributeWithSDOName"/> +</tns:AttributeWithSDOName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd new file mode 100644 index 0000000000..93f83cd0a1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeWithSDONameType"> + <sequence> + </sequence> + <attribute name="AttributeWithSDOName" sdo:name="AttributeWithSDONameSDOName" type="string"/> + </complexType> + + <element name="AttributeWithSDOName"> + <complexType> + <sequence> + <element name="AttributeWithSDONameElement" type="tns:AttributeWithSDONameType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml new file mode 100644 index 0000000000..ea7db70595 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeWithSDOPropertySDOOppositePropertyType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOPropertySDOOppositePropertyType.xsd "> + <AttributeWithSDOPropertySDOOppositePropertyTypeElement AttributeWithSDOPropertySDOOppositePropertyType="idvalue0"/> +</tns:AttributeWithSDOPropertySDOOppositePropertyType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd new file mode 100644 index 0000000000..c64323e7e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeWithSDOPropertySDOOppositePropertyTypeType"> + <sequence> + </sequence> + <attribute name="AttributeWithSDOPropertySDOOppositePropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType" sdo:oppositeProperty="tns:AttributeWithSDOPropertyType"/> + </complexType> + + <element name="AttributeWithSDOPropertySDOOppositePropertyType"> + <complexType> + <sequence> + <element name="AttributeWithSDOPropertySDOOppositePropertyTypeElement" type="tns:AttributeWithSDOPropertySDOOppositePropertyTypeType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml new file mode 100644 index 0000000000..85c7d85fd4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeWithSDOPropertyType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOPropertyType.xsd "> + <AttributeWithSDOPropertyTypeElement AttributeWithSDOPropertyType="idvalue0"/> +</tns:AttributeWithSDOPropertyType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd new file mode 100644 index 0000000000..543f276c50 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeWithSDOPropertyTypeType"> + <sequence> + </sequence> + <attribute name="AttributeWithSDOPropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType"/> + </complexType> + + <element name="AttributeWithSDOPropertyType"> + <complexType> + <sequence> + <element name="AttributeWithSDOPropertyTypeElement" type="tns:AttributeWithSDOPropertyTypeType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml new file mode 100644 index 0000000000..fcd281539b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:AttributeWithSDOString xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOString.xsd "> + <AttributeWithSDOStringElement AttributeWithSDOString="AttributeWithSDOString"/> +</tns:AttributeWithSDOString> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd new file mode 100644 index 0000000000..1610c2b861 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="AttributeWithSDOStringType"> + <sequence> + </sequence> + <attribute name="AttributeWithSDOString" type="string" sdo:string="true"/> + </complexType> + + <element name="AttributeWithSDOString"> + <complexType> + <sequence> + <element name="AttributeWithSDOStringElement" type="tns:AttributeWithSDOStringType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml new file mode 100644 index 0000000000..36a0760a61 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInAnySimpleType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnySimpleType.xsd "> + <anySimpleType>anySimpleType</anySimpleType> +</tns:BuiltInAnySimpleType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd new file mode 100644 index 0000000000..999b72bb35 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInAnySimpleType"> + <complexType> + <sequence> + <element name="anySimpleType" type="anySimpleType" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml new file mode 100644 index 0000000000..5849165fe0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInAnyType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnyType.xsd "> + <anyType xsi:type="anyType"/> +</tns:BuiltInAnyType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd new file mode 100644 index 0000000000..71dad561ca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInAnyType"> + <complexType> + <sequence> + <element name="anyType" type="anyType" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml new file mode 100644 index 0000000000..8acf9376d7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInAnyURI xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnyURI.xsd "> + <anyURI>http://tempuri.org</anyURI> +</tns:BuiltInAnyURI> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd new file mode 100644 index 0000000000..a49987c352 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInAnyURI"> + <complexType> + <sequence> + <element name="anyURI" type="anyURI" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml new file mode 100644 index 0000000000..a35b6e174a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuildInBase64Binary xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInBase64Binary.xsd "> + <base64Binary>ABCDEF</base64Binary> +</tns:BuildInBase64Binary> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd new file mode 100644 index 0000000000..e1995890f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuildInBase64Binary"> + <complexType> + <sequence> + <element name="base64Binary" type="base64Binary" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml new file mode 100644 index 0000000000..91cfce51b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml @@ -0,0 +1,27 @@ +<?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. +--> +<tns:BuiltInBoolean xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInBoolean.xsd "> + <boolean>true</boolean> + <boolean>false</boolean> + <boolean>1</boolean> + <boolean>0</boolean> +</tns:BuiltInBoolean> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd new file mode 100644 index 0000000000..a2f86ba8c5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInBoolean"> + <complexType> + <sequence> + <element name="boolean" type="boolean" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml new file mode 100644 index 0000000000..907474cd1b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInByte xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInByte.xsd "> + <byte>127</byte> + <byte>-127</byte> +</tns:BuiltInByte> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd new file mode 100644 index 0000000000..a2f6bcfa77 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInByte.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInByte"> + <complexType> + <sequence> + <element name="byte" type="byte" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml new file mode 100644 index 0000000000..c5820e1a2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInDate xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDate.xsd "> + <date>2001-01-01</date> +</tns:BuiltInDate> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd new file mode 100644 index 0000000000..f4d596bfe3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDate.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInDate"> + <complexType> + <sequence> + <element name="date" type="date" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml new file mode 100644 index 0000000000..0debe2fec5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInDateTime xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDateTime.xsd "> + <dateTime>2001-12-31T12:00:00</dateTime> +</tns:BuiltInDateTime> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd new file mode 100644 index 0000000000..b5bcfdcfd4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInDateTime"> + <complexType> + <sequence> + <element name="dateTime" type="dateTime" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml new file mode 100644 index 0000000000..7f001254cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml @@ -0,0 +1,23 @@ +<?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. +--> +<tns:BuiltInDecimal xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDecimal.xsd "> + <decimal>-1.23456789</decimal> + <decimal>1.23456789</decimal> +</tns:BuiltInDecimal> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd new file mode 100644 index 0000000000..8d4d106f59 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInDecimal"> + <complexType> + <sequence> + <element name="decimal" type="decimal" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml new file mode 100644 index 0000000000..f875b9f94d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInDouble xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDouble.xsd "> + <double>0.0</double> + <double>12.3E-4</double> +</tns:BuiltInDouble> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd new file mode 100644 index 0000000000..4c8a39b06c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInDouble"> + <complexType> + <sequence> + <element name="double" type="double" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml new file mode 100644 index 0000000000..7d343d6dda --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInDuration xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDuration.xsd "> + <duration>P1D</duration> +</tns:BuiltInDuration> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd new file mode 100644 index 0000000000..bb12bc04a9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInDuration"> + <complexType> + <sequence> + <element name="duration" type="duration" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml new file mode 100644 index 0000000000..7a81f3b0dd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInFloat xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInFloat.xsd "> + <float>0.0</float> +</tns:BuiltInFloat> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd new file mode 100644 index 0000000000..f0e1c21233 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInFloat"> + <complexType> + <sequence> + <element name="float" type="float" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml new file mode 100644 index 0000000000..d35568b3c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInGDay xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGDay.xsd "> + <gDay>---01</gDay> +</tns:BuiltInGDay> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd new file mode 100644 index 0000000000..92bd9a4b66 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInGDay"> + <complexType> + <sequence> + <element name="gDay" type="gDay" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml new file mode 100644 index 0000000000..52cdfa8c4e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInGMonth xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGMonth.xsd "> + <gMonth>--01--</gMonth> +</tns:BuiltInGMonth> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd new file mode 100644 index 0000000000..78d001a585 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInGMonth"> + <complexType> + <sequence> + <element name="gMonth" type="gMonth" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml new file mode 100644 index 0000000000..2609a858f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInGMonthDay xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGMonthDay.xsd "> + <gMonthDay>--01-01</gMonthDay> +</tns:BuiltInGMonthDay> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd new file mode 100644 index 0000000000..38f6c55059 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInGMonthDay"> + <complexType> + <sequence> + <element name="gMonthDay" type="gMonthDay" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml new file mode 100644 index 0000000000..7868a47ca3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInGYear xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGYear.xsd "> + <gYear>2001</gYear> +</tns:BuiltInGYear> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd new file mode 100644 index 0000000000..0d65b124ff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInGYear"> + <complexType> + <sequence> + <element name="gYear" type="gYear" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml new file mode 100644 index 0000000000..3f5080d49f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInGYearMonth xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGYearMonth.xsd "> + <gYearMonth>2001-01</gYearMonth> +</tns:BuiltInGYearMonth> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd new file mode 100644 index 0000000000..340555dc5f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInGYearMonth"> + <complexType> + <sequence> + <element name="gYearMonth" type="gYearMonth" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml new file mode 100644 index 0000000000..0deb7af980 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInHexBinary xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInHexBinary.xsd "> + <hexBinary>0F00</hexBinary> +</tns:BuiltInHexBinary> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd new file mode 100644 index 0000000000..8059fe6da0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInHexBinary"> + <complexType> + <sequence> + <element name="hexBinary" type="hexBinary" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml new file mode 100644 index 0000000000..06c92ce19b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInID xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInID.xsd "> + <ID>idvalue0</ID> +</tns:BuiltInID> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd new file mode 100644 index 0000000000..7b1f02d1d4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInID.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInID"> + <complexType> + <sequence> + <element name="ID" type="ID" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml new file mode 100644 index 0000000000..9bc0cefd0f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInIDREF xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInIDREF.xsd "> + <IDREF>idvalue0</IDREF> +</tns:BuiltInIDREF> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd new file mode 100644 index 0000000000..0c207983bc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInIDREF"> + <complexType> + <sequence> + <element name="IDREF" type="IDREF" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml new file mode 100644 index 0000000000..f91b602f99 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInIDREFS xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInIDREFS.xsd "> + <IDREFS>idvalue0</IDREFS> +</tns:BuiltInIDREFS> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd new file mode 100644 index 0000000000..b99bf01b73 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInIDREFS"> + <complexType> + <sequence> + <element name="IDREFS" type="IDREFS" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml new file mode 100644 index 0000000000..c99698e175 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInInt xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInInt.xsd "> + <int>-2147483648</int> + <int>2147483647</int> +</tns:BuiltInInt> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd new file mode 100644 index 0000000000..b5b9b0d1eb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInt.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInInt"> + <complexType> + <sequence> + <element name="int" type="int" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml new file mode 100644 index 0000000000..80d22ce057 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInInteger xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInInteger.xsd "> + <integer>-2147483648</integer> + <integer>2147483647</integer> +</tns:BuiltInInteger> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd new file mode 100644 index 0000000000..4902935db5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInInteger"> + <complexType> + <sequence> + <element name="integer" type="integer" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml new file mode 100644 index 0000000000..664bf824b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInLanguage xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInLanguage.xsd "> + <language>EN</language> +</tns:BuiltInLanguage> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd new file mode 100644 index 0000000000..5d3658d224 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInLanguage"> + <complexType> + <sequence> + <element name="language" type="language" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml new file mode 100644 index 0000000000..c5861fa92a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInLong xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInLong.xsd "> + <long>-9223372036854775808</long> + <long>9223372036854775807</long> +</tns:BuiltInLong> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd new file mode 100644 index 0000000000..0aa4710057 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd @@ -0,0 +1,33 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + +<notation name="interop50" public="commonj.sdo"/> + + <element name="BuiltInLong"> + <complexType> + <sequence> + <element name="long" type="long" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml new file mode 100644 index 0000000000..1f95950394 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInNCName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNCName.xsd "> + <NCName>NCName</NCName> +</tns:BuiltInNCName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd new file mode 100644 index 0000000000..6ee9c435db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInNCName"> + <complexType> + <sequence> + <element name="NCName" type="NCName" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml new file mode 100644 index 0000000000..0297f1aeb4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuildInNMTOKEN xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNMTOKEN.xsd "> + <NMTOKEN>NMTOKEN</NMTOKEN> +</tns:BuildInNMTOKEN> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd new file mode 100644 index 0000000000..56d027bdbb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuildInNMTOKEN"> + <complexType> + <sequence> + <element name="NMTOKEN" type="NMTOKEN" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml new file mode 100644 index 0000000000..81ba1069bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInNMTOKENS xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNMTOKENS.xsd "> + <NMTOKENS>NMTOKENS</NMTOKENS> +</tns:BuiltInNMTOKENS> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd new file mode 100644 index 0000000000..866ab73024 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInNMTOKENS"> + <complexType> + <sequence> + <element name="NMTOKENS" type="NMTOKENS" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml new file mode 100644 index 0000000000..8bb3a08b94 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInNOTATION xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNOTATION.xsd "> + <NOTATION>tns:BuiltInNotationNotation</NOTATION> +</tns:BuiltInNOTATION> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd new file mode 100644 index 0000000000..c7c62f812b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd @@ -0,0 +1,39 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <notation name="BuiltInNotationNotation" public="http://cwiki.apache.org/confluence/display/TUSCANY/Home"/> + + <element name="BuiltInNOTATION"> + <complexType> + <sequence> + <element name="NOTATION" maxOccurs="unbounded"> + <simpleType > + <restriction base="NOTATION"> + <enumeration value="tns:BuiltInNotationNotation"/> + </restriction> + </simpleType> + </element> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml new file mode 100644 index 0000000000..8235718c5e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInName.xsd "> + <Name>Name</Name> +</tns:BuiltInName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd new file mode 100644 index 0000000000..36caba2f16 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInName.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInName"> + <complexType> + <sequence> + <element name="Name" type="Name" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml new file mode 100644 index 0000000000..599c428a44 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInNegativeInteger xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNegativeInteger.xsd "> + <negativeInteger>-1</negativeInteger> +</tns:BuiltInNegativeInteger> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd new file mode 100644 index 0000000000..389d5a99f0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInNegativeInteger"> + <complexType> + <sequence> + <element name="negativeInteger" type="negativeInteger" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml new file mode 100644 index 0000000000..919c4a20ee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInNonNegativeInteger xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNonNegativeInteger.xsd "> + <nonNegativeInteger>0</nonNegativeInteger> +</tns:BuiltInNonNegativeInteger> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd new file mode 100644 index 0000000000..59887078b5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInNonNegativeInteger"> + <complexType> + <sequence> + <element name="nonNegativeInteger" type="nonNegativeInteger" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml new file mode 100644 index 0000000000..79011f26ab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInNonPositiveInteger xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNonPositiveInteger.xsd "> + <nonPositiveInteger>-1</nonPositiveInteger> +</tns:BuiltInNonPositiveInteger> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd new file mode 100644 index 0000000000..5de7d64d7b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInNonPositiveInteger"> + <complexType> + <sequence> + <element name="nonPositiveInteger" type="nonPositiveInteger" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml new file mode 100644 index 0000000000..c40be9e18b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInNormalizedString xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNormalizedString.xsd "> + <normalizedString>normalizedString</normalizedString> +</tns:BuiltInNormalizedString> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd new file mode 100644 index 0000000000..d4a78787b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInNormalizedString"> + <complexType> + <sequence> + <element name="normalizedString" type="normalizedString" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml new file mode 100644 index 0000000000..c30434de66 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInPositiveInteger xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInPositiveInteger.xsd "> + <positiveInteger>1</positiveInteger> +</tns:BuiltInPositiveInteger> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd new file mode 100644 index 0000000000..5381590cd1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInPositiveInteger"> + <complexType> + <sequence> + <element name="positiveInteger" type="positiveInteger" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml new file mode 100644 index 0000000000..4cd6ea7e72 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInQName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInQName.xsd "> + <QName>QName</QName> +</tns:BuiltInQName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd new file mode 100644 index 0000000000..e8faf6225b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInQName.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInQName"> + <complexType> + <sequence> + <element name="QName" type="QName" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml new file mode 100644 index 0000000000..b4375467c4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInShort xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInShort.xsd "> + <short>-32768</short> + <short>32767</short> +</tns:BuiltInShort> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd new file mode 100644 index 0000000000..a4f564d9b7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInShort.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInShort"> + <complexType> + <sequence> + <element name="short" type="short" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml new file mode 100644 index 0000000000..d30ab85530 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInString xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInString.xsd "> + <string>string</string> +</tns:BuiltInString> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd new file mode 100644 index 0000000000..8abb34b5a5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInString.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInString"> + <complexType> + <sequence> + <element name="string" type="string" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml new file mode 100644 index 0000000000..7fd9a061ae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInTime xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInTime.xsd "> + <time>12:00:00</time> +</tns:BuiltInTime> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd new file mode 100644 index 0000000000..1615976813 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInTime.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInTime"> + <complexType> + <sequence> + <element name="time" type="time" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml new file mode 100644 index 0000000000..cd567ba528 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:BuiltInToken xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInToken.xsd "> + <token>token</token> +</tns:BuiltInToken> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd new file mode 100644 index 0000000000..0beaac571f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInToken.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInToken"> + <complexType> + <sequence> + <element name="token" type="token" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml new file mode 100644 index 0000000000..025362defb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInUnsignedByte xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedByte.xsd "> + <unsignedByte>0</unsignedByte> + <unsignedByte>255</unsignedByte> +</tns:BuiltInUnsignedByte> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd new file mode 100644 index 0000000000..d6d951fe5d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInUnsignedByte"> + <complexType> + <sequence> + <element name="unsignedByte" type="unsignedByte" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml new file mode 100644 index 0000000000..5736a8c121 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInUnsignedInt xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedInt.xsd "> + <unsignedInt>0</unsignedInt> + <unsignedInt>4294967295</unsignedInt> +</tns:BuiltInUnsignedInt> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd new file mode 100644 index 0000000000..242be1d53b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInUnsignedInt"> + <complexType> + <sequence> + <element name="unsignedInt" type="unsignedInt" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml new file mode 100644 index 0000000000..d728115a77 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInUnsignedLong xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedLong.xsd "> + <unsignedLong>0</unsignedLong> + <unsignedLong>18446744073709551615</unsignedLong> +</tns:BuiltInUnsignedLong> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd new file mode 100644 index 0000000000..108e3a8619 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInUnsignedLong"> + <complexType> + <sequence> + <element name="unsignedLong" type="unsignedLong" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml new file mode 100644 index 0000000000..d4ffae5e17 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:BuiltInUnsignedShort xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedShort.xsd "> + <unsignedShort>0</unsignedShort> + <unsignedShort>65535</unsignedShort> +</tns:BuiltInUnsignedShort> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd new file mode 100644 index 0000000000..5ee5e0229e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="BuiltInUnsignedShort"> + <complexType> + <sequence> + <element name="unsignedShort" type="unsignedShort" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml new file mode 100644 index 0000000000..3d5aed5aa8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml @@ -0,0 +1,26 @@ +<?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. +--> +<tns:ComplexTypeComplexContentRestrictingComplexType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeComplexContentRestrictingComplexType.xsd "> + <ComplexTypeComplexContentRestrictingComplexTypeElement> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + </ComplexTypeComplexContentRestrictingComplexTypeElement> +</tns:ComplexTypeComplexContentRestrictingComplexType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd new file mode 100644 index 0000000000..e7b80ab11c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd @@ -0,0 +1,44 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="SimpleTypeWithName.xsd"/> + <include schemaLocation="ComplexTypeExtendingComplexType.xsd"/> + + <complexType name="ComplexTypeComplexContentRestrictingComplexTypeType"> + <complexContent> + <restriction base="tns:ComplexTypeExtendingComplexTypeType"> + <sequence> + <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/> + </sequence> + </restriction> + </complexContent> + </complexType> + + <element name="ComplexTypeComplexContentRestrictingComplexType"> + <complexType> + <sequence> + <element name="ComplexTypeComplexContentRestrictingComplexTypeElement" type="tns:ComplexTypeComplexContentRestrictingComplexTypeType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml new file mode 100644 index 0000000000..2b4fe5594e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml @@ -0,0 +1,27 @@ +<?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. +--> +<tns:ComplexTypeExtendingComplexType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeExtendingComplexType.xsd "> + <ComplexTypeExtendingComplexTypeElement> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + <SimpleTypeWithNameExtended>SimpleTypeWithNameExtended</SimpleTypeWithNameExtended> + </ComplexTypeExtendingComplexTypeElement> +</tns:ComplexTypeExtendingComplexType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd new file mode 100644 index 0000000000..fc4deb63c2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd @@ -0,0 +1,43 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="ComplexTypeWithContent.xsd"/> + + <complexType name="ComplexTypeExtendingComplexTypeType"> + <complexContent> + <extension base="tns:ComplexTypeWithContentType"> + <sequence> + <element name="SimpleTypeWithNameExtended" type="string"/> + </sequence> + </extension> + </complexContent> + </complexType> + + <element name="ComplexTypeExtendingComplexType"> + <complexType> + <sequence> + <element name="ComplexTypeExtendingComplexTypeElement" type="tns:ComplexTypeExtendingComplexTypeType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml new file mode 100644 index 0000000000..03570f41d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ComplexTypeExtendingSimpeType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeExtendingSimpleType.xsd "> + <ComplexTypeExtendingSimpeTypeElement AddedByExtension="">ComplexTypeExtendingSimpeTypeElement</ComplexTypeExtendingSimpeTypeElement> +</tns:ComplexTypeExtendingSimpeType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd new file mode 100644 index 0000000000..c754502645 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd @@ -0,0 +1,41 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="SimpleTypeWithName.xsd"/> + + <complexType name="ComplexTypeExtendingSimpleTypeType"> + <simpleContent> + <extension base="tns:SimpleTypeWithNameType"> + <attribute name="AddedByExtension" type="string"/> + </extension> + </simpleContent> + </complexType> + + <element name="ComplexTypeExtendingSimpeType"> + <complexType> + <sequence> + <element name="ComplexTypeExtendingSimpeTypeElement" type="tns:ComplexTypeExtendingSimpleTypeType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml new file mode 100644 index 0000000000..4603793bfc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ComplexTypeSimpleContentRestrictingComplexType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeSimpleContentRestrictingComplexType.xsd "> + <ComplexTypeSimpleContentRestrictingComplexTypeElement AddedByExtension="NCName">ComplexTypeSimpleContentRestrictingComplexTypeElement</ComplexTypeSimpleContentRestrictingComplexTypeElement> +</tns:ComplexTypeSimpleContentRestrictingComplexType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd new file mode 100644 index 0000000000..4bcd2f8c46 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd @@ -0,0 +1,41 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="ComplexTypeExtendingSimpleType.xsd"/> + + <complexType name="ComplexTypeSimpleContentRestrictingComplexTypeType"> + <simpleContent> + <restriction base="tns:ComplexTypeExtendingSimpleTypeType"> + <attribute name="AddedByExtension" type="NCName" /> + </restriction> + </simpleContent> + </complexType> + + <element name="ComplexTypeSimpleContentRestrictingComplexType"> + <complexType> + <sequence> + <element name="ComplexTypeSimpleContentRestrictingComplexTypeElement" type="tns:ComplexTypeSimpleContentRestrictingComplexTypeType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml new file mode 100644 index 0000000000..a6861f803a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml @@ -0,0 +1,27 @@ +<?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. +--> +<tns:ComplexTypeWithAbstract xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithAbstract.xsd "> + <ComplexTypeWithAbstractExtensionElement> + <BaseElement>BaseElement</BaseElement> + <ExtensionElement>ExtensionElement</ExtensionElement> + </ComplexTypeWithAbstractExtensionElement> +</tns:ComplexTypeWithAbstract> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd new file mode 100644 index 0000000000..8bb251cab2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd @@ -0,0 +1,47 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <complexType name="ComplexTypeWithAbstractType" abstract="true"> + <sequence> + <element name="BaseElement" type="string"/> + </sequence> + </complexType> + + <complexType name="ComplexTypeWithAbstractExtensionType"> + <complexContent> + <extension base="tns:ComplexTypeWithAbstractType"> + <sequence> + <element name="ExtensionElement" type="string"/> + </sequence> + </extension> + </complexContent> + </complexType> + + <element name="ComplexTypeWithAbstract"> + <complexType> + <sequence> + <element name="ComplexTypeWithAbstractExtensionElement" type="tns:ComplexTypeWithAbstractExtensionType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml new file mode 100644 index 0000000000..467ec007ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml @@ -0,0 +1,30 @@ +<?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. +--> +<tns:ComplexTypeWithCDATA xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithCDATA.xsd "> + <ComplexTypeWithCDATAElement> + Some + <![CDATA[some data and some <MoreXML></MoreXML>]]> + Mixed + <SimpleTypeWithName>SimpleType<![CDATA[some data and some <MoreXML></MoreXML>]]>WithName</SimpleTypeWithName> + Content + </ComplexTypeWithCDATAElement> +</tns:ComplexTypeWithCDATA> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd new file mode 100644 index 0000000000..8d00646678 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd @@ -0,0 +1,39 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="SimpleTypeWithName.xsd"/> + + <complexType name="ComplexTypeWithCDATAType" mixed="true"> + <sequence> + <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/> + </sequence> + </complexType> + + <element name="ComplexTypeWithCDATA"> + <complexType> + <sequence> + <element name="ComplexTypeWithCDATAElement" type="tns:ComplexTypeWithCDATAType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml new file mode 100644 index 0000000000..7deafd798a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml @@ -0,0 +1,26 @@ +<?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. +--> +<tns:ComplexTypeWithContent xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithContent.xsd "> + <ComplexTypeWithContentElement> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + </ComplexTypeWithContentElement> +</tns:ComplexTypeWithContent> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd new file mode 100644 index 0000000000..72ac75fee0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd @@ -0,0 +1,37 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <complexType name="ComplexTypeWithContentType"> + <sequence> + <element name="SimpleTypeWithName" type="string"/> + </sequence> + </complexType> + + <element name="ComplexTypeWithContent"> + <complexType> + <sequence> + <element name="ComplexTypeWithContentElement" type="tns:ComplexTypeWithContentType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml new file mode 100644 index 0000000000..f6208f81b3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml @@ -0,0 +1,29 @@ +<?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. +--> +<tns:ComplexTypeWithMixed xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithMixed.xsd "> + <ComplexTypeWithMixedElement> + Some + Mixed + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + Content + </ComplexTypeWithMixedElement> +</tns:ComplexTypeWithMixed> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd new file mode 100644 index 0000000000..1f26e13673 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd @@ -0,0 +1,39 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="SimpleTypeWithName.xsd"/> + + <complexType name="ComplexTypeWithMixedType" mixed="true"> + <sequence> + <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/> + </sequence> + </complexType> + + <element name="ComplexTypeWithMixed"> + <complexType> + <sequence> + <element name="ComplexTypeWithMixedElement" type="tns:ComplexTypeWithMixedType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml new file mode 100644 index 0000000000..97de7b98eb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ComplexTypeWithOpenAttributes xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOpenAttributes.xsd "> + <ComplexTypeWithOpenAttributesElement SomeOpenAttribute="Some Open Attribute"> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + </ComplexTypeWithOpenAttributesElement> +</tns:ComplexTypeWithOpenAttributes> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd new file mode 100644 index 0000000000..67716553d8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd @@ -0,0 +1,42 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="SimpleTypeWithName.xsd"/> + + <attribute name="SomeOpenAttribute" type="string"/> + + <complexType name="ComplexTypeWithOpenAttributesType"> + <sequence> + <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/> + </sequence> + <anyAttribute namespace="##any"/> + </complexType> + + <element name="ComplexTypeWithOpenAttributes"> + <complexType> + <sequence> + <element name="ComplexTypeWithOpenAttributesElement" type="tns:ComplexTypeWithOpenAttributesType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml new file mode 100644 index 0000000000..5941348921 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml @@ -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. +--> +<tns:ComplexTypeWithOpenContent xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOpenContent.xsd "> + <ComplexTypeWithOpenContentElement> + <tns:ComplexTypeWithMixed> + <ComplexTypeWithMixedElement> + Some + Mixed + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + Content + </ComplexTypeWithMixedElement> + </tns:ComplexTypeWithMixed> + </ComplexTypeWithOpenContentElement> +</tns:ComplexTypeWithOpenContent> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd new file mode 100644 index 0000000000..24d5d09054 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd @@ -0,0 +1,39 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="ComplexTypeWithMixed.xsd"/> + + <complexType name="ComplexTypeWithOpenContentType"> + <sequence> + <any namespace="##any"/> + </sequence> + </complexType> + + <element name="ComplexTypeWithOpenContent"> + <complexType> + <sequence> + <element name="ComplexTypeWithOpenContentElement" type="tns:ComplexTypeWithOpenContentType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml new file mode 100644 index 0000000000..f684d06a4d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml @@ -0,0 +1,30 @@ +<?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. +--> +<tns:ComplexTypeWithOppositeProperty xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOppositeProperty.xsd "> + <ComplexTypeReferencedDataObject DataObjectId="idvalue0"> + <SomeData>SomeData</SomeData> + </ComplexTypeReferencedDataObject> + <ComplexTypeReferencingDataObject AttributeWithSDOPropertyType="idvalue0" DataObjectId="idvalue1"> + <OppositeProperty>idvalue2</OppositeProperty> + </ComplexTypeReferencingDataObject> + <ComplexTypeWithOppositePropertyElement AttributeWithSDOPropertyType="idvalue1" DataObjectId="idvalue2"/> +</tns:ComplexTypeWithOppositeProperty> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd new file mode 100644 index 0000000000..de4a8a666d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd @@ -0,0 +1,59 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="ComplexTypeReferencedDataObjectType"> + <sequence> + <element name="SomeData" type="string"/> + </sequence> + <attribute name="DataObjectId" type="ID"/> + </complexType> + + <complexType name="ComplexTypeReferencingDataObjectType"> + <sequence> + <element name="OppositeProperty" type="IDREF"/> + </sequence> + <attribute name="AttributeWithSDOPropertyType" type="IDREF" + sdo:propertyType="tns:ComplexTypeReferencedDataObjectType"/> + <attribute name="DataObjectId" type="ID"/> + </complexType> + + <complexType name="ComplexTypeWithOppositePropertyType"> + <sequence> + </sequence> + <attribute name="AttributeWithSDOPropertyType" type="IDREF" + sdo:propertyType="tns:ComplexTypeReferencingDataObjectType" + sdo:oppositeProperty="OppositeProperty"/> + <attribute name="DataObjectId" type="ID"/> + </complexType> + + <element name="ComplexTypeWithOppositeProperty"> + <complexType> + <sequence> + <element name="ComplexTypeReferencedDataObject" type="tns:ComplexTypeReferencedDataObjectType"/> + <element name="ComplexTypeReferencingDataObject" type="tns:ComplexTypeReferencingDataObjectType"/> + <element name="ComplexTypeWithOppositePropertyElement" type="tns:ComplexTypeWithOppositePropertyType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml new file mode 100644 index 0000000000..242908bd27 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml @@ -0,0 +1,26 @@ +<?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. +--> +<tns:ComplexTypeWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOAliasName.xsd "> + <ComplexTypeWithSDOAliasNameElement> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + </ComplexTypeWithSDOAliasNameElement> +</tns:ComplexTypeWithSDOAliasName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd new file mode 100644 index 0000000000..4c00fbe295 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="ComplexTypeWithSDOAliasNameType" sdo:aliasName="ComplexTypeWithSDOAliasNameTypeSDOAliasName"> + <sequence> + <element name="SimpleTypeWithName" type="string"/> + </sequence> + </complexType> + + <element name="ComplexTypeWithSDOAliasName"> + <complexType> + <sequence> + <element name="ComplexTypeWithSDOAliasNameElement" type="tns:ComplexTypeWithSDOAliasNameType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml new file mode 100644 index 0000000000..925e8625d5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml @@ -0,0 +1,26 @@ +<?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. +--> +<tns:ComplexTypeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOName.xsd "> + <ComplexTypeWithSDONameElement> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + </ComplexTypeWithSDONameElement> +</tns:ComplexTypeWithSDOName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd new file mode 100644 index 0000000000..b12bec040b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <complexType name="ComplexTypeWithSDONameType" sdo:name="ComplexTypeWithSDONameTypeSDOName"> + <sequence> + <element name="SimpleTypeWithName" type="string"/> + </sequence> + </complexType> + + <element name="ComplexTypeWithSDOName"> + <complexType> + <sequence> + <element name="ComplexTypeWithSDONameElement" type="tns:ComplexTypeWithSDONameType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml new file mode 100644 index 0000000000..c73708ce46 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml @@ -0,0 +1,26 @@ +<?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. +--> +<tns:ComplexTypeWithSDOSequence xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOSequence.xsd "> + <ComplexTypeWithSDOSequenceElement> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + </ComplexTypeWithSDOSequenceElement> +</tns:ComplexTypeWithSDOSequence> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd new file mode 100644 index 0000000000..795c3ea7d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd @@ -0,0 +1,40 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <include schemaLocation="SimpleTypeWithName.xsd"/> + + <complexType name="ComplexTypeWithSDOSequenceType" sdo:sequence="true"> + <sequence> + <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType" /> + </sequence> + </complexType> + + <element name="ComplexTypeWithSDOSequence"> + <complexType> + <sequence> + <element name="ComplexTypeWithSDOSequenceElement" type="tns:ComplexTypeWithSDOSequenceType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml new file mode 100644 index 0000000000..3ebdc89ae0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ComplexTypeWithoutContent xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithoutContent.xsd "> + <ComplexTypeWithoutContentElement/> +</tns:ComplexTypeWithoutContent> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd new file mode 100644 index 0000000000..21546d0f67 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd @@ -0,0 +1,33 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <complexType name="ComplexTypeWithoutContentType"/> + + <element name="ComplexTypeWithoutContent"> + <complexType> + <sequence> + <element name="ComplexTypeWithoutContentElement" type="tns:ComplexTypeWithoutContentType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml new file mode 100644 index 0000000000..89657e42ca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml @@ -0,0 +1,26 @@ +<?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. +--> +<tns:ComplexTypeWithoutName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithoutName.xsd "> + <tns:ComplexTypeWithoutNameType> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + </tns:ComplexTypeWithoutNameType> +</tns:ComplexTypeWithoutName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd new file mode 100644 index 0000000000..d01b4172e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd @@ -0,0 +1,39 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="ComplexTypeWithoutNameType"> + <complexType> + <sequence> + <element name="SimpleTypeWithName" type="string"/> + </sequence> + </complexType> + </element> + + <element name="ComplexTypeWithoutName"> + <complexType> + <sequence> + <element ref="tns:ComplexTypeWithoutNameType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml new file mode 100644 index 0000000000..82fd1eedaf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml @@ -0,0 +1,23 @@ +<?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. +--> +<DefaultNamespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="DefaultNamespace.xsd"> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> +</DefaultNamespace> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd new file mode 100644 index 0000000000..e1dcf06194 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd @@ -0,0 +1,32 @@ +<?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. +--> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > + + <!-- top level test type --> + <xsd:complexType name="DefaultNamespaceComplexType"> + <xsd:sequence> + <!-- simple types --> + <xsd:element name="SimpleTypeWithName" type="xsd:string"/> + + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="Default" type="DefaultNamespaceComplexType"/> +</xsd:schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml new file mode 100644 index 0000000000..ebf03c9d5d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml @@ -0,0 +1,27 @@ +<?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. +--> +<tns:ElementInAll xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementInAll.xsd "> + <ElementInAllElement> + <ElementInAllOne>ElementInAllOne</ElementInAllOne> + <ElementInAllTwo>ElementInAllTwo</ElementInAllTwo> + </ElementInAllElement> +</tns:ElementInAll> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd new file mode 100644 index 0000000000..8b9ba5b4b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd @@ -0,0 +1,40 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <complexType name="ComplexTypeElementInAllTestType"> + <all> + <element name="ElementInAllOne" type="string"/> + <element name="ElementInAllTwo" type="string"/> + </all> + </complexType> + + <element name="ElementInAll"> + <complexType> + <sequence> + <choice maxOccurs="3"> + <element name="ElementInAllElement" type="tns:ComplexTypeElementInAllTestType"/> + </choice> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml new file mode 100644 index 0000000000..26466b1b39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:ElementInChoice xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementInChoice.xsd "> + <Element1InChoice>Element1InChoice</Element1InChoice> + <Element2InChoice>Element2InChoice</Element2InChoice> +</tns:ElementInChoice> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd new file mode 100644 index 0000000000..ff418c56ab --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd @@ -0,0 +1,48 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <group name="Group1"> + <sequence> + <element name="Element1InChoice" type="string" maxOccurs="2"/> + <element name="Element2InChoice" type="string" /> + </sequence> + </group> + + <group name="Group2"> + <sequence> + <element name="Element2InChoice" type="string" /> + <element name="Element1InChoice" type="string" maxOccurs="2"/> + </sequence> + </group> + + <element name="ElementInChoice"> + <complexType> + <sequence> + <choice maxOccurs="3"> + <group ref="tns:Group1"/> + <group ref="tns:Group2"/> + </choice> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml new file mode 100644 index 0000000000..27bb1ce9cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml @@ -0,0 +1,29 @@ +<?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. +--> +<tns:ElementOfSDOChangeSummaryType xmlns:sdo="commonj.sdo" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSDOChangeSummaryType.xsd commonj.sdo datagraph.xsd "> + <ElementOfSDOChangeSummaryTypeElement> + <ChangeSummaryElement> + ChangeSummaryText + </ChangeSummaryElement> + </ElementOfSDOChangeSummaryTypeElement> +</tns:ElementOfSDOChangeSummaryType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd new file mode 100644 index 0000000000..2bf1df8c99 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd @@ -0,0 +1,34 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <import schemaLocation="datagraph.xsd" namespace="commonj.sdo"/> + + <element name="ElementOfSDOChangeSummaryType"> + <complexType> + <sequence> + <element name="ElementOfSDOChangeSummaryTypeElement" type="sdo:ChangeSummaryType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml new file mode 100644 index 0000000000..9b5561ed43 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementOfSimpleTypeWithDefault xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithDefault.xsd "> + <ElementOfSimpleTypeWithDefaultElement>ElementOfSimpleTypeWithDefaultDefault</ElementOfSimpleTypeWithDefaultElement> +</tns:ElementOfSimpleTypeWithDefault> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd new file mode 100644 index 0000000000..0b4e7bdf45 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="ElementOfSimpleTypeWithDefault"> + <complexType> + <sequence> + <element name="ElementOfSimpleTypeWithDefaultElement" type="string" default="ElementOfSimpleTypeWithDefaultDefault" /> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml new file mode 100644 index 0000000000..f1b7cd264c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementOfSimpleTypeWithFixed xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithFixed.xsd "> + <ElementOfSimpleTypeWithFixedElement>ElementOfSimpleTypeWithFixedFixed</ElementOfSimpleTypeWithFixedElement> +</tns:ElementOfSimpleTypeWithFixed> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd new file mode 100644 index 0000000000..a2c8456257 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="ElementOfSimpleTypeWithFixed"> + <complexType> + <sequence> + <element name="ElementOfSimpleTypeWithFixedElement" type="string" fixed="ElementOfSimpleTypeWithFixedFixed" /> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml new file mode 100644 index 0000000000..1f60b0423f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementOfSimpleTypeWithSDODataType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDODataType.xsd "> + <ElementOfSimpleTypeWithSDODataTypeElement>ElementOfSimpleTypeWithSDODataTypeElement</ElementOfSimpleTypeWithSDODataTypeElement> +</tns:ElementOfSimpleTypeWithSDODataType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd new file mode 100644 index 0000000000..21e55ab8c1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd @@ -0,0 +1,33 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + + <element name="ElementOfSimpleTypeWithSDODataType"> + <complexType> + <sequence> + <element name="ElementOfSimpleTypeWithSDODataTypeElement" type="string" sdo:dataType="string"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml new file mode 100644 index 0000000000..30762f4912 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementOfSimpleTypeWithSDOOppositePropertyType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOOppositePropertyType.xsd "> + <ElementOfSimpleTypeWithSDOOppositePropertyTypeElement>idvalue0</ElementOfSimpleTypeWithSDOOppositePropertyTypeElement> +</tns:ElementOfSimpleTypeWithSDOOppositePropertyType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd new file mode 100644 index 0000000000..5bf35d0d70 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd @@ -0,0 +1,33 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + + <element name="ElementOfSimpleTypeWithSDOOppositePropertyType"> + <complexType> + <sequence> + <element name="ElementOfSimpleTypeWithSDOOppositePropertyTypeElement" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType" sdo:oppositeProperty="tns:ElementOfSimpleTypeWithSDOPropertyType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml new file mode 100644 index 0000000000..2dd01e4090 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementOfSimpleTypeWithSDOPropertyType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOPropertyType.xsd "> + <ElementOfSimpleTypeWithSDOPropertyTypeElement>idvalue0</ElementOfSimpleTypeWithSDOPropertyTypeElement> +</tns:ElementOfSimpleTypeWithSDOPropertyType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd new file mode 100644 index 0000000000..6920cd8dd0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd @@ -0,0 +1,32 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <element name="ElementOfSimpleTypeWithSDOPropertyType"> + <complexType> + <sequence> + <element name="ElementOfSimpleTypeWithSDOPropertyTypeElement" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml new file mode 100644 index 0000000000..6a526bdc47 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementOfSimpleTypeWithSDOString xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOString.xsd "> + <ElementOfSimpleTypeWithSDOStringElement>ElementOfSimpleTypeWithSDOStringElement</ElementOfSimpleTypeWithSDOStringElement> +</tns:ElementOfSimpleTypeWithSDOString> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd new file mode 100644 index 0000000000..1117a95eb8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd @@ -0,0 +1,32 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <element name="ElementOfSimpleTypeWithSDOString"> + <complexType> + <sequence> + <element name="ElementOfSimpleTypeWithSDOStringElement" type="string" sdo:string="true"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml new file mode 100644 index 0000000000..ab91458bff --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml @@ -0,0 +1,40 @@ +<?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. +--> +<tns:ElementSubstitutionGroupBase xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementSubstitutionGroupBase.xsd "> + <ElementSubstitutionGroupBaseElement> + <ElementInSubstitutionGroupBase> + ElementInSubstitutionGroupBase + </ElementInSubstitutionGroupBase> + </ElementSubstitutionGroupBaseElement> + + <ElementSubstitutionUnrelated>Some Data</ElementSubstitutionUnrelated> + + <ElementSubstitutionGroupExtends> + <ElementInSubstitutionGroupBase> + ElementInSubstitutionGroupBase + </ElementInSubstitutionGroupBase> + <ElementInSubstitutionGroupExtends> + ElementInSubstitutionGroupExtends + </ElementInSubstitutionGroupExtends> + </ElementSubstitutionGroupExtends> + +</tns:ElementSubstitutionGroupBase> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd new file mode 100644 index 0000000000..3e015843b5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd @@ -0,0 +1,52 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <complexType name="ComplexTypeSubstitutionGroupBaseType"> + <sequence> + <element name="ElementInSubstitutionGroupBase" type="string"/> + </sequence> + </complexType> + <element name="ElementSubstitutionGroupBaseElement" type="tns:ComplexTypeSubstitutionGroupBaseType"/> + + <element name="ElementSubstitutionGroupUnrelated" type="string" substitutionGroup="tns:ElementSubstitutionGroupBaseElement"/> + + <complexType name="ComplexTypeSubstitutionGroupExtendsType"> + <complexContent> + <extension base="tns:ComplexTypeSubstitutionGroupBaseType"> + <sequence> + <element name="ElementInSubstitutionGroupExtends" type="string"/> + </sequence> + </extension> + </complexContent> + </complexType> + + <element name="ElementSubstitutionGroupExtends" type="tns:ComplexTypeSubstitutionGroupExtendsType" substitutionGroup="tns:ElementSubstitutionGroupBaseElement"/> + + <element name="ElementSubstitutionGroupBase"> + <complexType> + <sequence> + <element ref="tns:ElementSubstitutionGroupBaseElement" maxOccurs="unbounded" /> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml new file mode 100644 index 0000000000..b6d68fd08a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:ElementWithMaxOccurs xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithMaxOccurs.xsd "> + <ElementWithMaxOccursElement>ElementWithMaxOccursElement1</ElementWithMaxOccursElement> + <ElementWithMaxOccursElement>ElementWithMaxOccursElement2</ElementWithMaxOccursElement> +</tns:ElementWithMaxOccurs> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd new file mode 100644 index 0000000000..d4453a4477 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="ElementWithMaxOccurs"> + <complexType> + <sequence> + <element name="ElementWithMaxOccursElement" type="string" maxOccurs="2"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml new file mode 100644 index 0000000000..6de3adc937 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementWithNillable xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithNillable.xsd "> + <ElementWithNillableElement>ElementWithNillableElement</ElementWithNillableElement> +</tns:ElementWithNillable> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd new file mode 100644 index 0000000000..786ab226da --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="ElementWithNillable"> + <complexType> + <sequence> + <element name="ElementWithNillableElement" type="string" nillable="true" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml new file mode 100644 index 0000000000..64093aa803 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithSDOAliasName.xsd "> + <ElementWithSDOAliasName>ElementWithSDOAliasName</ElementWithSDOAliasName> +</tns:ElementWithSDOAliasName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd new file mode 100644 index 0000000000..01f4c2b1ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd @@ -0,0 +1,32 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <element name="ElementWithSDOAliasName"> + <complexType> + <sequence> + <element name="ElementWithSDOAliasName" sdo:aliasName="ElementWithSDOAliasNameSDOAliasName" type="string"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml new file mode 100644 index 0000000000..774646f682 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:ElementWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithSDOName.xsd "> + <ElementWithSDONameElement>ElementWithSDONameElement</ElementWithSDONameElement> +</tns:ElementWithSDOName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd new file mode 100644 index 0000000000..34da37564c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd @@ -0,0 +1,32 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <element name="ElementWithSDOName"> + <complexType> + <sequence> + <element name="ElementWithSDONameElement" sdo:name="ElementWithSDONameSDOName" type="string"/> + </sequence> + </complexType> + </element> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml new file mode 100644 index 0000000000..a1fb3aa803 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:GlobalElementComplexType xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop GlobalElementComplexType.xsd"> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> +</tns:GlobalElementComplexType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd new file mode 100644 index 0000000000..8eb7a4fce4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <complexType name="GlobalElementComplexTypeComplexType"> + <sequence> + <element name="SimpleTypeWithName" type="string"/> + </sequence> + </complexType> + + <element name="GlobalElementComplexType" type="tns:GlobalElementComplexTypeComplexType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml new file mode 100644 index 0000000000..f68eb1939d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml @@ -0,0 +1,24 @@ +<?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. +--> +<GlobalElementSimpleType xmlns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop GlobalElementSimpleType.xsd"> + GlobalElementSimpleType +</GlobalElementSimpleType> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd new file mode 100644 index 0000000000..b9f77e6658 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd @@ -0,0 +1,26 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + + <element name="GlobalElementSimpleType" type="string"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Import.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Import.xml new file mode 100644 index 0000000000..fd28850050 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Import.xml @@ -0,0 +1,30 @@ +<?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. +--> +<tns:Import xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:imp="http://www.apache.org/tuscany/interop/import" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop Import.xsd"> + + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> + <Imported> + <AnElement>SomeString</AnElement> + <AnotherElement>SomeString</AnotherElement> + </Imported> +</tns:Import> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Import.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Import.xsd new file mode 100644 index 0000000000..eae93fd44a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Import.xsd @@ -0,0 +1,40 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:imp="http://www.apache.org/tuscany/interop/import" + xmlns:sdo="commonj.sdo" + xmlns:sdoJava="commonj.sdo"> + + <include schemaLocation="SimpleTypeWithName.xsd"/> + <import schemaLocation="ImportedSchema.xsd" + namespace="http://www.apache.org/tuscany/interop/import"/> + + <!-- top level test type --> + <complexType name="ImportComplexType"> + <sequence> + <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/> + <element name="Imported" type="imp:ImportedComplexType"/> + </sequence> + </complexType> + + <element name="Import" type="tns:ImportComplexType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd new file mode 100644 index 0000000000..a7e568decf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd @@ -0,0 +1,33 @@ +<?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. +--> + +<xsd:schema + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:imp="http://www.apache.org/tuscany/interop/import" + targetNamespace="http://www.apache.org/tuscany/interop/import"> + + <xsd:complexType name="ImportedComplexType"> + <xsd:sequence> + <xsd:element name="AnElement" type="xsd:string"/> + <xsd:element name="AnotherElement" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + +</xsd:schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Include.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Include.xml new file mode 100644 index 0000000000..d4b9e24fa6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Include.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:Include xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop Include.xsd"> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> +</tns:Include> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Include.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Include.xsd new file mode 100644 index 0000000000..34ff314a19 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Include.xsd @@ -0,0 +1,36 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <include schemaLocation="../xsd/SimpleTypeWithName.xsd"/> + + <!-- top level test type --> + <complexType name="IncludeComplexType"> + <sequence> + <!-- simple types --> + <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/> + + </sequence> + </complexType> + + <element name="IncludeElement" type="tns:IncludeComplexType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Interop.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Interop.xsd new file mode 100644 index 0000000000..ae22ab2c44 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Interop.xsd @@ -0,0 +1,138 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + +<!-- Causes SDO generator to crash + <include schemaLocation="../xsd/Annotation.xsd"/> +--> + <include schemaLocation="../xsd/Attribute.xsd"/> + <include schemaLocation="../xsd/AttributeReference.xsd"/> +<!-- + <include schemaLocation="AttributeWithDefaultValue.xsd"/> + <include schemaLocation="AttributeWithFixedValue.xsd"/> + <include schemaLocation="AttributeWithSDOAliasName.xsd"/> + <include schemaLocation="AttributeWithSDODataType.xsd"/> + <include schemaLocation="AttributeWithSDOName.xsd"/> + <include schemaLocation="AttributeWithSDOPropertySDOOppositePropertyType.xsd"/> + <include schemaLocation="AttributeWithSDOPropertyType.xsd"/> + <include schemaLocation="AttributeWithSDOString.xsd"/> + <include schemaLocation="BuiltInAnySimpleType.xsd"/> + <include schemaLocation="BuiltInAnyType.xsd"/> + <include schemaLocation="BuiltInAnyURI.xsd"/> + <include schemaLocation="BuiltInBase64Binary.xsd"/> + <include schemaLocation="BuiltInBoolean.xsd"/> + <include schemaLocation="BuiltInByte.xsd"/> + <include schemaLocation="BuiltInDate.xsd"/> + <include schemaLocation="BuiltInDateTime.xsd"/> + <include schemaLocation="BuiltInDecimal.xsd"/> + <include schemaLocation="BuiltInDouble.xsd"/> + <include schemaLocation="BuiltInDuration.xsd"/> + <include schemaLocation="BuiltInFloat.xsd"/> + <include schemaLocation="BuiltInGDay.xsd"/> + <include schemaLocation="BuiltInGMonth.xsd"/> + <include schemaLocation="BuiltInGMonthDay.xsd"/> + <include schemaLocation="BuiltInGYear.xsd"/> + <include schemaLocation="BuiltInGYearMonth.xsd"/> + <include schemaLocation="BuiltInHexBinary.xsd"/> + <include schemaLocation="BuiltInID.xsd"/> + <include schemaLocation="BuiltInIDREF.xsd"/> + <include schemaLocation="BuiltInIDREFS.xsd"/> + <include schemaLocation="BuiltInInt.xsd"/> + <include schemaLocation="BuiltInInteger.xsd"/> + <include schemaLocation="BuiltInLanguage.xsd"/> + <include schemaLocation="BuiltInLong.xsd"/> + <include schemaLocation="BuiltInNCName.xsd"/> + <include schemaLocation="BuiltInNMTOKEN.xsd"/> + <include schemaLocation="BuiltInNMTOKENS.xsd"/> + <include schemaLocation="BuiltInNOTATION.xsd"/> + <include schemaLocation="BuiltInName.xsd"/> + <include schemaLocation="BuiltInNegativeInteger.xsd"/> + <include schemaLocation="BuiltInNonNegativeInteger.xsd"/> + <include schemaLocation="BuiltInNonPositiveInteger.xsd"/> + <include schemaLocation="BuiltInNormalizedString.xsd"/> + <include schemaLocation="BuiltInPositiveInteger.xsd"/> + <include schemaLocation="BuiltInQName.xsd"/> + <include schemaLocation="BuiltInShort.xsd"/> + <include schemaLocation="BuiltInString.xsd"/> + <include schemaLocation="BuiltInTime.xsd"/> + <include schemaLocation="BuiltInToken.xsd"/> + <include schemaLocation="BuiltInUnsignedByte.xsd"/> + <include schemaLocation="BuiltInUnsignedInt.xsd"/> + <include schemaLocation="BuiltInUnsignedLong.xsd"/> + <include schemaLocation="BuiltInUnsignedShort.xsd"/> + <include schemaLocation="ComplexTypeComplexContentRestrictingComplexType.xsd"/> + <include schemaLocation="ComplexTypeExtendingComplexType.xsd"/> + <include schemaLocation="ComplexTypeExtendingSimpleType.xsd"/> + <include schemaLocation="ComplexTypeSimpleContentRestrictingComplexType.xsd"/> + <include schemaLocation="ComplexTypeWithAbstract.xsd"/> + <include schemaLocation="ComplexTypeWithCDATA.xsd"/> +--> + <include schemaLocation="../xsd/ComplexTypeWithContent.xsd"/> +<!-- + <include schemaLocation="ComplexTypeWithMixed.xsd"/> + <include schemaLocation="ComplexTypeWithOpenAttributes.xsd"/> + <include schemaLocation="ComplexTypeWithOpenContent.xsd"/> + <include schemaLocation="ComplexTypeWithOppositeProperty.xsd"/> + <include schemaLocation="ComplexTypeWithSDOAliasName.xsd"/> + <include schemaLocation="ComplexTypeWithSDOName.xsd"/> + <include schemaLocation="ComplexTypeWithSDOSequence.xsd"/> + <include schemaLocation="ComplexTypeWithoutContent.xsd"/> + <include schemaLocation="ComplexTypeWithoutName.xsd"/> + <include schemaLocation="DefaultNamespace.xsd"/> + <include schemaLocation="ElementInAll.xsd"/> + <include schemaLocation="ElementInChoice.xsd"/> + <include schemaLocation="ElementOfSDOChangeSummaryType.xsd"/> + <include schemaLocation="ElementOfSimpleTypeWithDefault.xsd"/> + <include schemaLocation="ElementOfSimpleTypeWithFixed.xsd"/> + <include schemaLocation="ElementOfSimpleTypeWithSDODataType.xsd"/> + <include schemaLocation="ElementOfSimpleTypeWithSDOOppositePropertyType.xsd"/> + <include schemaLocation="ElementOfSimpleTypeWithSDOPropertyType.xsd"/> + <include schemaLocation="ElementOfSimpleTypeWithSDOString.xsd"/> + <include schemaLocation="ElementSubstitutionGroupBase.xsd"/> + <include schemaLocation="ElementWithMaxOccurs.xsd"/> + <include schemaLocation="ElementWithNillable.xsd"/> + <include schemaLocation="ElementWithSDOAliasName.xsd"/> + <include schemaLocation="ElementWithSDOName.xsd"/> + <include schemaLocation="GlobalElementComplexType.xsd"/> + <include schemaLocation="GlobalElementSimpleType.xsd"/> + <include schemaLocation="Import.xsd"/> + <include schemaLocation="ImportedSchema.xsd"/> +--> + <include schemaLocation="../xsd/Include.xsd"/> +<!-- + <include schemaLocation="Notation.xsd"/> + <include schemaLocation="SDOJavaPackage.xsd"/> +--> + <include schemaLocation="../xsd/SimpleTypeWithAbstract.xsd"/> +<!-- + <include schemaLocation="SimpleTypeWithExtendedInstanceClass.xsd"/> + <include schemaLocation="SimpleTypeWithInstanceClass.xsd"/> + <include schemaLocation="SimpleTypeWithList.xsd"/> +--> + <include schemaLocation="../xsd/SimpleTypeWithName.xsd"/> +<!-- + <include schemaLocation="SimpleTypeWithSDOName.xsd"/> + <include schemaLocation="SimpleTypeWithUnion.xsd"/> + <include schemaLocation="SimpleTypeWithoutName.xsd"/> + <include schemaLocation="TargetNamespace.xsd"/> +--> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Notation.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Notation.xml new file mode 100644 index 0000000000..b75ac6500a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Notation.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:Notation xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop Notation.xsd "> +tns:Tuscany +</tns:Notation> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Notation.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Notation.xsd new file mode 100644 index 0000000000..6ad019cb81 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Notation.xsd @@ -0,0 +1,35 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <notation name="Tuscany" public="http://cwiki.apache.org/TUSCANY/"/> + <notation name="PHP_SCA_SDO" public="http://pecl.php.net/package/sca_sdo/"/> + + <simpleType name="NotationSimpleType"> + <restriction base="NOTATION"> + <enumeration value="tns:Tuscany"/> + <enumeration value="tns:PHP_SCA_SDO"/> + </restriction> + </simpleType> + + <element name="Notation" type="tns:NotationSimpleType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Person.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Person.xsd new file mode 100644 index 0000000000..5f5021b15e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/Person.xsd @@ -0,0 +1,30 @@ +<?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. +--> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://apache.org/tuscany/sca/itest/databinding/types"> + + <xsd:complexType name="PersonType"> + <xsd:sequence> + <xsd:element name="firstName" type="xsd:string" /> + <xsd:element name="lastName" type="xsd:string" /> + <xsd:element name="greeting" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> +</xsd:schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml new file mode 100644 index 0000000000..6c5ad88ff4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:SDOJavaPackage xmlns:p="commonj.sdo" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop interop05.xsd"> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> +</tns:SDOJavaPackage> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd new file mode 100644 index 0000000000..6b7e39b334 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd @@ -0,0 +1,39 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdoJava="commonj.sdo/java" + sdoJava:package="org.apache.tuscany"> + + <!-- should be a reference to the real schema wherever that is going to be --> + <import schemaLocation="sdoJava.xsd" namespace="commonj.sdo/java"/> + + <!-- top level test type --> + <complexType name="SDOJavaPackageComplexType"> + <sequence> + <!-- simple types --> + <element name="SimpleTypeWithName" type="string"/> + + </sequence> + </complexType> + + <element name="SDOJavaPackage" type="tns:SDOJavaPackageComplexType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml new file mode 100644 index 0000000000..f9d4a24a49 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:SimpleTypeWithAbstract xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithAbstract.xsd "> + <SimpleTypeWithAbstractExtensionElement>SimpleTypeWithAbstractExtensionElement</SimpleTypeWithAbstractExtensionElement> +</tns:SimpleTypeWithAbstract> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd new file mode 100644 index 0000000000..f649e2ba83 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd @@ -0,0 +1,40 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <!--simpleType name="SimpleTypeWithAbstractType" abstract="true"--> + <simpleType name="SimpleTypeWithAbstractType" > + <restriction base="string"/> + </simpleType> + + <simpleType name="SimpleTypeWithAbstractExtensionType"> + <restriction base="tns:SimpleTypeWithAbstractType"/> + </simpleType> + + <complexType name="SimpleTypeWithAbstractComplexType"> + <sequence> + <element name="SimpleTypeWithAbstractExtensionElement" type="tns:SimpleTypeWithAbstractExtensionType"/> + </sequence> + </complexType> + + <element name="SimpleTypeWithAbstract" type="tns:SimpleTypeWithAbstractComplexType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml new file mode 100644 index 0000000000..410df4b7e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:SimpleTypeWithExtendedInstanceClass xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithExtendedInstanceClass.xsd "> + <SimpleTypeWithExtendedInstanceClassElement>SimpleTypeWithExtendedInstanceClassElement</SimpleTypeWithExtendedInstanceClassElement> +</tns:SimpleTypeWithExtendedInstanceClass> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd new file mode 100644 index 0000000000..36629e8295 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd @@ -0,0 +1,36 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdoJava="commonj.sdo"> + + <simpleType name="SimpleTypeWithExtendedInstanceClassType" sdoJava:extendedInstanceClass="String"> + <restriction base="string"/> + </simpleType> + + <complexType name="SimpleTypeWithExtendedInstanceClassComplexType"> + <sequence> + <element name="SimpleTypeWithExtendedInstanceClassElement" type="tns:SimpleTypeWithExtendedInstanceClassType"/> + </sequence> + </complexType> + + <element name="SimpleTypeWithExtendedInstanceClass" type="SimpleTypeWithExtendedInstanceClassComplexType"> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml new file mode 100644 index 0000000000..7b74867c03 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:SimpleTypeWithInstanceClass xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithInstanceClass.xsd "> + <SimpleTypeWithInstanceClassElement>SimpleTypeWithInstanceClassElement</SimpleTypeWithInstanceClassElement> +</tns:SimpleTypeWithInstanceClass> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd new file mode 100644 index 0000000000..7a08de84be --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd @@ -0,0 +1,37 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdoJava="commonj.sdo"> + + <simpleType name="SimpleTypeWithInstanceClassType" sdoJava:instanceClass="String"> + <restriction base="string"/> + </simpleType> + + + <complexType name="SimpleTypeWithInstanceClassComplexType"> + <sequence> + <element name="SimpleTypeWithInstanceClassElement" type="tns:SimpleTypeWithInstanceClassType"/> + </sequence> + </complexType> + + <element name="SimpleTypeWithInstanceClass" type="SimpleTypeWithInstanceClassComplexType"> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml new file mode 100644 index 0000000000..708d526f44 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:SimpleTypeWithList xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithList.xsd "> + <SimpleTypeWithListElement>listmember1 listmember2</SimpleTypeWithListElement> +</tns:SimpleTypeWithList> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd new file mode 100644 index 0000000000..681cf7d5af --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd @@ -0,0 +1,37 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdoJava="commonj.sdo"> + + <simpleType name="SimpleTypeWithListType"> + <list itemType="string"/> + </simpleType> + + + <complexType name="SimpleTypeWithListComplexType"> + <sequence> + <element name="SimpleTypeWithListElement" type="tns:SimpleTypeWithListType"/> + </sequence> + </complexType> + + <element name="SimpleTypeWithList" type="SimpleTypeWithListComplexType"> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml new file mode 100644 index 0000000000..e404ac86b7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:SimpleTypeWithName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithName.xsd "> + <SimpleTypeWithNameElement>SimpleTypeWithNameElement</SimpleTypeWithNameElement> +</tns:SimpleTypeWithName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd new file mode 100644 index 0000000000..af0431f048 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd @@ -0,0 +1,36 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <simpleType name="SimpleTypeWithNameType"> + <restriction base="string"/> + </simpleType> + + <complexType name="SimpleTypeWithNameComplexType"> + <sequence> + <element name="SimpleTypeWithNameElement" type="tns:SimpleTypeWithNameType"/> + </sequence> + </complexType> + + <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameComplexType"/> + +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml new file mode 100644 index 0000000000..c86a0f6bcb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:SimpleTypeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithSDOName.xsd "> + <SimpleTypeWithSDONameElement>SimpleTypeWithSDONameElement</SimpleTypeWithSDONameElement> +</tns:SimpleTypeWithSDOName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd new file mode 100644 index 0000000000..89b00a36cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd @@ -0,0 +1,37 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdo="commonj.sdo"> + + <simpleType name="SimpleTypeWithSDONameType" sdo:name="SimpleTypeWithSDONameTypeSDOName"> + <restriction base="string"/> + </simpleType> + + + <complexType name="SimpleTypeWithSDONameComplexType"> + <sequence> + <element name="SimpleTypeWithSDONameElement" type="tns:SimpleTypeWithSDONameType"/> + </sequence> + </complexType> + + <element name="SimpleTypeWithSDOName" type="tns:SimpleTypeWithSDONameComplexType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml new file mode 100644 index 0000000000..399b0d8175 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml @@ -0,0 +1,25 @@ +<?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. +--> +<tns:SimpleTypeWithUnion xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithUnion.xsd "> + <SimpleTypeWithUnionElement>EN</SimpleTypeWithUnionElement> + <SimpleTypeWithUnionElement>01:02:03</SimpleTypeWithUnionElement> +</tns:SimpleTypeWithUnion> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd new file mode 100644 index 0000000000..fee04b9f24 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd @@ -0,0 +1,46 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:sdoJava="commonj.sdo"> + + <simpleType name="SimpleTypeWithUnionType"> + <union> + <simpleType> + <restriction base="language"> + </restriction> + </simpleType> + <simpleType> + <restriction base="time"> + </restriction> + </simpleType> + </union> + </simpleType> + + + <complexType name="SimpleTypeWithUnionComplexType"> + <sequence> + <element name="SimpleTypeWithUnionElement" type="tns:SimpleTypeWithUnionType" minOccurs="2" maxOccurs="2"/> + </sequence> + </complexType> + + <element name="SimpleTypeWithUnion" type="SimpleTypeWithUnionComplexType"> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml new file mode 100644 index 0000000000..bc8cf35368 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml @@ -0,0 +1,26 @@ +<?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. +--> + <SimpleTypeWithoutName xmlns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithoutName.xsd"> + <SimpleTypeWithoutNameElement> + SimpleTypeWithoutName + </SimpleTypeWithoutNameElement> +</SimpleTypeWithoutName> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd new file mode 100644 index 0000000000..536aa822de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd @@ -0,0 +1,38 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <element name="SimpleTypeWithoutNameElement"> + <simpleType> + <restriction base="string"/> + </simpleType> + </element> + + + <complexType name="SimpleTypeWithoutNameComplexType"> + <sequence> + <element ref="tns:SimpleTypeWithoutNameElement"/> + </sequence> + </complexType> + + <element name="SimpleTypeWithoutName" type="SimpleTypeWithoutNameComplexType"> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml new file mode 100644 index 0000000000..da2929776e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml @@ -0,0 +1,24 @@ +<?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. +--> +<tns:TargetNamespace xmlns:tns="http://www.apache.org/tuscany/interop" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.apache.org/tuscany/interop TargetNamespace.xsd"> + <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName> +</tns:TargetNamespace> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd new file mode 100644 index 0000000000..ace5427786 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd @@ -0,0 +1,34 @@ +<?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 xmlns="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.apache.org/tuscany/interop" + xmlns:tns="http://www.apache.org/tuscany/interop"> + + <!-- top level test type --> + <complexType name="TargetNamespaceComplexType"> + <sequence> + <!-- simple types --> + <element name="SimpleTypeWithName" type="string"/> + + </sequence> + </complexType> + + <element name="TargetNamespace" type="tns:TargetNamespaceComplexType"/> +</schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/datagraph.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/datagraph.xsd new file mode 100644 index 0000000000..e6b9697a8d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/datagraph.xsd @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +/** + * <copyright> + * + * Service Data Objects + * Version 2.1.0 + * Licensed Materials + * + * (c) Copyright BEA Systems, Inc., International Business Machines Corporation, + * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG., + * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, + * 2005, 2006. All rights reserved. + * + * </copyright> + * + */ +--> + +<xsd:schema + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:sdo="commonj.sdo" + xmlns:sdoJava="commonj.sdo/java" + targetNamespace="commonj.sdo"> + + <xsd:element name="datagraph" type="sdo:DataGraphType"/> + + <xsd:complexType name="DataGraphType"> + <xsd:complexContent> + <xsd:extension base="sdo:BaseDataGraphType"> + <xsd:sequence> + <xsd:any minOccurs="0" maxOccurs="1" namespace="##other" processContents="lax"/> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <xsd:complexType name="BaseDataGraphType" abstract="true"> + <xsd:sequence> + <xsd:element name="models" type="sdo:ModelsType" minOccurs="0"/> + <xsd:element name="xsd" type="sdo:XSDType" minOccurs="0"/> + <xsd:element name="changeSummary" type="sdo:ChangeSummaryType" minOccurs="0"/> + </xsd:sequence> + <xsd:anyAttribute namespace="##other" processContents="lax"/> + </xsd:complexType> + + <xsd:complexType name="ModelsType"> + <xsd:annotation> + <xsd:documentation> + Expected type is emof:Package. + </xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="XSDType"> + <xsd:annotation> + <xsd:documentation> + Expected type is xsd:schema. + </xsd:documentation> + </xsd:annotation> + <xsd:sequence> + <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/> + </xsd:sequence> + </xsd:complexType> + +<!-- FB TEMP --> + <xsd:simpleType name="ChangeSummaryType" sdoJava:instanceClass="commonj.sdo.ChangeSummary"> + <xsd:restriction base="xsd:string"/> + </xsd:simpleType> +<!-- + <xsd:complexType name="ChangeSummaryType"> + <xsd:sequence> + <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/> + </xsd:sequence> + <xsd:attribute name="create" type="xsd:string"/> + <xsd:attribute name="delete" type="xsd:string"/> + <xsd:attribute name="logging" type="xsd:boolean"/> + </xsd:complexType> +--> + + <xsd:attribute name="ref" type="xsd:string"/> + <xsd:attribute name="unset" type="xsd:string"/> + +</xsd:schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd new file mode 100644 index 0000000000..7387568942 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +/** + * <copyright> + * + * Service Data Objects + * Version 2.1.0 + * Licensed Materials + * + * (c) Copyright BEA Systems, Inc., International Business Machines Corporation, + * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG., + * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, + * 2005, 2006. All rights reserved. + * + * </copyright> + * + */ +--> + +<xsd:schema + targetNamespace="commonj.sdo/java" + xmlns:sdoJava="commonj.sdo/java" + xmlns:sdo="commonj.sdo" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + +<xsd:import namespace="commonj.sdo" schemaLocation="sdoModel.xsd"/> + +<!-- + These attributes are used to customize the Java mapping of + XSD to SDO Types and Properties. +--> + +<xsd:attribute name="package" type="xsd:string" /> +<xsd:attribute name="instanceClass" type="xsd:string" /> +<xsd:attribute name="extendedInstanceClass" type="xsd:string" /> +<xsd:attribute name="nestedInterfaces" type="xsd:boolean" /> + +<!-- + Global properties used in open content for + the Java binding of SDO Types and Properties. +--> + +<xsd:attribute name="javaClass" type="sdo:String"/> + +<!-- JavaInfo deprecated in 2.1.0 --> +<xsd:complexType name="JavaInfo"> + <xsd:attribute name="javaClass" type="sdo:String"/> +</xsd:complexType> + +<!-- + The Java object data types. +--> + +<xsd:simpleType name="BooleanObject" sdoJava:instanceClass="java.lang.Boolean"> + <xsd:restriction base="xsd:boolean"/> +</xsd:simpleType> + +<xsd:simpleType name="ByteObject" sdoJava:instanceClass="java.lang.Byte"> + <xsd:restriction base="xsd:byte"/> +</xsd:simpleType> + +<xsd:simpleType name="CharacterObject" sdoJava:instanceClass="java.lang.Character"> + <xsd:restriction base="xsd:string"/> +</xsd:simpleType> + +<xsd:simpleType name="DoubleObject" sdoJava:instanceClass="java.lang.Double"> + <xsd:restriction base="xsd:double"/> +</xsd:simpleType> + +<xsd:simpleType name="FloatObject" sdoJava:instanceClass="java.lang.Float"> + <xsd:restriction base="xsd:float"/> +</xsd:simpleType> + +<xsd:simpleType name="IntObject" sdoJava:instanceClass="java.lang.Integer"> + <xsd:restriction base="xsd:int"/> +</xsd:simpleType> + +<xsd:simpleType name="LongObject" sdoJava:instanceClass="java.lang.Long"> + <xsd:restriction base="xsd:long"/> +</xsd:simpleType> + +<xsd:simpleType name="ShortObject" sdoJava:instanceClass="java.lang.Short"> + <xsd:restriction base="xsd:short"/> +</xsd:simpleType> + +</xsd:schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd new file mode 100644 index 0000000000..c5aabc9cc8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd @@ -0,0 +1,221 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +/** + * <copyright> + * + * Service Data Objects + * Version 2.1.0 + * Licensed Materials + * + * (c) Copyright BEA Systems, Inc., International Business Machines Corporation, + * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG., + * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies, + * 2005, 2006. All rights reserved. + * + * </copyright> + * + */ + +--> + +<xsd:schema + targetNamespace="commonj.sdo" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:sdo="commonj.sdo" + xmlns:sdoXML="commonj.sdo/xml" + xmlns:sdoJava="commonj.sdo/java" + elementFormDefault="qualified" + xsi:schemaLocation="commonj.sdo/xml sdoXML.xsd + commonj.sdo/java sdoJava.xsd"> + +<xsd:include schemaLocation="datagraph.xsd"/> + +<!-- Root element for defining several Types in one document. + Is not part of the model. +--> +<xsd:element name="types" type="sdo:Types"/> +<xsd:complexType name="Types"> + <xsd:sequence> + <xsd:element name="type" type="sdo:Type" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> +</xsd:complexType> + +<!-- Any data object may be serialized with this element, + with xsi:type to declare the + actual type of the DataObject serialized. +--> +<xsd:element name="dataObject" type="xsd:anyType"/> + +<!-- Model Types + SDO Type and Property are defined in terms of themselves. +--> +<xsd:element name="type" type="sdo:Type"/> +<xsd:complexType name="Type"> + <xsd:sequence> + <xsd:element name="baseType" type="sdo:URI" + minOccurs="0" maxOccurs="unbounded" + sdoXML:propertyType="sdo:Type" /> + <xsd:element name="property" type="sdo:Property" + minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="aliasName" type="sdo:String" + minOccurs="0" maxOccurs="unbounded" /> + <xsd:any namespace="##other" processContents="lax" + minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:ID" sdoXML:dataType="sdo:String"/> + <xsd:attribute name="uri" type="sdo:URI"/> + <xsd:attribute name="dataType" type="sdo:Boolean"/> + <xsd:attribute name="open" type="sdo:Boolean"/> + <xsd:attribute name="sequenced" type="sdo:Boolean"/> + <xsd:attribute name="abstract" type="sdo:Boolean"/> + <xsd:anyAttribute namespace="##any" processContents="lax"/> +</xsd:complexType> + +<xsd:complexType name="Property"> + <xsd:sequence> + <xsd:element name="aliasName" type="sdo:String" + minOccurs="0" maxOccurs="unbounded" /> + <xsd:any namespace="##other" processContents="lax" + minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attribute name="name" type="sdo:String"/> + <xsd:attribute name="many" type="sdo:Boolean"/> + <xsd:attribute name="containment" type="sdo:Boolean"/> + <xsd:attribute name="default" type="sdo:String"/> + <xsd:attribute name="readOnly" type="sdo:Boolean"/> + <xsd:attribute name="type" type="sdo:URI" sdoXML:propertyType="sdo:Type"/> + <xsd:attribute name="opposite" type="sdo:URI" sdoXML:propertyType="sdo:Property"/> + <xsd:attribute name="nullable" type="sdo:Boolean"/> + <xsd:anyAttribute namespace="##any" processContents="lax"/> +</xsd:complexType> + +<!-- Special Types --> +<xsd:complexType name="DataObject" abstract="true"/> + +<!-- TextType deprecated in 2.1.0 --> + <xsd:complexType name="TextType" abstract="true"> + <xsd:sequence> + <xsd:element name="text" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/> + </xsd:sequence> + </xsd:complexType> + +<!-- ChangeSummaryType is defined in datagraph.xsd. + Although declared there as a ComplexType, + at the model level it is treated as a SimpleType + with a special XML serialization. +--> + +<!-- Data Types --> +<xsd:simpleType name="Boolean" sdoJava:instanceClass="boolean"> + <xsd:restriction base="xsd:boolean"/> +</xsd:simpleType> + +<xsd:simpleType name="Byte" sdoJava:instanceClass="byte"> + <xsd:restriction base="xsd:byte"/> +</xsd:simpleType> + +<xsd:simpleType name="Bytes" sdoJava:instanceClass="byte[]"> + <xsd:restriction base="xsd:hexBinary"/> +</xsd:simpleType> + +<xsd:simpleType name="Character" sdoJava:instanceClass="char"> + <xsd:restriction base="xsd:string"/> +</xsd:simpleType> + +<xsd:simpleType name="Date" sdoJava:instanceClass="java.util.Date"> + <xsd:restriction base="xsd:dateTime"/> +</xsd:simpleType> + +<xsd:simpleType name="DateTime" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:dateTime"/> +</xsd:simpleType> + +<xsd:simpleType name="Day" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:gDay"/> +</xsd:simpleType> + +<xsd:simpleType name="Decimal" sdoJava:instanceClass="java.math.BigDecimal"> + <xsd:restriction base="xsd:decimal"/> +</xsd:simpleType> + +<xsd:simpleType name="Double" sdoJava:instanceClass="double"> + <xsd:restriction base="xsd:double"/> +</xsd:simpleType> + +<xsd:simpleType name="Duration" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:duration"/> +</xsd:simpleType> + +<xsd:simpleType name="Float" sdoJava:instanceClass="float"> + <xsd:restriction base="xsd:float"/> +</xsd:simpleType> + +<xsd:simpleType name="Int" sdoJava:instanceClass="int"> + <xsd:restriction base="xsd:int"/> +</xsd:simpleType> + +<xsd:simpleType name="Integer" sdoJava:instanceClass="java.math.BigInteger"> + <xsd:restriction base="xsd:integer"/> +</xsd:simpleType> + +<xsd:simpleType name="Long" sdoJava:instanceClass="long"> + <xsd:restriction base="xsd:long"/> +</xsd:simpleType> + +<xsd:simpleType name="Month" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:gMonth"/> +</xsd:simpleType> + +<xsd:simpleType name="MonthDay" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:gMonthDay"/> +</xsd:simpleType> + +<xsd:simpleType name="Object" sdoJava:instanceClass="java.lang.Object"> + <!-- Only the schema for schemas is allowed to restrict anySimpleType. + <xsd:restriction base="xsd:anySimpleType"/> + The equivalent declaration is a union of the predefined XSD data types. + --> + <xsd:union memberTypes="xsd:anyURI xsd:base64Binary xsd:boolean xsd:byte + xsd:date xsd:dateTime xsd:decimal xsd:double xsd:duration xsd:ENTITIES xsd:ENTITY xsd:float + xsd:gDay xsd:gMonth xsd:gMonthDay xsd:gYear xsd:gYearMonth xsd:hexBinary xsd:ID xsd:IDREF xsd:IDREFS + xsd:int xsd:integer xsd:language xsd:long xsd:Name xsd:NCName xsd:negativeInteger + xsd:NMTOKEN xsd:NMTOKENS xsd:nonNegativeInteger xsd:nonPositiveInteger + xsd:normalizedString xsd:NOTATION xsd:positiveInteger xsd:QName xsd:short xsd:string + xsd:time xsd:token xsd:unsignedByte xsd:unsignedInt xsd:unsignedLong xsd:unsignedShort"/> +</xsd:simpleType> + +<xsd:simpleType name="Short" sdoJava:instanceClass="short"> + <xsd:restriction base="xsd:short"/> +</xsd:simpleType> + +<xsd:simpleType name="String" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:string"/> +</xsd:simpleType> + +<xsd:simpleType name="Strings" sdoJava:instanceClass="java.util.List"> + <xsd:restriction base="xsd:string"/> +</xsd:simpleType> + +<xsd:simpleType name="Time" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:time"/> +</xsd:simpleType> + +<xsd:simpleType name="Year" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:gYear"/> +</xsd:simpleType> + +<xsd:simpleType name="YearMonth" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:gYearMonth"/> +</xsd:simpleType> + +<xsd:simpleType name="YearMonthDay" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:date"/> +</xsd:simpleType> + +<xsd:simpleType name="URI" sdoJava:instanceClass="java.lang.String"> + <xsd:restriction base="xsd:anyURI"/> +</xsd:simpleType> + +</xsd:schema> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java new file mode 100644 index 0000000000..fa3f310d4d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java @@ -0,0 +1,49 @@ +/* + * 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.itest.generate; + +import junit.framework.TestCase; + + +/** + * + */ +public class GenerateTestCase extends TestCase { + + //private Generate generator = null; + + @Override + protected void setUp() throws Exception { + //generator = new Generate(); + } + + @Override + protected void tearDown() { + } + + /** + * Invokes the Generate class to generate databinding test classes and resources. + * + * @throws Exception + */ + public void testGenerate() throws Exception { + //generator.generate(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/config.png b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/config.png Binary files differnew file mode 100644 index 0000000000..7912019e9d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/config.png diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/config.svg b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/config.svg new file mode 100644 index 0000000000..aaf027e2df --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/config.svg @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + * 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. +--> + +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg3168" + sodipodi:version="0.32" + inkscape:version="0.44" + sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings" + sodipodi:docname="config.svg"> + <defs + id="defs3170" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.7" + inkscape:cx="375" + inkscape:cy="748.57143" + inkscape:document-units="px" + inkscape:current-layer="layer1" + inkscape:window-width="990" + inkscape:window-height="664" + inkscape:window-x="103" + inkscape:window-y="84" /> + <metadata + id="metadata3173"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <flowRoot + xml:space="preserve" + id="flowRoot3194" + inkscape:export-xdpi="52.84" + inkscape:export-ydpi="52.84"><flowRegion + id="flowRegion3196"><rect + id="rect3198" + width="505.71429" + height="531.42859" + x="94.285713" + y="83.790756" /></flowRegion><flowPara + id="flowPara3200"><tns:Generate ...></flowPara><flowPara + id="flowPara3202"> <Template></flowPara><flowPara + id="flowPara3204"> <TemplateName>greeter.composite.vm</TemplateName></flowPara><flowPara + id="flowPara3206"> <TemplateTargetDir>classes</TemplateTargetDir></flowPara><flowPara + id="flowPara3208"> </Template></flowPara><flowPara + id="flowPara3210"> ...</flowPara><flowPara + id="flowPara3212"> </flowPara><flowPara + id="flowPara3214"> <InputFile></flowPara><flowPara + id="flowPara3216"> <FileName>Person.xsd</FileName></flowPara><flowPara + id="flowPara3218"> <FilePath>xsd</FilePath></flowPara><flowPara + id="flowPara3220"> <JavaPackage>org.apache.tuscany.sca.itest.databinding.types</JavaPackage></flowPara><flowPara + id="flowPara3222"> <Factory>TypesFactory</Factory></flowPara><flowPara + id="flowPara3224"> <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace></flowPara><flowPara + id="flowPara3226"> <Prefix>p</Prefix></flowPara><flowPara + id="flowPara3228"> <Type></flowPara><flowPara + id="flowPara3230"> <TypeName>PersonType</TypeName></flowPara><flowPara + id="flowPara3232"> <CreateTypeCode></flowPara><flowPara + id="flowPara3234"> TypesFactory factory = TypesFactory.INSTANCE;</flowPara><flowPara + id="flowPara3236"> param = factory.createPersonType();</flowPara><flowPara + id="flowPara3238"> param.setFirstName("George");</flowPara><flowPara + id="flowPara3240"> param.setLastName("Doors");</flowPara><flowPara + id="flowPara3242"> </CreateTypeCode></flowPara><flowPara + id="flowPara3244"> <ModifyTypeCode></flowPara><flowPara + id="flowPara3246"> param.setGreeting("Hello");</flowPara><flowPara + id="flowPara3248"> </ModifyTypeCode></flowPara><flowPara + id="flowPara3250"> <ResultComparison></flowPara><flowPara + id="flowPara3252"> assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting());</flowPara><flowPara + id="flowPara3254"> </ResultComparison></flowPara><flowPara + id="flowPara3256"> </Type></flowPara><flowPara + id="flowPara3258"> </InputFile></flowPara><flowPara + id="flowPara3260"> ...</flowPara><flowPara + id="flowPara3262"></flowPara><flowPara + id="flowPara3264"></tns:Generate></flowPara></flowRoot> </g> +</svg> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/databinding.png b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/databinding.png Binary files differnew file mode 100644 index 0000000000..76a9c71b7d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/databinding.png diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/databinding.svg b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/databinding.svg new file mode 100644 index 0000000000..d6850ccf7d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/databinding.svg @@ -0,0 +1,242 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + * 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. +--> + +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="1052.3622" + height="744.09448" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.44" + sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings" + sodipodi:docname="databinding.svg" + version="1.0" + inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings\databinding.png" + inkscape:export-xdpi="52.84" + inkscape:export-ydpi="52.84"> + <defs + id="defs4"> + <marker + inkscape:stockid="Arrow2Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow2Lend" + style="overflow:visible;"> + <path + id="path3078" + style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + transform="scale(1.1) rotate(180) translate(1,0)" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.4" + inkscape:cx="499.13602" + inkscape:cy="337.74555" + inkscape:document-units="px" + inkscape:current-layer="layer1" + inkscape:window-width="1180" + inkscape:window-height="775" + inkscape:window-x="36" + inkscape:window-y="42" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <g + id="g2997" + transform="matrix(1.084673,0,0,0.856154,-21.78728,27.4907)"> + <rect + rx="15.307091" + ry="15.260983" + y="192.00233" + x="258.31146" + height="360.71414" + width="495.71429" + id="rect2067" + style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.07541251;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <flowRoot + id="flowRoot2954" + xml:space="preserve"><flowRegion + id="flowRegion2956"><rect + y="212.66591" + x="281.42856" + height="61.42857" + width="170" + id="rect2958" /></flowRegion><flowPara + id="flowPara2960">GreeterService</flowPara></flowRoot> </g> + <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect2988" + width="115.66247" + height="85.862968" + x="312.05917" + y="258.59619" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot2966" + transform="translate(44.4684,52.65764)"><flowRegion + id="flowRegion2968"><rect + id="rect2970" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara2972">DefaultGreeter</flowPara><flowPara + id="flowPara2019">ServiceClient</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 294.90867,290.44317 L 328.24371,290.44317 L 334.30462,303.57515 L 327.23356,315.69699 L 294.90867,315.69699 L 302.48482,303.57515 L 294.90867,290.44317 z " + id="path3017" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 408.16111,288.60489 L 441.49615,288.60489 L 447.55706,301.73687 L 440.486,313.85871 L 408.16111,313.85871 L 415.73726,301.73687 L 408.16111,288.60489 z " + id="path3019" /> + <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect1985" + width="115.66247" + height="85.862968" + x="642.96918" + y="315.88455" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot1987" + transform="translate(375.3784,109.946)"><flowRegion + id="flowRegion1989"><rect + id="rect1991" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara1993">GreeterService</flowPara><flowPara + id="flowPara2017">Component</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 625.81867,347.73153 L 659.15371,347.73153 L 665.21462,360.86351 L 658.14356,372.98535 L 625.81867,372.98535 L 633.39482,360.86351 L 625.81867,347.73153 z " + id="path1997" /> + <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect2001" + width="115.66247" + height="85.862968" + x="313.68344" + y="371.59885" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot2003" + transform="translate(46.09269,165.6602)"><flowRegion + id="flowRegion2005"><rect + id="rect2007" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara2009">WSGreeter</flowPara><flowPara + id="flowPara2021">ServiceClient</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 296.53296,403.44581 L 329.868,403.44581 L 335.92891,416.57779 L 328.85785,428.69963 L 296.53296,428.69963 L 304.10911,416.57779 L 296.53296,403.44581 z " + id="path2013" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 409.7854,401.60753 L 443.12044,401.60753 L 449.18135,414.73951 L 442.11029,426.86135 L 409.7854,426.86135 L 417.36155,414.73951 L 409.7854,401.60753 z " + id="path2015" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Lend);stroke-opacity:1" + d="M 447.14297,301.23734 L 527.11201,301.95163 L 526.12473,354.09448 L 626.8265,354.80877" + id="path2039" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 463.87333,395.75343 L 516.54902,395.75343 L 526.12641,417.42827 L 514.95279,437.43583 L 463.87333,437.43583 L 475.84509,417.42827 L 463.87333,395.75343 z " + id="path3108" + inkscape:transform-center-y="-33.571429" + inkscape:transform-center-x="31.706144" /> + <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 535.3019,397.182 L 577.70287,397.182 L 585.41213,416.99969 L 576.41799,435.29297 L 535.3019,435.29297 L 544.93849,416.99969 L 535.3019,397.182 z " + id="path3110" /> + <flowRoot + xml:space="preserve" + id="flowRoot3112" + transform="matrix(0.778099,0,0,0.884748,255.7727,214.0266)"><flowRegion + id="flowRegion3114"><rect + id="rect3116" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3120">WS</flowPara><flowPara + id="flowPara3124">Reference</flowPara></flowRoot> <flowRoot + xml:space="preserve" + id="flowRoot3128" + transform="matrix(0.778099,0,0,0.884748,324.368,215.5376)"><flowRegion + id="flowRegion3130"><rect + id="rect3132" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3134">WS</flowPara><flowPara + id="flowPara3136">Service</flowPara></flowRoot> <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="M 447.85714,415.52305 L 475.71429,415.52305" + id="path3138" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="M 525.71429,417.66591 L 543.57143,417.66591" + id="path3140" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)" + d="M 585.71429,416.23734 L 599.28571,416.23734 L 600,364.80877 L 629.28571,364.80877" + id="path3142" /> + </g> +</svg> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop.png b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop.png Binary files differnew file mode 100644 index 0000000000..005e0f24ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop.png diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop.svg b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop.svg new file mode 100644 index 0000000000..03897c6d09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop.svg @@ -0,0 +1,352 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + * 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. +--> + +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="1052.3622" + height="744.09448" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.44" + sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings" + sodipodi:docname="interop.svg" + version="1.0" + inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings\interop.png" + inkscape:export-xdpi="52.84" + inkscape:export-ydpi="52.84"> + <defs + id="defs4"> + <marker + inkscape:stockid="Arrow2Lend" + orient="auto" + refY="0.0" + refX="0.0" + id="Arrow2Lend" + style="overflow:visible;"> + <path + id="path3078" + style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;" + d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " + transform="scale(1.1) rotate(180) translate(1,0)" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.4" + inkscape:cx="428.95418" + inkscape:cy="356.33178" + inkscape:document-units="px" + inkscape:current-layer="g2997" + inkscape:window-width="1234" + inkscape:window-height="800" + inkscape:window-x="27" + inkscape:window-y="108" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <g + id="g2997" + transform="matrix(0.979246,0,0,1.158467,-105.7257,-23.34339)"> + <rect + rx="25.230545" + ry="12.196672" + y="179.85953" + x="146.34595" + height="288.28497" + width="817.08154" + id="rect2067" + style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.87776983;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <flowRoot + id="flowRoot2954" + xml:space="preserve" + transform="translate(-102.7603,-25.12021)"><flowRegion + id="flowRegion2956"><rect + y="212.66591" + x="281.42856" + height="61.42857" + width="170" + id="rect2958" /></flowRegion><flowPara + id="flowPara2960">InteropGreeterService</flowPara></flowRoot> </g> + <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3332" + width="115.66247" + height="85.862968" + x="77.514153" + y="231.09024" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot3334" + transform="translate(-185.0766,21.58025)"><flowRegion + id="flowRegion3336"><rect + id="rect3338" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3340">SDO</flowPara><flowPara + id="flowPara3379">DefaultGreeter</flowPara><flowPara + id="flowPara2019">ServiceClient</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 60.363662,262.93721 L 93.698702,262.93721 L 99.759609,276.06919 L 92.688552,288.19103 L 60.363662,288.19103 L 67.939812,276.06919 L 60.363662,262.93721 z " + id="path3343" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 173.6161,261.09893 L 206.95114,261.09893 L 213.01205,274.23091 L 205.94099,286.35275 L 173.6161,286.35275 L 181.19225,274.23091 L 173.6161,261.09893 z " + id="path3345" /> + <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect1985" + width="115.66247" + height="85.862968" + x="681.65045" + y="289.48157" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot1987" + transform="translate(423.3454,80.68594)"><flowRegion + id="flowRegion1989"><rect + id="rect1991" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara1993">SDO</flowPara><flowPara + id="flowPara3399">GreeterService</flowPara><flowPara + id="flowPara2017">Component</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 664.49995,321.32854 L 697.83499,321.32854 L 703.8959,334.46052 L 696.82484,346.58236 L 664.49995,346.58236 L 672.0761,334.46052 L 664.49995,321.32854 z " + id="path1997" /> + <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect2001" + width="115.66247" + height="85.862968" + x="76.281281" + y="356.23575" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot2003" + transform="translate(-185.5951,150.2971)"><flowRegion + id="flowRegion2005"><rect + id="rect2007" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara2009">SDO</flowPara><flowPara + id="flowPara3401">WSGreeter</flowPara><flowPara + id="flowPara2021">ServiceClient</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 59.130809,388.08271 L 92.465849,388.08271 L 98.526759,401.21469 L 91.455699,413.33653 L 59.130809,413.33653 L 66.706959,401.21469 L 59.130809,388.08271 z " + id="path2013" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 172.38325,386.24443 L 205.71829,386.24443 L 211.7792,399.37641 L 204.70814,411.49825 L 172.38325,411.49825 L 179.9594,399.37641 L 172.38325,386.24443 z " + id="path2015" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 226.47114,380.39017 L 271.82375,380.39017 L 280.06966,400.95073 L 270.44943,419.92971 L 226.47114,419.92971 L 236.77856,400.95073 L 226.47114,380.39017 z " + id="path3108" + inkscape:transform-center-y="-31.845711" + inkscape:transform-center-x="27.298337" /> + <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 286.59013,381.79328 L 328.89058,381.79328 L 336.58156,401.62413 L 327.60875,419.92957 L 286.59013,419.92957 L 296.20387,401.62413 L 286.59013,381.79328 z " + id="path3110" /> + <flowRoot + xml:space="preserve" + id="flowRoot3112" + transform="matrix(0.654898,0,0,0.869049,51.92158,201.8882)"><flowRegion + id="flowRegion3114"><rect + id="rect3116" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3120">WS</flowPara><flowPara + id="flowPara3124">Reference</flowPara></flowRoot> <flowRoot + xml:space="preserve" + id="flowRoot3128" + transform="matrix(0.654898,0,0,0.869049,112.0605,203.3723)"><flowRegion + id="flowRegion3130"><rect + id="rect3132" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3134">WS</flowPara><flowPara + id="flowPara3136">Service</flowPara></flowRoot> <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3381" + width="115.66247" + height="85.862968" + x="376.54059" + y="229.73444" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot3383" + transform="translate(113.9499,20.22444)"><flowRegion + id="flowRegion3385"><rect + id="rect3387" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3389">JAXB</flowPara><flowPara + id="flowPara3391">DefaultGreeter</flowPara><flowPara + id="flowPara3393">ServiceClient</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 359.39009,261.5814 L 392.72513,261.5814 L 398.78604,274.71338 L 391.71498,286.83522 L 359.39009,286.83522 L 366.96624,274.71338 L 359.39009,261.5814 z " + id="path3395" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 472.64253,259.74312 L 505.97757,259.74312 L 512.03848,272.8751 L 504.96742,284.99694 L 472.64253,284.99694 L 480.21868,272.8751 L 472.64253,259.74312 z " + id="path3397" /> + <rect + style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect3403" + width="115.66247" + height="85.862968" + x="375.19193" + y="355.69083" + rx="6.9961648" + ry="7.1230249" /> + <flowRoot + xml:space="preserve" + id="flowRoot3405" + transform="translate(112.6012,146.1808)"><flowRegion + id="flowRegion3407"><rect + id="rect3409" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3411">JAXB</flowPara><flowPara + id="flowPara3413">WSGreeter</flowPara><flowPara + id="flowPara3415">ServiceClient</flowPara></flowRoot> <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 358.0414,387.53779 L 391.37644,387.53779 L 397.43735,400.66977 L 390.36629,412.79161 L 358.0414,412.79161 L 365.61755,400.66977 L 358.0414,387.53779 z " + id="path3417" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 471.29384,385.69951 L 504.62888,385.69951 L 510.68979,398.83149 L 503.61873,410.95333 L 471.29384,410.95333 L 478.86999,398.83149 L 471.29384,385.69951 z " + id="path3419" /> + <path + style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 531.84342,380.87285 L 577.19603,380.87285 L 585.44194,401.43341 L 575.82171,420.41239 L 531.84342,420.41239 L 542.15084,401.43341 L 531.84342,380.87285 z " + id="path3421" + inkscape:transform-center-y="-31.845711" + inkscape:transform-center-x="27.298337" /> + <path + style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 591.96241,382.27596 L 634.26286,382.27596 L 641.95384,402.10681 L 632.98103,420.41225 L 591.96241,420.41225 L 601.57615,402.10681 L 591.96241,382.27596 z " + id="path3423" /> + <flowRoot + xml:space="preserve" + id="flowRoot3425" + transform="matrix(0.654898,0,0,0.869049,357.2939,202.3709)"><flowRegion + id="flowRegion3427"><rect + id="rect3429" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3431">WS</flowPara><flowPara + id="flowPara3433">Reference</flowPara></flowRoot> <flowRoot + xml:space="preserve" + id="flowRoot3435" + transform="matrix(0.654898,0,0,0.869049,417.4328,203.855)"><flowRegion + id="flowRegion3437"><rect + id="rect3439" + width="170" + height="61.42857" + x="281.42856" + y="212.66591" /></flowRegion><flowPara + id="flowPara3441">WS</flowPara><flowPara + id="flowPara3443">Service</flowPara></flowRoot> <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 212.14286,274.09448 L 366.42857,274.80877" + id="path3447" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 512.14286,272.66591 L 599.28571,272.66591 L 599.28571,325.52305 L 665.71429,325.52305" + id="path3453" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 210.71429,399.80877 L 235.71429,399.80877" + id="path3455" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 278.57143,401.23734 L 295.71429,401.23734" + id="path3459" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 336.42857,401.95163 L 365.71429,401.95163" + id="path3461" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 510.71429,399.80877 L 540.71429,399.80877" + id="path3463" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 585,401.95163 L 600.71429,401.95163" + id="path3465" /> + <path + style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="M 641.42857,402.66591 L 657.14286,402.66591 L 657.85714,339.09448 L 669.28571,339.09448" + id="path3467" /> + </g> +</svg> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/pom.xml new file mode 100644 index 0000000000..e9090de627 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/pom.xml @@ -0,0 +1,223 @@ +<?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. +--> +<project> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + + <artifactId>itest-databindings-interop</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Apache Tuscany SCA DataBinding Interop Integration Tests</name> + + <repositories> + <repository> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>http://download.java.net/maven/1</url> + <layout>legacy</layout> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>http://download.java.net/maven/1</url> + <layout>legacy</layout> + </pluginRepository> + </pluginRepositories> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-jaxb</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-axiom</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>2.1.4</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>com.sun.xml.ws</groupId> + <artifactId>jaxws-rt</artifactId> + <version>2.1.1</version> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings-common</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings-sdo</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings-jaxb</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-interface-java-xml</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <argLine>-Djava.endorsed.dirs=target/endorsed</argLine> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings-common</artifactId> + <version>${project.version}</version> + <overWrite>true</overWrite> + <outputDirectory>${project.build.directory}/classes</outputDirectory> + </artifactItem> + </artifactItems> + </configuration> + </execution> + <execution> + <id>copy</id> + <phase>generate-sources</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <type>jar</type> + </artifactItem> + <artifactItem> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + <type>jar</type> + </artifactItem> + </artifactItems> + <outputDirectory>${project.build.directory}/endorsed</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-test-source</id> + <phase>process-resources</phase> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass> + <arguments> + <argument>${project.build.directory}</argument> + </arguments> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm new file mode 100644 index 0000000000..7bdfc57924 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm @@ -0,0 +1,113 @@ +/* + * 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 $template.getJavaPackage(); + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import ${template.getJavaPackage()}.GreeterService; + +// Data types +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) +import $file.getJavaPackage().$typeInstance.getTypeName(); +import $file.getJavaPackage().$file.getFactory(); +#end +#end + +/** + * Automatically generated test case. Calls the greeter client for a number of + * bindings and a number of data types. + * + * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $ + */ +public class InteropDatabindingTestCase extends TestCase { + + private static boolean initalised = false; + private GreeterService greeterClient; + private static SCADomain domain; + + /** + * Runs before each test method + */ + protected void setUp() throws Exception { + if (!initalised) { + domain = SCADomain.newInstance("interopgreeter.composite"); + super.setUp(); + initalised = true; + } + } + + /** + * Runs after each test method + */ + protected void tearDown() { + + } + + /** + * Finds the SCA component that relates to the protocol being tested. This test + * always connects locally to the client component but the client component will + * connect to the back end component using the appropriate protocol + * + * @param ext the protcol required + */ + private void setUpClient(String ext) throws Exception { + greeterClient = domain.getService(GreeterService.class, "SDO" + ext + "GreeterServiceClient"); + } + + /** + * Invokes the SDO Greet service using web service bindings with SDO payload + */ + public void testWSGreet() throws Exception { + setUpClient("WS"); + greet(); + } + + /** + * Invokes the SDO Greet service using default bindings with SDO payload + */ + public void testDefaultGreet() throws Exception { + setUpClient("Default"); + greet(); + } + + /** + * A generic method which, regarless of which client is connected, sends out a + * series of requrests passing different data types. + */ + public void greet() { +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + + // test $typeInstance.getTypeName() + { + $typeInstance.getTypeName() param = null; + $typeInstance.getCreateTypeCode() + $typeInstance.getTypeName() result = greeterClient.greet$typeInstance.getTypeName()(param); + $typeInstance.getResultComparison() + } +#end +#end + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm new file mode 100644 index 0000000000..38bfccce0c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm @@ -0,0 +1,103 @@ +<?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. +--> +<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services/jaxb" + xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services/jaxb" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="Greeter"> + + <wsdl:types> + <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" +#foreach($file in $fileList) + xmlns:$file.getPrefix()="$file.getNamespace()" +#end + targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services/jaxb" + elementFormDefault="qualified"> + +#foreach($file in $fileList) + <xsd:import namespace="$file.getNamespace()" + schemaLocation="../xsd/$file.getFileName()" /> +#end + +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <element name="greet$typeInstance.getTypeName()"> + <complexType> + <sequence> + <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" /> + </sequence> + </complexType> + </element> +#end +#end + </xsd:schema> + </wsdl:types> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + + <wsdl:message name="$typeInstance.getTypeName()Request"> + <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" /> + </wsdl:message> + <wsdl:message name="$typeInstance.getTypeName()Response"> + <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" /> + </wsdl:message> +#end +#end + + <wsdl:portType name="GreeterPortType"> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <wsdl:operation name="greet$typeInstance.getTypeName()"> + <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" /> + <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" /> + </wsdl:operation> +#end +#end + </wsdl:portType> + + <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <wsdl:operation name="greet$typeInstance.getTypeName()"> + <wsdlsoap:operation soapAction="" /> + <wsdl:input name="$typeInstance.getTypeName()RequestMsg"> + <wsdlsoap:body use="literal" /> + </wsdl:input> + <wsdl:output name="$typeInstance.getTypeName()ResponseMsg"> + <wsdlsoap:body use="literal" /> + </wsdl:output> + </wsdl:operation> +#end +#end + </wsdl:binding> + + <wsdl:service name="GreeterService"> + <wsdl:port name="GreeterPort" binding="tns:GreeterBinding"> + <wsdlsoap:address location="http://localhost:8085/services/JAXBGreeterServiceWebServiceBinding" /> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm new file mode 100644 index 0000000000..6f02af4c9d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm @@ -0,0 +1,103 @@ +<?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. +--> +<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services/sdo" + xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services/sdo" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="Greeter"> + + <wsdl:types> + <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" +#foreach($file in $fileList) + xmlns:$file.getPrefix()="$file.getNamespace()" +#end + targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services/sdo" + elementFormDefault="qualified"> + +#foreach($file in $fileList) + <xsd:import namespace="$file.getNamespace()" + schemaLocation="../xsd/$file.getFileName()" /> +#end + +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <element name="greet$typeInstance.getTypeName()"> + <complexType> + <sequence> + <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" /> + </sequence> + </complexType> + </element> +#end +#end + </xsd:schema> + </wsdl:types> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + + <wsdl:message name="$typeInstance.getTypeName()Request"> + <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" /> + </wsdl:message> + <wsdl:message name="$typeInstance.getTypeName()Response"> + <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" /> + </wsdl:message> +#end +#end + + <wsdl:portType name="GreeterPortType"> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <wsdl:operation name="greet$typeInstance.getTypeName()"> + <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" /> + <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" /> + </wsdl:operation> +#end +#end + </wsdl:portType> + + <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> +#foreach($file in $fileList) +#set($typeList = $file.getType_()) +#foreach($typeInstance in $typeList) + <wsdl:operation name="greet$typeInstance.getTypeName()"> + <wsdlsoap:operation soapAction="" /> + <wsdl:input name="$typeInstance.getTypeName()RequestMsg"> + <wsdlsoap:body use="literal" /> + </wsdl:input> + <wsdl:output name="$typeInstance.getTypeName()ResponseMsg"> + <wsdlsoap:body use="literal" /> + </wsdl:output> + </wsdl:operation> +#end +#end + </wsdl:binding> + + <wsdl:service name="GreeterService"> + <wsdl:port name="GreeterPort" binding="tns:GreeterBinding"> + <wsdlsoap:address location="http://localhost:8085/services/SDOGreeterServiceWebServiceBinding" /> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/generate.xml new file mode 100644 index 0000000000..8453dd56b4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/generate.xml @@ -0,0 +1,159 @@ +<?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. +--> +<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.example.org/generate generate.xsd "> + + <Template> + <TemplateName>InteropDatabindingTestCase.java.vm</TemplateName> + <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>interopgreeter.composite.vm</TemplateName> + <TemplateTargetDir>classes</TemplateTargetDir> + </Template> + <Template> + <TemplateName>SDOGreeter.wsdl.vm</TemplateName> + <TemplateTargetDir>classes/wsdl</TemplateTargetDir> + </Template> + <Template> + <TemplateName>JAXBGreeter.wsdl.vm</TemplateName> + <TemplateTargetDir>classes/wsdl</TemplateTargetDir> + </Template> + <InputFile> + <FileName>Person.xsd</FileName> + <FilePath>xsd</FilePath> + <JavaPackage>org.apache.tuscany.sca.itest.databinding.types</JavaPackage> + <Factory>TypesFactory</Factory> + <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace> + <Prefix>p</Prefix> + <Type> + <TypeName>PersonType</TypeName> + <CreateTypeCode> + TypesFactory factory = TypesFactory.INSTANCE; + param = factory.createPersonType(); + param.setFirstName("George"); + param.setLastName("Doors"); + </CreateTypeCode> + <ModifyTypeCode> + param.setGreeting("Hello"); + </ModifyTypeCode> + <ResultComparison> + assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting()); + </ResultComparison> + </Type> + </InputFile> + <InputFile> + <FileName>Interop.xsd</FileName> + <FilePath>xsd</FilePath> + <JavaPackage>org.apache.tuscany.interop</JavaPackage> + <Factory>InteropFactory</Factory> + <Namespace>http://www.apache.org/tuscany/interop</Namespace> + <Prefix>i</Prefix> + <!-- Type> + <TypeName>AnnotationComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createAnnotationComplexType(); + param.setSimpleTypeWithNameElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithNameElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement()); + </ResultComparison> + </Type--> + <Type> + <TypeName>AttributeComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + org.apache.tuscany.interop.AttributeType attrib = factory.createAttributeType(); + attrib.setAttribute("SomeText"); + param = factory.createAttributeComplexType(); + param.setAttributeElement(attrib); + </CreateTypeCode> + <ModifyTypeCode> + param.getAttributeElement().setAttribute("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute()); + </ResultComparison> + </Type> + <Type> + <TypeName>AttributeReferenceComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createAttributeReferenceComplexType(); + + param.setReferencedAttribute("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setReferencedAttribute("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute()); + </ResultComparison> + </Type> + <Type> + <TypeName>SimpleTypeWithAbstractComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createSimpleTypeWithAbstractComplexType(); + param.setSimpleTypeWithAbstractExtensionElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement()); + </ResultComparison> + </Type> + <Type> + <TypeName>SimpleTypeWithNameComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createSimpleTypeWithNameComplexType(); + param.setSimpleTypeWithNameElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithNameElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement()); + </ResultComparison> + </Type> + <Type> + <TypeName>ComplexTypeWithContentType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createComplexTypeWithContentType(); + param.setSimpleTypeWithName("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithName("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName()); + </ResultComparison> + </Type> + </InputFile> +</tns:Generate> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm new file mode 100644 index 0000000000..36797fde57 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm @@ -0,0 +1,78 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" + xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" + name="InteropGreeterService"> + + <!-- SDO factory classes --> + #foreach( $file in $fileList ) + <dbsdo:import.sdo factory="$file.getJavaPackage().$file.getFactory()"/> + #end + + <!-- Default binding test --> + <component name="SDODefaultGreeterServiceClient"> + <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" /> + <reference name="greeterService" target="JAXBDefaultGreeterServiceClient"/> + </component> + + <component name="JAXBDefaultGreeterServiceClient"> + <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" /> + <reference name="greeterService" target="SDODefaultGreeterServiceComponent"/> + </component> + + <component name="SDODefaultGreeterServiceComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" /> + </component> + + <!-- WS binding test --> + <component name="SDOWSGreeterServiceClient"> + <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" /> + </component> + + <reference name="JAXBWSGreeterServiceReference" promote="SDOWSGreeterServiceClient/greeterService"> + <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.interface(GreeterPortType)"/> + <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.port(GreeterService/GreeterPort)"/> + </reference> + + <service name="JAXBWSGreeterService" promote="JAXBWSGreeterServiceClient"> + <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.interface(GreeterPortType)"/> + <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.port(GreeterService/GreeterPort)"/> + </service> + + <component name="JAXBWSGreeterServiceClient"> + <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" /> + </component> + + <reference name="SDOWSGreeterServiceReference" promote="JAXBWSGreeterServiceClient/greeterService"> + <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.interface(GreeterPortType)"/> + <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.port(GreeterService/GreeterPort)"/> + </reference> + + <service name="SDOWSGreeterService" promote="SDOWSGreeterServiceComponent"> + <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.interface(GreeterPortType)"/> + <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.port(GreeterService/GreeterPort)"/> + </service> + + <component name="SDOWSGreeterServiceComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" /> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/pom.xml new file mode 100644 index 0000000000..b18e3d5939 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/pom.xml @@ -0,0 +1,251 @@ +<?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. +--> +<project> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + + <artifactId>itest-databindings-jaxb</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Apache Tuscany SCA JAXB Databinding Integration Tests</name> + + <repositories> + <repository> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>http://download.java.net/maven/1</url> + <layout>legacy</layout> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>http://download.java.net/maven/1</url> + <layout>legacy</layout> + </pluginRepository> + </pluginRepositories> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${pom.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-jaxb</artifactId> + <version>${pom.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-axiom</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings-common</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-interface-java-xml</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>2.1.4</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>com.sun.xml.ws</groupId> + <artifactId>jaxws-rt</artifactId> + <version>2.1.1</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <argLine>-Djava.endorsed.dirs=target/endorsed</argLine> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings-common</artifactId> + <version>${project.version}</version> + <overWrite>true</overWrite> + <outputDirectory>${project.build.directory}/classes</outputDirectory> + </artifactItem> + </artifactItems> + </configuration> + </execution> + <execution> + <id>copy</id> + <phase>generate-sources</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.1</version> + <type>jar</type> + </artifactItem> + <artifactItem> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + <type>jar</type> + </artifactItem> + </artifactItems> + <outputDirectory>${project.build.directory}/endorsed</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-test-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-test-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxws-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-test-source</id> + <phase>process-resources</phase> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass> + <arguments> + <argument>${project.build.directory}</argument> + </arguments> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <executions> + <execution> + <phase>process-resources</phase> + <goals> + <goal>wsimport</goal> + </goals> + </execution> + </executions> + <configuration> + <packageName>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</packageName> + <wsdlDirectory>${project.build.directory}/classes/wsdl</wsdlDirectory> + <wsdlFiles> + <wsdlFile>Greeter.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <verbose>true</verbose> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml new file mode 100644 index 0000000000..8381a164ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml @@ -0,0 +1,172 @@ +<?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. +--> +<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.example.org/generate generate.xsd "> + + + <Template> + <TemplateName>GreeterService.java.vm</TemplateName> + <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>GreeterServiceImpl.java.vm</TemplateName> + <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>GreeterServiceClient.java.vm</TemplateName> + <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>GreeterServiceClientImpl.java.vm</TemplateName> + <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>DatabindingTestCase.java.vm</TemplateName> + <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>Greeter.wsdl.vm</TemplateName> + <TemplateTargetDir>classes/wsdl</TemplateTargetDir> + </Template> + <InputFile> + <FileName>Person.xsd</FileName> + <FilePath>xsd</FilePath> + <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</JavaPackage> + <Factory>ObjectFactory</Factory> + <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace> + <Prefix>p</Prefix> + <Type> + <TypeName>PersonType</TypeName> + <CreateTypeCode> + ObjectFactory factory = new ObjectFactory(); + param = factory.createPersonType(); + param.setFirstName("George"); + param.setLastName("Doors"); + </CreateTypeCode> + <ModifyTypeCode> + param.setGreeting("Hello"); + </ModifyTypeCode> + <ResultComparison> + assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting()); + </ResultComparison> + </Type> + </InputFile> + <InputFile> + <FileName>Interop.xsd</FileName> + <FilePath>xsd</FilePath> + <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</JavaPackage> + <Factory>ObjectFactory</Factory> + <Namespace>http://www.apache.org/tuscany/interop</Namespace> + <Prefix>i</Prefix> + <!-- Type> + <TypeName>AnnotationComplexType</TypeName> + <CreateTypeCode> + ObjectFactory factory = new ObjectFactory(); + param = factory.createAnnotationComplexType(); + param.setSimpleTypeWithNameElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithNameElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement()); + </ResultComparison> + </Type--> + <Type> + <TypeName>AttributeComplexType</TypeName> + <CreateTypeCode> + ObjectFactory factory = new ObjectFactory(); + org.apache.tuscany.sca.itest.jaxbdatabinding.generated.AttributeType attrib = factory.createAttributeType(); + attrib.setAttribute("SomeText"); + param = factory.createAttributeComplexType(); + param.setAttributeElement(attrib); + </CreateTypeCode> + <ModifyTypeCode> + param.getAttributeElement().setAttribute("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute()); + </ResultComparison> + </Type> + <Type> + <TypeName>AttributeReferenceComplexType</TypeName> + <CreateTypeCode> + ObjectFactory factory = new ObjectFactory(); + param = factory.createAttributeReferenceComplexType(); + + param.setReferencedAttribute("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setReferencedAttribute("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute()); + </ResultComparison> + </Type> + <Type> + <TypeName>SimpleTypeWithAbstractComplexType</TypeName> + <CreateTypeCode> + ObjectFactory factory = new ObjectFactory(); + param = factory.createSimpleTypeWithAbstractComplexType(); + param.setSimpleTypeWithAbstractExtensionElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement()); + </ResultComparison> + </Type> + <Type> + <TypeName>SimpleTypeWithNameComplexType</TypeName> + <CreateTypeCode> + ObjectFactory factory = new ObjectFactory(); + param = factory.createSimpleTypeWithNameComplexType(); + param.setSimpleTypeWithNameElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithNameElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement()); + </ResultComparison> + </Type> + <Type> + <TypeName>ComplexTypeWithContentType</TypeName> + <CreateTypeCode> + ObjectFactory factory = new ObjectFactory(); + param = factory.createComplexTypeWithContentType(); + param.setSimpleTypeWithName("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithName("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName()); + </ResultComparison> + </Type> + </InputFile> +</tns:Generate> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/src/main/resources/greeter.composite b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/src/main/resources/greeter.composite new file mode 100644 index 0000000000..ae0740e6fe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/jaxbgen/src/main/resources/greeter.composite @@ -0,0 +1,49 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="JAXBGreeterService">
+
+ <!-- Clients to test the services -->
+ <component name="DefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="JAXBGreeterServiceComponent"/>
+ </component>
+
+ <component name="WSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="JAXBGreeterServiceWSReference" promote="WSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <!-- The greeter service -->
+ <service name="JAXBGreeterService" promote="JAXBGreeterServiceComponent">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </service>
+
+ <!-- Components used to implement the services -->
+ <component name="JAXBGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/pom.xml new file mode 100644 index 0000000000..5530b2475b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings</artifactId> + <name>Apache Tuscany SCA Databindings Integration Tests</name> + <version>1.1-incubating-SNAPSHOT</version> + + + <packaging>pom</packaging> + <build> + <defaultGoal>install</defaultGoal> + </build> + <modules> + <module>common</module> + <module>sdogen</module> + <module>jaxbgen</module> + <module>interop</module> + </modules> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/readme.html b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/readme.html new file mode 100644 index 0000000000..24a44e4ed7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/readme.html @@ -0,0 +1,157 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!-- + * 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. +--> + +<html> +<head> + <meta http-equiv="Content-Type" content= + "text/html; charset=us-ascii"> + <meta http-equiv="Content-Style-Type" content="text/css"> + + <title>Tuscany SCA Integration Test Databindings</title> + <!-- LINK rel="stylesheet" href="ait.css" type="text/css" --> + <link rel="stylesheet" href="../../css/base.css" type="text/css"> +</head> + +<body> +<h3>Tuscany SCA Integation Test Databindings </h3> + +<h4>Overview</h4> + +<p> +This integration test tests the Tuscany SCA databinding implementation by passing various data structures +across various bindings using the supported databindings. There are tests for the individual databindings +which exercise various bindings with the same databinding at client and server ends of each binding. There +is also an integration test which exercises the transformer chains by specifying different databindings at +client and server ends of the binding. +</p> +<p> +In doing this testing it is apparent that there is a lot of repetition in creating client, services, idl and +type for each of the data types for each of the bindings for each of the databindings. To reduce the amount +of effort required to maintain the tests as new types, bindings and databindings are added the test cases +themselves are generated from configuration files. +</p> + +<h4>Test Structure</h4> + +Databindings/Common - hold files common across all tests <br/> +Databindings/Interop - test the transformer chains with combinations of databindings<br/> +Databindings/sdogen and jaxbgen - test each databindings independently<br/> + +<h4>Test Generation</h4> +<p> +To reduce the amount of manual effort involved in building and maintaining tests cases the test cases +themselves are generated at run time using a set of velocity templates. Each test module has a generate.xml +file in the resources/generate directory which tells the generator what to do. The file looks like this. +</p> +<img src="config.png"> +<p> +Each <Template> element describes a velocit template to use in the test. The generator process is to expand +each velocity template provided with all of the types specified in the <InputFile> sections. +</p> +<p> +Each <InputFile> element describes a schema file used in the test. It also contains a description of each +data type that will be tested. The generator then arranges for the databinding being tested to generate +appropriate Java classes to represent the type at runtime. The individual databinding tests use the following +flow. +</p> + +Create data object at client<br/> +Client passes data object to server<br/> +Server modifies data object<br/> +Server returns modified data object to client<br/> +Client tests that modified data object is as expected<br/> +<p> +Hence the CreateTypeCode, ModifyTypeCode and ResultComparison elements which contain the type specific code +that is used in the tests. +</p> + +<h4>The Common Directory</h4> +<p> +The common directory contains the information that is common across all of the tests. This includes the +common velocity templates and the source for the generator that reads the config.xml for each test. Common +also contains all of the data type schema as these are common across all tests. Each test pom is written so +that the contents of the common project are expanded into the tests target directory before the test starts. +In this way all of the common elements are available for the test generation phase and at test runtime. +</p> + +<h4>Individual Databinding Tests</h4> +<p> +The individual databinding tests, for example, sdogen and jaxbgen, are mostly empty as their content is +generated at runtime. The configuration and any test specific templates can be found in the resources/generate +directory. Some files are hand crafted for each test and live in their static position in the tests directory +structure. +</p> +<p> +Each test uses the same scenario +</p> +<img src="databinding.png"> +<p> +The interface exposed by the greeter service provides a greet method for each data type being tested, for +example, +</p> +<code> +PersonType greetPersonType(PersonType param);<br/> +AttributeComplexType greetAttributeComplexType(AttributeComplexType param);<br/> +AttributeReferenceComplexType greetAttributeReferenceComplexType(AttributeReferenceComplexType param);<br/> +</code> +<p> +These methods are taken from the SDO databinding test and hence PersonType, AttributeComplexType, etc. will +have been generated by the SDO static type generator. +</p> +<p> +Hence this tests a single databinding across a variety of data types and a variety of bindings. New bindings +be tested by extending the composite. Be datatypes can be tested by updating the confix.xml file. +</p> +<h4>Databinding Interoperability Tests</h4> +<p> +This test uses the generated client, services and types from the individual databinding tests. It does not +regenerate them and you will see a dependency in the interop test pom on the other databinding tests. Is also +has some generate elements because the composite file must currently have import statements for all of the +SDO factories required during tested. +</p> +<p> +The scenario used here is, +</p> +<img src="interop.png"> +<p> +A chain of components is built up for each binding. Each component, drawn from the the inidividual databinding +tests, tests the full range of datatypes. The client components are designed so that they can be chained together +and so tranformations across different databindings is tests. The service component simply changes the data +content and returns it as before. +</p> +<h4>Building And Running The Tests</h4> +<p> +The tests can be built by doing the following. +</p> +<code> +cd sca/itest/databindings <br/> +mvn +</code> +<p> +The only modification to this process is required if a new input file is added to the tests suite. In this +case you will need to edit the config.xml files as appropriate but run mvn twice. This may sound a little +odd but currently the sdo test uses its pom file to generate the require SDO types. As the test is self +generating the pom file will not be updated to include the new type file until the second time it's run. The +aim is at some point to remove this feature from the pom. +</p> + + +</body> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/pom.xml new file mode 100644 index 0000000000..733d966884 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/pom.xml @@ -0,0 +1,238 @@ +<?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. +--> +<project> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + + <artifactId>itest-databindings-sdo</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <packaging>jar</packaging> + <name>Apache Tuscany SCA SDO Databinding Integration Tests</name> + + <repositories> + <repository> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>https://maven-repository.dev.java.net/nonav/repository</url> + <layout>legacy</layout> + </repository> + </repositories> + + <pluginRepositories> + <pluginRepository> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>java.net</id> + <name>java.net Maven 1.x Repository</name> + <url>https://maven-repository.dev.java.net/repository</url> + <layout>legacy</layout> + </pluginRepository> + </pluginRepositories> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>${pom.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-core-databinding</artifactId> + <version>${pom.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-jaxb</artifactId> + <version>${pom.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-axiom</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-interface-java-xml</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings-common</artifactId> + <version>${pom.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>${pom.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-databindings-common</artifactId> + <version>${project.version}</version> + <overWrite>true</overWrite> + <outputDirectory>${project.build.directory}/classes</outputDirectory> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>add-test-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.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-test-sdo-source</id> + <phase>process-resources</phase> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass> + <arguments> + <argument>${project.build.directory}</argument> + <argument>true</argument> + </arguments> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-test-source</id> + <phase>process-resources</phase> + <goals> + <goal>java</goal> + </goals> + </execution> + </executions> + <configuration> + <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass> + <arguments> + <argument>${project.build.directory}</argument> + <argument>true</argument> + </arguments> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-plugin</artifactId> + <version>1.0-incubating</version> + <executions> + <execution> + <id>generate-sdo</id> + <phase>process-resources</phase> + <configuration> + <schemaFiles> + <configuration> + <fileName>${project.build.directory}/classes/wsdl/Greeter.wsdl</fileName> + <javaPackage>org.apache.tuscany.sca.itest.databinding.services</javaPackage> + </configuration> + </schemaFiles> + <noNotification>true</noNotification> + <noContainment>true</noContainment> + <noUnsettable>true</noUnsettable> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/src/main/resources/generate/generate.xml new file mode 100644 index 0000000000..3f9926604d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/src/main/resources/generate/generate.xml @@ -0,0 +1,170 @@ +<?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. +--> +<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.example.org/generate generate.xsd "> + + <Template> + <TemplateName>greeter.composite.vm</TemplateName> + <TemplateTargetDir>classes</TemplateTargetDir> + </Template> + <Template> + <TemplateName>GreeterService.java.vm</TemplateName> + <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>GreeterServiceImpl.java.vm</TemplateName> + <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>GreeterServiceClientImpl.java.vm</TemplateName> + <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>DatabindingTestCase.java.vm</TemplateName> + <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir> + <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage> + </Template> + <Template> + <TemplateName>Greeter.wsdl.vm</TemplateName> + <TemplateTargetDir>classes/wsdl</TemplateTargetDir> + </Template> + <InputFile> + <FileName>Person.xsd</FileName> + <FilePath>xsd</FilePath> + <JavaPackage>org.apache.tuscany.sca.itest.databinding.types</JavaPackage> + <Factory>TypesFactory</Factory> + <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace> + <Prefix>p</Prefix> + <Type> + <TypeName>PersonType</TypeName> + <CreateTypeCode> + TypesFactory factory = TypesFactory.INSTANCE; + param = factory.createPersonType(); + param.setFirstName("George"); + param.setLastName("Doors"); + </CreateTypeCode> + <ModifyTypeCode> + param.setGreeting("Hello"); + </ModifyTypeCode> + <ResultComparison> + assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting()); + </ResultComparison> + </Type> + </InputFile> + <InputFile> + <FileName>Interop.xsd</FileName> + <FilePath>xsd</FilePath> + <JavaPackage>org.apache.tuscany.interop</JavaPackage> + <Factory>InteropFactory</Factory> + <Namespace>http://www.apache.org/tuscany/interop</Namespace> + <Prefix>i</Prefix> + <!-- Type> + <TypeName>AnnotationComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createAnnotationComplexType(); + param.setSimpleTypeWithNameElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithNameElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement()); + </ResultComparison> + </Type--> + <Type> + <TypeName>AttributeComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + org.apache.tuscany.interop.AttributeType attrib = factory.createAttributeType(); + attrib.setAttribute("SomeText"); + param = factory.createAttributeComplexType(); + param.setAttributeElement(attrib); + </CreateTypeCode> + <ModifyTypeCode> + param.getAttributeElement().setAttribute("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute()); + </ResultComparison> + </Type> + <Type> + <TypeName>AttributeReferenceComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createAttributeReferenceComplexType(); + + param.setReferencedAttribute("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setReferencedAttribute("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute()); + </ResultComparison> + </Type> + <Type> + <TypeName>SimpleTypeWithAbstractComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createSimpleTypeWithAbstractComplexType(); + param.setSimpleTypeWithAbstractExtensionElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement()); + </ResultComparison> + </Type> + <Type> + <TypeName>SimpleTypeWithNameComplexType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createSimpleTypeWithNameComplexType(); + param.setSimpleTypeWithNameElement("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithNameElement("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement()); + </ResultComparison> + </Type> + <Type> + <TypeName>ComplexTypeWithContentType</TypeName> + <CreateTypeCode> + InteropFactory factory = InteropFactory.INSTANCE; + param = factory.createComplexTypeWithContentType(); + param.setSimpleTypeWithName("SomeText"); + </CreateTypeCode> + <ModifyTypeCode> + param.setSimpleTypeWithName("SomeChangedText");; + </ModifyTypeCode> + <ResultComparison> + assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName()); + </ResultComparison> + </Type> + </InputFile> +</tns:Generate> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm new file mode 100644 index 0000000000..9494d70f96 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm @@ -0,0 +1,56 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" + xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" + name="SDOGreeterService"> + + <!-- SDO factory classes --> + <dbsdo:import.sdo factory="org.apache.tuscany.sca.itest.databinding.services.ServicesFactory"/> + #foreach( $file in $fileList ) + <dbsdo:import.sdo factory="$file.getJavaPackage().$file.getFactory()"/> + #end + + <!-- Clients to test the services --> + <component name="DefaultGreeterServiceClient"> + <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" /> + <reference name="greeterService" target="SDOGreeterServiceComponent"/> + </component> + + <component name="WSGreeterServiceClient"> + <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" /> + </component> + + <reference name="SDOGreeterServiceWSReference" promote="WSGreeterServiceClient/greeterService"> + <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/> + <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/> + </reference> + + <!-- The greeter service --> + <service name="SDOGreeterService" promote="SDOGreeterServiceComponent"> + <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/> + <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/> + </service> + + <component name="SDOGreeterServiceComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" /> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/domain/pom.xml new file mode 100644 index 0000000000..a2367d8084 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/pom.xml @@ -0,0 +1,81 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-domain</artifactId>
+ <name>Apache Tuscany SCA Domain Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-impl</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..797ebb4024 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..1a63d4ff77 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddServiceImpl.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 calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.java new file mode 100644 index 0000000000..93486d915e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/AddServiceUpdateImpl.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 calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceUpdateImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService Update - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..2718ab8772 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/CalculatorService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The Calculator service interface.
+ */
+@Remotable
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..8ee640ed6b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,74 @@ +/*
+ * 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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..ef6a8b375b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/*
+ * 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 calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..8c33862f6d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/*
+ * 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 calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..db568cc762 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/*
+ * 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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..c7fbc73c00 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/*
+ * 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 calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..615320e670 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/SubtractService.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 calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..abf2777c7d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/java/calculator/SubtractServiceImpl.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 calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionA/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionA/Calculator.composite new file mode 100644 index 0000000000..534e1a29af --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionA/Calculator.composite @@ -0,0 +1,44 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorA">
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <binding.sca/>
+ </service>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..1b1c0291e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionA/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:CalculatorA"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite new file mode 100644 index 0000000000..bdb89803d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionB/META-INF/sca-deployables/Calculator.composite @@ -0,0 +1,45 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="CalculatorServiceComponentB">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentB"/>
+ <reference name="divideService" target="DivideServiceComponentB" />
+ </component>
+
+ <component name="MultiplyServiceComponentB">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentB">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionBupdate/META-INF/sca-deployables/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionBupdate/META-INF/sca-deployables/Calculator.composite new file mode 100644 index 0000000000..0c8d3e2858 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionBupdate/META-INF/sca-deployables/Calculator.composite @@ -0,0 +1,45 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorB">
+
+ <component name="CalculatorServiceComponentB">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentB"/>
+ <reference name="divideService" target="DivideServiceComponentB" />
+ </component>
+
+ <component name="MultiplyServiceComponentB">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentB">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceUpdateImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite new file mode 100644 index 0000000000..c5af8dd3cc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionC/META-INF/sca-deployables/Calculator.composite @@ -0,0 +1,32 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorC">
+
+ <component name="SubtractServiceComponentC">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ <service name="SubtractService">
+ <binding.sca/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionD/META-INF/sca-deployables/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionD/META-INF/sca-deployables/Calculator.composite new file mode 100644 index 0000000000..119c52cbf8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionD/META-INF/sca-deployables/Calculator.composite @@ -0,0 +1,49 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="CalculatorD">
+
+ <component name="CalculatorServiceComponentD">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentD" />
+ <reference name="subtractService" target="SubtractServiceComponentD" />
+ <reference name="multiplyService" target="MultiplyServiceComponentD"/>
+ <reference name="divideService" target="DivideServiceComponentD" />
+ </component>
+
+ <component name="MultiplyServiceComponentD">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentD">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponentD">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="SubtractServiceComponentD">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionDependent/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionDependent/Calculator.composite new file mode 100644 index 0000000000..538ad2e4c8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionDependent/Calculator.composite @@ -0,0 +1,33 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://dependent"
+ xmlns:dependent="http://dependent"
+ name="CalculatorB">
+
+ <component name="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="SubtractServiceComponentB">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..8264a8243f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionDependent/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://dependent"
+ xmlns:sample="http://dependent">
+ <export namespace="http://dependent"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionPrimary/Calculator.composite b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionPrimary/Calculator.composite new file mode 100644 index 0000000000..c120fed3ca --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionPrimary/Calculator.composite @@ -0,0 +1,47 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://primary"
+ xmlns:primary="http://primary"
+ xmlns:dependent="http://dependent"
+ name="CalculatorA">
+
+ <include name="dependent:CalculatorB"/>
+
+ <component name="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <service name="CalculatorService">
+ <binding.sca/>
+ </service>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentB" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e53c14a651 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/main/resources/contributionPrimary/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://primary"
+ xmlns:sample="http://primary">
+ <deployable composite="sample:CalculatorA"/>
+ <import namespace="http://dependent"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/DomainAPITestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/DomainAPITestCase.java new file mode 100644 index 0000000000..d5e5c6f488 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/DomainAPITestCase.java @@ -0,0 +1,238 @@ +/*
+ * 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.itest.domain;
+
+
+import java.lang.reflect.UndeclaredThrowableException;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.domain.impl.SCADomainImpl;
+import org.apache.tuscany.sca.node.SCADomainFinder;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.AddService;
+import calculator.CalculatorService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class DomainAPITestCase {
+
+ private static ClassLoader cl;
+ private static SCADomain domain;
+ private static SCANode nodeA;
+ private static SCANode nodeB;
+ private static CalculatorService calculatorService;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ System.out.println("Setting up domain");
+
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain = domainFactory.createSCADomain("http://localhost:9999");
+
+ System.out.println("Setting up nodes");
+
+ cl = DomainAPITestCase.class.getClassLoader();
+
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+
+ nodeA = nodeFactory.createSCANode("http://localhost:8100/nodeA", "http://localhost:9999");
+ nodeB = nodeFactory.createSCANode("http://localhost:8200/nodeB", "http://localhost:9999");
+
+ } catch(Exception ex){
+ ex.printStackTrace();
+ }
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+
+ // destroy the nodes
+ nodeA.destroy();
+ nodeB.destroy();
+
+ // destroy the domain
+ domain.destroy();
+ }
+
+ @Test
+ public void testStartWithNoNodeContributions() throws Exception {
+ try {
+ domain.start();
+ domain.stop();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAddContribution() throws Exception {
+ try {
+ domain.addContribution("contributionD", cl.getResource("contributionD/"));
+ domain.addToDomainLevelComposite(new QName("http://sample", "CalculatorD"));
+ //domain.startComposite(new QName("http://sample", "CalculatorD"));
+ domain.start();
+
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponentD");
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorService.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorService.divide(3, 2), 1.5);
+
+ domain.stop();
+
+ try {
+ calculatorService.add(3, 2);
+ Assert.fail();
+ } catch (UndeclaredThrowableException ex){
+ // do nothing
+
+ // TODO - can't this be a better exception than undeclared throwable
+ }
+
+ domain.start();
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+
+
+ domain.stopComposite(new QName("http://sample", "CalculatorD"));
+
+ try {
+ calculatorService.add(3, 2);
+ Assert.fail();
+ } catch (UndeclaredThrowableException ex){
+ // do nothing
+ }
+
+ domain.startComposite(new QName("http://sample", "CalculatorD"));
+
+
+ // TODO - this hangs for some reason
+ //Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ //Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+
+ domain.stop();
+ domain.removeContribution("contributionD");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAddDependentContribution() throws Exception {
+ try {
+ domain.addContribution("contributionDependent", cl.getResource("contributionDependent/"));
+ domain.addContribution("contributionPrimary", cl.getResource("contributionPrimary/"));
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://primary", "CalculatorA"),
+ "http://localhost:8200/nodeB");
+ domain.start();
+
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorService.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorService.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorService.divide(3, 2), 1.5);
+
+ domain.stop();
+ domain.removeContribution("contributionPrimary");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAddMultipleContributions() throws Exception {
+ try {
+ domain.addContribution("contributionA", cl.getResource("contributionA/"));
+ domain.addContribution("contributionB", cl.getResource("contributionB/"));
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://sample", "CalculatorA"),
+ "http://localhost:8100/nodeA");
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://sample", "CalculatorB"),
+ "http://localhost:8200/nodeB");
+ domain.start();
+
+
+ //Assert.assertEquals("<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://tuscany.apache.org/domain\" xmlns:domain=\"http://tuscany.apache.org/domain\" xmlns:include0=\"http://sample\" xmlns:include1=\"http://sample\" name=\"DomainLevelComposite\"><include name=\"include0:CalculatorB\"/><include name=\"include1:CalculatorA\"/></composite>",
+ // domain.getDomainLevelComposite());
+
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+
+ domain.stop();
+ domain.removeContribution("contributionA");
+ domain.removeContribution("contributionB");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void testAddAndUpdateContribution() throws Exception {
+ try {
+ domain.addContribution("contributionA", cl.getResource("contributionA/"));
+ domain.addContribution("contributionB", cl.getResource("contributionB/"));
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://sample", "CalculatorA"),
+ "http://localhost:8100/nodeA");
+ ((SCADomainImpl)domain).addToDomainLevelComposite(new QName("http://sample", "CalculatorB"),
+ "http://localhost:8200/nodeB");
+ domain.start();
+
+ //Assert.assertEquals("<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://tuscany.apache.org/domain\" xmlns:domain=\"http://tuscany.apache.org/domain\" xmlns:include0=\"http://sample\" xmlns:include1=\"http://sample\" name=\"DomainLevelComposite\"><include name=\"include0:CalculatorB\"/><include name=\"include1:CalculatorA\"/></composite>",
+ // domain.getDomainLevelComposite());
+
+ calculatorService = domain.getService(CalculatorService.class, "CalculatorServiceComponentA");
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+
+ domain.updateContribution("contributionB", cl.getResource("contributionBupdate/"));
+
+ Assert.assertEquals(calculatorService.add(3, 2), 5.0);
+
+ domain.stop();
+ domain.removeContribution("contributionA");
+ domain.removeContribution("contributionB");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ Assert.fail();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/pom.xml new file mode 100644 index 0000000000..083f710e09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/pom.xml @@ -0,0 +1,222 @@ +<?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.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>itest-exceptions-cross-binding-ws</artifactId>
+ <name>Apache Tuscany SCA WS Binding Exceptions Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <!-- Sun's JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <verbose>true</verbose>
+ <packageName>org.apache.tuscany.sca.test.exceptions.impl.jaxb</packageName>
+ <keep>true</keep>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- SDO Generation -->
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</wsdlFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java new file mode 100644 index 0000000000..f5e36db7cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.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.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest; +import org.osoa.sca.annotations.Remotable; + +/** + * + */ +@Remotable +public interface StockExceptionTestJAXB extends StockExceptionTest { + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java new file mode 100644 index 0000000000..65751175fb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java @@ -0,0 +1,76 @@ +/* + * 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.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault_Exception; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.MarketClosedFault; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.ObjectFactory; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.TestNotDeclaredAtSourceFault; +import org.osoa.sca.annotations.Service; + +/** + * + */ +@Service(StockExceptionTestJAXB.class) +public class StockExchangeJaxB implements StockExceptionTestJAXB { + + /** + * + */ + public StockExchangeJaxB() { + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest#stockQuoteOffer(org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer) + */ + public StockOffer stockQuoteOffer(StockOffer input) throws InvalidSymbolFault_Exception, MarketClosedFault, TestNotDeclaredAtSourceFault{ + + System.out.println("stockQuoteOffer '" + input + "'"); + + String symbol = input.getSymbol(); + if ("IBM".equals(symbol)) { + input.setPrice(99.00F); + return input; + + } + else if ("CLOSED".equals(input.getName())) { + throw new MarketClosedFault("TO LATE!", 3); + + } else if( "testNotDeclaredAtSourceTest".equals(input.getName())){ + + throw new TestNotDeclaredAtSourceFault("not declared", "fault info"); + + } + ObjectFactory jaxbOjectFactory = new ObjectFactory(); + + InvalidSymbolFault faultinfo = jaxbOjectFactory.createInvalidSymbolFault(); + + faultinfo.setOffer(input); + + throw new InvalidSymbolFault_Exception("bad symbol", faultinfo); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java new file mode 100644 index 0000000000..5f65d293ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.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.exceptions.impl; + +import java.rmi.RemoteException; + +import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException; +import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException; + +import stockexceptiontestservice.scatesttool.StockOffer; + +public interface StockTraderSDO { + + StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException; + + void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException; + + Object testNotDeclaredAtSourceTest(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java new file mode 100644 index 0000000000..7d303887e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java @@ -0,0 +1,122 @@ +/* + * 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.exceptions.impl; + +import java.rmi.RemoteException; + +import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException; +import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException; +import org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import stockexceptiontestservice.scatesttool.ScatesttoolFactory; +import stockexceptiontestservice.scatesttool.StockOffer; + +/** + * + */ +@Service(StockTraderSDO.class) +public class StockTraderSDOImpl implements StockTraderSDO { + + private StockExceptionTest exchangeJaxb; + + /** + * + */ + + public StockTraderSDOImpl() { + // TODO Auto-generated constructor stub + } + + @Reference + public void setExchangeJaxb(StockExceptionTest exchangeJaxb) { + this.exchangeJaxb = exchangeJaxb; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO#tradingTest() + */ + public StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException { + StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer(); + stockOffer.setName("IBM"); + stockOffer.setSymbol("IBM"); + stockOffer.setPrice(100.00F); // offer to buy at max $100.00 + + StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer); + + return stockOfferAccepted; + + } + + public void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException, + MarketClosedSDOException { + StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer(); + // set up for a InvalidSymbolSDOException + stockOffer.setName(""); + stockOffer.setSymbol("IBM0"); + + stockOffer.setPrice(11.0F); // offer to buy at max $100.00 + exchangeJaxb.stockQuoteOffer(stockOffer); + + } + + public void marketClosedSDOExceptionTest() { + StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer(); + + // set up for a MarketClosedSDOException + stockOffer.setName("CLOSED"); + stockOffer.setSymbol("MBI"); + stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00 + try { + StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer); + stockOfferAccepted.getPrice(); // the price actually bought. + } catch (RemoteException e) { + + e.printStackTrace(); + } catch (InvalidSymbolSDOException e) { + + e.printStackTrace(); + } catch (MarketClosedSDOException e) { + + e.printStackTrace(); + } + } + + public Object testNotDeclaredAtSourceTest() { + StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer(); + + // set up for a MarketClosedSDOException + stockOffer.setName("testNotDeclaredAtSourceTest"); + stockOffer.setSymbol("TNDAS"); + stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00 + try { + return exchangeJaxb.stockQuoteOffer(stockOffer); + + } catch (Exception e) { + return e; + + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java new file mode 100644 index 0000000000..1567aaba02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java @@ -0,0 +1,85 @@ +/* + * 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.exceptions.sdohandgen; + +import javax.xml.namespace.QName; + +import stockexceptiontestservice.scatesttool.InvalidSymbolFault; + +/** + * + */ +public class InvalidSymbolSDOException extends Exception { + private static final long serialVersionUID = -3824848763300476741L; + + public static final QName FAULT_ELEMENT = new QName("http://scatesttool.stockexceptiontestservice", "InvalidSymbolFault"); + + /** + * + */ + public InvalidSymbolSDOException() { + + } + + /** + * @param message + * @param faultInfo + */ + public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo) { + super(message); + this.faultInfo = faultInfo; + + } + + /** + * @param cause + */ + public InvalidSymbolSDOException(InvalidSymbolFault faultInfo, Throwable cause) { + super(cause); + this.faultInfo = faultInfo; + + } + + /** + * @param message + * @param cause + */ + public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo, Throwable cause) { + super(message, cause); + this.faultInfo = faultInfo; + + } + + // *** Below was hand added ... tooling needs to do this ***/ + + /** + * Java type that goes as soapenv:Fault detail element. + */ + private InvalidSymbolFault faultInfo; + + /** + * @return returns fault bean: + * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault + */ + public InvalidSymbolFault getFaultInfo() { + return faultInfo; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java new file mode 100644 index 0000000000..8b28a652b0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java @@ -0,0 +1,78 @@ +/* + * 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.exceptions.sdohandgen; + +import javax.xml.namespace.QName; + +/** + * + */ +public class MarketClosedSDOException extends Exception { + private static final long serialVersionUID = 7652466275656958031L; + + public static final QName FAULT_ELEMENT = + new QName("http://scatesttool.stockexceptiontestservice", "MarketClosedFault"); + + + /** + * Java type that goes as soapenv:Fault detail element. + */ + private int faultInfo; + + /** + * + */ + public MarketClosedSDOException() { + + } + + /** + * @param message + */ + public MarketClosedSDOException(String message, int faultInfo) { + super(message); + this.faultInfo = faultInfo; + } + + /** + * @param cause + */ + public MarketClosedSDOException(int faultInfo, Throwable cause) { + super(cause); + this.faultInfo = faultInfo; + } + + /** + * @param message + * @param cause + */ + public MarketClosedSDOException(String message, int faultInfo, Throwable cause) { + super(message, cause); + this.faultInfo = faultInfo; + } + + /** + * @return returns fault bean: int + */ + public int getFaultInfo() { + return faultInfo; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java new file mode 100644 index 0000000000..add0f6193b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java @@ -0,0 +1,46 @@ +/* + * 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. + */ +/** + * StockExceptionTest.java + * + * This file was auto-generated from WSDL + * by the Apache Axis2 version: #axisVersion# #today# + */ +package org.apache.tuscany.sca.test.exceptions.sdohandgen; + +import org.osoa.sca.annotations.Remotable; + +import stockexceptiontestservice.scatesttool.StockOffer; + +/* + * StockExceptionTest java interface + */ + +@Remotable +public interface StockExceptionTest { + + /** + * Auto generated method signatures + * + * @param param0 + */ + StockOffer stockQuoteOffer(StockOffer param0) + throws java.rmi.RemoteException, InvalidSymbolSDOException, MarketClosedSDOException; + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite new file mode 100644 index 0000000000..acecdff613 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite @@ -0,0 +1,23 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo" + name="ExceptionTest"> + <include name="foo:intracomposite" /> +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite new file mode 100644 index 0000000000..d571c7b44f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite @@ -0,0 +1,44 @@ +<?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. +--> +<composite + targetNamespace="http://foo" + name="intracomposite" xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"> + + <service name="exchangeJaxbService" promote="exchangeJaxbComponent"> + <interface.java interface="org.apache.tuscany.sca.test.exceptions.impl.StockExceptionTestJAXB" /> + <binding.ws + wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)"/> + </service> + + <component name="exchangeJaxbComponent"> + <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockExchangeJaxB" /> + </component> + + <component name="stockTraderSDOComponent"> + <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDOImpl" /> + </component> + + <reference name="stockTraderSDOReference" promote="stockTraderSDOComponent/exchangeJaxb"> + <interface.java interface="org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest" /> + <binding.ws + wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)"/> + </reference> +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl new file mode 100644 index 0000000000..d70cdad313 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl @@ -0,0 +1,141 @@ +<?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.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+<!--
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+-->
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+<!--
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+-->
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl new file mode 100644 index 0000000000..40e87953b6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl @@ -0,0 +1,148 @@ +<?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.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="xsd:int" />
+
+ <element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="TestNotDeclaredAtSourceFault">
+ <wsdl:part element="tns:TestNotDeclaredAtSourceFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+
+ <wsdl:fault message="tns:TestNotDeclaredAtSourceFault" name="TestNotDeclaredAtSourceException" />
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="TestNotDeclaredAtSourceException">
+ <wsdlsoap:fault name="TestNotDeclaredAtSourceException" use="literal" />
+ </wsdl:fault>
+
+
+
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/services/exchangeJaxbService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd new file mode 100644 index 0000000000..9759647cfe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd @@ -0,0 +1,65 @@ +<?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://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://scatesttool.stockexceptiontestservice" + > + <complexType name="StockOffer"> + <sequence> + <element name="symbol" minOccurs="1" type="xsd:string" /> + <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response --> + <element name="name" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + + <element name="stockQuoteOffer"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + <element name="stockQuoteOfferResponse"> + <complexType> + <sequence> + <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + + <!-- Faults --> + <element name="InvalidSymbolFault"> + <complexType> + <sequence> + <element name="message" minOccurs="1" type="xsd:string" /> + <element name="offer" minOccurs="1" type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + + <element name="MarketClosedFault"> + <complexType> + <sequence> + <element name="message" minOccurs="1" type="xsd:string" /> + </sequence> + </complexType> + </element> + + </schema>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCaseFIXME.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCaseFIXME.java new file mode 100644 index 0000000000..45918cb85c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCaseFIXME.java @@ -0,0 +1,92 @@ +/* + * 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.exceptions; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.databinding.TransformationException; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO; +import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException; + +import stockexceptiontestservice.scatesttool.InvalidSymbolFault; +import stockexceptiontestservice.scatesttool.StockOffer; + +public class IntraCompositeTestCaseFIXME extends TestCase { + private SCADomain domain; + private StockTraderSDO stockTrader; + + public void testTrading() { + try { + StockOffer sp = stockTrader.testTrading(); + assertNotNull(sp); + assertEquals(99.00F, sp.getPrice()); + assertEquals("IBM", sp.getSymbol()); + } catch (Exception e) { + + e.printStackTrace(); + fail(e + ""); + + } + + } + + public void testInvalidSymbolSDOException() { + try { + stockTrader.testInvalidSymbolSDOException(); + fail("Expected InvalidSymbolSDOException"); + } catch (InvalidSymbolSDOException e) { + InvalidSymbolFault isf = e.getFaultInfo(); + + assertNotNull(isf); + StockOffer sp = isf.getOffer(); + assertEquals(11.00F, sp.getPrice()); + assertEquals("IBM0", sp.getSymbol()); + + } catch (Exception e) { + e.printStackTrace(); + fail("Expected InvalidSymbolSDOException" + e); + + } + } + + public void _testNotDeclaredAtSourceException() { + + Object ret = stockTrader.testNotDeclaredAtSourceTest(); + + assertNotNull(ret); + + assertEquals(TransformationException.class, ret.getClass()); + + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("intracomposite.composite"); + stockTrader = domain.getService(StockTraderSDO.class, "stockTraderSDOComponent"); + assertNotNull(stockTrader); + } + + @Override + protected void tearDown() throws Exception { + if (domain != null) { + domain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/pom.xml new file mode 100644 index 0000000000..f0780efa9e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/pom.xml @@ -0,0 +1,216 @@ +<?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.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>itest-exceptions-cross-binding</artifactId>
+ <name>Apache Tuscany SCA Cross-Binding Exceptions Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ <!-- JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <verbose>true</verbose>
+ <packageName>org.apache.tuscany.sca.test.exceptions.impl.jaxb</packageName>
+ <keep>true</keep>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- SDO Generation -->
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</wsdlFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java new file mode 100644 index 0000000000..f5e36db7cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.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.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest; +import org.osoa.sca.annotations.Remotable; + +/** + * + */ +@Remotable +public interface StockExceptionTestJAXB extends StockExceptionTest { + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java new file mode 100644 index 0000000000..65751175fb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java @@ -0,0 +1,76 @@ +/* + * 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.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault_Exception; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.MarketClosedFault; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.ObjectFactory; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer; +import org.apache.tuscany.sca.test.exceptions.impl.jaxb.TestNotDeclaredAtSourceFault; +import org.osoa.sca.annotations.Service; + +/** + * + */ +@Service(StockExceptionTestJAXB.class) +public class StockExchangeJaxB implements StockExceptionTestJAXB { + + /** + * + */ + public StockExchangeJaxB() { + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest#stockQuoteOffer(org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer) + */ + public StockOffer stockQuoteOffer(StockOffer input) throws InvalidSymbolFault_Exception, MarketClosedFault, TestNotDeclaredAtSourceFault{ + + System.out.println("stockQuoteOffer '" + input + "'"); + + String symbol = input.getSymbol(); + if ("IBM".equals(symbol)) { + input.setPrice(99.00F); + return input; + + } + else if ("CLOSED".equals(input.getName())) { + throw new MarketClosedFault("TO LATE!", 3); + + } else if( "testNotDeclaredAtSourceTest".equals(input.getName())){ + + throw new TestNotDeclaredAtSourceFault("not declared", "fault info"); + + } + ObjectFactory jaxbOjectFactory = new ObjectFactory(); + + InvalidSymbolFault faultinfo = jaxbOjectFactory.createInvalidSymbolFault(); + + faultinfo.setOffer(input); + + throw new InvalidSymbolFault_Exception("bad symbol", faultinfo); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java new file mode 100644 index 0000000000..5f65d293ea --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.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.exceptions.impl; + +import java.rmi.RemoteException; + +import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException; +import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException; + +import stockexceptiontestservice.scatesttool.StockOffer; + +public interface StockTraderSDO { + + StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException; + + void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException; + + Object testNotDeclaredAtSourceTest(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java new file mode 100644 index 0000000000..7d303887e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java @@ -0,0 +1,122 @@ +/* + * 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.exceptions.impl; + +import java.rmi.RemoteException; + +import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException; +import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException; +import org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import stockexceptiontestservice.scatesttool.ScatesttoolFactory; +import stockexceptiontestservice.scatesttool.StockOffer; + +/** + * + */ +@Service(StockTraderSDO.class) +public class StockTraderSDOImpl implements StockTraderSDO { + + private StockExceptionTest exchangeJaxb; + + /** + * + */ + + public StockTraderSDOImpl() { + // TODO Auto-generated constructor stub + } + + @Reference + public void setExchangeJaxb(StockExceptionTest exchangeJaxb) { + this.exchangeJaxb = exchangeJaxb; + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO#tradingTest() + */ + public StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException { + StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer(); + stockOffer.setName("IBM"); + stockOffer.setSymbol("IBM"); + stockOffer.setPrice(100.00F); // offer to buy at max $100.00 + + StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer); + + return stockOfferAccepted; + + } + + public void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException, + MarketClosedSDOException { + StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer(); + // set up for a InvalidSymbolSDOException + stockOffer.setName(""); + stockOffer.setSymbol("IBM0"); + + stockOffer.setPrice(11.0F); // offer to buy at max $100.00 + exchangeJaxb.stockQuoteOffer(stockOffer); + + } + + public void marketClosedSDOExceptionTest() { + StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer(); + + // set up for a MarketClosedSDOException + stockOffer.setName("CLOSED"); + stockOffer.setSymbol("MBI"); + stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00 + try { + StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer); + stockOfferAccepted.getPrice(); // the price actually bought. + } catch (RemoteException e) { + + e.printStackTrace(); + } catch (InvalidSymbolSDOException e) { + + e.printStackTrace(); + } catch (MarketClosedSDOException e) { + + e.printStackTrace(); + } + } + + public Object testNotDeclaredAtSourceTest() { + StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer(); + + // set up for a MarketClosedSDOException + stockOffer.setName("testNotDeclaredAtSourceTest"); + stockOffer.setSymbol("TNDAS"); + stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00 + try { + return exchangeJaxb.stockQuoteOffer(stockOffer); + + } catch (Exception e) { + return e; + + } + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java new file mode 100644 index 0000000000..1567aaba02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java @@ -0,0 +1,85 @@ +/* + * 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.exceptions.sdohandgen; + +import javax.xml.namespace.QName; + +import stockexceptiontestservice.scatesttool.InvalidSymbolFault; + +/** + * + */ +public class InvalidSymbolSDOException extends Exception { + private static final long serialVersionUID = -3824848763300476741L; + + public static final QName FAULT_ELEMENT = new QName("http://scatesttool.stockexceptiontestservice", "InvalidSymbolFault"); + + /** + * + */ + public InvalidSymbolSDOException() { + + } + + /** + * @param message + * @param faultInfo + */ + public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo) { + super(message); + this.faultInfo = faultInfo; + + } + + /** + * @param cause + */ + public InvalidSymbolSDOException(InvalidSymbolFault faultInfo, Throwable cause) { + super(cause); + this.faultInfo = faultInfo; + + } + + /** + * @param message + * @param cause + */ + public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo, Throwable cause) { + super(message, cause); + this.faultInfo = faultInfo; + + } + + // *** Below was hand added ... tooling needs to do this ***/ + + /** + * Java type that goes as soapenv:Fault detail element. + */ + private InvalidSymbolFault faultInfo; + + /** + * @return returns fault bean: + * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault + */ + public InvalidSymbolFault getFaultInfo() { + return faultInfo; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java new file mode 100644 index 0000000000..8b28a652b0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java @@ -0,0 +1,78 @@ +/* + * 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.exceptions.sdohandgen; + +import javax.xml.namespace.QName; + +/** + * + */ +public class MarketClosedSDOException extends Exception { + private static final long serialVersionUID = 7652466275656958031L; + + public static final QName FAULT_ELEMENT = + new QName("http://scatesttool.stockexceptiontestservice", "MarketClosedFault"); + + + /** + * Java type that goes as soapenv:Fault detail element. + */ + private int faultInfo; + + /** + * + */ + public MarketClosedSDOException() { + + } + + /** + * @param message + */ + public MarketClosedSDOException(String message, int faultInfo) { + super(message); + this.faultInfo = faultInfo; + } + + /** + * @param cause + */ + public MarketClosedSDOException(int faultInfo, Throwable cause) { + super(cause); + this.faultInfo = faultInfo; + } + + /** + * @param message + * @param cause + */ + public MarketClosedSDOException(String message, int faultInfo, Throwable cause) { + super(message, cause); + this.faultInfo = faultInfo; + } + + /** + * @return returns fault bean: int + */ + public int getFaultInfo() { + return faultInfo; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java new file mode 100644 index 0000000000..add0f6193b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java @@ -0,0 +1,46 @@ +/* + * 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. + */ +/** + * StockExceptionTest.java + * + * This file was auto-generated from WSDL + * by the Apache Axis2 version: #axisVersion# #today# + */ +package org.apache.tuscany.sca.test.exceptions.sdohandgen; + +import org.osoa.sca.annotations.Remotable; + +import stockexceptiontestservice.scatesttool.StockOffer; + +/* + * StockExceptionTest java interface + */ + +@Remotable +public interface StockExceptionTest { + + /** + * Auto generated method signatures + * + * @param param0 + */ + StockOffer stockQuoteOffer(StockOffer param0) + throws java.rmi.RemoteException, InvalidSymbolSDOException, MarketClosedSDOException; + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite new file mode 100644 index 0000000000..872fd721d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite @@ -0,0 +1,25 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo" + name="ExceptionTest"> + + <include name="foo:intracomposite" /> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite new file mode 100644 index 0000000000..83526cb6a1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite @@ -0,0 +1,35 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://foo" xmlns:foo="http://foo" + xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" name="intracomposite"> + + <component name="stockTraderSDOComponent"> + <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDOImpl" /> + <reference name="exchangeJaxb" target="exchangeJaxbComponent"></reference> + </component> + + <component name="exchangeJaxbComponent"> + <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockExchangeJaxB" /> + </component> + + <!-- Move to the end to verify the fix for TUSCANY-1165 --> + <!-- dbsdo:import.sdo factory="stockexceptiontestservice.scatesttool.ScatesttoolFactory" / --> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl new file mode 100644 index 0000000000..d70cdad313 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl @@ -0,0 +1,141 @@ +<?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.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+<!--
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+-->
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+<!--
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+-->
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl new file mode 100644 index 0000000000..33b830c856 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl @@ -0,0 +1,148 @@ +<?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.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="xsd:int" />
+
+ <element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="TestNotDeclaredAtSourceFault">
+ <wsdl:part element="tns:TestNotDeclaredAtSourceFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+
+ <wsdl:fault message="tns:TestNotDeclaredAtSourceFault" name="TestNotDeclaredAtSourceException" />
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="TestNotDeclaredAtSourceException">
+ <wsdlsoap:fault name="TestNotDeclaredAtSourceException" use="literal" />
+ </wsdl:fault>
+
+
+
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd new file mode 100644 index 0000000000..9759647cfe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd @@ -0,0 +1,65 @@ +<?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://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://scatesttool.stockexceptiontestservice" + > + <complexType name="StockOffer"> + <sequence> + <element name="symbol" minOccurs="1" type="xsd:string" /> + <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response --> + <element name="name" minOccurs="0" type="xsd:string" /> + </sequence> + </complexType> + + <element name="stockQuoteOffer"> + <complexType> + <sequence> + <element name="input" minOccurs="0" type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + <element name="stockQuoteOfferResponse"> + <complexType> + <sequence> + <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + + <!-- Faults --> + <element name="InvalidSymbolFault"> + <complexType> + <sequence> + <element name="message" minOccurs="1" type="xsd:string" /> + <element name="offer" minOccurs="1" type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + + <element name="MarketClosedFault"> + <complexType> + <sequence> + <element name="message" minOccurs="1" type="xsd:string" /> + </sequence> + </complexType> + </element> + + </schema>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java new file mode 100644 index 0000000000..3f8dd1bbaf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java @@ -0,0 +1,93 @@ +/* + * 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.exceptions; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.databinding.TransformationException; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO; +import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException; + +import stockexceptiontestservice.scatesttool.InvalidSymbolFault; +import stockexceptiontestservice.scatesttool.StockOffer; + +public class IntraCompositeTestCase extends TestCase { + private SCADomain domain; + + private StockTraderSDO stockTrader; + + public void testTrading() { + try { + StockOffer sp = stockTrader.testTrading(); + assertNotNull(sp); + assertEquals(99.00F, sp.getPrice()); + assertEquals("IBM", sp.getSymbol()); + } catch (Exception e) { + + e.printStackTrace(); + fail(e + ""); + + } + + } + + public void testInvalidSymbolSDOException() { + try { + stockTrader.testInvalidSymbolSDOException(); + fail("Expected InvalidSymbolSDOException"); + } catch (InvalidSymbolSDOException e) { + InvalidSymbolFault isf = e.getFaultInfo(); + + assertNotNull(isf); + StockOffer sp = isf.getOffer(); + assertEquals(11.00F, sp.getPrice()); + assertEquals("IBM0", sp.getSymbol()); + + } catch (Exception e) { + e.printStackTrace(); + fail("Expected InvalidSymbolSDOException" + e); + + } + } + + public void testNotDeclaredAtSourceException() { + + Object ret = stockTrader.testNotDeclaredAtSourceTest(); + + assertNotNull(ret); + + assertEquals(TransformationException.class, ret.getClass()); + + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("ExceptionTest.composite"); + stockTrader = domain.getService(StockTraderSDO.class, "stockTraderSDOComponent"); + assertNotNull(stockTrader); + } + + @Override + protected void tearDown() throws Exception { + if (domain != null) { + domain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/pom.xml new file mode 100644 index 0000000000..e5d1e760d7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/pom.xml @@ -0,0 +1,59 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-exceptions-simple-ws</artifactId> + <name>Apache Tuscany Test for Simple Exceptions over Web Services</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-tomcat</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java new file mode 100644 index 0000000000..764f31b7cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/BusinessException.java @@ -0,0 +1,43 @@ +/* + * 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 com.example; + +public class BusinessException extends Exception { + + private String clientName; + + public BusinessException(String message) { + super(message); + } + + public BusinessException(String message, String clientName) { + super(message); + this.clientName = clientName; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + +} + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java new file mode 100644 index 0000000000..0c72b52ed9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClient.java @@ -0,0 +1,23 @@ +/* + * 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 com.example; + +public interface ExampleClient { + void runTest(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java new file mode 100644 index 0000000000..d6545b5a23 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientImpl.java @@ -0,0 +1,44 @@ +/* + * 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 com.example; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(ExampleClient.class) +@Scope("COMPOSITE") +public class ExampleClientImpl implements ExampleClient { + + private ExampleService myService; + + @Reference + public void setMyService(ExampleService myService) { + this.myService = myService; + } + + public void runTest() { + try { + Object result = myService.hello("John"); + System.out.println("myService returned " + result.getClass().getName()); + } catch (BusinessException e) { + System.out.println("caught exception from hello(): " + e.getMessage() + " for " + e.getClientName()); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java new file mode 100644 index 0000000000..30ea559694 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleService.java @@ -0,0 +1,27 @@ +/* + * 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 com.example; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface ExampleService { + + String hello(String name) throws BusinessException; +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java new file mode 100644 index 0000000000..b3b6f033e5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceImpl.java @@ -0,0 +1,26 @@ +/* + * 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 com.example; + +public class ExampleServiceImpl implements ExampleService { + public String hello(String name) throws BusinessException { + throw new BusinessException("bad news", name); + // return "Hello, " + name; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/resources/example.composite b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/resources/example.composite new file mode 100644 index 0000000000..8c33a22e58 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/resources/example.composite @@ -0,0 +1,40 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://www.example.com"
+ xmlns:hw="http://www.example.com"
+ name="example">
+
+ <component name="ExampleClientComponent">
+ <implementation.java class="com.example.ExampleClientImpl" />
+ <reference name="myService">
+ <interface.wsdl interface="http://example.com#wsdl.interface(ExampleServicePortType)" />
+ <binding.ws wsdlElement="http://example.com#wsdl.port(ExampleService/ExampleServiceSOAP11port_http)" />
+ </reference>
+ </component>
+
+ <component name="ExampleComponent">
+ <implementation.java class="com.example.ExampleServiceImpl"/>
+ <service name="ExampleService">
+ <interface.wsdl interface="http://example.com#wsdl.interface(ExampleServicePortType)" />
+ <binding.ws wsdlElement="http://example.com#wsdl.port(ExampleService/ExampleServiceSOAP11port_http)" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl new file mode 100644 index 0000000000..04a061d5e5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/main/resources/wsdl/ExampleService.wsdl @@ -0,0 +1,129 @@ +<?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.
+-->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns0="http://example.com" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns1="http://example.com/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://example.com">
+ <wsdl:types>
+ <xs:schema xmlns:ns="http://example.com" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com">
+ <xs:complexType name="Exception">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="BusinessException">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="BusinessException" nillable="true" type="ns1:BusinessException"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="hello">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="helloResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ <xs:schema xmlns:ax21="http://example.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/xsd">
+ <xs:complexType name="BusinessException">
+ <xs:complexContent>
+ <xs:extension base="ns0:Exception">
+ <xs:sequence/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="helloRequest">
+ <wsdl:part name="parameters" element="ns0:hello"/>
+ </wsdl:message>
+ <wsdl:message name="helloResponse">
+ <wsdl:part name="parameters" element="ns0:helloResponse"/>
+ </wsdl:message>
+ <wsdl:message name="BusinessException">
+ <wsdl:part name="parameters" element="ns0:BusinessException"/>
+ </wsdl:message>
+ <wsdl:portType name="ExampleServicePortType">
+ <wsdl:operation name="hello">
+ <wsdl:input message="ns0:helloRequest" wsaw:Action="urn:hello"/>
+ <wsdl:output message="ns0:helloResponse" wsaw:Action="urn:helloResponse"/>
+ <wsdl:fault message="ns0:BusinessException" name="BusinessException" wsaw:Action="urn:helloBusinessException"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="ExampleServiceSOAP11Binding" type="ns0:ExampleServicePortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="urn:hello" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="BusinessException">
+ <soap:fault use="literal" name="BusinessException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ExampleServiceSOAP12Binding" type="ns0:ExampleServicePortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="hello">
+ <soap12:operation soapAction="urn:hello" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="BusinessException">
+ <soap12:fault use="literal" name="BusinessException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="ExampleServiceHttpBinding" type="ns0:ExampleServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="hello">
+ <http:operation location="ExampleService/hello"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="hello"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="ExampleService">
+ <wsdl:port name="ExampleServiceSOAP11port_http" binding="ns0:ExampleServiceSOAP11Binding">
+ <soap:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ <wsdl:port name="ExampleServiceSOAP12port_http" binding="ns0:ExampleServiceSOAP12Binding">
+ <soap12:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ <wsdl:port name="ExampleServiceHttpport" binding="ns0:ExampleServiceHttpBinding">
+ <http:address location="http://localhost:8085/axis2/services/ExampleService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java new file mode 100644 index 0000000000..740af4f43d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions-simple-ws/src/test/java/com/example/ExampleTestCase.java @@ -0,0 +1,44 @@ +/* + * 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 com.example; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class ExampleTestCase extends TestCase { + + private SCADomain scaDomain; + private ExampleClient client; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("example.composite"); + client = scaDomain.getService(ExampleClient.class, "ExampleClientComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + client.runTest(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/pom.xml new file mode 100644 index 0000000000..4dd1f2812a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-exceptions</artifactId> + <name>Apache Tuscany SCA Exceptions Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java new file mode 100644 index 0000000000..b95b0ccb31 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java @@ -0,0 +1,58 @@ +/* + * 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.exceptions; + + +public class Checked extends Exception { + private static final long serialVersionUID = -129752837478357452L; + + /** + * + */ + public Checked() { + + } + + /** + * @param message + */ + public Checked(String message) { + super(message); + + } + + /** + * @param cause + */ + public Checked(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public Checked(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java new file mode 100644 index 0000000000..0d14240513 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.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.exceptions; + +public interface ExceptionHandler { + + public abstract void testing(); + + public abstract Checked getTheBad(); + + public abstract String getTheGood(); + + public abstract UnChecked getTheUgly(); + +}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java new file mode 100644 index 0000000000..80073e7679 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.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.exceptions; + +public interface ExceptionThrower { + public static final String SO_THEY_SAY = "All is good that ends good."; + + public String theGood() throws org.apache.tuscany.sca.test.exceptions.Checked; + + public String theBad() throws org.apache.tuscany.sca.test.exceptions.Checked; + + public String theUgly() throws org.apache.tuscany.sca.test.exceptions.Checked; + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java new file mode 100644 index 0000000000..453528444d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java @@ -0,0 +1,57 @@ +/* + * 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.exceptions; + +public class UnChecked extends RuntimeException { + private static final long serialVersionUID = -1318118082838092244L; + + /** + * + */ + public UnChecked() { + + } + + /** + * @param message + */ + public UnChecked(String message) { + super(message); + + } + + /** + * @param cause + */ + public UnChecked(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public UnChecked(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java new file mode 100644 index 0000000000..32a23c5e7d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java @@ -0,0 +1,120 @@ +/* + * 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.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.Checked; +import org.apache.tuscany.sca.test.exceptions.ExceptionHandler; +import org.apache.tuscany.sca.test.exceptions.ExceptionThrower; +import org.apache.tuscany.sca.test.exceptions.UnChecked; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class ExceptionHandlerImpl implements ExceptionHandler { + static final String INIT = "INIT"; + + private ExceptionThrower exceptionThrower; + + private String theGood; + + private Checked theBad; + + private UnChecked theUgly; + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.exceptions.impl.ExceptionHandler#testing() + */ + public void testing() { + + assert exceptionThrower != null : "'exceptionThrower' never wired"; + String result = INIT; + try { + theGood = result = exceptionThrower.theGood(); + assert result == ExceptionThrower.SO_THEY_SAY; + } catch (Throwable e) { + assert result == INIT; + assert false; + e.printStackTrace(); + } + + result = INIT; + try { + result = exceptionThrower.theBad(); + // incredible + assert false : "Expected 'Check' Exception"; + + } catch (Checked e) { + // This is good... + assert result == INIT; + theBad = e; + } catch (Throwable t) { + // This is not so good. + t.printStackTrace(); + assert result == INIT; + assert false : "Got wrong exception '" + t.getClass().getName(); + } + + result = INIT; + try { + result = exceptionThrower.theUgly(); + // incredible + assert false : "Expected 'UnCheck' Exception"; + + } catch (Checked e) { + // This is not so good... + assert false : "Got wrong exception '" + e.getClass().getName(); + assert result == INIT; + } catch (UnChecked e) { + theUgly = e; + + } catch (Throwable t) { + // This is not good. + assert false; + assert result == INIT; + + System.out.println(ExceptionThrower.SO_THEY_SAY + " " + INIT); + } + + } + + @Reference + public void setExceptionThrower(ExceptionThrower exceptionThrower) { + this.exceptionThrower = exceptionThrower; + } + + public String getTheGood() { + return theGood; + } + + public Checked getTheBad() { + return theBad; + } + + public UnChecked getTheUgly() { + return theUgly; + } + + public ExceptionThrower getExceptionThrower() { + return exceptionThrower; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java new file mode 100644 index 0000000000..067615eed8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java @@ -0,0 +1,48 @@ +/* + * 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.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.Checked; +import org.apache.tuscany.sca.test.exceptions.ExceptionThrower; +import org.apache.tuscany.sca.test.exceptions.UnChecked; + +/** + * + * + */ +public class ExceptionThrowerImpl implements ExceptionThrower { + + public String theBad() throws Checked { + + throw new Checked("theBad"); + + } + + public String theGood() throws Checked { + + return SO_THEY_SAY; + } + + public String theUgly() throws Checked { + + throw new UnChecked("theUgly"); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/resources/ExceptionTest.composite new file mode 100644 index 0000000000..a725864d30 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/resources/ExceptionTest.composite @@ -0,0 +1,27 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:foo="http://foo" + targetNamespace = "http://foo" + name="ExceptionTest"> + + <include name="foo:intracomposite"/> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/resources/intracomposite.composite new file mode 100644 index 0000000000..efe1c5e207 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/main/resources/intracomposite.composite @@ -0,0 +1,34 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:foo="http://foo" + targetNamespace="http://foo" + name="intracomposite"> + + <component name="main"> + <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionHandlerImpl"/> + <reference name="exceptionThrower" target="exceptionThrower"/> + </component> + + <component name="exceptionThrower"> + <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionThrowerImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java new file mode 100644 index 0000000000..4f719a26c4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.exceptions; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class IntraCompositeTestCase extends TestCase { + + private SCADomain domain; + private ExceptionHandler exceptionHandler; + + public void testALL() { + exceptionHandler.testing(); + assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() ); + assertNotNull(exceptionHandler.getTheBad()); + assertEquals( Checked.class, exceptionHandler.getTheBad().getClass()); + assertNotNull(exceptionHandler.getTheUgly()); + assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass()); + + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("ExceptionTest.composite"); + exceptionHandler = domain.getService(ExceptionHandler.class, "main"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/pom.xml new file mode 100644 index 0000000000..a00686dbe9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/pom.xml @@ -0,0 +1,51 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-extended-api</artifactId>
+ <name>Apache Tuscany SCA Extended API Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+ + <dependency> +
+ <groupId>org.apache.tuscany.sca</groupId> +
+ <artifactId>tuscany-implementation-java-runtime</artifactId> +
+ <version>1.1-incubating-SNAPSHOT</version> +
+ <scope>runtime</scope> +
+ </dependency> +
+ </dependencies>
+</project>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java new file mode 100644 index 0000000000..869565af17 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java @@ -0,0 +1,26 @@ +/* + * 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.extended; + +public interface BasicService { + + int negate(int theInt); + int delegateNegate(int theInt); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java new file mode 100644 index 0000000000..c54af93c05 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java @@ -0,0 +1,25 @@ +/* + * 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.extended; + +public interface MathService { + + int negate(int theInt); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java new file mode 100644 index 0000000000..523d238f2e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java @@ -0,0 +1,45 @@ +/* + * 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.extended.impl; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.test.extended.BasicService; +import org.apache.tuscany.sca.test.extended.MathService; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Service; + +@Service(BasicService.class) +public class BasicServiceImpl implements BasicService { + + @Context + protected ComponentContext context; + + public int negate(int theInt) { + return -theInt; + } + + public int delegateNegate(int theInt) { + SCADomain domain = SCADomain.connect("sca://local"); + MathService service = domain.getService(MathService.class, "MathServiceComponent"); + return service.negate(theInt); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java new file mode 100644 index 0000000000..ab4300a7dd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.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.extended.impl; + +import org.apache.tuscany.sca.test.extended.MathService; +import org.osoa.sca.annotations.Service; + +@Service(MathService.class) +public class MathServiceImpl implements MathService { + + public int negate(int theInt) { + return -theInt; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/resources/BasicService.composite b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/resources/BasicService.composite new file mode 100644 index 0000000000..128b33b16f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/resources/BasicService.composite @@ -0,0 +1,29 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="BasicServiceComposite">
+
+ <component name="BasicServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.extended.impl.BasicServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/resources/MathService.composite b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/resources/MathService.composite new file mode 100644 index 0000000000..8e99d3da60 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/main/resources/MathService.composite @@ -0,0 +1,29 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ targetNamespace="http://foo"
+ name="MathServiceComposite">
+
+ <component name="MathServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.extended.impl.MathServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java new file mode 100644 index 0000000000..c480235d88 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java @@ -0,0 +1,73 @@ +/* + * 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.extended; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.osoa.sca.ServiceRuntimeException; + +public class ServiceLocateTestCase { + + private SCADomain domain; + + /** + * Test description: Locate a service using Domain.getService() from an + * unmanaged client and invoke a method on that service + */ + @Test + public void unmanagedLocateService() { + BasicService service = domain.getService(BasicService.class, "BasicServiceComponent"); + assertEquals(-99, service.negate(99)); + } + + /** + * Test description: Locate a service using Domain.getService() from an + * managed client. A service is located from this unmanaged test client and a method + * is invoked. The method implementation of the service will also use Domain.getService + */ + @Test + public void managedLocateService() { + BasicService service = domain.getService(BasicService.class, "BasicServiceComponent"); + assertEquals(-99, service.delegateNegate(99)); + } + + /** + * Test description: Attempt to locate a service with an invalid name. + */ + @Test(expected = ServiceRuntimeException.class) + public void badComponentName() { + BasicService service = domain.getService(BasicService.class, "IvalidServiceName"); + service.negate(-1); + } + + @Before + public void init() throws Exception { + domain = SCADomain.newInstance("http://localhost", "/", "BasicService.composite", "MathService.composite"); + } + + @After + public void destroy() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/pom.xml new file mode 100644 index 0000000000..dfc20a9e36 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/pom.xml @@ -0,0 +1,46 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-interfaces</artifactId> + <name>Apache Tuscany Interface Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java new file mode 100644 index 0000000000..5bc872ef83 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.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.itest.interfaces; + + +/** + * only for callBack + */ +public interface LocalCallbackInterface { + + public void callbackMethod(String str); + + public void modifyParameter(ParameterObject po); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java new file mode 100644 index 0000000000..7bfcf5de11 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java @@ -0,0 +1,47 @@ +/* + * 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.itest.interfaces; + +import org.osoa.sca.annotations.OneWay; + +/* + * itest for interface: local,method-overloading + */ +public interface LocalClientComponent { + + String foo1(ParameterObject po); + + String foo1(String str) throws Exception; + + String foo2(String str, int i); + + String foo2(int i, String str) throws Exception; + + void callback(String str); + + void callModifyParameter(); + + @OneWay + void onewayMethod(String str); + + String getCallbackValue(); + + String getOnewayValue(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java new file mode 100644 index 0000000000..d4f7694e8f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java @@ -0,0 +1,83 @@ +/* + * 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.itest.interfaces; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(LocalClientComponent.class) +public class LocalClientComponentImpl implements LocalClientComponent, LocalCallbackInterface { + + @Reference + protected LocalServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo1(ParameterObject po) { + po.field1 = "AComponent"; + return "AComponent"; + } + + public String foo1(String str) throws Exception { + return str + "AComponent"; + } + + public String foo2(String str, int i) { + return str + "AComponent" + i; + } + + public String foo2(int i, String str) throws Exception { + return str + "AComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "AComponent"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java new file mode 100644 index 0000000000..6a04376168 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java @@ -0,0 +1,39 @@ +/* + * 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.itest.interfaces; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +/** + * Remote be-directional callBackService + */ +@Remotable +@Callback(LocalCallbackInterface.class) +public interface LocalServiceComponent { + + String foo(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java new file mode 100644 index 0000000000..e100636b23 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java @@ -0,0 +1,49 @@ +/* + * 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.itest.interfaces; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Service; + +@Service(LocalServiceComponent.class) +public class LocalServiceComponentImpl implements LocalServiceComponent { + + @Callback + protected LocalCallbackInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(String str) { + return str; + } + + public ParameterObject getPO() { + return po; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java new file mode 100644 index 0000000000..0bc8d10904 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java @@ -0,0 +1,47 @@ +/* + * 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.itest.interfaces; + +import java.io.Serializable; + +public class ParameterObject implements Serializable { + private static final long serialVersionUID = 1L; + public String field1; + + public ParameterObject() { + this.field1 = null; + } + + public ParameterObject(String field1) { + this.field1 = field1; + } + + @Override + public boolean equals(Object o) { + if (o == this) + return true; + if (o instanceof ParameterObject) { + ParameterObject other = (ParameterObject)o; + if (field1 != null) + return field1.equals(other.field1); + } + return false; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java new file mode 100644 index 0000000000..e2b70313ed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java @@ -0,0 +1,33 @@ +/* + * 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.itest.interfaces; + +import org.osoa.sca.annotations.Remotable; + +/** + * only for callBack + */ +@Remotable +public interface RemoteCallbackInterface { + + public void callbackMethod(String str); + + public void modifyParameter(ParameterObject po); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java new file mode 100644 index 0000000000..87690c0385 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java @@ -0,0 +1,62 @@ +/* + * 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. + */ + +package org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Remotable; + +/* + * different signatures + */ + +@Remotable +public interface RemoteClientComponent { + + String foo1(ParameterObject po); + + String foo2(int i, String str1) throws Exception; + + void callback(String str); + + void callModifyParameter(); + + String getCallbackValue(); + + void onewayMethod(String str); + + String getOnewayValue(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java new file mode 100644 index 0000000000..87151b3bcd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java @@ -0,0 +1,74 @@ +/* + * 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.itest.interfaces; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(RemoteClientComponent.class) +public class RemoteClientComponentImpl implements RemoteClientComponent, RemoteCallbackInterface { + + @Reference + protected RemoteServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo1(ParameterObject po) { + po.field1 = "BComponent"; + return "BComponent"; + } + + public String foo2(int i, String str) throws Exception { + return str + "BComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "BComponent"; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java new file mode 100644 index 0000000000..6c40db0e70 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.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 org.apache.tuscany.sca.itest.interfaces; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(RemoteCallbackInterface.class) +public interface RemoteServiceComponent { + + String foo(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + + String[] bar(int[][] intArray); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java new file mode 100644 index 0000000000..3804d31902 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java @@ -0,0 +1,54 @@ +/* + * 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.itest.interfaces; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Service; + +@Service(RemoteServiceComponent.class) +public class RemoteServiceComponentImpl implements RemoteServiceComponent { + + @Callback + protected RemoteCallbackInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(String str) { + return str; + } + + public ParameterObject getPO() { + return po; + } + + public String[] bar(int[][] intArray) { + return new String[] {"int"}; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/resources/InterfacesTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/resources/InterfacesTest.composite new file mode 100644 index 0000000000..0361d8c83c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/main/resources/InterfacesTest.composite @@ -0,0 +1,40 @@ +<?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
+ * 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:foo="http://foo" targetNamespace="http://foo"
+ name="InterfacesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="LocalClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalClientComponentImpl" />
+ <reference name="aCallBackService" target="LocalServiceComponent" />
+ </component>
+
+ <component name="RemoteClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.RemoteClientComponentImpl" />
+ <reference name="aCallBackService" target="RemoteServiceComponent" />
+ </component>
+
+ <component name="LocalServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.LocalServiceComponentImpl" />
+ </component>
+
+ <component name="RemoteServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.interfaces.RemoteServiceComponentImpl" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java new file mode 100644 index 0000000000..db23b223c4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java @@ -0,0 +1,121 @@ +/* + * 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.itest.interfaces; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class InterfacesTestCase { + private static SCADomain domain; + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("InterfacesTest.composite"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } + + @Test + public void testLocalClient() { + LocalServiceComponent service = domain.getService(LocalServiceComponent.class, "LocalServiceComponent"); + LocalClientComponent local = domain.getService(LocalClientComponent.class, "LocalClientComponent"); + + try { + ParameterObject po = new ParameterObject(); + assertEquals("AComponent", local.foo1(po)); + assertEquals("AComponent", po.field1); + + assertEquals("AAComponent", local.foo1("A")); + + assertEquals("AAComponent1", local.foo2("A", 1)); + assertEquals("AAComponent1", local.foo2(1, "A")); + } catch (Exception e) { + fail(); + } + + try { + // test local callback + local.callback("CallBack"); + Thread.sleep(100); + assertEquals("CallBack", local.getCallbackValue()); + + local.callModifyParameter(); + Thread.sleep(100); + assertEquals("AComponent", service.getPO().field1); + } catch (Exception e) { + e.printStackTrace(); + fail("CallBack failed"); + } + + try { + local.onewayMethod("OneWay"); + Thread.sleep(100); + assertEquals("OneWay", local.getOnewayValue()); + } catch (Exception e) { + fail("OneWay failed"); + } + } + + @Test + public void testRemoteClient() { + RemoteServiceComponent service = domain.getService(RemoteServiceComponent.class, "RemoteServiceComponent"); + RemoteClientComponent remote = domain.getService(RemoteClientComponent.class, "RemoteClientComponent"); + + try { + ParameterObject po = new ParameterObject("NotBComponent"); + assertEquals("BComponent", remote.foo1(po)); + assertEquals("NotBComponent", po.field1); + + assertEquals("BBComponent1", remote.foo2(1, "B")); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + + try { + remote.callback("CallBack"); + Thread.sleep(100); + assertEquals("CallBack", remote.getCallbackValue()); + + remote.callModifyParameter(); + Thread.sleep(100); + assertEquals("CallBack", service.getPO().field1); + } catch (Exception e) { + fail("CallBack failed"); + } + + try { + remote.onewayMethod("OneWay"); + Thread.sleep(100); + assertEquals("OneWay", remote.getOnewayValue()); + } catch (Exception e) { + fail("OneWay failed"); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/jms/pom.xml new file mode 100644 index 0000000000..e4fc455617 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/pom.xml @@ -0,0 +1,86 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <artifactId>itest-jms</artifactId> + <name>Apache Tuscany SCA JMS Tests</name> + + <repositories> + <repository> + <id>apache.incubator</id> + <url>http://people.apache.org/repo/m2-incubating-repository</url> + </repository> + </repositories> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jms</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jms-activemq</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..86d4719646 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java @@ -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. + */ +package org.apache.tuscany.sca.binding.jms; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldClientImpl implements HelloWorldService { + + private HelloWorldService serviceA; + + @Reference + public void setServiceA(HelloWorldService service) { + this.serviceA = service; + } + + public String sayHello(String name) { + return serviceA.sayHello(name); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..abb29aec4c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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.binding.jms; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..daa3d551df --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java @@ -0,0 +1,27 @@ +/* + * 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.binding.jms; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + return "jmsHello " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java new file mode 100644 index 0000000000..218cccf64c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java @@ -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. + */ +package org.apache.tuscany.sca.binding.jms; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the OneWay service. + */ +@Service(OneWayService.class) +public class OneWayClientImpl implements OneWayService { + + private OneWayService serviceA; + + @Reference + public void setServiceA(OneWayService service) { + this.serviceA = service; + } + + public void sayHello(String name) { + serviceA.sayHello(name); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java new file mode 100644 index 0000000000..f16f853ba7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java @@ -0,0 +1,29 @@ +/* + * 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.binding.jms; + +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface OneWayService { + + @OneWay + void sayHello(String name); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java new file mode 100644 index 0000000000..bff4536fa0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java @@ -0,0 +1,34 @@ +/* + * 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.binding.jms; + +public class OneWayServiceImpl implements OneWayService { + + public static Object mutex = new Object(); + public static String name; + + public void sayHello(String name) { + OneWayServiceImpl.name = name; + synchronized (OneWayServiceImpl.mutex) { + OneWayServiceImpl.mutex.notify(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/external/client.composite b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/external/client.composite new file mode 100644 index 0000000000..dcea428493 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/external/client.composite @@ -0,0 +1,38 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/external/service.composite b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/external/service.composite new file mode 100644 index 0000000000..44b7b29610 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/external/service.composite @@ -0,0 +1,35 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/oneway/OneWayClient.composite b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/oneway/OneWayClient.composite new file mode 100644 index 0000000000..fdffbc13ee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/oneway/OneWayClient.composite @@ -0,0 +1,35 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="OneWayComposite">
+
+ <component name="OneWayClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="OneWayClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.OneWayService" />
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+ <destination name="DestQueueA"/>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/oneway/OneWayService.composite b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/oneway/OneWayService.composite new file mode 100644 index 0000000000..f687c2b03f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/oneway/OneWayService.composite @@ -0,0 +1,32 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="OneWayComposite">
+
+ <component name="OneWayService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+ <destination name="DestQueueA" create="always"/>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/simple/client.composite b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/simple/client.composite new file mode 100644 index 0000000000..ddb31cb2af --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/simple/client.composite @@ -0,0 +1,38 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldClient">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
+ <reference name="serviceA" />
+ </component>
+
+ <reference name="serviceA" promote="HelloWorldClient/serviceA">
+ <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+ <destination name="DestQueueA"/>
+ <response>
+ <destination name="RespQueueA"/>
+ </response>
+ </binding.jms>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/simple/service.composite b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/simple/service.composite new file mode 100644 index 0000000000..fc81d7e8eb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/main/resources/simple/service.composite @@ -0,0 +1,35 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="RPCComposite">
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
+ <service name="HelloWorldService">
+ <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61619">
+ <destination name="DestQueueA" create="always"/>
+ <response>
+ <destination name="RespQueueA" create="always"/>
+ </response>
+ </binding.jms>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java new file mode 100644 index 0000000000..258b54a20d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java @@ -0,0 +1,68 @@ +/* + * 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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests using the JMS binding with an external JMS broker + */ +public class ExternalBrokerTestCase { + + private static SCADomain scaDomain; + private BrokerService broker; + + @Before + public void init() throws Exception { + startBroker(); + scaDomain = SCADomain.newInstance("http://localhost", "/", "external/client.composite", "external/service.composite"); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() throws Exception { + if (scaDomain != null) { + scaDomain.close(); + } + stopBroker(); + } + + protected void startBroker() throws Exception { + broker = new BrokerService(); + broker.addConnector("tcp://localhost:61616"); + broker.start(); + } + protected void stopBroker() throws Exception { + if (broker != null) { + broker.stop(); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java new file mode 100644 index 0000000000..26dda13cf9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java @@ -0,0 +1,58 @@ +/* + * 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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class OneWayTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = SCADomain.newInstance("http://localhost", "/", "oneway/OneWayClient.composite", "oneway/OneWayService.composite"); + } + + @Test + public void testOneWayInvoked() throws Exception { + OneWayService oneWayService = scaDomain.getService(OneWayService.class, "OneWayClient"); + oneWayService.sayHello("Petra"); + synchronized (OneWayServiceImpl.mutex) { + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayServiceImpl.mutex.wait(10000); + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java new file mode 100644 index 0000000000..c1882a1e26 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/jms/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java @@ -0,0 +1,54 @@ +/* + * 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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class RPCTestCase { + + private static SCADomain scaDomain; + + @Before + public void init() { + scaDomain = + SCADomain.newInstance("http://localhost", "/", "simple/client.composite", "simple/service.composite"); + // scaDomain = SCADomain.newInstance("http://localhost", "/", "simple/client.composite"); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() { + if (scaDomain != null) { + scaDomain.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/pom.xml new file mode 100644 index 0000000000..d02c88565c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/pom.xml @@ -0,0 +1,130 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-large-sdo-ws</artifactId> + <packaging>jar</packaging> + <name>Apache Tuscany SCA Web Service with Large SDO Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-tomcat</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> <!-- to keep compatible with older servlet containers --> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <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.0-incubating</version> + <executions> + <execution> + <id>generate-ifx-sdo</id> + <phase>generate-sources</phase> + <configuration> + <schemaFiles> + <configuration> + <fileName>${basedir}/src/main/resources/wsdl/IFX170_XSD.xsd</fileName> + <noNotification>true</noNotification> + </configuration> + </schemaFiles> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java new file mode 100644 index 0000000000..f5a8830c4a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqClient.java @@ -0,0 +1,43 @@ +/* + * 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.itest.trninq; + +import java.rmi.RemoteException; + +import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type; +import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type; + +/** + * @version $Rev$ $Date$ + */ +public class TrnInqClient implements TrninqInterface { + + //service interface + private TrninqInterface transactionInquiryService; + + // setting service interface + public void setTransactionInquiryService(TrninqInterface transactionInquiryService) { + this.transactionInquiryService = transactionInquiryService; + } + + public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type req) throws RemoteException { + return transactionInquiryService.DepAcctTrnInq(req); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java new file mode 100644 index 0000000000..14da53cf98 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrnInqService.java @@ -0,0 +1,112 @@ +/* + * 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.itest.trninq; + +import java.rmi.RemoteException; +import java.util.List; + +import org.ifxforum.xsd._1.AdditionalStatus_Type; +import org.ifxforum.xsd._1.BankAcctTrnRec_Type; +import org.ifxforum.xsd._1.BillerId_Type; +import org.ifxforum.xsd._1.BillerPayee_Type; +import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type; +import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type; +import org.ifxforum.xsd._1.DepAcctTrnRec_Type; +import org.ifxforum.xsd._1._1Factory; + +/** + * @version $Rev$ $Date$ + */ +public class TrnInqService implements TrninqInterface { + + public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type req) throws RemoteException { + + DepAcctTrnInqRs_Type response = _1Factory.INSTANCE.createDepAcctTrnInqRs_Type(); + + response.setStatus(_1Factory.INSTANCE.createStatus_Type()); + response.getStatus().setStatusCode(1); + response.getStatus().setStatusDesc("the description associated with the code 1"); + AdditionalStatus_Type addStatus = _1Factory.INSTANCE.createAdditionalStatus_Type(); + addStatus.setServerStatusCode("STATUS_OK"); + addStatus.setSeverity("SEVERITY_WARNING"); + response.getStatus().getAdditionalStatus().add(addStatus); + + response.setDepAcctId(_1Factory.INSTANCE.createDepAcctId_Type()); + response.getDepAcctId().setBankInfo(_1Factory.INSTANCE.createBankInfo_Type()); + response.getDepAcctId().getBankInfo().setBranchId("Concord_1"); + response.getDepAcctId().getBankInfo().setBankId("Dufferin hill"); + response.getDepAcctId().getBankInfo().setBankIdType("Concord branch"); + response.getDepAcctId().getBankInfo().setBranchName("A Happy branch"); + response.getDepAcctId().getBankInfo().setCity("Toronto"); + + response.getDepAcctId().getBankInfo().setCountry("Canada"); + response.getDepAcctId().getBankInfo().setName("Info for A Happy branch"); + response.getDepAcctId().getBankInfo().setPostalCode("L1LL1L"); + response.getDepAcctId().getBankInfo().setStateProv("ON"); + + List records = response.getDepAcctTrnRec(); + // Record1 + DepAcctTrnRec_Type trnRec1 = null; + BankAcctTrnRec_Type baTrnRec1 = null; + long maxRec = req.getTrnCountLimit().getCount(); + for (int i = 0; i < maxRec; i++) { + trnRec1 = _1Factory.INSTANCE.createDepAcctTrnRec_Type(); + baTrnRec1 = _1Factory.INSTANCE.createBankAcctTrnRec_Type(); + + trnRec1.setBankAcctTrnRec(baTrnRec1); + trnRec1.getBankAcctTrnRec().setCSPRefId("CSPRefId1"); + trnRec1.getBankAcctTrnRec().setPostedDt("1"); + trnRec1.getBankAcctTrnRec().setOrigDt("1"); + trnRec1.getBankAcctTrnRec().setBillRefInfo("aaaa"); + + trnRec1.getBankAcctTrnRec().setTrnType("1"); + + trnRec1.getBankAcctTrnRec().setCurAmt(_1Factory.INSTANCE.createCurrencyAmount()); + trnRec1.getBankAcctTrnRec().getCurAmt().setAmt(new java.math.BigDecimal(2000.35)); + trnRec1.getBankAcctTrnRec().getCurAmt().setCurCode("100"); + + trnRec1.setStmtRunningBal(_1Factory.INSTANCE.createCurrencyAmount()); + trnRec1.getStmtRunningBal().setAmt(new java.math.BigDecimal("1345.55")); + + trnRec1.getBankAcctTrnRec().setCustPayeeInfo(_1Factory.INSTANCE.createCustPayeeInfo_Type()); + trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setBillingAcct("000601832"); + trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setAcctPayAcctId("12"); + trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setName("John Doe"); + trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setNickname("Jody"); + + trnRec1.getBankAcctTrnRec().getCustPayeeInfo().setBillerPayee(_1Factory.INSTANCE.createBillerPayee_Type()); + BillerPayee_Type BillerP = trnRec1.getBankAcctTrnRec().getCustPayeeInfo().getBillerPayee(); + + BillerP.setBillerId(_1Factory.INSTANCE.createBillerId_Type()); + BillerId_Type BId = BillerP.getBillerId(); + + BId.setBillerNum("123"); + BId.setSPName("SomeName"); + + trnRec1.setAvailDt("sss"); + trnRec1.setPmtId("SomeID"); + trnRec1.setXferId("SomeOtherID"); + + records.add(trnRec1); + } + + return response; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.java b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.java new file mode 100644 index 0000000000..3575d94f48 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/java/org/apache/tuscany/sca/itest/trninq/TrninqInterface.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 org.apache.tuscany.sca.itest.trninq; + +import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type; +import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type; +import org.osoa.sca.annotations.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface TrninqInterface { + + /** + * Auto generated method signatures + * @param depAcctTrnInqRq + */ + public DepAcctTrnInqRs_Type DepAcctTrnInq(DepAcctTrnInqRq_Type depAcctTrnInqRq) throws java.rmi.RemoteException; + + // +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/trnInq.composite b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/trnInq.composite new file mode 100644 index 0000000000..02c262fe0a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/trnInq.composite @@ -0,0 +1,39 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://trninqcomposite"
+ name="TestService">
+
+ <service name="TrnInqService" promote="TransactionInquiryComponent">
+ <interface.java class="org.apache.tuscany.sca.itest.trninq.TrnInqInterface" />
+ <binding.ws wsdlElement="http://trninq#wsdl.port(TrnInqSvc/TrnInqSvcPort)" />
+ </service>
+ <component name="TransactionInquiryComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.trninq.TrnInqService" />
+ </component>
+
+ <reference name="TrnInqReference" promote="TransactionInquiryClientComponent/transactionInquiryService">
+ <interface.java class="org.apache.tuscany.sca.itest.trninq.TrnInqInterface" />
+ <binding.ws wsdlElement="http://trninq#wsdl.port(TrnInqSvc/TrnInqSvcPort)" />
+ </reference>
+ <component name="TransactionInquiryClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.trninq.TrnInqClient" />
+ </component>
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd new file mode 100644 index 0000000000..b85b80abc4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/wsdl/IFX170_XSD.xsd @@ -0,0 +1,146 @@ +<?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. + --> + <!-- + http://www.ifxforum.org/standards/standard/license + +IFX License Statement +===================== +IFX Forum hereby grants to all users of the IFX Business Message Specification +and Data Dictionary (the "Specification") a perpetual, worldwide, royalty-free, +nonexclusive, nontransferable license to (a) use the specification in the development +of software and/or data compilations which facilitate electronic transmission of +information in accordance with the Specification and otherwise implement the +Specification in user's products, and (b) market, reproduce, display, and distribute +(in any medium known now or in the future) the Specification as implemented in user's +products. The foregoing rights may be sublicensed through multiple tiers of distribution, +including resellers. + +Other than as licensed herein, the IFX Forum shall retain all right, title and interest +to any patent, copyrights, trade secrets or other proprietary rights ("Intellectual +Property Rights") in the Specification. Subject to all patent rights preserved by IFX Forum +members pursuant to Section 5.1 of the "Membership Rules of the Interactive Financial +Exchange Forum, Inc.", users shall retain all right, title and interest to the Intellectual +Property Rights in any products of user created using the Specification and any modifications, +extensions or derivative works of the Specification that user develops or has developed on +its behalf as permitted under this Agreement (the "Derivatives"), provided, however, that, +users may not hold Derivatives out as being endorsed, sponsored by or affiliated with the +IFX Forum. + --> +<xsd:schema xmlns="urn:ifxforum-org:XSD:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="urn:ifxforum-org:XSD:1" elementFormDefault="qualified" attributeFormDefault="unqualified"> + <xsd:complexType name="AdditionalStatus_Type"> + <xsd:sequence> + <xsd:element name="ServerStatusCode" type="xsd:string" /> + <xsd:element name="Severity" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="BankAcctTrnRec_Type"> + <xsd:sequence> + <xsd:element name="TrnType" type="xsd:string" minOccurs="0" /> + <xsd:element name="PostedDt" type="xsd:string" /> + <xsd:element name="OrigDt" type="xsd:string" minOccurs="0" /> + <xsd:element name="CurAmt" type="CurrencyAmount" /> + <xsd:element name="BillRefInfo" type="xsd:string" minOccurs="0" /> + <xsd:element name="CustPayeeInfo" type="CustPayeeInfo_Type" minOccurs="0" /> + <xsd:element name="CSPRefId" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="BankInfo_Type"> + <xsd:sequence> + <xsd:element name="BankIdType" type="xsd:string" minOccurs="0" /> + <xsd:element name="BankId" type="xsd:string" minOccurs="0" /> + <xsd:element name="Name" type="xsd:string" minOccurs="0" /> + <xsd:element name="BranchId" type="xsd:string" minOccurs="0" /> + <xsd:element name="BranchName" type="xsd:string" minOccurs="0" /> + <xsd:element name="City" type="xsd:string" minOccurs="0" /> + <xsd:element name="StateProv" type="xsd:string" minOccurs="0" /> + <xsd:element name="PostalCode" type="xsd:string" minOccurs="0" /> + <xsd:element name="Country" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="BillerId_Type"> + <xsd:sequence> + <xsd:element name="SPName" type="xsd:string" /> + <xsd:element name="BillerNum" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="BillerPayee_Type"> + <xsd:sequence> + <xsd:element name="BillerId" type="BillerId_Type" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CurrencyAmount"> + <xsd:sequence> + <xsd:element name="Amt" type="xsd:decimal" /> + <xsd:element name="CurCode" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="CustPayeeInfo_Type"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" minOccurs="0" /> + <xsd:element name="Nickname" type="xsd:string" minOccurs="0" /> + <xsd:element name="BillerPayee" type="BillerPayee_Type" /> + <xsd:element name="BillingAcct" type="xsd:string" minOccurs="0" /> + <xsd:element name="AcctPayAcctId" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="DepAcctTrnInqRq_Type"> + <xsd:sequence> + <xsd:element name="TrnCountLimit" type="TrnCountLimit_Type" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="DepAcctTrnInqRs_Type"> + <xsd:sequence> + <xsd:sequence> + <xsd:element name="Status" type="Status_Type" /> + <xsd:element name="DepAcctId" type="DepAcctId_Type" /> + <xsd:element name="DepAcctTrnRec" type="DepAcctTrnRec_Type" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="DepAcctTrnRec_Type"> + <xsd:sequence> + <xsd:element name="BankAcctTrnRec" type="BankAcctTrnRec_Type" /> + <xsd:element name="StmtRunningBal" type="CurrencyAmount" minOccurs="0" /> + <xsd:element name="AvailDt" type="xsd:string" minOccurs="0" /> + <xsd:element name="XferId" type="xsd:string" minOccurs="0" /> + <xsd:element name="PmtId" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="DepAcctId_Type"> + <xsd:sequence> + <xsd:element name="BankInfo" type="BankInfo_Type" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="Status_Type"> + <xsd:sequence> + <xsd:element name="StatusCode" type="xsd:int" /> + <xsd:element name="StatusDesc" type="xsd:string" /> + <xsd:element name="AdditionalStatus" type="AdditionalStatus_Type" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="TrnCountLimit_Type"> + <xsd:sequence> + <xsd:element name="Count" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + <xsd:element name="DepAcctTrnInqRq" type="DepAcctTrnInqRq_Type" /> + <xsd:element name="DepAcctTrnInqRs" type="DepAcctTrnInqRs_Type" /> +</xsd:schema>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl new file mode 100644 index 0000000000..12764c2142 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/main/resources/wsdl/trninq.wsdl @@ -0,0 +1,57 @@ +<?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.
+-->
+<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:trninq="urn:ifxforum-org:XSD:1"
+ xmlns:tns="http://trninq" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://trninq">
+ <types>
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://trninq">
+ <xsd:import namespace="urn:ifxforum-org:XSD:1" schemaLocation="IFX170_XSD.xsd" />
+ </xsd:schema>
+ </types>
+ <message name="DepAcctTrnInqRq">
+ <part name="messagePart" element="trninq:DepAcctTrnInqRq" />
+ </message>
+ <message name="DepAcctTrnInqRs">
+ <part name="messagePart" element="trninq:DepAcctTrnInqRs" />
+ </message>
+ <portType name="trninqInterface">
+ <operation name="DepAcctTrnInq">
+ <input message="tns:DepAcctTrnInqRq" />
+ <output message="tns:DepAcctTrnInqRs" />
+ </operation>
+ </portType>
+ <binding name="trninq" type="tns:trninqInterface">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <operation name="DepAcctTrnInq">
+ <soap:operation soapAction="trninq:DepAcctTrnInq" style="document" />
+ <input>
+ <soap:body use="literal" />
+ </input>
+ <output>
+ <soap:body use="literal" />
+ </output>
+ </operation>
+ </binding>
+ <service name="TrnInqSvc">
+ <port name="TrnInqSvcPort" binding="tns:trninq">
+ <soap:address location="http://localhost:8085/TestService/services/TrnInqService" />
+ </port>
+ </service>
+</definitions>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java new file mode 100644 index 0000000000..9c86d429a3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/large-sdo-ws/src/test/java/trninq/TrnInqServiceTestCase.java @@ -0,0 +1,85 @@ +/* + * 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 trninq; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.itest.trninq.TrninqInterface; +import org.ifxforum.xsd._1.DepAcctTrnInqRq_Type; +import org.ifxforum.xsd._1.DepAcctTrnInqRs_Type; +import org.ifxforum.xsd._1.TrnCountLimit_Type; +import org.ifxforum.xsd._1._1Factory; +import org.junit.Assert; + +/** + * This test is created to cover https://issues.apache.org/jira/browse/TUSCANY-1541 + * + * @version $Rev$ $Date$ + */ +public class TrnInqServiceTestCase extends TestCase { + + private SCADomain scaDomain; + private TrninqInterface trnInq; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("trnInq.composite"); + trnInq = scaDomain.getService(TrninqInterface.class, "TransactionInquiryClientComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testDepAcctTrnInq() throws IOException { + DepAcctTrnInqRq_Type depAcctTrnInqRequest = _1Factory.INSTANCE.createDepAcctTrnInqRq_Type(); + TrnCountLimit_Type trnCountLimit = _1Factory.INSTANCE.createTrnCountLimit_Type(); + depAcctTrnInqRequest.setTrnCountLimit(trnCountLimit); + depAcctTrnInqRequest.getTrnCountLimit().setCount(2); + + try { + DepAcctTrnInqRs_Type depAcctTrnInqResponse = trnInq.DepAcctTrnInq(depAcctTrnInqRequest); + } catch (Exception e) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + Assert.fail("Should pass with MaxRec 2! \n" + sw); + sw.close(); + pw.close(); + } + + depAcctTrnInqRequest.getTrnCountLimit().setCount(10); + try { + DepAcctTrnInqRs_Type depAcctTrnInqResponse = trnInq.DepAcctTrnInq(depAcctTrnInqRequest); + } catch (Exception e) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + Assert.fail("Should pass with MaxRec 10! \n" + sw); + sw.close(); + pw.close(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/build.xml b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/build.xml new file mode 100644 index 0000000000..3bef840161 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/build.xml @@ -0,0 +1,127 @@ +<!--
+ * 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 name="oneway" default="runServer">
+
+ <property name="m2.repo" value="${user.home}\.m2\repository" />
+
+ <path id="repo.classpath">
+ <pathelement location="target/classes"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-spi\1.1-incubating-SNAPSHOT\tuscany-core-spi-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-http\1.1-incubating-SNAPSHOT\tuscany-host-http-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-axis2\1.1-incubating-SNAPSHOT\tuscany-binding-ws-axis2-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy\1.1-incubating-SNAPSHOT\tuscany-policy-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.jar"/>
+ <pathelement location="${m2.repo}\org\mortbay\jetty\jetty-util\6.1.3\jetty-util-6.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-jms_1.1_spec\1.1\geronimo-jms_1.1_spec-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-runtime\1.1-incubating-SNAPSHOT\tuscany-implementation-java-runtime-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\wsdl4j\wsdl4j\1.6.2\wsdl4j-1.6.2.jar"/>
+ <pathelement location="${m2.repo}\commons-codec\commons-codec\1.3\commons-codec-1.3.jar"/>
+ <pathelement location="${m2.repo}\xml-apis\xml-apis\1.3.03\xml-apis-1.3.03.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\security\wss4j\1.5.3\wss4j-1.5.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-namespace\1.1-incubating-SNAPSHOT\tuscany-contribution-namespace-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\jdom\jdom\1.0\jdom-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xsd\1.1-incubating-SNAPSHOT\tuscany-assembly-xsd-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly\1.1-incubating-SNAPSHOT\tuscany-assembly-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-trust\1.3\rampart-trust-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core-databinding\1.1-incubating-SNAPSHOT\tuscany-core-databinding-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-api\1.2.5\axiom-api-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-xml\1.1-incubating-SNAPSHOT\tuscany-policy-xml-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-kernel\1.3\axis2-kernel-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-sca-api\1.1-incubating-SNAPSHOT\tuscany-sca-api-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore\4.0-alpha5\httpcore-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\backport-util-concurrent\backport-util-concurrent\2.2\backport-util-concurrent-2.2.jar"/>
+ <pathelement location="${m2.repo}\commons-logging\commons-logging\1.1\commons-logging-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-java\1.1-incubating-SNAPSHOT\tuscany-contribution-java-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-activation_1.1_spec\1.0-M1\geronimo-activation_1.1_spec-1.0-M1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding\1.1-incubating-SNAPSHOT\tuscany-databinding-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\logkit\logkit\1.0.1\logkit-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws-xml\1.1-incubating-SNAPSHOT\tuscany-binding-ws-xml-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\commons-fileupload\commons-fileupload\1.1.1\commons-fileupload-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\annogen\annogen\0.1.0\annogen-0.1.0.jar"/>
+ <pathelement location="${m2.repo}\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-adb\1.3\axis2-adb-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-security\1.1-incubating-SNAPSHOT\tuscany-policy-security-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-assembly-xml\1.1-incubating-SNAPSHOT\tuscany-assembly-xml-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-mtompolicy\1.3\axis2-mtompolicy-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain\1.1-incubating-SNAPSHOT\tuscany-domain-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\commons-httpclient\commons-httpclient\3.0.1\commons-httpclient-3.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java\1.1-incubating-SNAPSHOT\tuscany-interface-java-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-java2wsdl\1.3\axis2-java2wsdl-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore-nio\4.0-alpha5\httpcore-nio-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution\1.1-incubating-SNAPSHOT\tuscany-contribution-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java\1.1-incubating-SNAPSHOT\tuscany-implementation-java-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\xalan\xalan\2.7.0\xalan-2.7.0.jar"/>
+ <pathelement location="${m2.repo}\com\ibm\icu\icu4j\2.6.1\icu4j-2.6.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-core\1.3\rampart-core-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-commonj_1.1_spec\1.0\geronimo-commonj_1.1_spec-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-domain-api\1.1-incubating-SNAPSHOT\tuscany-domain-api-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca\1.1-incubating-SNAPSHOT\tuscany-binding-sca-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\xom\xom\1.0\xom-1.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-jetty\1.1-incubating-SNAPSHOT\tuscany-host-jetty-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\rampart\rampart-policy\1.3\rampart-policy-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\httpcomponents\httpcore-niossl\4.0-alpha5\httpcore-niossl-4.0-alpha5.jar"/>
+ <pathelement location="${m2.repo}\junit\junit\4.2\junit-4.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-impl\1.2.5\axiom-impl-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-implementation-java-xml\1.1-incubating-SNAPSHOT\tuscany-implementation-java-xml-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-sca-xml\1.1-incubating-SNAPSHOT\tuscany-binding-sca-xml-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\neethi\neethi\2.0.2\neethi-2.0.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl\1.1-incubating-SNAPSHOT\tuscany-interface-wsdl-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-binding-ws\1.1-incubating-SNAPSHOT\tuscany-binding-ws-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\javax\activation\activation\1.1\activation-1.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ant\ant\1.7.0\ant-1.7.0.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-databinding-axiom\1.1-incubating-SNAPSHOT\tuscany-databinding-axiom-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\mortbay\jetty\jetty\6.1.3\jetty-6.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\geronimo\specs\geronimo-javamail_1.4_spec\1.0-M1\geronimo-javamail_1.4_spec-1.0-M1.jar"/>
+ <pathelement location="${m2.repo}\avalon-framework\avalon-framework\4.1.3\avalon-framework-4.1.3.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-core\1.1-incubating-SNAPSHOT\tuscany-core-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-wsdl-xml\1.1-incubating-SNAPSHOT\tuscany-interface-wsdl-xml-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-contribution-impl\1.1-incubating-SNAPSHOT\tuscany-contribution-impl-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-node\1.1-incubating-SNAPSHOT\tuscany-node-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-definitions\1.1-incubating-SNAPSHOT\tuscany-definitions-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\santuario\xmlsec\1.4.0\xmlsec-1.4.0.jar"/>
+ <pathelement location="${m2.repo}\jaxen\jaxen\1.1.1\jaxen-1.1.1.jar"/>
+ <pathelement location="${m2.repo}\commons-io\commons-io\1.2\commons-io-1.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-embedded\1.1-incubating-SNAPSHOT\tuscany-host-embedded-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\axiom\axiom-dom\1.2.5\axiom-dom-1.2.5.jar"/>
+ <pathelement location="${m2.repo}\log4j\log4j\1.2.12\log4j-1.2.12.jar"/>
+ <pathelement location="${m2.repo}\javax\mail\mail\1.4\mail-1.4.jar"/>
+ <pathelement location="${m2.repo}\org\apache\axis2\axis2-codegen\1.3\axis2-codegen-1.3.jar"/>
+ <pathelement location="${m2.repo}\org\codehaus\woodstox\wstx-asl\3.2.1\wstx-asl-3.2.1.jar"/>
+ <pathelement location="${m2.repo}\stax\stax-api\1.0.1\stax-api-1.0.1.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java-xml\1.1-incubating-SNAPSHOT\tuscany-interface-java-xml-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\apache\ws\commons\schema\XmlSchema\1.3.2\XmlSchema-1.3.2.jar"/>
+ <pathelement location="${m2.repo}\xerces\xmlParserAPIs\2.6.2\xmlParserAPIs-2.6.2.jar"/>
+ <pathelement location="${m2.repo}\org\apache\woden\woden\1.0-incubating-M7b\woden-1.0-incubating-M7b.jar"/>
+ <pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface\1.1-incubating-SNAPSHOT\tuscany-interface-1.1-incubating-SNAPSHOT.jar"/>
+ <pathelement location="${m2.repo}\org\easymock\easymock\2.2\easymock-2.2.jar"/>
+ </path>
+
+ <target name="runServer">
+ <java classname="org.apache.tuscany.sca.itest.oneway.impl.OneWayServer"
+ fork="true">
+ <classpath>
+ <path refid="repo.classpath"/>
+ </classpath>
+ </java>
+ </target>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/pom.xml new file mode 100644 index 0000000000..54afa556aa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/pom.xml @@ -0,0 +1,64 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-oneway</artifactId>
+ <name>Apache Tuscany SCA OneWay Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-jetty</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.java new file mode 100644 index 0000000000..afa008bd3e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayClient.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.itest.oneway;
+
+
+/**
+ * The client for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public interface OneWayClient {
+
+ public int doSomething(int count);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.java new file mode 100644 index 0000000000..b389927403 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/OneWayService.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.itest.oneway;
+
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The service interface used when testing oneway interactions
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+@Remotable
+public interface OneWayService {
+
+ @OneWay
+ public void doSomething(int count);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.java new file mode 100644 index 0000000000..c1d77dbbb1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayClientImpl.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 org.apache.tuscany.sca.itest.oneway.impl;
+
+import org.apache.tuscany.sca.itest.oneway.OneWayClient;
+import org.apache.tuscany.sca.itest.oneway.OneWayService;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * The client for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public class OneWayClientImpl implements OneWayClient {
+
+ @Reference
+ protected OneWayService oneWayService;
+
+ public static int callCount = 0;
+
+
+ public int doSomething(int count){
+
+ callCount = callCount + count;
+
+ for (int loopCount = 0; loopCount < count; loopCount++){
+ //System.out.println("Client: doSomething " + loopCount);
+ //System.out.flush();
+ oneWayService.doSomething(loopCount);
+ }
+
+ return count;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java new file mode 100644 index 0000000000..405fa5c3fd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServer.java @@ -0,0 +1,46 @@ +/*
+ * 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.itest.oneway.impl;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the oneway Web service endpoint.
+ */
+public class OneWayServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("oneWay.composite");
+
+ try {
+ System.out.println("OneWay server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("OneWay server stopped");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java new file mode 100644 index 0000000000..6e57e83ad8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/java/org/apache/tuscany/sca/itest/oneway/impl/OneWayServiceImpl.java @@ -0,0 +1,45 @@ +/*
+ * 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.itest.oneway.impl;
+
+import org.apache.tuscany.sca.itest.oneway.OneWayService;
+
+/**
+ * The service for the oneway itest
+ *
+ * @version $Rev: 537240 $ $Date: 2007-05-11 18:35:03 +0100 (Fri, 11 May 2007) $
+ */
+
+
+public class OneWayServiceImpl implements OneWayService {
+
+ public static int callCount = 0;
+
+ public void doSomething(int count){
+
+ synchronized(this){
+ callCount++;
+ }
+
+ // System.out.println("Service: doSomething " + count + " callCount = " + callCount);
+ // System.out.flush();
+
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite new file mode 100644 index 0000000000..f827327301 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite @@ -0,0 +1,39 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="OneWayITest">
+
+ <component name="OneWayClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl"/>
+ <reference name="oneWayService" target="OneWayServiceComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ <binding.ws/>
+ </reference>
+ </component>
+
+ <component name="OneWayServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl"/>
+ <service name="OneWayService">
+ <interface.java interface="org.apache.tuscany.sca.itest.oneway.OneWayService" />
+ <binding.ws/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java new file mode 100644 index 0000000000..86f10abcf6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCaseFIXME.java @@ -0,0 +1,82 @@ +/*
+ * 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.itest.oneway;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.itest.oneway.impl.OneWayClientImpl;
+import org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl;
+import org.apache.tuscany.sca.node.SCANode;
+import org.apache.tuscany.sca.node.SCANodeFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class OneWayTestCaseFIXME {
+
+ private SCADomain domain;
+
+ @Before
+ public void setUp() throws Exception {
+ SCANode node = SCANodeFactory.newInstance().createSCANode(null, null);
+ node.addContribution("mycontribution",
+ OneWayTestCaseFIXME.class.getResource("/OneWayContribution/."));
+ node.start();
+ domain = node.getDomain();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (domain != null) {
+ domain.destroy();
+ }
+ }
+
+ @Test
+ public void testOneWay() {
+ OneWayClient client =
+ domain.getService(OneWayClient.class, "OneWayClientComponent");
+ try {
+
+ int count = 100;
+
+ for (int i = 0; i < 10; i++){
+ // System.out.println("Test: doSomething " + count);
+ // System.out.flush();
+ client.doSomething(count);
+
+ Thread.sleep(2000);
+
+ System.out.println("Finished callCount = " + OneWayServiceImpl.callCount);
+
+ Assert.assertEquals(OneWayClientImpl.callCount, OneWayServiceImpl.callCount);
+ }
+ } catch (Exception ex) {
+ System.err.println("Exception: " + ex.toString());
+ }
+
+
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/pom.xml new file mode 100644 index 0000000000..c18092cd12 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-operation-overloading</artifactId> + <name>Apache Tuscany SCA Operation Overloading Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java new file mode 100644 index 0000000000..f630f9904f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java @@ -0,0 +1,42 @@ +/* + * 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.opoverload; + + +/** + * + */ +//@AllowsPassByReference +public interface OverloadASourceTarget { + final String opName = "operationA:"; + + String operationA(); + + String operationA(int parm1); + + String operationA(int parm1, String parm2); + + String operationA(String parm1, int parm2); + + String operationA(String string); + + String[] operationAall(); + +}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java new file mode 100644 index 0000000000..d0f78c409f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java @@ -0,0 +1,104 @@ +/* + * 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.opoverload.impl; + +import java.util.ArrayList; + +import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * + */ +@Service(OverloadASourceTarget.class) +public class OverloadASource implements OverloadASourceTarget{ + public OverloadASourceTarget overloadASourceTarget; + /** + * + */ + public OverloadASource() { + + } + /** + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA() + */ + public String[] operationAall() { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + ArrayList<String> ret = new ArrayList<String>(); + ret.add(overloadASourceTarget.operationA()); + ret.add(overloadASourceTarget.operationA(11)); + ret.add(overloadASourceTarget.operationA("eleven")); + ret.add(overloadASourceTarget.operationA(3,"three")); + ret.add(overloadASourceTarget.operationA("four",4)); + return (String[]) ret.toArray(new String[ret.size()]); + } + + + /** + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA() + */ + public String operationA() { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(); + } + /** + * @param parm1 + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int) + */ + public String operationA(int parm1) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(parm1); + } + /** + * @param parm1 + * @param parm2 + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int, java.lang.String) + */ + public String operationA(int parm1, String parm2) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(parm1, parm2); + } + public String operationA(String string) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(string); + } + /** + * @param parm1 + * @param parm2 + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(java.lang.String, int) + */ + public String operationA(String parm1, int parm2) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(parm1, parm2); + } + + @Reference + public void setOverloadASourceTarget(OverloadASourceTarget overloadASourceTarget) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is set tonull"; + this.overloadASourceTarget = overloadASourceTarget; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java new file mode 100644 index 0000000000..e83952e573 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.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 org.apache.tuscany.sca.test.opoverload.impl; + +import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget; +import org.osoa.sca.annotations.Service; + +/** + * + */ +@Service(OverloadASourceTarget.class) +public class OverloadATarget implements OverloadASourceTarget { + + /** + * + */ + public OverloadATarget() { + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int) + */ + public String operationA(int parm1) { + final String ret = opName + parm1; + out(ret); + return ret; + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int, + * java.lang.String) + */ + public String operationA(int parm1, String parm2) { + final String ret = opName + parm1 + parm2; + out(ret); + return ret; + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA() + */ + public String operationA() { + out(opName); + return opName; + + } + + public String operationA(String parm1, int parm2) { + final String ret = opName + parm1 + parm2; + out(ret); + return ret; + } + + public String operationA(String parm1) { + final String ret = opName + parm1; + out(ret); + return ret; + } + + private void out(String msg) { + + java.lang.System.out.println(msg); + } + + public String[] operationAall() { + throw new IllegalArgumentException("not supported"); + + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/resources/OperationOverload.composite b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/resources/OperationOverload.composite new file mode 100644 index 0000000000..cbf5aa2078 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/main/resources/OperationOverload.composite @@ -0,0 +1,34 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://foo" + xmlns:foo="http://foo" + name="OperationOverload"> + + <component name="OverloadASourceComponent"> + <implementation.java class="org.apache.tuscany.sca.test.opoverload.impl.OverloadASource" /> + <reference name="overloadASourceTarget" target="OverloadATargetComponent"/> + </component> + + <component name="OverloadATargetComponent"> + <implementation.java class="org.apache.tuscany.sca.test.opoverload.impl.OverloadATarget" /> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java new file mode 100644 index 0000000000..3129b03ff3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java @@ -0,0 +1,72 @@ +/* + * 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.opoverload.impl; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget; + +public class OverloadATestCase extends TestCase { + + private SCADomain domain; + private OverloadASourceTarget overloadA; + + public void testOperationAall() { + String[] result= overloadA.operationAall(); + assertEquals(5, result.length); + assertEquals(OverloadASourceTarget.opName , result[0]); + assertEquals(OverloadASourceTarget.opName + 11, result[1]); + assertEquals(OverloadASourceTarget.opName + "eleven", result[2]); + assertEquals(OverloadASourceTarget.opName + 3 + "three", result[3]); + assertEquals(OverloadASourceTarget.opName + "four" + 4, result[4]); + } + +// public void testOperationAInt() { +// String result= overloadA.operationA(29); +// assertEquals(OverloadASourceTarget.opName + 29, result); +// } +// +// public void testOperationAString() { +// String result= overloadA.operationA("rick:-)"); +// assertEquals(OverloadASourceTarget.opName + "rick:-)", result); +// } +// +// public void testOperationAIntString() { +// String result= overloadA.operationA(123, "Tuscany"); +// assertEquals(OverloadASourceTarget.opName +123+ "Tuscany", result); +// } +// +// public void testOperationStringInt() { +// String result= overloadA.operationA("StringInt", 77); +// assertEquals(OverloadASourceTarget.opName + "StringInt" + 77, result); +// } +// + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("OperationOverload.composite"); + overloadA = domain.getService(OverloadASourceTarget.class, "OverloadASourceComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/pom.xml new file mode 100644 index 0000000000..2b64fe9994 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/pom.xml @@ -0,0 +1,100 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tuscany-itest</artifactId> + <packaging>pom</packaging> + <name>Apache Tuscany SCA Integration Tests</name> + + <profiles> + <profile> + <id>default</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <modules> + <module>callablereferences</module> + <module>callablereferences-ws</module> + <module>callback-api</module> + <module>callback-basic</module> + <module>callback-complex-type</module> + <module>callback-id</module> + <module>callback-multiple-wires</module> + <module>callback-set-callback</module> + <module>callback-set-conversation</module> + <module>contribution</module> + <module>contribution-multiple</module> + <module>contribution-import-export</module> + <module>contribution-classloader</module> + <module>conversations</module> + <module>conversations-ws</module> + <module>databindings</module> + <module>domain</module> + <module>exceptions</module> + <module>exceptions-cross-binding</module> + <module>exceptions-cross-binding-ws</module> + <module>exceptions-simple-ws</module> + <module>extended-api</module> + <module>jms</module> + <module>large-sdo-ws</module> + <module>oneway</module> + <module>operation-overloading</module> + <module>properties</module> + <module>recursive</module> + <module>references</module> + <module>services</module> + <module>component-type</module> + <module>interfaces</module> + <module>wires</module> + <module>scopes</module> + <module>wsdl</module> + <module>wsdlless</module> + <module>wsdl2java</module> + <module>ws-void-args-return</module> + <module>transaction</module> + <module>bpel</module> + </modules> + </profile> + + </profiles> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymock</artifactId> + <version>2.2</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/properties/pom.xml new file mode 100644 index 0000000000..dc1e752b0a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/pom.xml @@ -0,0 +1,84 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-properties</artifactId>
+ <name>Apache Tuscany SCA Properties Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-customer-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/customer.xsd</schemaFile>
+ <javaPackage>com.example.customer.sdo</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java new file mode 100644 index 0000000000..1f2fd0e5bd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java @@ -0,0 +1,26 @@ +/* + * 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 mysca.test.myservice.impl; + + +public interface MyService { + String getLocation(); + + String getYear(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java new file mode 100644 index 0000000000..158f4a0c12 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java @@ -0,0 +1,73 @@ +/* + * 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 mysca.test.myservice.impl; + +import java.util.logging.Logger; + +import org.osoa.sca.annotations.ComponentName; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(MyService.class) +public class MyServiceImpl implements MyService { + + @Property(name = "location") + protected String location = "RTP"; + + @Property(name = "year") + protected String year = "2006"; + + @ComponentName + protected String componentName; + + + private Logger logger; + + public MyServiceImpl() { + logger = Logger.getAnonymousLogger(); + logger.info("creating service instance..."); + } + + @Init + public void start() { + logger.info("Start service.."); + } + + @Destroy + public void stop() { + logger.info("Stop service.."); + + } + + public String getComponentName() { + return componentName; + } + + public String getLocation() { + return location; + } + + public String getYear() { + return year; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java new file mode 100644 index 0000000000..9328c9149d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java @@ -0,0 +1,39 @@ +/* + * 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 mysca.test.myservice.impl; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(MyService.class) +public class MyTotalServiceImpl implements MyService { + + // default required==true so it is 1:1 + @Reference + public MyService myService; + + public String getLocation() { + return myService.getLocation(); + } + + public String getYear() { + return myService.getYear(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java new file mode 100644 index 0000000000..667b854c10 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java @@ -0,0 +1,27 @@ +/* + * 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.itest; + +public interface ABCDComponent { + String getA(); + String getB(); + String getC(); + String getD(); +} + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java new file mode 100644 index 0000000000..51d4d9b3cb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java @@ -0,0 +1,55 @@ +/* + * 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.itest; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class ABCDComponentImpl implements ABCDComponent { + private ABComponent abComponent; + private CDComponent cdComponent; + + @Reference + public void setAb(ABComponent component) { + this.abComponent = component; + } + + @Reference + public void setCd(CDComponent component) { + this.cdComponent = component; + } + + public String getA() { + return this.abComponent.getA(); + } + + public String getB() { + return this.abComponent.getB(); + } + + public String getC() { + return this.cdComponent.getC(); + } + + public String getD() { + return this.cdComponent.getD(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java new file mode 100644 index 0000000000..c33c140aec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java @@ -0,0 +1,35 @@ +/* + * 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.itest; + +import java.util.Collection; + +import org.osoa.sca.annotations.Remotable; +@Remotable +public interface ABComponent { + + String getA(); + String getB(); + String getZ(); + int getIntValue(); + String getF(); + Collection<String> getManyStringValues(); + Collection<Integer> getManyIntegers(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java new file mode 100644 index 0000000000..b78d6380ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java @@ -0,0 +1,98 @@ +/* + * 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.itest; + +import java.util.Collection; + +import org.osoa.sca.annotations.Property; + +public class ABComponentImpl implements ABComponent { + + private String aProperty; + private String bProperty; + private int intValue; + private Collection<String> manyStringValues; + private Collection<Integer> manyIntegerValues; + private String zProperty; + private String fProperty; + + @Property(name="xpath") + public void setZProperty(final String value) { + this.zProperty = value; + } + + @Property(name="foobar") + public void setManyStringValues(final Collection<String> value) { + this.manyStringValues = value; + } + + @Property(name="fooInts") + public void setManyIntegers(final Collection<Integer> value) { + this.manyIntegerValues = value; + } + + @Property + public void setA(final String A) { + this.aProperty = A; + } + + @Property + public void setB(final String B) { + this.bProperty = B; + } + + @Property + public void setF(final String F) { + this.fProperty = F; + } + + @Property + public void setOne(final int value) { + this.intValue = value; + } + + public String getA() { + return this.aProperty; + } + + public String getB() { + return this.bProperty; + } + + public int getIntValue() { + return this.intValue; + } + + public String getZ() { + return this.zProperty; + } + + public String getF() { + return this.fProperty; + } + + public Collection<String> getManyStringValues() { + return manyStringValues; + } + + public Collection<Integer> getManyIntegers() { + return manyIntegerValues; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java new file mode 100644 index 0000000000..cd3046c62c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java @@ -0,0 +1,33 @@ +/* + * 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.itest; + +import java.util.Collection; + +public interface CDComponent { + + String getC(); + String getC2(); + String getD(); + String getNoSource(); + String getFileProperty(); + Collection<String> getManyValuesFileProperty(); + int getOverrideValue(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java new file mode 100644 index 0000000000..aec71d30f9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java @@ -0,0 +1,97 @@ +/* + * 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.itest; + +import java.util.Collection; + +import org.osoa.sca.annotations.Property; + +public class CDComponentImpl implements CDComponent { + + private String cProperty; + private String dProperty; + private String nosource; + private String fileProperty; + private Collection<String> manyValuesFileProperty; + private int overrideNumber; + private String cProperty2; + + @Property(name="nonFileProperty") + public void setC2(final String value) { + this.cProperty2 = value; + } + @Property(name="two") + public void setOverrideNumber(final int value) { + this.overrideNumber = value; + } + + @Property(name="fileProperty") + public void setFileProp(final String value) { + this.fileProperty = value; + } + + @Property(name="manyValuesFileProperty") + public void setFileManyValueProp(final Collection<String> values) { + this.manyValuesFileProperty = values; + } + + @Property + public void setC(final String C) { + this.cProperty = C; + } + + @Property + public void setD(final String D) { + this.dProperty = D; + } + + @Property + public void setNosource(final String value) { + this.nosource = value; + } + + public String getFileProperty() { + return this.fileProperty; + } + + public String getC() { + return this.cProperty; + } + + public String getC2() { + return this.cProperty2; + } + + public String getD() { + return this.dProperty; + } + + public String getNoSource() { + return this.nosource; + } + + public int getOverrideValue() { + return this.overrideNumber; + } + public Collection<String> getManyValuesFileProperty() { + return this.manyValuesFileProperty; + } +} + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java new file mode 100644 index 0000000000..6335db8a75 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java @@ -0,0 +1,113 @@ +/*
+ * 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.itest;
+
+public class ComplexPropertyBean {
+
+ protected int integerNumber = 25;
+ protected float floatNumber = 50;
+ protected double doubleNumber = 75;
+ protected int[] intArray = null;
+ protected double[] doubleArray = null;
+ protected String[] stringArray = null;
+
+ ComplexPropertyBean numberSet;
+ protected ComplexPropertyBean[] numberSetArray = null;
+
+ public ComplexPropertyBean() {
+
+ }
+
+ public double getDoubleNumber() {
+ return doubleNumber;
+ }
+
+ public void setDoubleNumber(double doubleNumber) {
+ this.doubleNumber = doubleNumber;
+ }
+
+ public float getFloatNumber() {
+ return floatNumber;
+ }
+
+ public void setFloatNumber(float floatNumber) {
+ this.floatNumber = floatNumber;
+ }
+
+ public int getIntegerNumber() {
+ return integerNumber;
+ }
+
+ public void setIntegerNumber(int integerNumber) {
+ this.integerNumber = integerNumber;
+ }
+
+ public ComplexPropertyBean getNumberSet() {
+ return numberSet;
+ }
+
+ public void setNumberSet(ComplexPropertyBean numberSet) {
+ this.numberSet = numberSet;
+ }
+
+ @Override
+ public String toString() {
+ return Double.toString(integerNumber) + " - " +
+ Double.toString(floatNumber) + " - " +
+ Double.toString(doubleNumber) + " \n" +
+ ((intArray == null ) ? "" : intArray[0] + " - " + intArray[1] + " \n " ) +
+ ((doubleArray == null ) ? "" : doubleArray[0] + " - " + doubleArray[1] + " \n " ) +
+ ((stringArray == null ) ? "" : stringArray[0] + " - " + stringArray[1] + " \n " ) +
+ ((numberSetArray == null ) ? "" : numberSetArray[0] + " - " + numberSetArray[1] + " \n " ) +
+ ((numberSet == null ) ? "" : numberSet.toString());
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+
+ public int[] getIntArray() {
+ return intArray;
+ }
+
+ public void setIntArray(int[] intArray) {
+ this.intArray = intArray;
+ }
+
+ public double[] getDoubleArray() {
+ return doubleArray;
+ }
+
+ public void setDoubleArray(double[] doubleArray) {
+ this.doubleArray = doubleArray;
+ }
+
+ public ComplexPropertyBean[] getNumberSetArray() {
+ return numberSetArray;
+ }
+
+ public void setNumberSetArray(ComplexPropertyBean[] numberSetArray) {
+ this.numberSetArray = numberSetArray;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java new file mode 100644 index 0000000000..116cdef48f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java @@ -0,0 +1,25 @@ + +/* + * 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.itest; + +public interface OverrideService { + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java new file mode 100644 index 0000000000..a36bb5e419 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java @@ -0,0 +1,24 @@ +/* + * 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.itest; + +public class OverrideServiceImpl implements OverrideService { + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java new file mode 100644 index 0000000000..5b2948715d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java @@ -0,0 +1,62 @@ +/*
+ * 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.itest;
+
+import java.util.Collection;
+
+import commonj.sdo.DataObject;
+
+
+public interface PropertyComponent {
+ public String getLocation();
+ public String getLocationFromComponentContext();
+ public String getYear();
+
+ /**
+ * This method is used to test injecting a primitive String Array
+ * @return The injected array
+ */
+ public String[] getDaysOfTheWeek();
+
+ /**
+ * This method is used to test injecting an Object Integer Array
+ * @return The injected array
+ */
+ public Integer[] getIntegerNumbers();
+
+ /**
+ * This method is used to test injecting an int Array
+ * @return The injected array
+ */
+ public int[] getIntNumbers();
+
+ /**
+ * This method is used to test injecting an Object Array
+ * @return The injected array
+ */
+ public DataObject[] getSdoArrayProperty();
+
+ public ComplexPropertyBean getComplexPropertyOne();
+ public ComplexPropertyBean getComplexPropertyTwo();
+ public ComplexPropertyBean getComplexPropertyThree();
+ public Collection<ComplexPropertyBean> getComplexPropertyFour();
+ public DataObject getSdoProperty();
+ public DataObject getCustomerSdo();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java new file mode 100644 index 0000000000..43c9935d7e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java @@ -0,0 +1,152 @@ +/*
+ * 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.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Property;
+
+import com.example.customer.sdo.impl.CustomerImpl;
+import commonj.sdo.DataObject;
+
+public class PropertyComponentImpl implements PropertyComponent {
+
+ @Context
+ protected ComponentContext context;
+
+ @Property
+ protected CustomerImpl customerSdo;
+
+ @Property
+ protected DataObject sdoProperty;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyOne;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyTwo;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyThree;
+
+ @Property
+ protected Collection<ComplexPropertyBean> complexPropertyFour;
+
+ @Property(name = "location")
+ protected String location;
+
+ @Property(name = "year")
+ protected String year;
+
+ @Property(name = "daysOfTheWeek")
+ protected String[] daysOfTheWeek;
+
+ @Property(name = "integerNumbers")
+ protected Integer[] integerNumbers;
+
+ @Property(name = "intNumbers")
+ protected int[] intNumbers;
+
+ @Property(name = "sdoArray")
+ protected DataObject[] sdoArray;
+
+ public String getLocation(){
+ return location;
+ }
+
+ public String getLocationFromComponentContext() {
+ return context.getProperty(String.class, "location");
+ }
+
+ public String getYear(){
+ return year;
+ }
+
+ public ComplexPropertyBean getComplexPropertyOne() {
+ //System.out.println(complexPropertyOne);
+ return complexPropertyOne;
+ }
+
+ public ComplexPropertyBean getComplexPropertyTwo() {
+ //System.out.println(complexPropertyTwo);
+ return complexPropertyTwo;
+ }
+
+ public ComplexPropertyBean getComplexPropertyThree() {
+ //System.out.println(complexPropertyThree);
+ return complexPropertyThree;
+ }
+
+ public Collection<ComplexPropertyBean> getComplexPropertyFour() {
+ //System.out.println(complexPropertyThree);
+ return complexPropertyFour;
+ }
+
+ public DataObject getSdoProperty() {
+ return sdoProperty;
+ }
+
+ public void setSdoProperty(DataObject sdoProperty) {
+ System.out.println("Reached here da machi");
+ this.sdoProperty = sdoProperty;
+ }
+
+ public CustomerImpl getCustomerSdo() {
+ return customerSdo;
+ }
+
+ public void setCustomerSdo(CustomerImpl customerSdo) {
+ this.customerSdo = customerSdo;
+ }
+
+ /**
+ * This method is used to test injecting an Array
+ * @return The injected array
+ */
+ public String[] getDaysOfTheWeek() {
+ return daysOfTheWeek;
+ }
+
+ /**
+ * This method is used to test injecting an Object Integer Array
+ * @return The injected array
+ */
+ public Integer[] getIntegerNumbers() {
+ return integerNumbers;
+ }
+
+ /**
+ * This method is used to test injecting an int Array
+ * @return The injected array
+ */
+ public int[] getIntNumbers() {
+ return intNumbers;
+ }
+
+ /**
+ * This method is used to test injecting an Object Array
+ * @return The injected array
+ */
+ public DataObject[] getSdoArrayProperty() {
+ return sdoArray;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java new file mode 100644 index 0000000000..f20d295a06 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java @@ -0,0 +1,24 @@ +/* + * 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.itest; + +public interface PropertyService { + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java new file mode 100644 index 0000000000..c147a2affe --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java @@ -0,0 +1,23 @@ +/* + * 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.itest.cdi; + +public interface Bar { + public String getBar(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java new file mode 100644 index 0000000000..0a84e93828 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java @@ -0,0 +1,39 @@ +/* + * 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.itest.cdi; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(Bar.class) +public class Foo1 implements Bar { + + @Property + protected String bar; + + @Constructor( {"bar"}) + public Foo1(String b) { + this.bar = b; + } + + public String getBar() { + return this.bar; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java new file mode 100644 index 0000000000..6344a8aa83 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java @@ -0,0 +1,39 @@ +/* + * 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.itest.cdi; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(Bar.class) +public class Foo2 implements Bar { + + protected String bar; + + @Constructor + public Foo2(@Property(name = "bar") String b) { + this.bar = b; + } + + public String getBar() { + return this.bar; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java new file mode 100644 index 0000000000..11a0a758cd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java @@ -0,0 +1,44 @@ +/* + * 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.itest.cdi; + +import org.osoa.sca.annotations.Constructor; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + +@Service(Bar.class) +public class Foo3 implements Bar { + + protected String bar; + + @Constructor + public Foo3() { + this.bar = "bar"; + } + + public String getBar() { + return this.bar; + } + + @Property(name = "bar") + public void setBar(String b) { + this.bar = b; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/ConstructorPropertyInjection.composite b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/ConstructorPropertyInjection.composite new file mode 100644 index 0000000000..70a251fa16 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/ConstructorPropertyInjection.composite @@ -0,0 +1,41 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="ConstructorPropertyInjection">
+
+ <component name="Foo1Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo1" />
+ <property name="bar">fubar</property>
+ </component>
+
+ <component name="Foo2Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo2" />
+ <property name="bar">fubar</property>
+ </component>
+
+ <component name="Foo3Component">
+ <implementation.java
+ class="org.apache.tuscany.sca.itest.cdi.Foo3" />
+ <property name="bar">fubar</property>
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/Outer.composite b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/Outer.composite new file mode 100644 index 0000000000..b3e529e8b5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/Outer.composite @@ -0,0 +1,43 @@ +<?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
+ * 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0" name="Iteration3Composite"
+ targetNamespace="http://foo" local="true" autowire="false">
+
+ <property name="newLocation" type="xsd:anyURI">Raleigh</property>
+ <property name="newYear" type="xsd:anyURI">2008</property>
+ <component name="MyServiceComponent">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ </component>
+ <component name="MyServiceComponentNew">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ <property name="location" source="$newLocation" />
+ <property name="year" source="$newYear" />
+ </component>
+ <component name="MyTotalServiceNewComponent">
+ <implementation.java class="mysca.test.myservice.impl.MyTotalServiceImpl" />
+ <reference name="myService" target="MyServiceComponentNew/MyService" />
+ </component>
+ <component name="MySimpleServiceInRecursiveAnother">
+ <implementation.composite name="foo:MySimpleService" />
+ <property name="newLocation">Durham</property>
+ <property name="newYear">2009</property>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/OuterPropertyTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/OuterPropertyTest.composite new file mode 100644 index 0000000000..5237e964a3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/OuterPropertyTest.composite @@ -0,0 +1,42 @@ +<?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
+ * 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:foo="http://foo"
+ targetNamespace="http://foo"
+ name="OuterPropertyTest" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="OuterComponent">
+ <implementation.composite name="foo:PropertyTest"/>
+ <property name="number">125</property>
+ <property name="complex" type="foo:MyComplexType">
+ <foo:MyComplexValue xsi:type="foo:MyComplexType" >
+ <foo:a>Overriden A</foo:a>
+ <foo:b>Overriden B</foo:b>
+ <foo:c>Overriden C</foo:c>
+ <foo:d>Overriden D</foo:d>
+ <foo:x>
+ <foo:y>Overriden Y</foo:y>
+ <foo:z>Overriden Z</foo:z>
+ </foo:x>
+ </foo:MyComplexValue>
+ </property>
+ </component>
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/PropertyTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/PropertyTest.composite new file mode 100644 index 0000000000..172f014ad0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/PropertyTest.composite @@ -0,0 +1,237 @@ +<?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 + * 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:foo="http://foo" + xmlns:cust="http://www.example.com/Customer" + xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://foo" + name="PropertyTest" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <service name="ProperterTestService" promote="ABComponent"> + <interface.java interface="org.apache.tuscany.sca.itest.ABComponent"/> + </service> + + <dbsdo:import.sdo location="customer.xsd" /> + <!-- dbsdo:import.sdo factory="com.example.customer.sdo.SdoFactory" / --> + + <property name="number" type="xsd:int">1</property> + <property name="complex" type="foo:MyComplexType" > + <foo:MyComplexValue xsi:type="foo:MyComplexType" > + <foo:a>a</foo:a> + <foo:b>b</foo:b> + <foo:c>c</foo:c> + <foo:d>d</foo:d> + <foo:x> + <foo:y>y</foo:y> + <foo:z>z</foo:z> + </foo:x> + </foo:MyComplexValue> + </property> + + <property name="moreComplex" type="foo:MyMoreComplexType"> + <MyMoreComplexValue xmlns=""> + <numberSetArray> + <integerNumber>1</integerNumber> + <floatNumber>11</floatNumber> + <doubleNumber>111</doubleNumber> + </numberSetArray> + <numberSetArray> + <integerNumber>2</integerNumber> + <floatNumber>22</floatNumber> + <doubleNumber>222</doubleNumber> + </numberSetArray> + <stringArray>TestString_1</stringArray> + <stringArray>TestString_2</stringArray> + <intArray>10</intArray> + <intArray>20</intArray> + <integerNumber>27</integerNumber> + <floatNumber>79.34</floatNumber> + <doubleNumber>184.52</doubleNumber> + <doubleArray>50.05</doubleArray> + <doubleArray>25.52</doubleArray> + <numberSet> + <integerNumber>54</integerNumber> + <floatNumber>158.68</floatNumber> + <doubleNumber>369.04</doubleNumber> + </numberSet> + </MyMoreComplexValue> + </property> + + <component name="ABCDComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.ABCDComponentImpl"/> + <reference name="ab" target="ABComponent"/> + <reference name="cd" target="CDComponent"/> + </component> + + <component name="ABComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.ABComponentImpl"/> + <property name="a" source="$complex/foo:MyComplexValue/foo:a"/> + <property name="b" source="$complex/foo:MyComplexValue/foo:b"/> + <property name="f" source="$complex/foo:MyComplexValue/foo:a">f</property> + <property name="xpath" source="$complex/foo:MyComplexValue/foo:x/*[local-name()='z']"/> + <property name="one" source="$number"/> + <property name="foobar" many="true">"Apache" "Tuscany" "Java SCA"</property> + <property name="fooInts" many="true">123 456 789</property> + </component> + + + <component name="CDComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.CDComponentImpl"/> + <property name="c" source="$complex/foo:MyComplexValue/foo:c"/> + <property name="d" source="$complex/foo:MyComplexValue/foo:d"/> + <property name="nosource">aValue</property> + <property name="fileProperty" file="fileProperty.txt"/> + <property name="manyValuesFileProperty" many="true" file="manyValuesFileProperty.txt"/> + <property name="nonFileProperty" file="fileProperty.txt" source="$complex/foo:MyComplexValue/foo:c"/> + <property name="two" source="$number">25</property> + </component> + + <component name="PropertyComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.PropertyComponentImpl"/> + <property name="complexPropertyOne" source="$moreComplex"></property> + <property name="complexPropertyTwo"> + <MyAnotherComplexValue xmlns=""> + <stringArray>TestString_1</stringArray> + <stringArray>TestString_2</stringArray> + <intArray>10</intArray> + <integerNumber>27</integerNumber> + <floatNumber>79.34</floatNumber> + <doubleArray>25.52</doubleArray> + <doubleNumber>184.52</doubleNumber> + <doubleArray>50.05</doubleArray> + <intArray>20</intArray> + <numberSetArray> + <integerNumber>1</integerNumber> + <floatNumber>11</floatNumber> + <doubleNumber>111</doubleNumber> + </numberSetArray> + <numberSetArray> + <integerNumber>2</integerNumber> + <floatNumber>22</floatNumber> + <doubleNumber>222</doubleNumber> + </numberSetArray> + <numberSet> + <integerNumber>54</integerNumber> + <floatNumber>158.68</floatNumber> + <doubleNumber>369.04</doubleNumber> + </numberSet> + </MyAnotherComplexValue> + </property> + <property name="complexPropertyThree" element="foo:PropertyThreeElement"> + <PropertyThreeElement xmlns=""> + <stringArray>TestElementString_1</stringArray> + <stringArray>TestElementString_2</stringArray> + <intArray>10</intArray> + <integerNumber>27</integerNumber> + <floatNumber>79.34</floatNumber> + <doubleArray>25.52</doubleArray> + <doubleNumber>184.52</doubleNumber> + <doubleArray>50.05</doubleArray> + <intArray>20</intArray> + <numberSetArray> + <integerNumber>1</integerNumber> + <floatNumber>11</floatNumber> + <doubleNumber>111</doubleNumber> + </numberSetArray> + <numberSetArray> + <integerNumber>2</integerNumber> + <floatNumber>22</floatNumber> + <doubleNumber>222</doubleNumber> + </numberSetArray> + <numberSet> + <integerNumber>54</integerNumber> + <floatNumber>158.68</floatNumber> + <doubleNumber>369.04</doubleNumber> + </numberSet> + </PropertyThreeElement> + </property> + <property name="complexPropertyFour" element="foo:PropertyFourElement" many="true"> + <PropertyFourElement xmlns=""> + <integerNumber>1</integerNumber> + <floatNumber>11.11</floatNumber> + <doubleNumber>111.111</doubleNumber> + <numberSet> + <integerNumber>11</integerNumber> + <floatNumber>1111.1111</floatNumber> + <doubleNumber>11111.11111</doubleNumber> + </numberSet> + </PropertyFourElement> + <PropertyFourElement xmlns=""> + <integerNumber>2</integerNumber> + <floatNumber>22.22</floatNumber> + <doubleNumber>222.222</doubleNumber> + <numberSet> + <integerNumber>22</integerNumber> + <floatNumber>2222.2222</floatNumber> + <doubleNumber>22222.22222</doubleNumber> + </numberSet> + </PropertyFourElement> + <PropertyFourElement xmlns=""> + <integerNumber>3</integerNumber> + <floatNumber>33.33</floatNumber> + <doubleNumber>333.333</doubleNumber> + <numberSet> + <integerNumber>33</integerNumber> + <floatNumber>3333.3333</floatNumber> + <doubleNumber>33333.33333</doubleNumber> + </numberSet> + </PropertyFourElement> + </property> + <property name="sdoProperty" type="cust:Customer"> + <cust:customer> + <cust:firstName>Firstly Name</cust:firstName> + <cust:middleName>Middler Name</cust:middleName> + <cust:lastName>Lasting Name</cust:lastName> + </cust:customer> + </property> + <property name="customerSdo" type="cust:Customer"> + <cust:customer> + <cust:firstName>Sdo Firstly Name</cust:firstName> + <cust:middleName>Sdo Middler Name</cust:middleName> + <cust:lastName>Sdo Lasting Name</cust:lastName> + </cust:customer> + </property> + <property name="location" type="xsd:string">RTP</property> + <property name="year" type="xsd:string">2006</property> + <property name="daysOfTheWeek" many="true" type="xsd:string">"Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"</property> + <property name="integerNumbers" many="true" type="xsd:int">1 2 3 4 5 6 7 8 9 10</property> + <property name="intNumbers" many="true" type="xsd:int">10 9 8 7 6 5 4 3 2 1 0</property> + <property name="sdoArray" many="true" type="cust:Customer"> + <cust:customer> + <cust:firstName>Firstly Name 1</cust:firstName> + <cust:middleName>Middler Name 1</cust:middleName> + <cust:lastName>Lasting Name 1</cust:lastName> + </cust:customer> + <cust:customer> + <cust:firstName>Firstly Name 2</cust:firstName> + <cust:middleName>Middler Name 2</cust:middleName> + <cust:lastName>Lasting Name 2</cust:lastName> + </cust:customer> + <cust:customer> + <cust:firstName>Firstly Name 3</cust:firstName> + <cust:middleName>Middler Name 3</cust:middleName> + <cust:lastName>Lasting Name 3</cust:lastName> + </cust:customer> + </property> + </component> +</composite> + + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/customer.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/customer.xsd new file mode 100644 index 0000000000..8861d7e7b8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/customer.xsd @@ -0,0 +1,30 @@ +<!--
+ * 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.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://www.example.com/Customer" targetNamespace="http://www.example.com/Customer">
+
+ <xsd:element name="customer" type="Customer"/>
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string"/>
+ <xsd:element name="middleName" type="xsd:string"/>
+ <xsd:element name="lastName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/fileProperty.txt b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/fileProperty.txt new file mode 100644 index 0000000000..0d3d9ead83 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/fileProperty.txt @@ -0,0 +1,21 @@ +<?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. +--> + +<filePropertyTest>fileValue</filePropertyTest> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/manyValuesFileProperty.txt b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/manyValuesFileProperty.txt new file mode 100644 index 0000000000..450f397b30 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/manyValuesFileProperty.txt @@ -0,0 +1,23 @@ +<?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.
+-->
+
+<manyFilePropertyValues>
+ "fileValueOne" "fileValueTwo" "fileValueThree" "fileValueFour"
+</manyFilePropertyValues>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/mySimpleService.composite b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/mySimpleService.composite new file mode 100644 index 0000000000..75fdd24add --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/main/resources/mySimpleService.composite @@ -0,0 +1,40 @@ +<?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.
+-->
+<composite autowire="false" local="true" name="MySimpleService"
+ targetNamespace="http://foo" xmlns:foo="http://foo" xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 ">
+
+
+ <service name="MyServiceNew1" promote="MyServiceComponentNew/MyService">
+ <interface.java interface="mysca.test.myservice.impl.MyService" />
+ </service>
+
+ <property name="newLocation" type="xsd:anyURI">Raleigh</property>
+ <property name="newYear" type="xsd:anyURI">2008</property>
+
+
+ <component name="MyServiceComponentNew">
+ <implementation.java class="mysca.test.myservice.impl.MyServiceImpl" />
+ <property name="location" source="$newLocation" />
+ <property name="year" source="$newYear" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java new file mode 100644 index 0000000000..5eb5e57f90 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java @@ -0,0 +1,69 @@ +/* + * 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.itest; +import static junit.framework.Assert.assertEquals; +import mysca.test.myservice.impl.MyService; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class MyTotalServiceTestCase { + private static MyService service1; + private static MyService service2; + private static MyService service3; + + private static SCADomain domain; + + @Test + public void testPropertyDefault() { + assertEquals("RTP", service1.getLocation()); + assertEquals("2006", service1.getYear()); + } + + @Test + public void testPropertyOverride() { + assertEquals("Raleigh", service2.getLocation()); + assertEquals("2008", service2.getYear()); + } + + @Test + public void testPropertyNestedOverride() { + assertEquals("Durham", service3.getLocation()); + assertEquals("2009", service3.getYear()); + } + + @BeforeClass + /** + * Sets up for the test case execution such as locating services. + */ + public static void setUp() throws Exception { + + domain = SCADomain.newInstance("Outer.composite"); + service1 = domain.getService(MyService.class, "MyServiceComponent/MyService"); + service2 = domain.getService(MyService.class, "MyServiceComponentNew/MyService"); + service3 = domain.getService(MyService.class, "MySimpleServiceInRecursiveAnother"); + } + + @AfterClass + public static void tearDown() { + domain.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java new file mode 100644 index 0000000000..b2ac537dec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java @@ -0,0 +1,92 @@ +/*
+ * 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.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class OuterPropertyTestCase {
+
+ private static SCADomain domain;
+ private static ABComponent outerABService;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("OuterPropertyTest.composite");
+ outerABService = domain.getService(ABComponent.class, "OuterComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testOverridenA() {
+ assertEquals("Overriden A", outerABService.getA());
+ }
+
+ @Test
+ public void testOverridenB() {
+ assertEquals("Overriden B", outerABService.getB());
+ }
+
+ @Test
+ public void testOverridenF() {
+ assertEquals("Overriden A", outerABService.getF());
+ }
+
+ @Test
+ public void testOverridenZ() {
+ assertEquals("Overriden Z", outerABService.getZ());
+ }
+
+ @Test
+ public void testOverridenIntValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ @Test
+ public void testDefaultValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = outerABService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ @Test
+ public void testManySimpleIntegerValues() {
+ Iterator<Integer> iterator = outerABService.getManyIntegers().iterator();
+ assertEquals(123, iterator.next().intValue());
+ assertEquals(456, iterator.next().intValue());
+ assertEquals(789, iterator.next().intValue());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java new file mode 100644 index 0000000000..39cc0759f8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java @@ -0,0 +1,266 @@ +/* + * 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.itest; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.util.Arrays; +import java.util.Iterator; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import commonj.sdo.DataObject; + +public class PropertyTestCase { + private static SCADomain domain; + private static ABComponent abService; + private static CDComponent cdService; + private static ABCDComponent abcdService; + private static PropertyComponent propertyService; + + @Test + public void testA() { + assertEquals("a", abService.getA()); + } + + @Test + public void testB() { + assertEquals("b", abService.getB()); + } + + @Test + public void testC() { + assertEquals("c", cdService.getC()); + } + + @Test + public void testC2() { + assertEquals("c", cdService.getC2()); + } + + @Test + public void testD() { + assertEquals("d", cdService.getD()); + } + + @Test + public void testF() { + assertEquals("a", abService.getF()); + } + + @Test + public void testZ() { + assertEquals("z", abService.getZ()); + } + + @Test + public void testIntValue() { + assertEquals(1, abService.getIntValue()); + } + + @Test + public void testDefaultValue() { + assertEquals(1, abService.getIntValue()); + } + + @Test + public void testDefaultValueOverride() { + assertEquals(1, cdService.getOverrideValue()); + } + + @Test + public void testNoSource() { + assertEquals("aValue", cdService.getNoSource()); + } + + @Test + public void testFileProperty() { + assertEquals("fileValue", cdService.getFileProperty()); + } + + @Test + public void testManyValuesFileProperty() { + Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator(); + iterator.next(); + String secondValue = iterator.next(); + assertEquals(4, cdService.getManyValuesFileProperty().size()); + assertEquals("fileValueTwo", secondValue); + } + + @Test + public void testABCD() { + assertEquals("a", abcdService.getA()); + assertEquals("b", abcdService.getB()); + assertEquals("c", abcdService.getC()); + assertEquals("d", abcdService.getD()); + } + + @Test + public void testDefaultProperty() { + assertEquals("RTP", propertyService.getLocation()); + assertEquals("2006", propertyService.getYear()); + + } + + @Test + public void testManySimpleStringValues() { + Iterator<String> iterator = abService.getManyStringValues().iterator(); + assertEquals("Apache", iterator.next()); + assertEquals("Tuscany", iterator.next()); + assertEquals("Java SCA", iterator.next()); + } + + @Test + public void testManySimpleIntegerValues() { + Iterator<Integer> iterator = abService.getManyIntegers().iterator(); + assertEquals(123, iterator.next().intValue()); + assertEquals(456, iterator.next().intValue()); + assertEquals(789, iterator.next().intValue()); + } + + @Test + public void testComplexPropertyOne() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyOne(); + assertNotNull(propBean); + assertEquals("TestString_1", propBean.getStringArray()[0]); + assertEquals(2, propBean.numberSetArray[1].integerNumber); + } + + @Test + public void testComplexPropertyTwo() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo(); + assertNotNull(propBean); + assertEquals(10, propBean.intArray[0]); + assertEquals((float)22, propBean.numberSetArray[1].floatNumber); + } + + @Test + public void testComplexPropertyThree() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyThree(); + assertNotNull(propBean); + assertEquals("TestElementString_1", propBean.stringArray[0]); + assertEquals((float)22, propBean.numberSetArray[1].floatNumber); + } + + @Test + public void testComplexPropertyFour() { + Object[] propBeanCollection = propertyService.getComplexPropertyFour().toArray(); + assertNotNull(propBeanCollection); + assertEquals(1, ((ComplexPropertyBean)propBeanCollection[0]).getIntegerNumber()); + assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber()); + assertEquals(33, ((ComplexPropertyBean)propBeanCollection[2]).getNumberSet().getIntegerNumber()); + } + + @Test + public void testSDOProperty1() { + DataObject dataObject = propertyService.getSdoProperty(); + assertNotNull(dataObject); + assertEquals("Firstly Name", dataObject.get("firstName")); + assertEquals("Middler Name", dataObject.getString("middleName")); + assertEquals("Lasting Name", dataObject.getString("lastName")); + } + + @Test + public void testSDOProperty2() { + DataObject dataObject = propertyService.getCustomerSdo(); + assertNotNull(dataObject); + assertEquals("Sdo Firstly Name", dataObject.get("firstName")); + assertEquals("Sdo Middler Name", dataObject.getString("middleName")); + assertEquals("Sdo Lasting Name", dataObject.getString("lastName")); + } + + @Test + public void testGetLocationFromComponentContext() { + String location = propertyService.getLocation(); + assertNotNull(location); + String locationFromCC = propertyService.getLocationFromComponentContext(); + assertNotNull(locationFromCC); + assertEquals(location, locationFromCC); + } + + @Test + public void testGetInjectedStringArrayProperty() + { + String[] daysOfWeek = propertyService.getDaysOfTheWeek(); + assertNotNull(daysOfWeek); + + String[] expected = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; + Assert.assertTrue(Arrays.equals(expected, daysOfWeek)); + } + + @Test + public void testGetInjectedIntegerArrayProperty() + { + Integer[] numbers = propertyService.getIntegerNumbers(); + assertNotNull(numbers); + + Integer[] expected = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + Assert.assertTrue(Arrays.equals(expected, numbers)); + } + + @Test + public void testGetInjectedIntArrayProperty() + { + int[] numbers = propertyService.getIntNumbers(); + assertNotNull(numbers); + + int[] expected = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; + Assert.assertTrue(Arrays.equals(expected, numbers)); + } + + + @Test + public void testGetInjectedSdoArrayProperty() + { + DataObject[] sdos = propertyService.getSdoArrayProperty(); + assertNotNull(sdos); + + for (int i = 1; i <= 3; i++) { + DataObject dataObject = sdos[i - 1]; + assertEquals("Firstly Name " + i, dataObject.get("firstName")); + assertEquals("Middler Name " + i, dataObject.getString("middleName")); + assertEquals("Lasting Name " + i, dataObject.getString("lastName")); + } + } + + + @BeforeClass + public static void init() throws Exception { + try { + domain = SCADomain.newInstance("PropertyTest.composite"); + } catch ( Exception e ) { e.printStackTrace(); } + abService = domain.getService(ABComponent.class, "ABComponent"); + cdService = domain.getService(CDComponent.class, "CDComponent"); + abcdService = domain.getService(ABCDComponent.class, "ABCDComponent"); + propertyService = + domain.getService(PropertyComponent.class, "PropertyComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java new file mode 100644 index 0000000000..8ee5dce91f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java @@ -0,0 +1,44 @@ +/* + * 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.itest.cdi; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class ConstructorPropertyInjectionTestCase extends TestCase { + + public void testFoo1() throws Exception { + SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite"); + Bar foo = sca.getService(Bar.class, "Foo1Component"); + assertEquals("fubar", foo.getBar()); + } + + public void testFoo2() throws Exception { + SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite"); + Bar foo = sca.getService(Bar.class, "Foo2Component"); + assertEquals("fubar", foo.getBar()); + } + + public void testFoo3() throws Exception { + SCADomain sca = SCADomain.newInstance("ConstructorPropertyInjection.composite"); + Bar foo = sca.getService(Bar.class, "Foo3Component"); + assertEquals("fubar", foo.getBar()); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/pom.xml new file mode 100644 index 0000000000..38e0d76cb4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-recursive</artifactId> + <name>Apache Tuscany SCA Recursive Composition Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/CompositeClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/CompositeClient.java new file mode 100644 index 0000000000..5edc305970 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/CompositeClient.java @@ -0,0 +1,42 @@ +/* + * 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 org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Simple client program that invokes the components that we wired together. + * + * @version $Rev$ $Date$ + */ +public class CompositeClient { + + public static void main(String[] args) throws Exception { + SCADomain domain = SCADomain.newInstance("OuterComposite.composite"); + + Source source = domain.getService(Source.class, "SourceComponent"); + + System.out.println("Main thread " + Thread.currentThread()); + source.clientMethod("Client.main"); + Thread.sleep(500); + + domain.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/Source.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/Source.java new file mode 100644 index 0000000000..d0efcc1df1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/Source.java @@ -0,0 +1,24 @@ +/* + * 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; + +public interface Source { + + void clientMethod(String arg); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/SourceCallback.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/SourceCallback.java new file mode 100644 index 0000000000..baa95a8e39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/SourceCallback.java @@ -0,0 +1,24 @@ +/* + * 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; + +public interface SourceCallback { + + void receiveResult(String result); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/SourceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/SourceImpl.java new file mode 100644 index 0000000000..b9a0c7ff74 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/SourceImpl.java @@ -0,0 +1,55 @@ +/* + * 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 org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + + +@Service(Source.class) +@Scope("COMPOSITE") +public class SourceImpl implements Source, SourceCallback { + + private Target targetReference; + private Target targetReference2; + + @Reference + public void setTargetReference(Target target) { + this.targetReference = target; + } + + @Reference + public void setTargetReference2(Target target) { + this.targetReference2 = target; + } + + public void clientMethod(String arg) { + System.out.println("Source: " + arg + " -> Source.clientMethod"); + targetReference.someMethod(arg + " -> Source.clientMethod"); + + System.out.println("Source: " + arg + " => Source.clientMethod2"); + targetReference2.someMethod(arg + " => Source.clientMethod2"); + } + + public void receiveResult(String result) { + System.out.println("Work thread " + Thread.currentThread()); + System.out.println("Result: " + result); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/Target.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/Target.java new file mode 100644 index 0000000000..9a8f68a7fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/Target.java @@ -0,0 +1,30 @@ +/* + * 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 org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.OneWay; + + +@Callback(SourceCallback.class) +public interface Target { + + @OneWay + void someMethod(String arg); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/TargetImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/TargetImpl.java new file mode 100644 index 0000000000..86686e9233 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/composite/TargetImpl.java @@ -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. + */ +package composite; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + + +@Service(Target.class) +@Scope("COMPOSITE") +public class TargetImpl implements Target { + + private SourceCallback sourceCallback; + + @Callback + public void setSourceCallback(SourceCallback sourceCallback) { + this.sourceCallback = sourceCallback; + } + + public void someMethod(String arg) { + System.out.println("Target: " + arg); + sourceCallback.receiveResult(arg + " -> Target.someMethod"); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/A.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/A.java new file mode 100644 index 0000000000..e87cbde26d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/A.java @@ -0,0 +1,28 @@ +/* + * 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 org.osoa.sca.annotations.Service; + +@Service(I.class) +public class A implements I { + public String get(int i) { + return A.class.getName(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/B.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/B.java new file mode 100644 index 0000000000..9d060cab59 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/B.java @@ -0,0 +1,36 @@ +/* + * 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 org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(I.class) +public class B implements I { + protected I i = null; + + @Reference(name = "i", required = true) + public void setC(I c) { + this.i = c; + } + + public String get(int i) { + return this.i.get(i); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/I.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/I.java new file mode 100644 index 0000000000..f6d55baef3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/foo/I.java @@ -0,0 +1,23 @@ +/* + * 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; + +public interface I { + String get(int i); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentAImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentAImpl.java new file mode 100644 index 0000000000..f513949105 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentAImpl.java @@ -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. + */ + +package sample; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Service1.class) +public class ComponentAImpl implements Service1 { + + @Reference(name = "Reference1", required = false) + protected Service1 ref; + + public String track(String source) { + if (ref != null) { + return ref.track(source + "-->ComponentA"); + } + return source + "-->ComponentA"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentCImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentCImpl.java new file mode 100644 index 0000000000..586a9ee6a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentCImpl.java @@ -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. + */ + +package sample; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Service1.class) +public class ComponentCImpl implements Service1 { + + @Reference(name = "Reference1", required = false) + protected Service1 ref; + + public String track(String source) { + if (ref != null) { + return ref.track(source + "-->ComponentC"); + } + return source + "-->ComponentC"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentEImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentEImpl.java new file mode 100644 index 0000000000..dbf2735aa7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentEImpl.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.Property; +import org.osoa.sca.annotations.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class ComponentEImpl implements Service1 { + @Property(name = "Property1") + protected String prefix; + + @Reference(name = "Reference1") + protected Service1 ref; + + public String track(String source) { + return ref.track(source + "-->ComponentE"); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentFImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentFImpl.java new file mode 100644 index 0000000000..5e136e536c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/ComponentFImpl.java @@ -0,0 +1,45 @@ +/* + * 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.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class ComponentFImpl implements Service1 { + + private Service1 ref; + + public String track(String source) { + if (ref != null) { + return ref.track(source + "-->ComponentF"); + } else { + System.err.println("Reference1 is not wired..."); + return source + "-->ComponentF"; + } + } + + @Reference(name = "Reference1") + public void setComponentA(Service1 ref) { + this.ref = ref; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/Service1.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/Service1.java new file mode 100644 index 0000000000..81bdce79f1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/sample/Service1.java @@ -0,0 +1,27 @@ +/* + * 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; + +/** + * @version $Rev$ $Date$ + */ +public interface Service1 { + String track(String source); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/Aggregator.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/Aggregator.java new file mode 100644 index 0000000000..88b3bed1b2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/Aggregator.java @@ -0,0 +1,27 @@ +/* + * 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; + +/** + * @version $Rev$ $Date$ + */ +public interface Aggregator { + String getAggregatedData(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/AggregatorImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/AggregatorImpl.java new file mode 100644 index 0000000000..f6ac6c8741 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/AggregatorImpl.java @@ -0,0 +1,55 @@ +/* + * 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 java.util.List; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Aggregator.class) +public class AggregatorImpl implements Aggregator { + + @Reference(name = "uniSource") + protected Source source; + + @Reference(name = "multiSource") + protected List<Source> sources; + + public String getAggregatedData() { + System.out.println("uniSource: " + source.getData()); + StringBuffer sb = new StringBuffer(); + int i = 0; + for (Source s : sources) { + if (i != 0) { + sb.append(", "); + } else { + sb.append("multiSource: "); + } + sb.append(s.getData()); + i++; + } + return sb.toString(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/InnerSourceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/InnerSourceImpl.java new file mode 100644 index 0000000000..c8dad5ae35 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/InnerSourceImpl.java @@ -0,0 +1,34 @@ +/* + * 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 org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Source.class) +public class InnerSourceImpl implements Source { + + public String getData() { + return "InnerSource"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/OuterSourceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/OuterSourceImpl.java new file mode 100644 index 0000000000..11816e82cf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/OuterSourceImpl.java @@ -0,0 +1,34 @@ +/* + * 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 org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(Source.class) +public class OuterSourceImpl implements Source { + + public String getData() { + return "OuterSource"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/Source.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/Source.java new file mode 100644 index 0000000000..9b93740d9d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test/Source.java @@ -0,0 +1,30 @@ +/* + * 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 org.osoa.sca.annotations.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface Source { + String getData(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/Target.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/Target.java new file mode 100644 index 0000000000..4883e12f49 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/Target.java @@ -0,0 +1,23 @@ +/* + * 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; + +public interface Target { + String hello(String arg); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/TargetOne.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/TargetOne.java new file mode 100644 index 0000000000..a7c68f4ffd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/TargetOne.java @@ -0,0 +1,29 @@ +/* + * 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 org.osoa.sca.annotations.Service; + +@Service(Target.class) +public class TargetOne implements Target { + + public String hello(String arg) { + return "TargetOne: Hello " + arg + "!"; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/TargetTwo.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/TargetTwo.java new file mode 100644 index 0000000000..7fff8e2e9b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/java/test1/composite/TargetTwo.java @@ -0,0 +1,29 @@ +/* + * 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 org.osoa.sca.annotations.Service; + +@Service(Target.class) +public class TargetTwo implements Target { + + public String hello(String arg) { + return "TargetTwo: Hello " + arg + "!"; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite1.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite1.composite new file mode 100644 index 0000000000..56fd7c621f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite1.composite @@ -0,0 +1,42 @@ +<?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. + --> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample" + xmlns:sample="http://sample" + name="Composite1"> + + <component name="ComponentA"> + <implementation.java class="sample.ComponentAImpl"/> + </component> + + <component name="ComponentB"> + <!-- Implemented by Composite3 --> + <implementation.composite name="sample:Composite3"/> + + <!-- Wired to ComponentA --> + <reference name="Reference1" target="ComponentA"/> + + <property name="Property1">ABC</property> + </component> + + <!-- ComponentB.Service1 is promoted --> + <service name="Service1" promote="ComponentB/Service1" /> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite2.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite2.composite new file mode 100644 index 0000000000..54f10673a4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite2.composite @@ -0,0 +1,43 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample" + xmlns:sample="http://sample" + name="Composite2"> + + <component name="ComponentC"> + <implementation.java class="sample.ComponentCImpl" /> + + <!-- Wired to ComponentD.Service1 --> + <reference name="Reference1" target="ComponentD/Service1" /> + </component> + + <component name="ComponentD"> + <!-- Implemented by Composite3 --> + <implementation.composite name="sample:Composite3" /> + + <!-- The property value is "XYZ" --> + <property name="Property1">XYZ</property> + </component> + + <!-- ComponentD.Reference1 is promoted --> + <reference name="Reference1" promote="ComponentD/Reference1" /> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite3.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite3.composite new file mode 100644 index 0000000000..040653493f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Composite3.composite @@ -0,0 +1,48 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample" + xmlns:sample="http://sample" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="Composite3"> + + <component name="ComponentE"> + <implementation.java class="sample.ComponentEImpl" /> + <reference name="Reference1" target="ComponentF/Service1" /> + + <!-- The property is from the composite Property1 --> + <property name="Property1" source="$Property1" /> + </component> + + <component name="ComponentF"> + <implementation.java class="sample.ComponentFImpl" /> + </component> + + <service name="Service1" promote="ComponentE/Service1" /> + + <reference name="Reference1" promote="ComponentF/Reference1"> + <!-- + <binding.sca /> + --> + </reference> + + <property name="Property1" type="xsd:string">123</property> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Inner.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Inner.composite new file mode 100644 index 0000000000..398ebdf6e2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Inner.composite @@ -0,0 +1,45 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:sample="http://test"
+ name="Inner">
+
+ <component name="Aggregator">
+ <implementation.java class="test.AggregatorImpl"/>
+ <reference name="uniSource" target="InnerSource/Source"/>
+ <reference name="multiSource" target="InnerSource/Source"/>
+ </component>
+
+ <component name="InnerSource">
+ <implementation.java class="test.InnerSourceImpl"/>
+ </component>
+
+ <reference name="uniSource" promote="Aggregator/uniSource">
+ <binding.sca/>
+ </reference>
+
+ <reference name="multiSource" promote="Aggregator/multiSource">
+ <binding.sca/>
+ </reference>
+
+ <service name="aggregator" promote="Aggregator"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/InnerComposite.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/InnerComposite.composite new file mode 100644 index 0000000000..3376ac8ff5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/InnerComposite.composite @@ -0,0 +1,41 @@ +<?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. + --> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample" + xmlns:sample="http://sample" + name="InnerComposite"> + + <service name="InnerSourceService" promote="InnerSourceComponent"> + <interface.java interface="composite.Source"/> + </service> + + <component name="InnerSourceComponent"> + <implementation.java class="composite.SourceImpl"/> + </component> + + <reference name="targetComponentRef" promote="InnerSourceComponent/targetReference"> + <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/> + </reference> + + <reference name="targetComponentRef2" promote="InnerSourceComponent/targetReference2"> + <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/> + </reference> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/InnerComposite2.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/InnerComposite2.composite new file mode 100644 index 0000000000..c9eff4fa9d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/InnerComposite2.composite @@ -0,0 +1,33 @@ +<?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. + --> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample" + xmlns:sample="http://sample" + name="InnerComposite2"> + + <service name="InnerTargetService" promote="InnerTargetComponent"> + <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/> + </service> + + <component name="InnerTargetComponent"> + <implementation.java class="composite.TargetImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..289b92a3f2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:OuterComposite"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Outer.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Outer.composite new file mode 100644 index 0000000000..987990d854 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/Outer.composite @@ -0,0 +1,39 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:test="http://test"
+ name="Outer">
+
+ <component name="OuterSource">
+ <implementation.java class="test.OuterSourceImpl"/>
+ </component>
+
+ <component name="Inner">
+ <!-- Implemented by Composite3 -->
+ <implementation.composite name="test:Inner"/>
+
+ <reference name="uniSource" target="OuterSource"/>
+
+ <reference name="multiSource" target="OuterSource"/>
+
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/OuterComposite.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/OuterComposite.composite new file mode 100644 index 0000000000..cb1c1e13d4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/OuterComposite.composite @@ -0,0 +1,39 @@ +<?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. + --> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample" + xmlns:sample="http://sample" + name="OuterComposite"> + + <component name="SourceComponent"> + <implementation.composite name="sample:InnerComposite"/> + <reference name="targetComponentRef" target="TargetComponent"/> + <reference name="targetComponentRef2" target="TargetComponent2/InnerTargetService"/> + </component> + + <component name="TargetComponent"> + <implementation.java class="composite.TargetImpl"/> + </component> + + <component name="TargetComponent2"> + <implementation.composite name="sample:InnerComposite2"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/foo.png b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/foo.png Binary files differnew file mode 100644 index 0000000000..0f2ec78aaf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/foo.png diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o1.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o1.composite new file mode 100644 index 0000000000..1d31c2f424 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o1.composite @@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O1Composite">
+
+ <service name="O1Service" promote="AComponent">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="foo.A" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o2.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o2.composite new file mode 100644 index 0000000000..4f21c21860 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o2.composite @@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O2Composite">
+
+ <service name="O2Service" promote="O1Component/O1Service">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="O1Component">
+ <implementation.composite name="bar:O1Composite" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o3.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o3.composite new file mode 100644 index 0000000000..72c732c03e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o3.composite @@ -0,0 +1,35 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O3Composite">
+
+ <service name="O3Service" promote="BComponent">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="BComponent">
+ <implementation.java class="foo.B" />
+ </component>
+
+ <reference name="O3Reference" promote="BComponent/i">
+ <interface.java interface="foo.I" />
+ </reference>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o4.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o4.composite new file mode 100644 index 0000000000..f8f07eed09 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/foo/o4.composite @@ -0,0 +1,37 @@ +<?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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://bar" xmlns:bar="http://bar"
+ name="O4Composite">
+
+ <service name="O4Service" promote="O3Component/O3Service">
+ <interface.java interface="foo.I" />
+ </service>
+
+ <component name="O3Component">
+ <implementation.composite name="bar:O3Composite" />
+ <reference name="O3Reference" target="O2Component/O2Service" />
+ </component>
+
+ <component name="O2Component">
+ <implementation.composite name="bar:O2Composite" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/test1/InnerComposite.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/test1/InnerComposite.composite new file mode 100644 index 0000000000..177fa10550 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/test1/InnerComposite.composite @@ -0,0 +1,39 @@ +<?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. + --> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample1" + xmlns:sample1="http://sample1" + name="InnerComposite"> + + <service name="Service_One" promote="ComponentOne"> + <interface.java interface="test1.composite.Target"/> + </service> + <service name="Service_Two" promote="ComponentTwo"> + <interface.java interface="test1.composite.Target"/> + </service> + + <component name="ComponentOne"> + <implementation.java class="test1.composite.TargetOne"/> + </component> + <component name="ComponentTwo"> + <implementation.java class="test1.composite.TargetTwo"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/test1/OuterComposite.composite b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/test1/OuterComposite.composite new file mode 100644 index 0000000000..6253533e01 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/main/resources/test1/OuterComposite.composite @@ -0,0 +1,27 @@ +<?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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample1"
+ xmlns:sample1="http://sample1"
+ name="OuterComposite">
+ <component name="TargetComponent">
+ <implementation.composite name="sample1:InnerComposite"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/CompositeTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/CompositeTestCase.java new file mode 100644 index 0000000000..5482e47463 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/CompositeTestCase.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 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/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java new file mode 100644 index 0000000000..f042113f7a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceEmbeddedSCADomainTestCase.java @@ -0,0 +1,113 @@ +/*
+ * 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/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java new file mode 100644 index 0000000000..87eb948452 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/composite/LocateServiceSCADomainTestCase.java @@ -0,0 +1,73 @@ +/*
+ * 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/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O2TestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O2TestCase.java new file mode 100644 index 0000000000..d617ec8592 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O2TestCase.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 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/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O4TestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O4TestCase.java new file mode 100644 index 0000000000..15626c75ac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/foo/O4TestCase.java @@ -0,0 +1,39 @@ +/* + * 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/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/sample/RecursiveCompositeTestCaseFIXME.java new file mode 100644 index 0000000000..a543add69b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.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/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test/InnerTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test/InnerTestCase.java new file mode 100644 index 0000000000..ebb4bc7acb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test/InnerTestCase.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 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/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test/OuterTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test/OuterTestCase.java new file mode 100644 index 0000000000..17de5ca4a8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test/OuterTestCase.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 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/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java new file mode 100644 index 0000000000..ab3e625ae5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.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 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(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/references/pom.xml new file mode 100644 index 0000000000..5743ddf87c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/pom.xml @@ -0,0 +1,46 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-references</artifactId> + <name>Apache Tuscany SCA References Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java new file mode 100644 index 0000000000..f8c0850118 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.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.itest.references; + +public interface AComponent { + + String fooB(); + + String fooC(); + + String fooBC(); + + String fooD1(); + + String fooD2(); + + String fooMultipleD(); + + String fooMultipleDArray(); + + String fooMultipleDServiceRef(); + + DComponent getDReference(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java new file mode 100644 index 0000000000..647fff0159 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java @@ -0,0 +1,126 @@ +/* + * 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.itest.references; + +import java.util.Collection; +import java.util.List; + +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Reference; + +public class AComponentImpl implements AComponent { + + @Reference(name = "bReference") + protected BComponent b; + + @Reference + protected CComponent cReference; + + @Reference(required = false) + protected DComponent dReference; + + @Reference(name = "dReferences") + public Collection<DComponent> dReferences; + + @Reference(name = "dReferenceArray") + public DComponent[] dReferenceArray; + + + @Reference(name = "dServiceReferences") + public List<ServiceReference<DComponent>> dServiceReferences; + + private DComponent dReference1; + + private DComponent dReference2; + + @Reference(name = "dReference1") + public void setDReference(DComponent dReference) { + this.dReference1 = dReference; + } + + @Reference + public void setDReference2(DComponent dReference2) { + this.dReference2 = dReference2; + } + + public String fooB() { + return b.bFoo(); + } + + public String fooC() { + return cReference.cFoo(); + } + + public String fooBC() { + return b.fooC(); + } + + public String fooD() { + return dReference1.dFoo(); + } + + public String fooD1() { + return dReference1.dFoo(); + } + + public String fooD2() { + return dReference2.dFoo(); + } + + public String fooMultipleDArray() { + StringBuffer str = new StringBuffer(); + for (DComponent d : dReferenceArray) { + str.append(d.getComponentName()); + str.append(','); + } + if (str.length() > 0) { + str.deleteCharAt(str.length() - 1); + } + return str.toString(); + } + + public String fooMultipleD() { + StringBuffer str = new StringBuffer(); + for (DComponent d : dReferences) { + str.append(d.getComponentName()); + str.append(','); + } + if (str.length() > 0) { + str.deleteCharAt(str.length() - 1); + } + return str.toString(); + } + + public String fooMultipleDServiceRef() { + StringBuffer str = new StringBuffer(); + for (ServiceReference<DComponent> d : dServiceReferences) { + str.append(d.getService().getComponentName()); + str.append(','); + } + if (str.length() > 0) { + str.deleteCharAt(str.length() - 1); + } + return str.toString(); + } + + public DComponent getDReference() { + return dReference; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java new file mode 100644 index 0000000000..785920bb2d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java @@ -0,0 +1,26 @@ +/* + * 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.itest.references; + +public interface BComponent { + + String bFoo(); + + String fooC(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java new file mode 100644 index 0000000000..6b1065ab0d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java @@ -0,0 +1,39 @@ +/* + * 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.itest.references; + +import org.osoa.sca.annotations.Reference; + +public class BComponentImpl implements BComponent { + + protected CComponent cReference; + + public BComponentImpl(@Reference(name = "cReference") CComponent cReference) { + this.cReference = cReference; + } + + public String bFoo() { + return "BComponent"; + } + + public String fooC() { + return "B" + cReference.cFoo(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java new file mode 100644 index 0000000000..d436c28adc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java @@ -0,0 +1,24 @@ +/* + * 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.itest.references; + +public interface CComponent { + + String cFoo(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java new file mode 100644 index 0000000000..a1823e1cdc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java @@ -0,0 +1,27 @@ +/* + * 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.itest.references; + +public class CComponentImpl implements CComponent { + + public String cFoo() { + return "CComponent"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java new file mode 100644 index 0000000000..c4718cd4ac --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java @@ -0,0 +1,25 @@ +/* + * 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.itest.references; + +public interface DComponent { + + String dFoo(); + String getComponentName(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java new file mode 100644 index 0000000000..79c802bc97 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java @@ -0,0 +1,35 @@ +/* + * 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.itest.references; + +import org.osoa.sca.annotations.ComponentName; + +public class DComponentImpl implements DComponent { + @ComponentName + public String name; + + public String dFoo() { + return "DComponent"; + } + + public String getComponentName() { + return name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/resources/AutoWiredReferencesTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/resources/AutoWiredReferencesTest.composite new file mode 100644 index 0000000000..68663f7b26 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/resources/AutoWiredReferencesTest.composite @@ -0,0 +1,56 @@ +<?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
+ * 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:foo="http://foo" targetNamespace="http://foo"
+ name="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autowire="true">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.references.AComponent" />
+ </service>
+
+ <component name="AComponent" autowire="false">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" autowire="true" />
+ <reference name="dReference1" />
+ <!--
+ <reference name="dReference1" target="DComponent" />
+ -->
+ <reference name="DReference2" target="DComponent" />
+ <reference name="dReferences" autowire="true" />
+ <reference name="dReferenceArray" autowire="true" />
+ <reference name="dServiceReferences" target="DComponent DComponent1" />
+
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.BComponentImpl" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/resources/InnerReferencesTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/resources/InnerReferencesTest.composite new file mode 100644 index 0000000000..6cadc52c13 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/main/resources/InnerReferencesTest.composite @@ -0,0 +1,54 @@ +<?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
+ * 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:foo="http://foo" targetNamespace="http://foo"
+ name="InnerReferencesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="AComponent" promote="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.references.AComponent" />
+ </service>
+
+ <component name="AComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.AComponentImpl" />
+ <reference name="bReference" target="BComponent" />
+ <reference name="cReference" target="CComponent" />
+ <reference name="dReference1" target="DComponent" />
+ <reference name="DReference2" target="DComponent" />
+ <reference name="dReferences" target="DComponent DComponent1" />
+ <reference name="dReferenceArray" target="DComponent1" />
+ <reference name="dServiceReferences" target="DComponent DComponent1" />
+ </component>
+
+ <component name="BComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.BComponentImpl" />
+ <reference name="cReference" target="CComponent" />
+ </component>
+
+ <component name="CComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.CComponentImpl" />
+ </component>
+
+ <component name="DComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.references.DComponentImpl" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java new file mode 100644 index 0000000000..37000846a2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java @@ -0,0 +1,92 @@ +/* + * 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.itest.references; + +import static junit.framework.Assert.assertEquals; +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.osoa.sca.ServiceUnavailableException; + +public class AutoWiredReferenceTestCase { + private static SCADomain domain; + private static AComponent acomponent; + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("AutoWiredReferencesTest.composite"); + acomponent = domain.getService(AComponent.class, "AComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } + + @Test + public void testBReference() { + assertEquals("BComponent", acomponent.fooB()); + } + + @Test + public void testCReference() { + assertEquals("CComponent", acomponent.fooC()); + } + + @Test + public void testBCReference() { + assertEquals("BCComponent", acomponent.fooBC()); + } + + @Test(expected = ServiceUnavailableException.class) + public void testD1Reference() { + acomponent.fooD1(); + } + + @Test + public void testD2Reference() { + assertEquals("DComponent", acomponent.fooD2()); + } + + @Test + public void testMultiDReferenceArray() { + String components = acomponent.fooMultipleDArray(); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testMultiDServiceReference() { + String components = acomponent.fooMultipleDServiceRef(); + Assert.assertTrue(components.contains("DComponent")); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testRequiredFalseReference() { + try { + acomponent.getDReference().dFoo(); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java new file mode 100644 index 0000000000..c6ff311159 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java @@ -0,0 +1,98 @@ +/* + * 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.itest.references; + +import static junit.framework.Assert.assertEquals; +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class InnerReferenceTestCase { + private static SCADomain domain; + private static AComponent acomponent; + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("InnerReferencesTest.composite"); + acomponent = domain.getService(AComponent.class, "AComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } + + @Test + public void testBReference() { + assertEquals("BComponent", acomponent.fooB()); + } + + @Test + public void testCReference() { + assertEquals("CComponent", acomponent.fooC()); + } + + @Test + public void testBCReference() { + assertEquals("BCComponent", acomponent.fooBC()); + } + + @Test + public void testD1Reference() { + assertEquals("DComponent", acomponent.fooD1()); + } + + @Test + public void testD2Reference() { + assertEquals("DComponent", acomponent.fooD2()); + } + + @Test + public void testMultiDReference() { + String components = acomponent.fooMultipleD(); + Assert.assertTrue(components.contains("DComponent")); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testMultiDReferenceArray() { + String components = acomponent.fooMultipleDArray(); + Assert.assertTrue(components.equals("DComponent1")); + } + + @Test + public void testMultiDServiceReference() { + String components = acomponent.fooMultipleDServiceRef(); + Assert.assertTrue(components.contains("DComponent")); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testRequiredFalseReference() { + try { + acomponent.getDReference().dFoo(); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/scopes/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/pom.xml new file mode 100644 index 0000000000..6b10a7dcf5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/pom.xml @@ -0,0 +1,47 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <name>Apache Tuscany SCA Scopes Integration Tests</name> + <artifactId>itest-scopes</artifactId> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java new file mode 100644 index 0000000000..f913b57130 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java @@ -0,0 +1,44 @@ +/* + * 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.itest.scopes; + +import org.osoa.sca.annotations.Scope; + +// Test module scope +@Scope("COMPOSITE") +public class CompositeScopeStateVerifierImpl implements StateVerifier { + + // State data for this module (composite). + // In order to support thread-based state verification, + // the module state needs to be a ThreadLocal. + ThreadLocal<Integer> moduleState; + + public CompositeScopeStateVerifierImpl() { + moduleState = new ThreadLocal<Integer>(); + } + + public void setState(int i) { + moduleState.set(i); + } + + public boolean checkState(int i) { + return (moduleState.get() == i); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.java new file mode 100644 index 0000000000..5e01553b78 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/RequestScopeStateVerifierImpl.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.itest.scopes; +import org.osoa.sca.annotations.Scope; + +// Test request scope +@Scope("REQUEST") +public class RequestScopeStateVerifierImpl implements StateVerifier { + + // State data for this request thread. + int requestState; + + public void setState(int i) { + requestState = i; + } + + public boolean checkState(int i) { + return (requestState == i); + } + +}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java new file mode 100644 index 0000000000..878f7e4cc6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java @@ -0,0 +1,25 @@ +/* + * 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.itest.scopes; + +public interface StateVerifier { + void setState(int i); + boolean checkState(int i); +} + diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/resources/scopes.composite b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/resources/scopes.composite new file mode 100644 index 0000000000..54a1b66830 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/main/resources/scopes.composite @@ -0,0 +1,33 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="Scopes">
+
+ <!-- Components used to test scopes. -->
+
+ <component name="RequestScopeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.scopes.RequestScopeStateVerifierImpl"/>
+ </component>
+
+ <component name="ModuleScopeComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.scopes.CompositeScopeStateVerifierImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java new file mode 100644 index 0000000000..ce2519cbc0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java @@ -0,0 +1,93 @@ +/* + * 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; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.itest.scopes.StateVerifier; + +public class ScopeTestCase extends TestCase { + + final static int numThreads = 4; // number of threads to drive each scope container + final static int iterations = 200; // number of iterations per thread + private SCADomain domain; + + // Test scope containers. + // The request scope container isn't hooked up for some reason so the code below + // that tests request scope is commented out. + // Code could be added to test session scope once it is supported in a standalone environment. + + public void testScopes() throws InterruptedException { + + Thread[] moduleScopeThreadTable = new Thread[numThreads]; + Thread[] requestScopeThreadTable = new Thread[numThreads]; + + for(int i=0; i<numThreads; i++) + { + moduleScopeThreadTable[i] = new ModuleScopeTestThread(); + requestScopeThreadTable[i] = new RequestScopeTestThread(); + } + for(int j=0; j<numThreads; j++) + { + moduleScopeThreadTable[j].start(); + requestScopeThreadTable[j].start(); + } + for(int k=0; k<numThreads; k++) + { + moduleScopeThreadTable[k].join(); + requestScopeThreadTable[k].join(); + } + } + + private class ModuleScopeTestThread extends Thread { + @Override + public void run() { + StateVerifier moduleScopeService = domain.getService(StateVerifier.class, "ModuleScopeComponent"); + for(int i=1; i<=iterations; i++) { + moduleScopeService.setState(i); + if (!moduleScopeService.checkState(i)) + fail("The module scope service lost its state on iteration " + i); + } + } + } + + private class RequestScopeTestThread extends Thread { + @Override + public void run() { + StateVerifier requestScopeService = domain.getService(StateVerifier.class, "RequestScopeComponent"); + for(int i=1; i<=iterations; i++) { + requestScopeService.setState(i); + if (!requestScopeService.checkState(i)) + fail("The request scope service lost its state on iteration " + i); + } + } + } + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("scopes.composite"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/services/pom.xml new file mode 100644 index 0000000000..0ec99599d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/pom.xml @@ -0,0 +1,46 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-services</artifactId> + <name>Apache Tuscany SCA Services Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java new file mode 100644 index 0000000000..1304ba4288 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java @@ -0,0 +1,27 @@ +/* + * 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.itest.services; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface AComponent { + String foo(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java new file mode 100644 index 0000000000..3577e09add --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java @@ -0,0 +1,28 @@ +/* + * 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.itest.services; + +public class AComponentImpl implements AComponent { + + public String foo() { + return "AComponent"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java new file mode 100644 index 0000000000..2e9b56d64d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java @@ -0,0 +1,25 @@ +/* + * 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.itest.services; + +public interface BComponent { + + String foo(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java new file mode 100644 index 0000000000..cda3f38636 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.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.itest.services; + +import org.osoa.sca.annotations.Service; + +@Service(BComponent.class) +public class BComponentImpl implements BComponent { + + public String foo() { + return "BComponent"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java new file mode 100644 index 0000000000..39806a8101 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java @@ -0,0 +1,27 @@ +/* + * 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.itest.services; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CComponent { + String foo(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java new file mode 100644 index 0000000000..8713e5ab22 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java @@ -0,0 +1,28 @@ +/* + * 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.itest.services; + +public class CComponentImpl implements CComponent { + + public String foo() { + return "CComponent"; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java new file mode 100644 index 0000000000..aa745deb63 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java @@ -0,0 +1,25 @@ +/* + * 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.itest.services; + + +public interface D1Component { + String foo1(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java new file mode 100644 index 0000000000..83da15089f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java @@ -0,0 +1,25 @@ +/* + * 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.itest.services; + + +public interface DComponent { + String foo(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java new file mode 100644 index 0000000000..36189f94bb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java @@ -0,0 +1,34 @@ +/* + * 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.itest.services; + +import org.osoa.sca.annotations.Service; + +@Service(interfaces = {DComponent.class, D1Component.class}) +public class DComponentImpl implements DComponent, D1Component { + + public String foo() { + return "DComponent"; + } + + public String foo1() { + return "DComponent"; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/resources/ServicesTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/resources/ServicesTest.composite new file mode 100644 index 0000000000..eda885f9ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/main/resources/ServicesTest.composite @@ -0,0 +1,70 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://foo"
+ name="InnerServicesTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="AComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.AComponentImpl" />
+ </component>
+
+ <component name="AComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.AComponentImpl" />
+ <service name="AComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.AComponent" />
+ </service>
+ </component>
+
+ <component name="BComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.BComponentImpl" />
+ </component>
+
+ <component name="BComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.BComponentImpl" />
+ <service name="BComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.BComponent" />
+ </service>
+ </component>
+
+ <component name="CComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.CComponentImpl" />
+ </component>
+
+ <component name="CComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.CComponentImpl" />
+ <service name="CComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.CComponent" />
+ </service>
+ </component>
+
+ <component name="DComponent1">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.DComponentImpl" />
+ </component>
+
+ <component name="DComponent2">
+ <implementation.java class="org.apache.tuscany.sca.itest.services.DComponentImpl" />
+ <service name="DComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.DComponent" />
+ </service>
+ <service name="D1Component">
+ <interface.java interface="org.apache.tuscany.sca.itest.services.D1Component" />
+ </service>
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java new file mode 100644 index 0000000000..347419eee4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java @@ -0,0 +1,103 @@ +/* + * 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.itest.services; + +import static junit.framework.Assert.assertEquals; +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.osoa.sca.ServiceRuntimeException; + +public class ServicesTestCase { + private static SCADomain domain; + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("ServicesTest.composite"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } + + @Test + public void testAService() { + AComponent a1 = domain.getService(AComponent.class, "AComponent1"); + assertEquals("AComponent", a1.foo()); + + AComponent a2 = domain.getService(AComponent.class, "AComponent2/AComponent"); + assertEquals("AComponent", a2.foo()); + } + + @Test + public void testBService() { + BComponent a1 = domain.getService(BComponent.class, "BComponent1"); + assertEquals("BComponent", a1.foo()); + + BComponent a2 = domain.getService(BComponent.class, "BComponent2/BComponent"); + assertEquals("BComponent", a2.foo()); + } + + @Test + public void testCService() { + CComponent a1 = domain.getService(CComponent.class, "CComponent1"); + assertEquals("CComponent", a1.foo()); + + CComponent a2 = domain.getService(CComponent.class, "CComponent2/CComponent"); + assertEquals("CComponent", a2.foo()); + } + + @Test + public void testDService() { + DComponent a1 = domain.getService(DComponent.class, "DComponent1/DComponent"); + assertEquals("DComponent", a1.foo()); + + D1Component a2 = domain.getService(D1Component.class, "DComponent1/D1Component"); + assertEquals("DComponent", a2.foo1()); + + try { + domain.getService(DComponent.class, "DComponent1"); + Assert.fail("The service name is required"); + } catch (ServiceRuntimeException e) { + Assert.assertTrue("The service name is required", true); + } + + DComponent a3 = domain.getService(DComponent.class, "DComponent2/DComponent"); + assertEquals("DComponent", a3.foo()); + + D1Component a4 = domain.getService(D1Component.class, "DComponent2/D1Component"); + assertEquals("DComponent", a4.foo1()); + + } + + public static void main(String[] args) throws Exception { + ServicesTestCase.init(); + ServicesTestCase tester = new ServicesTestCase(); + tester.testAService(); + tester.testBService(); + tester.testCService(); + tester.testDService(); + ServicesTestCase.destroy(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/pom.xml new file mode 100644 index 0000000000..83eb9196b9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/pom.xml @@ -0,0 +1,91 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-transaction</artifactId> + <name>Apache Tuscany SCA Transaction Policy Integration Test</name> + + <dependencies> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-policy-transaction</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-core</artifactId> + <version>4.1.1</version> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-ra</artifactId> + <version>4.1.1</version> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jms_1.1_spec</artifactId> + <version>1.1</version> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.3.1.4</version> + </dependency> + + <!-- + <dependency> + <groupId>jotm</groupId> + <artifactId>jotm</artifactId> + <version>2.0.10</version> + <exclusions> + <exclusion> + <artifactId>jta</artifactId> + <groupId>javax.transaction</groupId> + </exclusion> + <exclusion> + <artifactId>connector</artifactId> + <groupId>javax.resource</groupId> + </exclusion> + </exclusions> + </dependency> + --> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java new file mode 100644 index 0000000000..d7d18181d9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountNotFoundException.java @@ -0,0 +1,36 @@ +/* + * 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.itest.transaction; + +/** + * @version $Rev$ $Date$ + */ +public class AccountNotFoundException extends Exception { + private static final long serialVersionUID = -4709084750220950706L; + + public AccountNotFoundException() { + super(); + } + + public AccountNotFoundException(String message) { + super(message); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.java new file mode 100644 index 0000000000..ac986dd417 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountService.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.itest.transaction; + +/** + * @version $Rev$ $Date$ + */ +public interface AccountService { + float getBalance(String accountNumber) throws AccountNotFoundException; + + void deposit(String accountNumber, float amount) throws AccountNotFoundException; + + void withdraw(String accountNumber, float amount) throws OverDraftException, AccountNotFoundException; +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java new file mode 100644 index 0000000000..a6ea036da7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/AccountServiceImpl.java @@ -0,0 +1,70 @@ +/* + * 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.itest.transaction; + +import java.util.HashMap; +import java.util.Map; + +/** + * @version $Rev$ $Date$ + */ +public abstract class AccountServiceImpl implements AccountService { + protected Map<String, Float> accounts = new HashMap<String, Float>(); + + /** + * @see org.apache.tuscany.sca.itest.transaction.AccountService#deposit(String, float) + */ + public void deposit(String accountNumber, float amount) throws AccountNotFoundException { + float balance = getBalance(accountNumber); + balance += amount; + save(accountNumber, balance); + accounts.put(accountNumber, balance); + } + + /** + * @see org.apache.tuscany.sca.itest.transaction.AccountService#getBalance(String) + */ + public float getBalance(String accountNumber) throws AccountNotFoundException { + Float balance = accounts.get(accountNumber); + if (balance == null) { + balance = load(accountNumber); + accounts.put(accountNumber, balance); + } + return balance; + } + + /** + * @see org.apache.tuscany.sca.itest.transaction.AccountService#withdraw(String, float) + */ + public void withdraw(String accountNumber, float amount) throws OverDraftException, AccountNotFoundException { + float balance = getBalance(accountNumber); + if (amount > balance) { + throw new OverDraftException("Insufficient fund"); + } + balance -= amount; + save(accountNumber, balance); + accounts.put(accountNumber, balance); + } + + protected abstract float load(String accountNumber) throws AccountNotFoundException; + + protected abstract void save(String accountNumber, float balance) throws AccountNotFoundException; + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java new file mode 100644 index 0000000000..c00935a756 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/CheckingAccountServiceImpl.java @@ -0,0 +1,143 @@ +/* + * 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.itest.transaction; + +import java.io.File; +import java.util.Enumeration; + +import javax.jms.Connection; +import javax.jms.JMSException; +import javax.jms.MapMessage; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Queue; +import javax.jms.QueueBrowser; +import javax.jms.Session; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.ActiveMQSession; +import org.apache.activemq.broker.BrokerService; +import org.osoa.sca.ServiceRuntimeException; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(AccountService.class) +@Scope("COMPOSITE") +public class CheckingAccountServiceImpl extends AccountServiceImpl { + private static final String url = "tcp://localhost:61616"; + private BrokerService broker; + private Queue queue; + + @Init + public void init() throws Exception { + broker = new BrokerService(); + broker.setBrokerName("localhost"); + broker.setDataDirectory(new File("target/activemq-data/localhost")); + broker.addConnector(url); + broker.start(); + + ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url); + Connection conn = connFac.createConnection(); + ActiveMQSession session = (ActiveMQSession)conn.createSession(true, Session.AUTO_ACKNOWLEDGE); + queue = session.createQueue("CheckAccounts"); + MessageProducer producer = session.createProducer(queue); + MapMessage map = session.createMapMessage(); + + for (int i = 0; i < 3; i++) { + String accountNumber = "C00" + (i + 1); + float balance = (float)(1000.0 + Math.random() * 200.0); + map.setStringProperty("accountNumber", accountNumber); + map.setFloatProperty("balance", balance); + + map.setString("accountNumber", accountNumber); + map.setFloat("balance", balance); + + producer.send(map); + } + session.commit(); + conn.close(); + } + + @Destroy + public void destroy() throws Exception { + if (broker != null) { + broker.stop(); + } + } + + @Override + protected float load(String accountNumber) throws AccountNotFoundException { + try { + ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url); + Connection conn = connFac.createConnection(); + conn.start(); + Session session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE); + QueueBrowser browser = session.createBrowser(queue, "accountNumber = '" + accountNumber + "'"); + Enumeration msgs = browser.getEnumeration(); + if (msgs.hasMoreElements()) { + MapMessage msg = (MapMessage)msgs.nextElement(); + float balance = msg.getFloat("balance"); + conn.close(); + return balance; + } else { + conn.close(); + throw new AccountNotFoundException(accountNumber); + } + } catch (JMSException e) { + throw new ServiceRuntimeException(e); + } + } + + @Override + protected void save(String accountNumber, float balance) throws AccountNotFoundException { + try { + ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(url); + Connection conn = connFac.createConnection(); + conn.start(); + ActiveMQSession session = (ActiveMQSession)conn.createSession(true, Session.AUTO_ACKNOWLEDGE); + MessageConsumer consumer = session.createConsumer(queue, "accountNumber = '" + accountNumber + "'"); + Message msg = consumer.receiveNoWait(); + if (msg == null) { + conn.close(); + throw new AccountNotFoundException(accountNumber); + } + MapMessage map = session.createMapMessage(); + map.setStringProperty("accountNumber", accountNumber); + map.setFloatProperty("balance", balance); + + map.setString("accountNumber", accountNumber); + map.setFloat("balance", balance); + + MessageProducer producer = session.createProducer(queue); + producer.send(map); + conn.close(); + + } catch (JMSException e) { + throw new ServiceRuntimeException(e); + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java new file mode 100644 index 0000000000..4d504a6a36 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/OverDraftException.java @@ -0,0 +1,36 @@ +/* + * 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.itest.transaction; + +/** + * @version $Rev$ $Date$ + */ +public class OverDraftException extends Exception { + private static final long serialVersionUID = -4709084750220950706L; + + public OverDraftException() { + super(); + } + + public OverDraftException(String message) { + super(message); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java new file mode 100644 index 0000000000..156b34227d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/SavingsAccountServiceImpl.java @@ -0,0 +1,133 @@ +/* + * 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.itest.transaction; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.logging.Logger; + +import javax.sql.XAConnection; + +import org.apache.derby.jdbc.EmbeddedXADataSource; +import org.osoa.sca.ServiceRuntimeException; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(AccountService.class) +@Scope("COMPOSITE") +public class SavingsAccountServiceImpl extends AccountServiceImpl { + private final static Logger log = Logger.getLogger(SavingsAccountServiceImpl.class.getName()); + private EmbeddedXADataSource xads; + + @Init + public void init() throws SQLException { + // Create the database and a table + xads = new EmbeddedXADataSource(); + xads.setDatabaseName("target/test"); + xads.setCreateDatabase("create"); + + XAConnection xaconn = xads.getXAConnection(); + Connection conn = xaconn.getConnection(); + PreparedStatement ps = + conn.prepareStatement("create table SavingsAccounts(accountNumber char(100), balance float)"); + try { + ps.execute(); + } catch (SQLException ex) { + log.info(ex.getMessage()); + } + ps = conn.prepareStatement("delete from SavingsAccounts"); + ps.execute(); + + ps = conn.prepareStatement("insert into SavingsAccounts(accountNumber, balance) values(?, ?)"); + for (int i = 0; i < 2; i++) { + ps.setString(1, "S00" + (i+1)); + ps.setFloat(2, (float)(1000.0f + Math.random() * 500.0)); + ps.executeUpdate(); + } + conn.commit(); + conn.close(); + } + + @Override + protected float load(String accountNumber) throws AccountNotFoundException { + try { + XAConnection xaconn = xads.getXAConnection(); + + Connection conn = xaconn.getConnection(); + PreparedStatement ps = conn.prepareStatement("select balance from SavingsAccounts where accountNumber=?"); + ps.setString(1, accountNumber); + ResultSet rs1 = ps.executeQuery(); + boolean found = rs1.next(); + if (found) { + float balance = rs1.getFloat(1); + conn.commit(); + conn.close(); + return balance; + } else { + conn.commit(); + conn.close(); + throw new AccountNotFoundException(accountNumber); + } + } catch (SQLException e) { + throw new ServiceRuntimeException(e); + } + } + + @Override + protected void save(String accountNumber, float balance) throws AccountNotFoundException { + try { + XAConnection xaconn = xads.getXAConnection(); + + Connection conn = xaconn.getConnection(); + PreparedStatement ps = conn.prepareStatement("update SavingsAccounts set balance=? where accountNumber=?"); + ps.setFloat(1, balance); + ps.setString(2, accountNumber); + int rows = ps.executeUpdate(); + conn.commit(); + boolean found = (rows >= 1); + if (found) { + conn.close(); + } else { + conn.close(); + throw new AccountNotFoundException(accountNumber); + } + } catch (SQLException e) { + throw new ServiceRuntimeException(e); + } + } + + @Destroy + public void destroy() throws SQLException { + XAConnection xaconn = xads.getXAConnection(); + Connection conn = xaconn.getConnection(); + PreparedStatement ps = conn.prepareStatement("drop table SavingsAccounts"); + ps.execute(); + conn.commit(); + conn.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.java new file mode 100644 index 0000000000..b7ea5f2663 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferService.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.itest.transaction; + +/** + * @version $Rev$ $Date$ + */ +public interface TransferService { + String[] getAccounts(); + + float getBalance(String accountNumber) throws AccountNotFoundException; + + void transfer(String from, String to, float amount) throws OverDraftException, AccountNotFoundException; +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java new file mode 100644 index 0000000000..341a7e53e3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/java/org/apache/tuscany/sca/itest/transaction/TransferServiceImpl.java @@ -0,0 +1,64 @@ +/* + * 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.itest.transaction; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(TransferService.class) +public class TransferServiceImpl implements TransferService { + @Reference + protected AccountService savings; + + @Reference + protected AccountService checking; + + /** + * @see org.apache.tuscany.sca.itest.transaction.TransferService#transfer(java.lang.String, java.lang.String, float) + */ + public void transfer(String from, String to, float amount) throws OverDraftException, AccountNotFoundException { + if (from.startsWith("C")) { + checking.withdraw(from, amount); + } else { + savings.withdraw(from, amount); + } + if (to.startsWith("C")) { + checking.deposit(to, amount); + } else { + savings.deposit(to, amount); + } + } + + public float getBalance(String accountNumber) throws AccountNotFoundException { + if(accountNumber.startsWith("C")) { + return checking.getBalance(accountNumber); + } else { + return savings.getBalance(accountNumber); + } + } + + public String[] getAccounts() { + return new String[] {"S001", "S002", "C001"}; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/accounts.composite b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/accounts.composite new file mode 100644 index 0000000000..f4c6b650c7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/accounts.composite @@ -0,0 +1,43 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:foo="http://foo" targetNamespace="http://account"
+ name="Accounts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="TransferServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.TransferServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="TransferService" />
+ <reference name="savings" requires="propagatesTransaction" target="SavingsAccountServiceComponent"></reference>
+ <reference name="checking" requires="propagatesTransaction" target="CheckingAccountServiceComponent"></reference>
+ </component>
+
+ <component name="SavingsAccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.SavingsAccountServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="AccountService" requires="propagatesTransaction" />
+ </component>
+
+ <component name="CheckingAccountServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.transaction.CheckingAccountServiceImpl"
+ requires="managedTransaction.global" />
+ <service name="AccountService" requires="propagatesTransaction" />
+ </component>
+
+</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/definitions.xml new file mode 100644 index 0000000000..b1599c0633 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/definitions.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * 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. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://www.osoa.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> + + <policySet name="tuscany:ManagedTransactionPolicySet" provides="managedTransaction" appliesTo="implementation"> + <intentMap provides="managedTransaction" default="global"> + <qualifier name="global"> + <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_GLOBAL" /> + </qualifier> + <qualifier name="local"> + <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_LOCAL" /> + </qualifier> + </intentMap> + </policySet> + + <policySet name="tuscany:NoManagedTransactionPolicySet" provides="noManagedTransaction" + appliesTo="implementation"> + <tuscany:transactionPolicy action="REQUIRE_NONE" /> + </policySet> + + <policySet name="tuscany:PropagatesTransactionPolicySet" provides="propagatesTransaction" appliesTo="binding"> + <tuscany:transactionPolicy action="PROPAGATE" /> + </policySet> + + <policySet name="tuscany:SuspendsTransactionPolicySet" provides="suspendsTransaction" appliesTo="binding"> + <tuscany:transactionPolicy action="SUSPEND" /> + </policySet> + + <policySet name="tuscany:TransactedOneWayPolicySet" provides="transactedOneWay" appliesTo="binding"> + <tuscany:transactionPolicy action="PROPAGATE" /> + </policySet> + + <policySet name="tuscany:ImmediateOneWayPolicySet" provides="immediateOneWay" appliesTo="binding"> + <tuscany:transactionPolicy action="SUSPEND" /> + </policySet> + + <intent name="managedTransaction" constrains="implementation"> + <description>Used to indicate the transaction environment desired by a component implementation.</description> + </intent> + <intent name="managedTransaction.global"> + <description> + Used to indicate that a component implementation requires a managed global transaction. + </description> + </intent> + <intent name="managedTransaction.local"> + <description> + Used to indicate that a component implementation requires a managed local transaction. + </description> + </intent> + <intent name="noManagedTransaction" constrains="implementation"> + <description> + Used to indicate that a component implementation will manage its own transaction resources. + </description> + </intent> + <intent name="propagatesTransaction" constrains="binding"> + <description> + Used to indicate that a reference will propagate any client transaction or that a service will be dispatched + under any received transaction. + </description> + </intent> + <intent name="suspendsTransaction" constrains="binding"> + <description> + Used to indicate that a reference will not propagate any client transaction or that a service will not be + dispatched under any received transaction. + </description> + </intent> + <intent name="transactedOneWay" constrains="binding"> + <description> + Used to indicate that the component requires the SCA runtime to transact OneWay send of messages as part of + any client global transaction or to transact oneWay message receipt as part of any service global + transaction. + </description> + </intent> + <intent name="immediateOneWay" constrains="binding"> + <description> + Used to indicate that the component requires the SCA runtime to process the sending or receiving of OneWay + messages immediately, regardless of any transaction under which the sending/receiving component runs. + </description> + </intent> + +</definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/log4j.properties b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/log4j.properties new file mode 100644 index 0000000000..698ee41d7e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/main/resources/log4j.properties @@ -0,0 +1,29 @@ +# 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. +# +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=INFO, CONSOLE + +# CONSOLE is set to be a ConsoleAppender. +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout + + +# Print only messages of level WARN or above in the package com.foo. +log4j.logger.org.apache.tuscany=INFO
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java new file mode 100644 index 0000000000..c23628ff91 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/ConcurrentXAResourceTestCase.java @@ -0,0 +1,119 @@ +/* + * 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.itest.transaction; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.logging.Logger; + +import javax.sql.XAConnection; +import javax.transaction.Transaction; +import javax.transaction.TransactionManager; + +import junit.framework.TestCase; + +import org.apache.derby.jdbc.EmbeddedXADataSource; +import org.apache.tuscany.sca.policy.transaction.TransactionManagerHelper; +import org.apache.tuscany.sca.policy.transaction.TransactionManagerWrapper; + +public class ConcurrentXAResourceTestCase extends TestCase { + class TestThread extends Thread { + private int counter; + + TestThread(int i) { + counter = i; + } + + public void run() { + log.info(this + " running..."); + + EmbeddedXADataSource xads = new EmbeddedXADataSource(); + xads.setDatabaseName("target/test" + counter); + xads.setCreateDatabase("create"); + Connection conn = null; + try { + + Transaction trans = helper.managedGlobalTransactionPreInvoke(); + + XAConnection xaconn = xads.getXAConnection(); + + trans.enlistResource(xaconn.getXAResource()); + + conn = xaconn.getConnection(); + try { + conn.prepareStatement("create table T1(col1 char(100))").execute(); + } catch (SQLException ex) { + log.info("table T1 exists"); + } + conn.prepareStatement("insert into T1 values('kkkkkkkk')").execute(); + ResultSet rs = conn.prepareStatement("select count(*) from T1").executeQuery(); + rs.next(); + log.info(String.valueOf(rs.getInt(1))); + + helper.managedGlobalTransactionPostInvoke(trans, false); + + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + try { + conn.close(); + } catch (Exception _ex) { + _ex.printStackTrace(); + } + } + } + + } + private TransactionManagerWrapper activator; + private TransactionManagerHelper helper; + + private Logger log = Logger.getLogger(this.getClass().getName()); + + public void setUp() throws Exception { + activator = new TransactionManagerWrapper(); + activator.start(); + TransactionManager tm = activator.getTransactionManager(); + helper = new TransactionManagerHelper(tm); + } + + public void tearDown() throws Exception { + activator.stop(); + + } + + public void testConcurrent() { + TestThread[] tts = new TestThread[5]; + for (int i = 0; i < tts.length; i++) { + tts[i] = new TestThread(i); + tts[i].start(); + // log.info("one TestThread started..."); + } + try { + for (TestThread tt : tts) { + while (tt != null && tt.isAlive()) { + // log.info("wait for..."); + Thread.sleep(200); + } + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.java new file mode 100644 index 0000000000..36884f6098 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/transaction/src/test/java/org/apache/tuscany/sca/itest/transaction/TransactionTestCase.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 org.apache.tuscany.sca.itest.transaction; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TransactionTestCase { + private static SCADomain domain; + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("accounts.composite"); + } + + @AfterClass + public static void destroy() throws Exception { + if (domain != null) { + domain.close(); + } + } + + @Test + public void testTransaction() throws Exception { + TransferService service = domain.getService(TransferService.class, "TransferServiceComponent"); + String[] accounts = service.getAccounts(); + for (int i = 0; i < accounts.length; i++) { + float balance = service.getBalance(accounts[i]); + System.out.println("[" + i + "] " + accounts[i] + ":" + balance); + } + service.transfer(accounts[0], accounts[2], 200.0f); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wires/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/wires/pom.xml new file mode 100644 index 0000000000..05c86d597d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wires/pom.xml @@ -0,0 +1,45 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-wires</artifactId> + <name>Apache Tuscany SCA Wires Basic Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java new file mode 100644 index 0000000000..09d5b0278e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java @@ -0,0 +1,34 @@ +/* + * 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.itest; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the client interface for the wires tests + */ +@Remotable +public interface WireClient { + + /** + * This tests the wires. + */ + void runTests(); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java new file mode 100644 index 0000000000..f0964ebb93 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java @@ -0,0 +1,52 @@ +/* + * 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.itest; + +import junit.framework.Assert; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This is the client implementation for the wires tests + */ +@Service(WireClient.class) +public class WireClientImpl implements WireClient { + /** + * This is our injected reference to the WireService + */ + @Reference + protected WireService aWireService; + + /** + * This tests the wire reference + */ + public void runTests() { + // Make sure the wire has injected a reference + Assert.assertNotNull(aWireService); + + // Test the injected reference + String msg = aWireService.sayHello("MCC"); + + // Validate the response + Assert.assertNotNull(msg); + Assert.assertEquals("Hello MCC", msg); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java new file mode 100644 index 0000000000..c19a0b4f74 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java @@ -0,0 +1,36 @@ +/* + * 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.itest; + +import org.osoa.sca.annotations.Remotable; + +/** + * Sample Wire Service + */ +@Remotable +public interface WireService { + /** + * Returns "Hello " + aName + * + * @param aName The name to say hello + * @return "Hello " + aName + */ + String sayHello(String aName); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java new file mode 100644 index 0000000000..b7ccdbf8d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java @@ -0,0 +1,39 @@ +/* + * 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.itest; + +import org.osoa.sca.annotations.Service; + +/** + * Sample WireService Implementation + */ +@Service(WireService.class) +public class WireServiceImpl implements WireService { + + /** + * Returns "Hello " + aName + * + * @param aName The name to say hello + * @return "Hello " + aName + */ + public String sayHello(String aName) { + return "Hello " + aName; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/resources/WireTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/resources/WireTest.composite new file mode 100644 index 0000000000..8b764d0e7d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/main/resources/WireTest.composite @@ -0,0 +1,39 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://wires" name="WireTest">
+
+ <component name="WireClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireClientImpl"/>
+<!-- We are not using a reference - we are using a wire - see below -->
+<!-- The equivalent reference for the wire would be as follows -->
+<!-- <reference name="aWireService" target="WireService"/>-->
+ </component>
+
+ <component name="AnotherWireClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireClientImpl"/>
+ </component>
+
+ <component name="WireServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.WireServiceImpl"/>
+ </component>
+
+ <wire source="WireClient/aWireService" target="WireServiceComponent"/>
+ <wire source="AnotherWireClient/aWireService" target="WireServiceComponent/WireService"/>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java new file mode 100644 index 0000000000..95f721cd8e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java @@ -0,0 +1,69 @@ +/* + * 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.itest; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This test case will attempt to use a wire + */ +public class WireTestCase extends TestCase { + + /** + * The SCADomain we are using + */ + private SCADomain domain; + + /** + * The client the tests should use + */ + private WireClient aWireClient; + + /** + * Run the wire tests + */ + public void testWire() { + aWireClient.runTests(); + } + + /** + * Load the Wire composite and look up the client. + */ + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("WireTest.composite"); + aWireClient = domain.getService(WireClient.class, "WireClient"); + Assert.assertNotNull(aWireClient); + + aWireClient = domain.getService(WireClient.class, "AnotherWireClient"); + Assert.assertNotNull(aWireClient); + } + + /** + * Shutdown the SCA domain + */ + @Override + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/pom.xml new file mode 100644 index 0000000000..b72b14e92b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/pom.xml @@ -0,0 +1,61 @@ +<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-ws-void-args-return</artifactId>
+ <name>Apache Tuscany SCA Web Services Void Args and Return Test</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java new file mode 100644 index 0000000000..dcc77c5539 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldImpl.java @@ -0,0 +1,49 @@ +/*
+ * 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 voidtest;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String getGreetings(String name) {
+ return "Hello " + name;
+ }
+
+ public void giveGreetings(String name) {
+ System.out.println("Hello " + name);
+ }
+
+ public void giveGreetingsOneWay(String name) {
+ System.out.println("Hi " + name);
+ }
+
+ public String takeGreetings() {
+ return "Hello Stranger";
+ }
+
+ public void noGreetings() {
+ System.out.println("Hello, who's there?");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java new file mode 100644 index 0000000000..5b1ba2e79c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/HelloWorldService.java @@ -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.
+ */
+package voidtest;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface HelloWorldService {
+
+ String getGreetings(String name);
+
+ void giveGreetings(String name);
+
+ @OneWay
+ void giveGreetingsOneWay(String name);
+
+ String takeGreetings();
+
+ void noGreetings();
+}
+
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java new file mode 100644 index 0000000000..d549bccaf0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/TestClient.java @@ -0,0 +1,23 @@ +/*
+ * 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 voidtest;
+
+public interface TestClient {
+ void runTest();
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java new file mode 100644 index 0000000000..d0fb8258dd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/java/voidtest/TestClientImpl.java @@ -0,0 +1,45 @@ +/*
+ * 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 voidtest;
+
+import static junit.framework.Assert.assertEquals;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(TestClient.class)
+@Scope("COMPOSITE")
+public class TestClientImpl implements TestClient {
+
+ private HelloWorldService helloService;
+
+ @Reference
+ public void setHelloService(HelloWorldService helloService) {
+ this.helloService = helloService;
+ }
+
+ public void runTest() {
+ assertEquals("Hello Smith", helloService.getGreetings(" Smith"));
+ helloService.giveGreetings("Jones");
+ helloService.giveGreetingsOneWay("Brown");
+ assertEquals("Hello Stranger", helloService.takeGreetings());
+ helloService.noGreetings();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/resources/voidtest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/resources/voidtest.composite new file mode 100644 index 0000000000..0f31c4cd2c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/main/resources/voidtest.composite @@ -0,0 +1,41 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://voidtest"
+ xmlns:hw="http://voidtest"
+ name="voidtest">
+
+ <component name="TestClientComponent">
+ <implementation.java class="voidtest.TestClientImpl" />
+ <reference name="helloService">
+ <interface.java interface="voidtest.HelloWorldService"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent/HelloWorldService"/>
+ </reference>
+ </component>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="voidtest.HelloWorldImpl" />
+ <service name="HelloWorldService">
+ <interface.java interface="voidtest.HelloWorldService"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldServiceComponent/HelloWorldService"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.java new file mode 100644 index 0000000000..eaaa67c22c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/ws-void-args-return/src/test/java/voidtest/VoidArgsReturnTestCase.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 voidtest;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that methods with no args and/or void return type work over Web services
+ */
+public class VoidArgsReturnTestCase {
+
+ private SCADomain scaDomain;
+ private TestClient client;
+
+ @Before
+ public void startServer() throws Exception {
+ scaDomain = SCADomain.newInstance("voidtest.composite");
+ client = scaDomain.getService(TestClient.class, "TestClientComponent");
+ }
+
+ @Test
+ public void testVoidCases() throws Exception {
+ client.runTest();
+ System.out.println("Sleeping...");
+ Thread.sleep(2000);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/pom.xml new file mode 100644 index 0000000000..ecc6b8266c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/pom.xml @@ -0,0 +1,135 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-wsdl</artifactId> + <name>Apache Tuscany SCA WSDL Support Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-interface-wsdl</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-axiom</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-impl</artifactId> + <version>1.0-incubating</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-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.0-incubating</version> + <executions> + <execution> + <id>generate-sdo</id> + <phase>generate-sources</phase> + <configuration> + <schemaFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</schemaFile> + <javaPackage>com.bigbank.account</javaPackage> + <prefix>Account</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/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..265b11f7dd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,92 @@ +/* + * 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 bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@AllowsPassByReference +public interface AccountDataService { + + /** + * Auto generated method signatures + * + * @param param0* + * @param param1* + * @param param2 + */ + public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param4 + */ + public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param6* + * @param param7 + */ + public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param9* + * @param param10* + * @param param11 + */ + public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11) + throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param13* + * @param param14 + */ + public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param16* + * @param param17 + */ + public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param19 + */ + public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param0 + */ + public com.bigbank.account.AccountLog getAccountLog(int param0) throws java.rmi.RemoteException; + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..f8c9c28f26 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,93 @@ +/* + * 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 bigbank.account.services.accountdata; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +@Service(AccountDataService.class) +public class AccountDataServiceImpl implements AccountDataService { + + public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException { + + return null; + } + + public AccountReport getAccountReport(int customerID) { + + AccountReport report =AccountFactory.INSTANCE.createAccountReport(); + AccountSummary summary1 = AccountFactory.INSTANCE.createAccountSummary(); + summary1.setAccountNumber("123"); + summary1.setAccountType("checking"); + summary1.setBalance(1000.0f); + report.getAccountSummaries().add(summary1); + AccountSummary summary2 = AccountFactory.INSTANCE.createAccountSummary(); + summary2.setAccountNumber("456"); + summary2.setAccountType("savings"); + summary2.setBalance(2000.0f); + report.getAccountSummaries().add(summary2); + + return report; + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + throws RemoteException { + CustomerProfileData data = AccountFactory.INSTANCE.createCustomerProfileData(); + data.setLoginID(customerProfile.getLoginID()); + data.setAddress(customerProfile.getAddress()); + data.setEmail(customerProfile.getEmail()); + data.setFirstName(customerProfile.getFirstName()); + data.setId(customerProfile.getId()); + data.setLastName(customerProfile.getLastName()); + data.setPassword(customerProfile.getPassword()); + return data; + } + + public float deposit(String param6, float param7) throws RemoteException { + + return 0; + } + + public StockSummary purchaseStock(int param0, StockSummary stock) throws RemoteException { + + return null; + } + + public StockSummary sellStock(int param13, int param14) throws RemoteException { + + return null; + } + + public float withdraw(String param16, float param17) throws RemoteException { + + return 0; + } + + public AccountLog getAccountLog(final int customerID) throws RemoteException { + throw new RemoteException("This method should not be called"); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java new file mode 100644 index 0000000000..f16d20689d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java @@ -0,0 +1,79 @@ +/* + * 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 bigbank.account.services.accountdata; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class AccountServiceClientImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) throws RemoteException { + + return 0; + } + + public AccountLog getAccountLog(int param0) throws RemoteException { + + return null; + } + + public AccountReport getAccountReport(int param19) throws RemoteException { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) throws RemoteException { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException { + + return null; + } + + public StockSummary sellStock(int param13, int param14) throws RemoteException { + + return null; + } + + public float withdraw(String param16, float param17) throws RemoteException { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java new file mode 100644 index 0000000000..cba6f2ee6c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java @@ -0,0 +1,79 @@ +/* + * 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 bigbank.account.services.accountdata; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class Component2aImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) throws RemoteException { + + return 0; + } + + public AccountLog getAccountLog(int param0) throws RemoteException { + + return null; + } + + public AccountReport getAccountReport(int param19) throws RemoteException { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) throws RemoteException { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException { + + return null; + } + + public StockSummary sellStock(int param13, int param14) throws RemoteException { + + return null; + } + + public float withdraw(String param16, float param17) throws RemoteException { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java new file mode 100644 index 0000000000..9f15be0236 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java @@ -0,0 +1,79 @@ +/* + * 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 bigbank.account.services.accountdata; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class Component2bImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) throws RemoteException { + + return 0; + } + + public AccountLog getAccountLog(int param0) throws RemoteException { + + return null; + } + + public AccountReport getAccountReport(int param19) throws RemoteException { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) throws RemoteException { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException { + + return null; + } + + public StockSummary sellStock(int param13, int param14) throws RemoteException { + + return null; + } + + public float withdraw(String param16, float param17) throws RemoteException { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java new file mode 100644 index 0000000000..f174e1af07 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java @@ -0,0 +1,79 @@ +/* + * 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 bigbank.account.services.accountdata; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class Component3aImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) throws RemoteException { + + return 0; + } + + public AccountLog getAccountLog(int param0) throws RemoteException { + + return null; + } + + public AccountReport getAccountReport(int param19) throws RemoteException { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) throws RemoteException { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException { + + return null; + } + + public StockSummary sellStock(int param13, int param14) throws RemoteException { + + return null; + } + + public float withdraw(String param16, float param17) throws RemoteException { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java new file mode 100644 index 0000000000..4a5b7bceef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java @@ -0,0 +1,79 @@ +/* + * 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 bigbank.account.services.accountdata; + +import java.rmi.RemoteException; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class Component3bImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) throws RemoteException { + + return 0; + } + + public AccountLog getAccountLog(int param0) throws RemoteException { + + return null; + } + + public AccountReport getAccountReport(int param19) throws RemoteException { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) throws RemoteException { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException { + + return null; + } + + public StockSummary sellStock(int param13, int param14) throws RemoteException { + + return null; + } + + public float withdraw(String param16, float param17) throws RemoteException { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java new file mode 100644 index 0000000000..e747eb041f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java @@ -0,0 +1,98 @@ +/* + * 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 bigbank.account.services.accountdata; + +import java.rmi.RemoteException; + +/** + * This interface allows access to a customer's id from the data service. + */ +public interface CustomerIdService { + + /* + * Return -1 if purchaseLotNumber not found + */ + public int getCustomerIdByPurchaseLotNumber(int purchaseLotNumber) throws RemoteException; + + /* + * Return -1 if account not found + */ + public int getCustomerIdByAccount(String account) throws RemoteException; + + // TODO (isilval) Fix this !!! + // Apparently, configuration can't deal with extends so I am adding the contents of AccountDataService here + + /** + * Auto generated method signatures + * + * @param param0* + * @param param1* + * @param param2 + */ + public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param4 + */ + public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param6* + * @param param7 + */ + public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param9* + * @param param10* + * @param param11 + */ + public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11) + throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param13* + * @param param14 + */ + public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param16* + * @param param17 + */ + public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param19 + */ + public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException; + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c9076ebba6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hi " + name; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..268d90e910 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..d706517b76 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,43 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } +}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java new file mode 100644 index 0000000000..9d147dc013 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.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 org.apache.tuscany.sca.itest; + +import helloworld.HelloWorldService; + +import org.osoa.sca.annotations.Reference; + +public class Component2aImpl implements HelloWorldService { + + private HelloWorldService comp; + + @Reference + public void setComp(HelloWorldService comp) { + this.comp = comp; + } + public String getGreetings(String s) { + return comp.getGreetings(s); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java new file mode 100644 index 0000000000..7556e02b36 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java @@ -0,0 +1,39 @@ +/* + * 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.itest; + +import helloworld.HelloWorldService; + +import org.osoa.sca.annotations.Reference; + +public class Component2bImpl implements HelloWorldService { + + private HelloWorldService comp; + + @Reference + public void setComp(HelloWorldService comp) { + this.comp = comp; + } + + public String getGreetings(String s) { + return comp.getGreetings(s); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java new file mode 100644 index 0000000000..e7031ff41c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java @@ -0,0 +1,39 @@ +/* + * 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.itest; + +import helloworld.HelloWorldService; + +import org.osoa.sca.annotations.Reference; + +public class Component3aImpl implements HelloWorldService { + + private HelloWorldService comp; + + @Reference + public void setComp(HelloWorldService comp) { + this.comp = comp; + } + + public String getGreetings(String s) { + return comp.getGreetings(s); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java new file mode 100644 index 0000000000..7a049ed7b0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java @@ -0,0 +1,39 @@ +/* + * 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.itest; + +import helloworld.HelloWorldService; + +import org.osoa.sca.annotations.Reference; + +public class Component3bImpl implements HelloWorldService { + + private HelloWorldService comp; + + @Reference + public void setComp(HelloWorldService comp) { + this.comp = comp; + } + + public String getGreetings(String s) { + return comp.getGreetings(s); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/SDOWSDLTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/SDOWSDLTest.composite new file mode 100644 index 0000000000..62596ee62a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/SDOWSDLTest.composite @@ -0,0 +1,344 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" name="SDOWSDLTest"> + + <!-- dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" + factory="com.bigbank.account.AccountFactory" / --> + + <service name="AccountService1a2a3a4a" promote="Component2a3a4a"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2a3a4a"/> + </service> + <service name="AccountService1a2a3a4b" promote="Component2a3a4b"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2a3a4b"/> + </service> + <service name="AccountService1a2a3b4a" promote="Component2a3b4a"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2a3b4a"/> + </service> + <service name="AccountService1a2a3b4b" promote="Component2a3b4b"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2a3b4b"/> + </service> + <service name="AccountService1a2b3a4a" promote="Component2b3a4a"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2b3a4a"/> + </service> + <service name="AccountService1a2b3a4b" promote="Component2b3a4b"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2b3a4b"/> + </service> + <service name="AccountService1a2b3b4a" promote="Component2b3b4a"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2b3b4a"/> + </service> + <service name="AccountService1a2b3b4b" promote="Component2b3b4b"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1a2b3b4b"/> + </service> + <service name="AccountService1b2a3a4a" promote="Component2a3a4a"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2a3a4a"/> + </service> + <service name="AccountService1b2a3a4b" promote="Component2a3a4b"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2a3a4b"/> + </service> + <service name="AccountService1b2a3b4a" promote="Component2a3b4a"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2a3b4a"/> + </service> + <service name="AccountService1b2a3b4b" promote="Component2a3b4b"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2a3b4b"/> + </service> + <service name="AccountService1b2b3a4a" promote="Component2b3a4a"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2b3a4a"/> + </service> + <service name="AccountService1b2b3a4b" promote="Component2b3a4b"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2b3a4b"/> + </service> + <service name="AccountService1b2b3b4a" promote="Component2b3b4a"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2b3b4a"/> + </service> + <service name="AccountService1b2b3b4b" promote="Component2b3b4b"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService1b2b3b4b"/> + </service> + + <component name="Component2a3a4a"> + <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" /> + <reference name="accountService" target="Component3a4a"/> + </component> + <component name="Component2a3a4b"> + <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" /> + <reference name="accountService" target="Component3a4b"/> + </component> + <component name="Component2a3b4a"> + <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" /> + <reference name="accountService" target="Component3b4a"/> + </component> + <component name="Component2a3b4b"> + <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" /> + <reference name="accountService" target="Component3b4b"/> + </component> + + <component name="Component2b3a4a"> + <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" /> + <reference name="accountService" target="Component3a4a"/> + </component> + <component name="Component2b3a4b"> + <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" /> + <reference name="accountService" target="Component3a4b"/> + </component> + <component name="Component2b3b4a"> + <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" /> + <reference name="accountService" target="Component3b4a"/> + </component> + <component name="Component2b3b4b"> + <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" /> + <reference name="accountService" target="Component3b4b"/> + </component> + + <component name="Component3a4a"> + <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" /> + </component> + <reference name="Component3a4aRef" promote="Component3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService" /> + </reference> + + <component name="Component3a4b"> + <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" /> + </component> + <reference name="Component3a4bRef" promote="Component3a4b/accountService"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService" /> + </reference> + + <component name="Component3b4a"> + <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" /> + </component> + <reference name="Component3b4aRef" promote="Component3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService" /> + </reference> + + <component name="Component3b4b"> + <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" /> + </component> + <reference name="Component3b4bRef" promote="Component3b4b/accountService"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService" /> + </reference> + + <!-- target service --> + + <service name="AccountService" promote="AccountServiceComponent"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="http://localhost:8085/AccountService"/> + </service> + + <component name="AccountServiceComponent"> + <implementation.java class="bigbank.account.services.accountdata.AccountDataServiceImpl" /> + </component> + + <!-- test client --> + + <component name="AccountServiceClient"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="AccountServiceRef" promote="AccountServiceClient/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"/> + </reference> + + <!-- clients --> + + <component name="Client1a2a3a4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1a2a3a4a" /> + </reference> + + <component name="Client1a2a3a4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl"/> + </component> + + <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1a2a3a4b" /> + </reference> + + <component name="Client1a2a3b4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1a2a3b4a" /> + </reference> + + <component name="Client1a2a3b4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1a2a3b4b" /> + </reference> + + <component name="Client1a2b3a4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1a2b3a4a" /> + </reference> + + <component name="Client1a2b3a4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1a2b3a4b" /> + </reference> + + <component name="Client1a2b3b4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1a2b3b4a" /> + </reference> + + <component name="Client1a2b3b4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1a2b3b4b" /> + </reference> + + <component name="Client1b2a3a4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1b2a3a4a" /> + </reference> + + <component name="Client1b2a3a4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1b2a3a4b" /> + </reference> + + <component name="Client1b2a3b4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1b2a3b4a" /> + </reference> + + <component name="Client1b2a3b4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1b2a3b4b" /> + </reference> + + <component name="Client1b2b3a4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1b2b3a4a" /> + </reference> + + <component name="Client1b2b3a4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1b2b3a4b" /> + </reference> + + <component name="Client1b2b3b4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1b2b3b4a" /> + </reference> + + <component name="Client1b2b3b4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" + uri="http://localhost:8085/AccountService1b2b3b4b" /> + </reference> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/WSDLTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/WSDLTest.composite new file mode 100644 index 0000000000..2024578dae --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/WSDLTest.composite @@ -0,0 +1,371 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + + name="WSDLTest"> + + <service name="HelloWorldService1a2a3a4a" promote="Component2a3a4a" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3a4a"/> + </service> + <service name="HelloWorldService1a2a3a4b" promote="Component2a3a4b" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3a4b"/> + </service> + <service name="HelloWorldService1a2a3b4a" promote="Component2a3b4a" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3b4a"/> + </service> + <service name="HelloWorldService1a2a3b4b" promote="Component2a3b4b" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2a3b4b"/> + </service> + <service name="HelloWorldService1a2b3a4a" promote="Component2b3a4a" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3a4a"/> + </service> + <service name="HelloWorldService1a2b3a4b" promote="Component2b3a4b" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3a4b"/> + </service> + <service name="HelloWorldService1a2b3b4a" promote="Component2b3b4a" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3b4a"/> + </service> + <service name="HelloWorldService1a2b3b4b" promote="Component2b3b4b" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1a2b3b4b"/> + </service> + + <service name="HelloWorldService1b2a3a4a" promote="Component2a3a4a" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2a3a4a"/> + </service> + <service name="HelloWorldService1b2a3a4b" promote="Component2a3a4b" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2a3a4b"/> + </service> + <service name="HelloWorldService1b2a3b4a" promote="Component2a3b4a" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2a3b4a"/> + </service> + <service name="HelloWorldService1b2a3b4b" promote="Component2a3b4b" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2a3b4b"/> + </service> + <service name="HelloWorldService1b2b3a4a" promote="Component2b3a4a" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2b3a4a"/> + </service> + <service name="HelloWorldService1b2b3a4b" promote="Component2b3a4b" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2b3a4b"/> + </service> + <service name="HelloWorldService1b2b3b4a" promote="Component2b3b4a" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2b3b4a"/> + </service> + <service name="HelloWorldService1b2b3b4b" promote="Component2b3b4b" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldService1b2b3b4b"/> + </service> + + <component name="Component2a3a4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/> + <reference name="comp" target="Component3a4a" /> + </component> + <component name="Component2a3a4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/> + <reference name="comp" target="Component3a4b" /> + </component> + <component name="Component2a3b4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/> + <reference name="comp" target="Component3b4a" /> + </component> + <component name="Component2a3b4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/> + <reference name="comp" target="Component3b4b" /> + </component> + + <component name="Component2b3a4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/> + <reference name="comp" target="Component3a4a" /> + </component> + <component name="Component2b3a4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/> + <reference name="comp" target="Component3a4b" /> + </component> + <component name="Component2b3b4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/> + <reference name="comp" target="Component3b4a" /> + </component> + <component name="Component2b3b4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/> + <reference name="comp" target="Component3b4b" /> + </component> + + <component name="Component3a4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/> + <reference name="comp" /> + </component> + <reference name="Component3a4aRef" promote="Component3a4a/comp" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldWebService" /> + </reference> + + <component name="Component3a4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/> + <reference name="comp" /> + </component> + <reference name="Component3a4bRef" promote="Component3a4b/comp" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldWebService" /> + </reference> + + <component name="Component3b4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/> + <reference name="comp" /> + </component> + <reference name="Component3b4aRef" promote="Component3b4a/comp" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldWebService" /> + </reference> + + <component name="Component3b4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/> + <reference name="comp" /> + </component> + <reference name="Component3b4bRef" promote="Component3b4b/comp" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldWebService" /> + </reference> + + +<!-- the servive --> + + <service name="HelloWorldWebService" promote="HelloWorldServiceComponent" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="http://localhost:8085/HelloWorldWebService"/> + </service> + + <component name="HelloWorldServiceComponent"> + <implementation.java class="helloworld.HelloWorldImpl" /> + </component> + +<!-- the clients --> + + <component name="Client1a2a3a4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1a2a3a4a" /> + </reference> + + <component name="Client1a2a3a4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1a2a3a4b" /> + </reference> + + <component name="Client1a2a3b4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1a2a3b4a" /> + </reference> + + <component name="Client1a2a3b4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1a2a3b4b" /> + </reference> + + <component name="Client1a2b3a4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1a2b3a4a" /> + </reference> + + <component name="Client1a2b3a4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1a2b3a4b" /> + </reference> + + <component name="Client1a2b3b4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1a2b3b4a" /> + </reference> + + <component name="Client1a2b3b4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1a2b3b4b" /> + </reference> + + <component name="Client1b2a3a4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1b2a3a4a" /> + </reference> + + <component name="Client1b2a3a4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1b2a3a4b" /> + </reference> + + <component name="Client1b2a3b4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1b2a3b4a" /> + </reference> + + <component name="Client1b2a3b4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1b2a3b4b" /> + </reference> + + <component name="Client1b2b3a4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1b2b3a4a" /> + </reference> + + <component name="Client1b2b3a4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1b2b3a4b" /> + </reference> + + <component name="Client1b2b3b4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1b2b3b4a" /> + </reference> + + <component name="Client1b2b3b4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" + uri="http://localhost:8085/HelloWorldService1b2b3b4b" /> + </reference> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..73f9ed4bfc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,453 @@ +<?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. +--> +<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:account="http://www.bigbank.com/account" + targetNamespace="http://www.bigbank.com/account" + name="AccountService"> + + <wsdl:types> + <xsd:schema targetNamespace="http://www.bigbank.com/account" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:account="http://www.bigbank.com/account"> + + <xsd:element name="getAccountReport"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerID" + type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="getAccountReportResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountReport" + type="account:AccountReport" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="AccountReport"> + <xsd:sequence> + <xsd:element name="accountSummaries" + type="account:AccountSummary" maxOccurs="unbounded" /> + <xsd:element name="stockSummaries" + type="account:StockSummary" maxOccurs="unbounded" /> + + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AccountSummary"> + <xsd:attribute name="accountNumber" type="xsd:string" /> + <xsd:attribute name="accountType" type="xsd:string" /> + <xsd:attribute name="balance" type="xsd:float" /> + </xsd:complexType> + + <xsd:complexType name="StockSummary"> + <!-- xsd:attribute name="id" type="xsd:int" / --> + <xsd:attribute name="purchaseLotNumber" type="xsd:int" /> + <!-- unique id for this purchase --> + <xsd:attribute name="symbol" type="xsd:string" /> + <xsd:attribute name="quantity" type="xsd:int" /> + <xsd:attribute name="purchaseDate" type="xsd:dateTime" /> + <xsd:attribute name="purchasePrice" type="xsd:float" /> + <xsd:attribute name="currentPrice" type="xsd:float" /> + <xsd:attribute name="company" type="xsd:string" /> + <xsd:attribute name="highPrice" type="xsd:float" /> + <xsd:attribute name="lowPrice" type="xsd:float" /> + + </xsd:complexType> + + <!-- Profile in data base --> + <xsd:element name="getCustomerProfile"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="loginID" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="CustomerProfileData"> + <xsd:sequence> + <xsd:element name="firstName" type="xsd:string" /> + <xsd:element name="lastName" type="xsd:string" /> + <xsd:element name="address" type="xsd:string" /> + <xsd:element name="email" type="xsd:string" /> + <xsd:element name="loginID" type="xsd:string" /> + <xsd:element name="password" type="xsd:string" /> + <xsd:element name="id" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="getCustomerProfileResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="withdraw"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountNumber" + type="xsd:string" /> + <xsd:element name="amount" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="withdrawResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="balance" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="deposit"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountNumber" + type="xsd:string" /> + <xsd:element name="amount" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="depositResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="balance" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="purchaseStock"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="id" type="xsd:int" /> + <xsd:element name="stock" type="account:StockSummary" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="purchaseStockResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="purchaseSummary" + type="account:StockSummary" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + + + <xsd:element name="sellStock"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="purchaseLotNumber" + type="xsd:int" /><!-- unique id for this purchase --> + <xsd:element name="quantity" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="createAccount"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + <xsd:element name="createSavings" + type="xsd:boolean" /> + <xsd:element name="createCheckings" + type="xsd:boolean" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="createAccountResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + </xsd:sequence> + </xsd:complexType> + + </xsd:element> + + <xsd:element name="getAccountLog"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerID" + type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="getAccountLogResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountLog" + type="account:AccountLog" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="AccountLog"> + <xsd:sequence> + <xsd:element name="accountLogEntries" + type="account:AccountLogEntry" maxOccurs="unbounded" /> + <xsd:element name="stockLogEntries" + type="account:StockLogEntry" maxOccurs="unbounded" /> + + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="AccountLogEntry"> + <xsd:attribute name="logSeqNo" type="xsd:int" /> + <xsd:attribute name="id" type="xsd:int" /> + <xsd:attribute name="accountNumber" type="xsd:string" /> + <xsd:attribute name="actionType" type="xsd:string" /> + <xsd:attribute name="amount" type="xsd:float" /> + </xsd:complexType> + + <xsd:complexType name="StockLogEntry"> + <xsd:attribute name="logSeqNo" type="xsd:int" /> + <xsd:attribute name="id" type="xsd:int" /> + <xsd:attribute name="symbol" type="xsd:string" /> + <xsd:attribute name="quantity" type="xsd:int" /> + <xsd:attribute name="actionType" type="xsd:string" /> + <xsd:attribute name="purchaseLotNumber" type="xsd:int" /> + </xsd:complexType> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="getAccountReportRequest"> + <wsdl:part element="account:getAccountReport" + name="getAccountReportRequest" /> + </wsdl:message> + <wsdl:message name="getAccountReportResponse"> + <wsdl:part element="account:getAccountReportResponse" + name="getAccountReportResponse" /> + </wsdl:message> + + <wsdl:message name="getCustomerProfileRequest"> + <wsdl:part element="account:getCustomerProfile" + name="getCustomerProfile" /> + </wsdl:message> + <wsdl:message name="getCustomerProfileResponse"> + <wsdl:part element="account:getCustomerProfileResponse" + name="getCustomerProfileResponse" /> + </wsdl:message> + + <wsdl:message name="withdrawRequest"> + <wsdl:part element="account:withdraw" name="withdrawRequest" /> + </wsdl:message> + + <wsdl:message name="withdrawResponse"> + <wsdl:part element="account:withdrawResponse" + name="withdrawResponse" /> + </wsdl:message> + + <wsdl:message name="depositRequest"> + <wsdl:part element="account:deposit" name="depositRequest" /> + </wsdl:message> + + <wsdl:message name="depositResponse"> + <wsdl:part element="account:depositResponse" + name="depositResponse" /> + </wsdl:message> + + <wsdl:message name="purchaseStockRequest"> + <wsdl:part element="account:purchaseStock" + name="purchaseStockRequest" /> + </wsdl:message> + + <wsdl:message name="purchaseStockResponse"> + <wsdl:part element="account:purchaseStockResponse" + name="purchaseStockResponse" /> + </wsdl:message> + + <wsdl:message name="sellStockRequest"> + <wsdl:part element="account:sellStock" name="sellStockRequest" /> + </wsdl:message> + + <wsdl:message name="createAccountRequest"> + <wsdl:part element="account:createAccount" name="createAccountRequest" /> + </wsdl:message> + + <wsdl:message name="createAccountResponse"> + <wsdl:part element="account:createAccountResponse" name="createAccountResponse" /> + </wsdl:message> + + <wsdl:message name="getAccountLogRequest"> + <wsdl:part element="account:getAccountLog" + name="getAccountLogRequest" /> + </wsdl:message> + + <wsdl:message name="getAccountLogResponse"> + <wsdl:part element="account:getAccountLogResponse" + name="getAccountLogResponse" /> + </wsdl:message> + + <wsdl:portType name="AccountService"> + <wsdl:operation name="getAccountReport"> + <wsdl:input message="account:getAccountReportRequest" /> + <wsdl:output message="account:getAccountReportResponse" /> + </wsdl:operation> + + <wsdl:operation name="getCustomerProfile"> + <wsdl:input message="account:getCustomerProfileRequest" /> + <wsdl:output message="account:getCustomerProfileResponse" /> + </wsdl:operation> + + <wsdl:operation name="withdraw"> + <wsdl:input message="account:withdrawRequest" /> + <wsdl:output message="account:withdrawResponse" /> + </wsdl:operation> + + <wsdl:operation name="deposit"> + <wsdl:input message="account:depositRequest" /> + <wsdl:output message="account:depositResponse" /> + </wsdl:operation> + + <wsdl:operation name="purchaseStock"> + <wsdl:input message="account:purchaseStockRequest" /> + <wsdl:output message="account:purchaseStockResponse" /> + </wsdl:operation> + + <wsdl:operation name="sellStock"> + <wsdl:input message="account:sellStockRequest" /> + <wsdl:output message="account:purchaseStockResponse" /> + </wsdl:operation> + + + <wsdl:operation name="createAccount"> + <wsdl:input message="account:createAccountRequest" /> + <wsdl:output message="account:createAccountResponse" /> + </wsdl:operation> + + <wsdl:operation name="getAccountLog"> + <wsdl:input message="account:getAccountLogRequest" /> + <wsdl:output message="account:getAccountLogResponse" /> + </wsdl:operation> + + </wsdl:portType> + + + + <wsdl:binding name="AccountServiceSOAP" type="account:AccountService"> + <soap:binding style="document" + transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="getAccountReport"> + <soap:operation + soapAction="http://www.bigbank.com/account/getAccountReport" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="getCustomerProfile"> + <soap:operation + soapAction="http://www.bigbank.com/account/getCustomerProfile" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="withdraw"> + <soap:operation + soapAction="http://www.bigbank.com/account/withdraw" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="deposit"> + <soap:operation + soapAction="http://www.bigbank.com/account/deposit" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="purchaseStock"> + <soap:operation + soapAction="http://www.bigbank.com/account/purchaseStock" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="sellStock"> + <soap:operation + soapAction="http://www.bigbank.com/account/sellStock" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="createAccount"> + <soap:operation + soapAction="http://www.bigbank.com/account/createAccount" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="getAccountLog"> + <soap:operation + soapAction="http://www.bigbank.com/account/getAccountLog" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + </wsdl:binding> + <wsdl:service name="AccountService"> + <wsdl:port binding="account:AccountServiceSOAP" + name="AccountServiceSOAP"> + <soap:address + location="http://localhost:8085/services/AccountService" /> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..3921dec72d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,80 @@ +<?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. +--> +<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="helloworld"> + + <wsdl:types> + <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema"> + + <element name="getGreetings"> + <complexType> + <sequence> + <element name="name" type="xsd:string"/> + </sequence> + </complexType> + </element> + + <element name="getGreetingsResponse"> + <complexType> + <sequence> + <element name="getGreetingsReturn" type="xsd:string"/> + </sequence> + </complexType> + </element> + + </schema> + </wsdl:types> + + <wsdl:message name="getGreetingsRequest"> + <wsdl:part element="tns:getGreetings" name="parameters"/> + </wsdl:message> + + <wsdl:message name="getGreetingsResponse"> + <wsdl:part element="tns:getGreetingsResponse" name="parameters"/> + </wsdl:message> + + <wsdl:portType name="HelloWorld"> + <wsdl:operation name="getGreetings"> + <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/> + <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/> + </wsdl:operation> + </wsdl:portType> + + <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="getGreetings"> + <wsdlsoap:operation soapAction=""/> + <wsdl:input name="getGreetingsRequest"> + <wsdlsoap:body use="literal"/> + </wsdl:input> + <wsdl:output name="getGreetingsResponse"> + <wsdlsoap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + + </wsdl:binding> + + <wsdl:service name="HelloWorldService"> + <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort"> + <wsdlsoap:address location=""/> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java new file mode 100644 index 0000000000..12441753fb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java @@ -0,0 +1,169 @@ +/* + * 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.itest; + +import static junit.framework.Assert.assertEquals; + +import java.rmi.RemoteException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import bigbank.account.services.accountdata.AccountDataService; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; + +/** + * Tests all the combinations of wiring services, components, and references + * which use either interface.java or interface.wsdl. + * + * The tests use a service (1) wired to a components (2) wired to another + * component (3) wired to a reference (4). Each of those uses either + * interface.java (a) or interface.wsdl (b). This results in 16 different + * combinations 1a2a3a4a thru 1b2b3b4b. + */ +public class SDOWSDLTestCase { + + private static SCADomain domain; + + @Test + public void testClient1a2a3a4a() throws RemoteException { + doit("Client1a2a3a4a"); + } + + @Test + public void testClient1a2a3a4b() throws RemoteException { + doit("Client1a2a3a4b"); + } + + @Test + public void testClient1a2a3b4a() throws RemoteException { + doit("Client1a2a3b4a"); + } + + @Test + public void testClient1a2a3b4b() throws RemoteException { + doit("Client1a2a3b4b"); + } + + @Test + public void testClient1a2b3a4a() throws RemoteException { + doit("Client1a2b3a4a"); + } + + @Test + public void testClient1a2b3a4b() throws RemoteException { + doit("Client1a2b3a4b"); + } + + @Test + public void testClient1a2b3b4a() throws RemoteException { + doit("Client1a2b3b4a"); + } + + @Test + public void testClient1a2b3b4b() throws RemoteException { + doit("Client1a2b3b4b"); + } + + @Test + public void testClient1b2a3a4a() throws RemoteException { + doit("Client1b2a3a4a"); + } + + @Test + public void testClient1b2a3a4b() throws RemoteException { + doit("Client1b2a3a4b"); + } + + @Test + public void testClient1b2a3b4a() throws RemoteException { + doit("Client1b2a3b4a"); + } + + @Test + public void testClient1b2a3b4b() throws RemoteException { + doit("Client1b2a3b4b"); + } + + @Test + public void testClient1b2b3a4a() throws RemoteException { + doit("Client1b2b3a4a"); + } + + @Test + public void testClient1b2b3a4b() throws RemoteException { + doit("Client1b2b3a4b"); + } + + @Test + public void testClient1b2b3b4a() throws RemoteException { + doit("Client1b2b3b4a"); + } + + @Test + public void testClient1b2b3b4b() throws RemoteException { + doit("Client1b2b3b4b"); + } + + private void doit(String compName) throws RemoteException { + AccountDataService client = domain.getService(AccountDataService.class, compName); + CustomerProfileData dataIn = AccountFactory.INSTANCE.createCustomerProfileData(); + dataIn.setAddress("home"); + dataIn.setEmail("petra@home"); + dataIn.setFirstName("petra"); + dataIn.setId(1); + dataIn.setLastName("A"); + dataIn.setLoginID("petra"); + dataIn.setPassword("ant"); + + CustomerProfileData dataOut = client.createAccount(dataIn , false, false); + + assertEquals(dataIn.getAddress(), dataOut.getAddress()); + assertEquals(dataIn.getEmail(), dataOut.getEmail()); + assertEquals(dataIn.getFirstName(), dataOut.getFirstName()); + assertEquals(dataIn.getId(), dataOut.getId()); + assertEquals(dataIn.getLastName(), dataOut.getLastName()); + assertEquals(dataIn.getLoginID(), dataOut.getLoginID()); + assertEquals(dataIn.getPassword(), dataOut.getPassword()); + + AccountReport report = client.getAccountReport(12345); + AccountSummary summary1 = (AccountSummary)report.getAccountSummaries().get(0); + assertEquals(summary1.getAccountType(), "checking"); + AccountSummary summary2 = (AccountSummary)report.getAccountSummaries().get(1); + assertEquals(summary2.getBalance(), 2000.f); + } + + @BeforeClass + public static void setUp() throws Exception { + domain = SCADomain.newInstance("SDOWSDLTest.composite"); + } + + @AfterClass + public static void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java new file mode 100644 index 0000000000..fd30d69c79 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java @@ -0,0 +1,146 @@ +/* + * 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.itest; + +import static junit.framework.Assert.assertEquals; +import helloworld.HelloWorldService; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Tests all the combinations of wiring services, components, and references + * which use either interface.java or interface.wsdl. The tests use a service + * (1) wired to a components (2) wired to another component (3) wired to a + * reference (4). Each of those uses either interface.java (a) or interface.wsdl + * (b). This results in 16 different combinations 1a2a3a4a thru 1b2b3b4b. + */ +public class WSDLTestCase { + + private static SCADomain domain; + + @Test + public void testClient1a2a3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2a3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2a3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2a3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @BeforeClass + public static void init() throws Throwable { + domain = SCADomain.newInstance("WSDLTest.composite"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/pom.xml new file mode 100644 index 0000000000..3f9b85d2b3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/pom.xml @@ -0,0 +1,188 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-wsdl2java</artifactId> + <name>Apache Tuscany SCA WSDL2Java Integration Tests</name> + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-interface-wsdl</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-axiom</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-impl</artifactId> + <version>1.0-incubating</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-test-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.0-incubating</version> + <executions> + <execution> + <id>generate-sdo-account-service</id> + <phase>generate-sources</phase> + <configuration> + <schemaFile> + ${basedir}/src/test/resources/AccountService.wsdl</schemaFile> + <targetDirectory> + ${basedir}/target/sdo-source</targetDirectory> + <javaPackage>com.bigbank.account</javaPackage> + <prefix>Account</prefix> + <noNotification>true</noNotification> + <noContainer>true</noContainer> + <noUnsettable>true</noUnsettable> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + <execution> + <id>generate-sdo-stock-exception</id> + <phase>generate-sources</phase> + <configuration> + <schemaFile> + ${basedir}/src/test/resources/StockExceptionTest.wsdl</schemaFile> + <targetDirectory> + ${basedir}/target/sdo-source</targetDirectory> + <prefix>Stock</prefix> + <noInterfaces>true</noInterfaces> + <noNotification>true</noNotification> + <noContainer>true</noContainer> + <noUnsettable>true</noUnsettable> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + <!--execution> + <id>generate-sdo-echo-service-xsd</id> + <phase>generate-sources</phase> + <configuration> + <schemaFile>${basedir}/src/test/resources/EchoService.xsd</schemaFile> + <targetDirectory>${basedir}/target/sdo-source</targetDirectory> + <prefix>Stock</prefix> + <noInterfaces>true</noInterfaces> + <noNotification>true</noNotification> + <noContainer>true</noContainer> + <noUnsettable>true</noUnsettable> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution--> + </executions> + </plugin> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-wsdl2java</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <configuration> + <wsdlFiles> + <wsdlFile> + <fileName> + ${basedir}/src/test/resources/AccountService.wsdl</fileName> + </wsdlFile> + <wsdlFile> + <fileName> + ${basedir}/src/test/resources/StockExceptionTest.wsdl</fileName> + </wsdlFile> + <!--wsdlFile> + <fileName>${basedir}/src/test/resources/EchoService.wsdl</fileName> + </wsdlFile--> + </wsdlFiles> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/AccountService.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/AccountService.wsdl new file mode 100644 index 0000000000..9e5650e7dd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/AccountService.wsdl @@ -0,0 +1,479 @@ +<?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. +--> +<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:account="http://www.bigbank.com/account" + targetNamespace="http://www.bigbank.com/account" + name="AccountServiceWithFault"> + + <wsdl:types> + <xsd:schema targetNamespace="http://www.bigbank.com/account" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:account="http://www.bigbank.com/account"> + + <xsd:element name="getAccountReport"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerID" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="getAccountReportResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountReport" + type="account:AccountReport" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="AccountReport"> + <xsd:sequence> + <xsd:element name="accountSummaries" + type="account:AccountSummary" maxOccurs="unbounded" /> + <xsd:element name="stockSummaries" + type="account:StockSummary" maxOccurs="unbounded" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AccountSummary"> + <xsd:attribute name="accountNumber" type="xsd:string" /> + <xsd:attribute name="accountType" type="xsd:string" /> + <xsd:attribute name="balance" type="xsd:float" /> + </xsd:complexType> + + <xsd:complexType name="StockSummary"> + <!-- xsd:attribute name="id" type="xsd:int" / --> + <xsd:attribute name="purchaseLotNumber" type="xsd:int" /> + <!-- unique id for this purchase --> + <xsd:attribute name="symbol" type="xsd:string" /> + <xsd:attribute name="quantity" type="xsd:int" /> + <xsd:attribute name="purchaseDate" type="xsd:dateTime" /> + <xsd:attribute name="purchasePrice" type="xsd:float" /> + <xsd:attribute name="currentPrice" type="xsd:float" /> + <xsd:attribute name="company" type="xsd:string" /> + <xsd:attribute name="highPrice" type="xsd:float" /> + <xsd:attribute name="lowPrice" type="xsd:float" /> + + </xsd:complexType> + + <!-- Profile in data base --> + <xsd:element name="getCustomerProfile"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="loginID" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="CustomerProfileData"> + <xsd:sequence> + <xsd:element name="firstName" type="xsd:string" /> + <xsd:element name="lastName" type="xsd:string" /> + <xsd:element name="address" type="xsd:string" /> + <xsd:element name="email" type="xsd:string" /> + <xsd:element name="loginID" type="xsd:string" /> + <xsd:element name="password" type="xsd:string" /> + <xsd:element name="id" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="getCustomerProfileResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="withdraw"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountNumber" + type="xsd:string" /> + <xsd:element name="amount" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="withdrawResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="balance" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <!-- @start added fault --> + <xsd:element name="insufficientFundsFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="message" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <!-- @end added fault --> + + <xsd:element name="deposit"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountNumber" + type="xsd:string" /> + <xsd:element name="amount" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="depositResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="balance" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="purchaseStock"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="id" type="xsd:int" /> + <xsd:element name="stock" + type="account:StockSummary" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="purchaseStockResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="purchaseSummary" + type="account:StockSummary" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + + + <xsd:element name="sellStock"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="purchaseLotNumber" + type="xsd:int" /><!-- unique id for this purchase --> + <xsd:element name="quantity" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="createAccount"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + <xsd:element name="createSavings" + type="xsd:boolean" /> + <xsd:element name="createCheckings" + type="xsd:boolean" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="createAccountResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + </xsd:sequence> + </xsd:complexType> + + </xsd:element> + + <xsd:element name="getAccountLog"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerID" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="getAccountLogResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountLog" + type="account:AccountLog" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="AccountLog"> + <xsd:sequence> + <xsd:element name="accountLogEntries" + type="account:AccountLogEntry" maxOccurs="unbounded" /> + <xsd:element name="stockLogEntries" + type="account:StockLogEntry" maxOccurs="unbounded" /> + + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="AccountLogEntry"> + <xsd:attribute name="logSeqNo" type="xsd:int" /> + <xsd:attribute name="id" type="xsd:int" /> + <xsd:attribute name="accountNumber" type="xsd:string" /> + <xsd:attribute name="actionType" type="xsd:string" /> + <xsd:attribute name="amount" type="xsd:float" /> + </xsd:complexType> + + <xsd:complexType name="StockLogEntry"> + <xsd:attribute name="logSeqNo" type="xsd:int" /> + <xsd:attribute name="id" type="xsd:int" /> + <xsd:attribute name="symbol" type="xsd:string" /> + <xsd:attribute name="quantity" type="xsd:int" /> + <xsd:attribute name="actionType" type="xsd:string" /> + <xsd:attribute name="purchaseLotNumber" type="xsd:int" /> + </xsd:complexType> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="getAccountReportRequest"> + <wsdl:part element="account:getAccountReport" + name="getAccountReportRequest" /> + </wsdl:message> + <wsdl:message name="getAccountReportResponse"> + <wsdl:part element="account:getAccountReportResponse" + name="getAccountReportResponse" /> + </wsdl:message> + + <wsdl:message name="getCustomerProfileRequest"> + <wsdl:part element="account:getCustomerProfile" + name="getCustomerProfile" /> + </wsdl:message> + <wsdl:message name="getCustomerProfileResponse"> + <wsdl:part element="account:getCustomerProfileResponse" + name="getCustomerProfileResponse" /> + </wsdl:message> + + <wsdl:message name="withdrawRequest"> + <wsdl:part element="account:withdraw" name="withdrawRequest" /> + </wsdl:message> + + <wsdl:message name="withdrawResponse"> + <wsdl:part element="account:withdrawResponse" + name="withdrawResponse" /> + </wsdl:message> + + <!-- @start added fault --> + <wsdl:message name="insufficientFundsException"> + <wsdl:part element="account:insufficientFundsFault" + name="insufficientFundsFault" /> + </wsdl:message> + <!-- @end added fault --> + + <wsdl:message name="depositRequest"> + <wsdl:part element="account:deposit" name="depositRequest" /> + </wsdl:message> + + <wsdl:message name="depositResponse"> + <wsdl:part element="account:depositResponse" + name="depositResponse" /> + </wsdl:message> + + <wsdl:message name="purchaseStockRequest"> + <wsdl:part element="account:purchaseStock" + name="purchaseStockRequest" /> + </wsdl:message> + + <wsdl:message name="purchaseStockResponse"> + <wsdl:part element="account:purchaseStockResponse" + name="purchaseStockResponse" /> + </wsdl:message> + + <wsdl:message name="sellStockRequest"> + <wsdl:part element="account:sellStock" name="sellStockRequest" /> + </wsdl:message> + + <wsdl:message name="createAccountRequest"> + <wsdl:part element="account:createAccount" + name="createAccountRequest" /> + </wsdl:message> + + <wsdl:message name="createAccountResponse"> + <wsdl:part element="account:createAccountResponse" + name="createAccountResponse" /> + </wsdl:message> + + <wsdl:message name="getAccountLogRequest"> + <wsdl:part element="account:getAccountLog" + name="getAccountLogRequest" /> + </wsdl:message> + + <wsdl:message name="getAccountLogResponse"> + <wsdl:part element="account:getAccountLogResponse" + name="getAccountLogResponse" /> + </wsdl:message> + + <wsdl:portType name="AccountServiceWithFault"> + <wsdl:operation name="getAccountReport"> + <wsdl:input message="account:getAccountReportRequest" /> + <wsdl:output message="account:getAccountReportResponse" /> + </wsdl:operation> + + <wsdl:operation name="getCustomerProfile"> + <wsdl:input message="account:getCustomerProfileRequest" /> + <wsdl:output message="account:getCustomerProfileResponse" /> + </wsdl:operation> + + <wsdl:operation name="withdraw"> + <wsdl:input message="account:withdrawRequest" /> + <wsdl:output message="account:withdrawResponse" /> + <!-- @start added fault --> + <wsdl:fault message="account:insufficientFundsException" + name="insufficientFundsException" /> + <!-- @end added fault --> + </wsdl:operation> + + <wsdl:operation name="deposit"> + <wsdl:input message="account:depositRequest" /> + <wsdl:output message="account:depositResponse" /> + </wsdl:operation> + + <wsdl:operation name="purchaseStock"> + <wsdl:input message="account:purchaseStockRequest" /> + <wsdl:output message="account:purchaseStockResponse" /> + </wsdl:operation> + + <wsdl:operation name="sellStock"> + <wsdl:input message="account:sellStockRequest" /> + <wsdl:output message="account:purchaseStockResponse" /> + </wsdl:operation> + + + <wsdl:operation name="createAccount"> + <wsdl:input message="account:createAccountRequest" /> + <wsdl:output message="account:createAccountResponse" /> + </wsdl:operation> + + <wsdl:operation name="getAccountLog"> + <wsdl:input message="account:getAccountLogRequest" /> + <wsdl:output message="account:getAccountLogResponse" /> + </wsdl:operation> + + </wsdl:portType> + + + + <wsdl:binding name="AccountServiceWithFaultSOAP" + type="account:AccountServiceWithFault"> + <soap:binding style="document" + transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="getAccountReport"> + <soap:operation + soapAction="http://www.bigbank.com/account/getAccountReport" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="getCustomerProfile"> + <soap:operation + soapAction="http://www.bigbank.com/account/getCustomerProfile" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="withdraw"> + <soap:operation + soapAction="http://www.bigbank.com/account/withdraw" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + <!-- @start added fault --> + <wsdl:fault name="insufficientFundsException"> + <soap:fault name="insufficientFundsException" use="literal" /> + </wsdl:fault> + <!-- @end added fault --> + </wsdl:operation> + + <wsdl:operation name="deposit"> + <soap:operation + soapAction="http://www.bigbank.com/account/deposit" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="purchaseStock"> + <soap:operation + soapAction="http://www.bigbank.com/account/purchaseStock" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="sellStock"> + <soap:operation + soapAction="http://www.bigbank.com/account/sellStock" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="createAccount"> + <soap:operation + soapAction="http://www.bigbank.com/account/createAccount" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="getAccountLog"> + <soap:operation + soapAction="http://www.bigbank.com/account/getAccountLog" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + </wsdl:binding> + <wsdl:service name="AccountServiceWithFault"> + <wsdl:port binding="account:AccountServiceWithFaultSOAP" + name="AccountServiceSOAP"> + <soap:address + location="http://localhost:8080/sample-bigbank-account/services/AccountServiceWithFault" /> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/EchoService.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/EchoService.wsdl new file mode 100644 index 0000000000..50d580f299 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/EchoService.wsdl @@ -0,0 +1,64 @@ +<?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. +--> +<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:tns="http://test/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="EchoService" + targetNamespace="http://test/"> + + <types> + <xsd:schema> + <xsd:import namespace="http://test/" + schemaLocation="EchoService.xsd" /> + </xsd:schema> + </types> + <message name="echo"> + <part element="tns:echo" name="parameters" /> + </message> + <message name="echoResponse"> + <part element="tns:echoResponse" name="parameters" /> + </message> + <portType name="Echo"> + <operation name="echo"> + <input message="tns:echo" /> + <output message="tns:echoResponse" /> + </operation> + </portType> + <binding name="EchoPortBinding" type="tns:Echo"> + <soap:binding style="document" + transport="http://schemas.xmlsoap.org/soap/http" /> + <operation name="echo"> + <soap:operation soapAction="" /> + <input> + <soap:body use="literal" /> + </input> + <output> + <soap:body use="literal" /> + </output> + </operation> + </binding> + <service name="EchoService"> + <port binding="tns:EchoPortBinding" name="EchoPort"> + <soap:address + location="http://localhost:8085/w1/EchoService" /> + </port> + </service> +</definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/EchoService.xsd b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/EchoService.xsd new file mode 100644 index 0000000000..8069d4861f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/EchoService.xsd @@ -0,0 +1,40 @@ +<?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. +--> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:tns="http://test/" + targetNamespace="http://test/" version="1.0"> + + <xs:complexType name="echoType"> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" type="xs:string"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="echoResponseType"> + <xs:sequence> + <xs:element minOccurs="0" name="return" type="xs:string"/> + </xs:sequence> + </xs:complexType> + + <xs:element name="echo" type="tns:echoType"/> + + <xs:element name="echoResponse" type="tns:echoResponseType"/> + +</xs:schema>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl new file mode 100644 index 0000000000..c44229c162 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdl2java/src/test/resources/StockExceptionTest.wsdl @@ -0,0 +1,167 @@ +<?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. +--> +<wsdl:definitions + targetNamespace="http://scatesttool.stockexceptiontestservice" + xmlns:impl="http://scatesttool.stockexceptiontestservice" + xmlns:tns="http://scatesttool.stockexceptiontestservice" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + name="StockExceptionTest"> + <wsdl:types> + <schema + targetNamespace="http://scatesttool.stockexceptiontestservice" + xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <complexType name="StockOffer"> + <sequence> + <element name="symbol" minOccurs="1" + type="xsd:string" /> + <element name="price" minOccurs="1" type="xsd:float" + nillable="true" /><!-- max price reqested, actual response --> + <element name="name" minOccurs="0" + type="xsd:string" /> + </sequence> + </complexType> + + <element name="stockQuoteOffer"> + <complexType> + <sequence> + <element name="input" minOccurs="0" + type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + <element name="stockQuoteOfferResponse"> + <complexType> + <sequence> + <element name="stockQuoteOfferReturn" + minOccurs="0" type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + + <!-- Faults --> + <element name="invalidSymbolFault"> + <complexType> + <sequence> + <element name="message" minOccurs="1" + type="xsd:string" /> + <element name="offer" minOccurs="1" + type="tns:StockOffer" /> + </sequence> + </complexType> + </element> + + <element name="marketClosedFault"> + <complexType> + <sequence> + <element name="message" minOccurs="1" + type="xsd:string" /> + </sequence> + </complexType> + </element> + + </schema> + </wsdl:types> + + + <wsdl:message name="stockQuoteOfferRequest"> + <wsdl:part element="tns:stockQuoteOffer" name="parameters" /> + </wsdl:message> + + <wsdl:message name="stockQuoteOfferResponse"> + <wsdl:part element="tns:stockQuoteOfferResponse" + name="parameters" /> + </wsdl:message> + + <wsdl:message name="invalidSymbolException"> + <wsdl:part element="tns:invalidSymbolFault" name="fault" /> + </wsdl:message> + + <wsdl:message name="marketClosedException"> + <wsdl:part element="tns:marketClosedFault" name="fault" /> + </wsdl:message> + + + <wsdl:portType name="StockExceptionTest"> + <wsdl:operation name="stockQuoteOffer"> + <wsdl:input message="tns:stockQuoteOfferRequest" + name="stockQuoteOfferRequest" /> + + <wsdl:output message="tns:stockQuoteOfferResponse" + name="stockQuoteOfferResponse" /> + + <wsdl:fault message="tns:invalidSymbolException" + name="InvalidSymbolException" /> + + <wsdl:fault message="tns:marketClosedException" + name="MarketClosedException" /> + + </wsdl:operation> + + + </wsdl:portType> + + <wsdl:binding name="StockExceptionTestServiceSoapBinding" + type="tns:StockExceptionTest"> + <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> --> + + <wsdlsoap:binding style="document" + transport="http://schemas.xmlsoap.org/soap/http" /> + + <wsdl:operation name="stockQuoteOffer"> + <wsdlsoap:operation soapAction="" /> + + <wsdl:input name="stockQuoteOfferRequest"> + <wsdlsoap:body use="literal" /> + </wsdl:input> + + <wsdl:output name="stockQuoteOfferResponse"> + <wsdlsoap:body use="literal" /> + </wsdl:output> + + <wsdl:fault name="InvalidSymbolException"> + <wsdlsoap:fault name="InvalidSymbolException" use="literal" /> + </wsdl:fault> + + <wsdl:fault name="MarketClosedException"> + <wsdlsoap:fault name="MarketClosedException" use="literal" /> + </wsdl:fault> + + </wsdl:operation> + + + </wsdl:binding> + + <wsdl:service name="StockExceptionTestService"> + <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" + name="StockExceptionTestServiceSoapPort"> + <wsdlsoap:address + location="http://localhost:8080/StockExceptionTestService/services/StockExceptionTestService" /> + + </wsdl:port> + + </wsdl:service> + +</wsdl:definitions>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/pom.xml b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/pom.xml new file mode 100644 index 0000000000..fd143d958f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/pom.xml @@ -0,0 +1,135 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-itest</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>itest-wsdlless</artifactId> + <name>Apache Tuscany SCA WSDLless Support Integration Tests</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-interface-wsdl</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-sdo</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-databinding-axiom</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>1.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-impl</artifactId> + <version>1.0-incubating</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-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.0-incubating</version> + <executions> + <execution> + <id>generate-sdo</id> + <phase>generate-sources</phase> + <configuration> + <schemaFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</schemaFile> + <javaPackage>com.bigbank.account</javaPackage> + <prefix>Account</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/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java new file mode 100644 index 0000000000..81e393852d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataService.java @@ -0,0 +1,91 @@ +/* + * 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 bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.AllowsPassByReference; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@AllowsPassByReference +public interface AccountDataService { + + /** + * Auto generated method signatures + * + * @param param0* + * @param param1* + * @param param2 + */ + public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1); + + /** + * Auto generated method signatures + * + * @param param4 + */ + public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4); + + /** + * Auto generated method signatures + * + * @param param6* + * @param param7 + */ + public float deposit(java.lang.String param6, float param7); + + /** + * Auto generated method signatures + * + * @param param9* + * @param param10* + * @param param11 + */ + public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11); + + /** + * Auto generated method signatures + * + * @param param13* + * @param param14 + */ + public com.bigbank.account.StockSummary sellStock(int param13, int param14); + + /** + * Auto generated method signatures + * + * @param param16* + * @param param17 + */ + public float withdraw(java.lang.String param16, float param17); + + /** + * Auto generated method signatures + * + * @param param19 + */ + public com.bigbank.account.AccountReport getAccountReport(int param19); + + /** + * Auto generated method signatures + * + * @param param0 + */ + public com.bigbank.account.AccountLog getAccountLog(int param0); + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..df658428fd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,91 @@ +/* + * 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 bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.Service; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +@Service(AccountDataService.class) +public class AccountDataServiceImpl implements AccountDataService { + + public CustomerProfileData getCustomerProfile(String logonID) { + + return null; + } + + public AccountReport getAccountReport(int customerID) { + + AccountReport report =AccountFactory.INSTANCE.createAccountReport(); + AccountSummary summary1 = AccountFactory.INSTANCE.createAccountSummary(); + summary1.setAccountNumber("123"); + summary1.setAccountType("checking"); + summary1.setBalance(1000.0f); + report.getAccountSummaries().add(summary1); + AccountSummary summary2 = AccountFactory.INSTANCE.createAccountSummary(); + summary2.setAccountNumber("456"); + summary2.setAccountType("savings"); + summary2.setBalance(2000.0f); + report.getAccountSummaries().add(summary2); + + return report; + } + + public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings) + { + CustomerProfileData data = AccountFactory.INSTANCE.createCustomerProfileData(); + data.setLoginID(customerProfile.getLoginID()); + data.setAddress(customerProfile.getAddress()); + data.setEmail(customerProfile.getEmail()); + data.setFirstName(customerProfile.getFirstName()); + data.setId(customerProfile.getId()); + data.setLastName(customerProfile.getLastName()); + data.setPassword(customerProfile.getPassword()); + return data; + } + + public float deposit(String param6, float param7) { + + return 0; + } + + public StockSummary purchaseStock(int param0, StockSummary stock) { + + return null; + } + + public StockSummary sellStock(int param13, int param14) { + + return null; + } + + public float withdraw(String param16, float param17) { + + return 0; + } + + public AccountLog getAccountLog(final int customerID) { + throw new IllegalStateException("This method should not be called"); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java new file mode 100644 index 0000000000..d39df8c00e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java @@ -0,0 +1,77 @@ +/* + * 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 bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class AccountServiceClientImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) { + + return 0; + } + + public AccountLog getAccountLog(int param0) { + + return null; + } + + public AccountReport getAccountReport(int param19) { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) { + + return null; + } + + public StockSummary sellStock(int param13, int param14) { + + return null; + } + + public float withdraw(String param16, float param17) { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java new file mode 100644 index 0000000000..d4a06780c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java @@ -0,0 +1,77 @@ +/* + * 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 bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class Component2aImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) { + + return 0; + } + + public AccountLog getAccountLog(int param0) { + + return null; + } + + public AccountReport getAccountReport(int param19) { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) { + + return null; + } + + public StockSummary sellStock(int param13, int param14) { + + return null; + } + + public float withdraw(String param16, float param17) { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java new file mode 100644 index 0000000000..6dc46c60b5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java @@ -0,0 +1,77 @@ +/* + * 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 bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class Component2bImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) { + + return 0; + } + + public AccountLog getAccountLog(int param0) { + + return null; + } + + public AccountReport getAccountReport(int param19) { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) { + + return null; + } + + public StockSummary sellStock(int param13, int param14) { + + return null; + } + + public float withdraw(String param16, float param17) { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java new file mode 100644 index 0000000000..8471000152 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java @@ -0,0 +1,77 @@ +/* + * 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 bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class Component3aImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) { + + return 0; + } + + public AccountLog getAccountLog(int param0) { + + return null; + } + + public AccountReport getAccountReport(int param19) { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) { + + return null; + } + + public StockSummary sellStock(int param13, int param14) { + + return null; + } + + public float withdraw(String param16, float param17) { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java new file mode 100644 index 0000000000..859c61a724 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java @@ -0,0 +1,77 @@ +/* + * 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 bigbank.account.services.accountdata; + +import org.osoa.sca.annotations.Reference; + +import com.bigbank.account.AccountLog; +import com.bigbank.account.AccountReport; +import com.bigbank.account.CustomerProfileData; +import com.bigbank.account.StockSummary; + +public class Component3bImpl implements AccountDataService { + + AccountDataService accountService; + + @Reference + public void setAccountService(AccountDataService accountService) { + this.accountService = accountService; + } + + public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) { + return accountService.createAccount(param9, param10, param11); + } + + public float deposit(String param6, float param7) { + + return 0; + } + + public AccountLog getAccountLog(int param0) { + + return null; + } + + public AccountReport getAccountReport(int param19) { + + return accountService.getAccountReport(param19); + } + + public CustomerProfileData getCustomerProfile(String param4) { + + return null; + } + + public StockSummary purchaseStock(int param0, StockSummary parm1) { + + return null; + } + + public StockSummary sellStock(int param13, int param14) { + + return null; + } + + public float withdraw(String param16, float param17) { + + return 0; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java new file mode 100644 index 0000000000..e747eb041f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java @@ -0,0 +1,98 @@ +/* + * 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 bigbank.account.services.accountdata; + +import java.rmi.RemoteException; + +/** + * This interface allows access to a customer's id from the data service. + */ +public interface CustomerIdService { + + /* + * Return -1 if purchaseLotNumber not found + */ + public int getCustomerIdByPurchaseLotNumber(int purchaseLotNumber) throws RemoteException; + + /* + * Return -1 if account not found + */ + public int getCustomerIdByAccount(String account) throws RemoteException; + + // TODO (isilval) Fix this !!! + // Apparently, configuration can't deal with extends so I am adding the contents of AccountDataService here + + /** + * Auto generated method signatures + * + * @param param0* + * @param param1* + * @param param2 + */ + public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param4 + */ + public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param6* + * @param param7 + */ + public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param9* + * @param param10* + * @param param11 + */ + public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11) + throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param13* + * @param param14 + */ + public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param16* + * @param param17 + */ + public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException; + + /** + * Auto generated method signatures + * + * @param param19 + */ + public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException; + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..ca7c25f3fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,44 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hi " + name; + } + + public String[] getMultipleGreetings(String[] names) { + if(names==null) { + return null; + } + String[] greetings = new String[names.length]; + for(int i=0; i<names.length;i++) { + greetings[i] = "Hi "+names[i]; + } + return greetings; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..8b234599aa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldService.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 helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); + public String[] getMultipleGreetings(String[] names); +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..03984f7252 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,47 @@ +/* + * 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 helloworld; + +import org.osoa.sca.annotations.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +@Scope("COMPOSITE") +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + this.helloWorldService = helloWorldService; + } + + public String[] getMultipleGreetings(String[] names) { + return helloWorldService.getMultipleGreetings(names); + } +}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java new file mode 100644 index 0000000000..45bb697437 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java @@ -0,0 +1,43 @@ +/* + * 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.itest; + +import helloworld.HelloWorldService; + +import org.osoa.sca.annotations.Reference; + +public class Component2aImpl implements HelloWorldService { + + private HelloWorldService comp; + + @Reference + public void setComp(HelloWorldService comp) { + this.comp = comp; + } + public String getGreetings(String s) { + return comp.getGreetings(s); + } + + public String[] getMultipleGreetings(String[] names) { + return comp.getMultipleGreetings(names); + } + + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java new file mode 100644 index 0000000000..9342c8e6ee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java @@ -0,0 +1,42 @@ +/* + * 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.itest; + +import helloworld.HelloWorldService; + +import org.osoa.sca.annotations.Reference; + +public class Component2bImpl implements HelloWorldService { + + private HelloWorldService comp; + + @Reference + public void setComp(HelloWorldService comp) { + this.comp = comp; + } + + public String getGreetings(String s) { + return comp.getGreetings(s); + } + public String[] getMultipleGreetings(String[] names) { + return comp.getMultipleGreetings(names); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java new file mode 100644 index 0000000000..6c5ac96b67 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java @@ -0,0 +1,42 @@ +/* + * 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.itest; + +import helloworld.HelloWorldService; + +import org.osoa.sca.annotations.Reference; + +public class Component3aImpl implements HelloWorldService { + + private HelloWorldService comp; + + @Reference + public void setComp(HelloWorldService comp) { + this.comp = comp; + } + + public String getGreetings(String s) { + return comp.getGreetings(s); + } + public String[] getMultipleGreetings(String[] names) { + return comp.getMultipleGreetings(names); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java new file mode 100644 index 0000000000..ebaf33f568 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java @@ -0,0 +1,43 @@ +/* + * 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.itest; + +import helloworld.HelloWorldService; + +import org.osoa.sca.annotations.Reference; + +public class Component3bImpl implements HelloWorldService { + + private HelloWorldService comp; + + @Reference + public void setComp(HelloWorldService comp) { + this.comp = comp; + } + + public String getGreetings(String s) { + return comp.getGreetings(s); + } + + public String[] getMultipleGreetings(String[] names) { + return comp.getMultipleGreetings(names); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/SDOWSDLTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/SDOWSDLTest.composite new file mode 100644 index 0000000000..16d3806318 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/SDOWSDLTest.composite @@ -0,0 +1,321 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" name="SDOWSDLTest"> + + <service name="AccountService1a2a3a4a" promote="Component2a3a4a"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2a3a4a"/> + </service> + <service name="AccountService1a2a3a4b" promote="Component2a3a4b"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2a3a4b"/> + </service> + <service name="AccountService1a2a3b4a" promote="Component2a3b4a"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2a3b4a"/> + </service> + <service name="AccountService1a2a3b4b" promote="Component2a3b4b"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2a3b4b"/> + </service> + <service name="AccountService1a2b3a4a" promote="Component2b3a4a"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2b3a4a"/> + </service> + <service name="AccountService1a2b3a4b" promote="Component2b3a4b"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2b3a4b"/> + </service> + <service name="AccountService1a2b3b4a" promote="Component2b3b4a"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2b3b4a"/> + </service> + <service name="AccountService1a2b3b4b" promote="Component2b3b4b"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2b3b4b"/> + </service> + <service name="AccountService1b2a3a4a" promote="Component2a3a4a"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService1b2a3a4a"/> + </service> + <service name="AccountService1b2a3a4b" promote="Component2a3a4b"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService1b2a3a4b"/> + </service> + <service name="AccountService1b2a3b4a" promote="Component2a3b4a"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService1b2a3b4a"/> + </service> + <service name="AccountService1b2a3b4b" promote="Component2a3b4b"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService1b2a3b4b"/> + </service> + <service name="AccountService1b2b3a4a" promote="Component2b3a4a"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService1b2b3a4a"/> + </service> + <service name="AccountService1b2b3a4b" promote="Component2b3a4b"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService1b2b3a4b"/> + </service> + <service name="AccountService1b2b3b4a" promote="Component2b3b4a"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService1b2b3b4a"/> + </service> + <service name="AccountService1b2b3b4b" promote="Component2b3b4b"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService1b2b3b4b"/> + </service> + + <component name="Component2a3a4a"> + <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" /> + <reference name="accountService" target="Component3a4a"/> + </component> + <component name="Component2a3a4b"> + <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" /> + <reference name="accountService" target="Component3a4b"/> + </component> + <component name="Component2a3b4a"> + <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" /> + <reference name="accountService" target="Component3b4a"/> + </component> + <component name="Component2a3b4b"> + <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" /> + <reference name="accountService" target="Component3b4b"/> + </component> + + <component name="Component2b3a4a"> + <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" /> + <reference name="accountService" target="Component3a4a"/> + </component> + <component name="Component2b3a4b"> + <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" /> + <reference name="accountService" target="Component3a4b"/> + </component> + <component name="Component2b3b4a"> + <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" /> + <reference name="accountService" target="Component3b4a"/> + </component> + <component name="Component2b3b4b"> + <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" /> + <reference name="accountService" target="Component3b4b"/> + </component> + + <component name="Component3a4a"> + <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" /> + </component> + <reference name="Component3a4aRef" promote="Component3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService" /> + </reference> + + <component name="Component3a4b"> + <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" /> + </component> + <reference name="Component3a4bRef" promote="Component3a4b/accountService"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService" /> + </reference> + + <component name="Component3b4a"> + <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" /> + </component> + <reference name="Component3b4aRef" promote="Component3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService" /> + </reference> + + <component name="Component3b4b"> + <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" /> + </component> + <reference name="Component3b4bRef" promote="Component3b4b/accountService"> + <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/> + <binding.ws uri="http://localhost:8085/AccountService" /> + </reference> + + <!-- target service --> + + <service name="AccountService" promote="AccountServiceComponent"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService"/> + </service> + + <component name="AccountServiceComponent"> + <implementation.java class="bigbank.account.services.accountdata.AccountDataServiceImpl" /> + </component> + + <!-- test client --> + + <component name="AccountServiceClient"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="AccountServiceRef" promote="AccountServiceClient/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/services/AccountService"/> + </reference> + + <!-- clients --> + + <component name="Client1a2a3a4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2a3a4a" /> + </reference> + + <component name="Client1a2a3a4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl"/> + </component> + + <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2a3a4b" /> + </reference> + + <component name="Client1a2a3b4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2a3b4a" /> + </reference> + + <component name="Client1a2a3b4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2a3b4b" /> + </reference> + + <component name="Client1a2b3a4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2b3a4a" /> + </reference> + + <component name="Client1a2b3a4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2b3a4b" /> + </reference> + + <component name="Client1a2b3b4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2b3b4a" /> + </reference> + + <component name="Client1a2b3b4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1a2b3b4b" /> + </reference> + + <component name="Client1b2a3a4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1b2a3a4a" /> + </reference> + + <component name="Client1b2a3a4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1b2a3a4b" /> + </reference> + + <component name="Client1b2a3b4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1b2a3b4a" /> + </reference> + + <component name="Client1b2a3b4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1b2a3b4b" /> + </reference> + + <component name="Client1b2b3a4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1b2b3a4a" /> + </reference> + + <component name="Client1b2b3a4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1b2b3a4b" /> + </reference> + + <component name="Client1b2b3b4a"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1b2b3b4a" /> + </reference> + + <component name="Client1b2b3b4b"> + <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" /> + </component> + + <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/accountService"> + <interface.java interface="bigbank.account.services.accountdata.AccountDataService" /> + <binding.ws uri="http://localhost:8085/AccountService1b2b3b4b" /> + </reference> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/WSDLTest.composite b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/WSDLTest.composite new file mode 100644 index 0000000000..e69cdbc282 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/WSDLTest.composite @@ -0,0 +1,350 @@ +<?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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + name="WSDLTest"> + + <service name="HelloWorldService1a2a3a4a" promote="Component2a3a4a" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4a"/> + </service> + <service name="HelloWorldService1a2a3a4b" promote="Component2a3a4b" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4b"/> + </service> + <service name="HelloWorldService1a2a3b4a" promote="Component2a3b4a" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4a"/> + </service> + <service name="HelloWorldService1a2a3b4b" promote="Component2a3b4b" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4b"/> + </service> + <service name="HelloWorldService1a2b3a4a" promote="Component2b3a4a" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4a"/> + </service> + <service name="HelloWorldService1a2b3a4b" promote="Component2b3a4b" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4b"/> + </service> + <service name="HelloWorldService1a2b3b4a" promote="Component2b3b4a" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4a"/> + </service> + <service name="HelloWorldService1a2b3b4b" promote="Component2b3b4b" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4b"/> + </service> + + <service name="HelloWorldService1b2a3a4a" promote="Component2a3a4a" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4a"/> + </service> + <service name="HelloWorldService1b2a3a4b" promote="Component2a3a4b" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4b"/> + </service> + <service name="HelloWorldService1b2a3b4a" promote="Component2a3b4a" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4a"/> + </service> + <service name="HelloWorldService1b2a3b4b" promote="Component2a3b4b" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4b"/> + </service> + <service name="HelloWorldService1b2b3a4a" promote="Component2b3a4a" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4a"/> + </service> + <service name="HelloWorldService1b2b3a4b" promote="Component2b3a4b" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4b"/> + </service> + <service name="HelloWorldService1b2b3b4a" promote="Component2b3b4a" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4a"/> + </service> + <service name="HelloWorldService1b2b3b4b" promote="Component2b3b4b" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4b"/> + </service> + + <component name="Component2a3a4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/> + <reference name="comp" target="Component3a4a" /> + </component> + <component name="Component2a3a4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/> + <reference name="comp" target="Component3a4b" /> + </component> + <component name="Component2a3b4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/> + <reference name="comp" target="Component3b4a" /> + </component> + <component name="Component2a3b4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/> + <reference name="comp" target="Component3b4b" /> + </component> + + <component name="Component2b3a4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/> + <reference name="comp" target="Component3a4a" /> + </component> + <component name="Component2b3a4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/> + <reference name="comp" target="Component3a4b" /> + </component> + <component name="Component2b3b4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/> + <reference name="comp" target="Component3b4a" /> + </component> + <component name="Component2b3b4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/> + <reference name="comp" target="Component3b4b" /> + </component> + + <component name="Component3a4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/> + <reference name="comp" /> + </component> + <reference name="Component3a4aRef" promote="Component3a4a/comp" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldWebService" /> + </reference> + + <component name="Component3a4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/> + <reference name="comp" /> + </component> + <reference name="Component3a4bRef" promote="Component3a4b/comp" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldWebService" /> + </reference> + + <component name="Component3b4a"> + <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/> + <reference name="comp" /> + </component> + <reference name="Component3b4aRef" promote="Component3b4a/comp" > + <interface.java interface="helloworld.HelloWorldService" /> + <binding.ws uri="http://localhost:8085/HelloWorldWebService" /> + </reference> + + <component name="Component3b4b"> + <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/> + <reference name="comp" /> + </component> + <reference name="Component3b4bRef" promote="Component3b4b/comp" > + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldWebService" /> + </reference> + + +<!-- the servive --> + + <service name="HelloWorldWebService" promote="HelloWorldServiceComponent" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldWebService"/> + </service> + + <component name="HelloWorldServiceComponent"> + <implementation.java class="helloworld.HelloWorldImpl" /> + </component> + +<!-- the clients --> + + <component name="Client1a2a3a4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4a" /> + </reference> + + <component name="Client1a2a3a4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3a4b" /> + </reference> + + <component name="Client1a2a3b4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4a" /> + </reference> + + <component name="Client1a2a3b4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2a3b4b" /> + </reference> + + <component name="Client1a2b3a4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4a" /> + </reference> + + <component name="Client1a2b3a4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3a4b" /> + </reference> + + <component name="Client1a2b3b4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4a" /> + </reference> + + <component name="Client1a2b3b4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1a2b3b4b" /> + </reference> + + <component name="Client1b2a3a4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4a" /> + </reference> + + <component name="Client1b2a3a4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3a4b" /> + </reference> + + <component name="Client1b2a3b4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4a" /> + </reference> + + <component name="Client1b2a3b4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2a3b4b" /> + </reference> + + <component name="Client1b2b3a4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4a" /> + </reference> + + <component name="Client1b2b3a4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3a4b" /> + </reference> + + <component name="Client1b2b3b4a"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4a" /> + </reference> + + <component name="Client1b2b3b4b"> + <implementation.java class="helloworld.HelloWorldServiceComponent"/> + <reference name="helloWorldService" /> + </component> + + <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/helloWorldService" > + <!-- interface.java interface="helloworld.HelloWorldService" / --> + <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" /> + <binding.ws uri="http://localhost:8085/HelloWorldService1b2b3b4b" /> + </reference> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl new file mode 100644 index 0000000000..73f9ed4bfc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/wsdl/AccountService.wsdl @@ -0,0 +1,453 @@ +<?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. +--> +<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:account="http://www.bigbank.com/account" + targetNamespace="http://www.bigbank.com/account" + name="AccountService"> + + <wsdl:types> + <xsd:schema targetNamespace="http://www.bigbank.com/account" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:account="http://www.bigbank.com/account"> + + <xsd:element name="getAccountReport"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerID" + type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="getAccountReportResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountReport" + type="account:AccountReport" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="AccountReport"> + <xsd:sequence> + <xsd:element name="accountSummaries" + type="account:AccountSummary" maxOccurs="unbounded" /> + <xsd:element name="stockSummaries" + type="account:StockSummary" maxOccurs="unbounded" /> + + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AccountSummary"> + <xsd:attribute name="accountNumber" type="xsd:string" /> + <xsd:attribute name="accountType" type="xsd:string" /> + <xsd:attribute name="balance" type="xsd:float" /> + </xsd:complexType> + + <xsd:complexType name="StockSummary"> + <!-- xsd:attribute name="id" type="xsd:int" / --> + <xsd:attribute name="purchaseLotNumber" type="xsd:int" /> + <!-- unique id for this purchase --> + <xsd:attribute name="symbol" type="xsd:string" /> + <xsd:attribute name="quantity" type="xsd:int" /> + <xsd:attribute name="purchaseDate" type="xsd:dateTime" /> + <xsd:attribute name="purchasePrice" type="xsd:float" /> + <xsd:attribute name="currentPrice" type="xsd:float" /> + <xsd:attribute name="company" type="xsd:string" /> + <xsd:attribute name="highPrice" type="xsd:float" /> + <xsd:attribute name="lowPrice" type="xsd:float" /> + + </xsd:complexType> + + <!-- Profile in data base --> + <xsd:element name="getCustomerProfile"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="loginID" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="CustomerProfileData"> + <xsd:sequence> + <xsd:element name="firstName" type="xsd:string" /> + <xsd:element name="lastName" type="xsd:string" /> + <xsd:element name="address" type="xsd:string" /> + <xsd:element name="email" type="xsd:string" /> + <xsd:element name="loginID" type="xsd:string" /> + <xsd:element name="password" type="xsd:string" /> + <xsd:element name="id" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="getCustomerProfileResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="withdraw"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountNumber" + type="xsd:string" /> + <xsd:element name="amount" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="withdrawResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="balance" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="deposit"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountNumber" + type="xsd:string" /> + <xsd:element name="amount" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="depositResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="balance" type="xsd:float" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="purchaseStock"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="id" type="xsd:int" /> + <xsd:element name="stock" type="account:StockSummary" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="purchaseStockResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="purchaseSummary" + type="account:StockSummary" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + + + <xsd:element name="sellStock"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="purchaseLotNumber" + type="xsd:int" /><!-- unique id for this purchase --> + <xsd:element name="quantity" type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:element name="createAccount"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + <xsd:element name="createSavings" + type="xsd:boolean" /> + <xsd:element name="createCheckings" + type="xsd:boolean" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="createAccountResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerProfile" + type="account:CustomerProfileData" /> + </xsd:sequence> + </xsd:complexType> + + </xsd:element> + + <xsd:element name="getAccountLog"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="customerID" + type="xsd:int" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="getAccountLogResponse"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="accountLog" + type="account:AccountLog" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="AccountLog"> + <xsd:sequence> + <xsd:element name="accountLogEntries" + type="account:AccountLogEntry" maxOccurs="unbounded" /> + <xsd:element name="stockLogEntries" + type="account:StockLogEntry" maxOccurs="unbounded" /> + + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="AccountLogEntry"> + <xsd:attribute name="logSeqNo" type="xsd:int" /> + <xsd:attribute name="id" type="xsd:int" /> + <xsd:attribute name="accountNumber" type="xsd:string" /> + <xsd:attribute name="actionType" type="xsd:string" /> + <xsd:attribute name="amount" type="xsd:float" /> + </xsd:complexType> + + <xsd:complexType name="StockLogEntry"> + <xsd:attribute name="logSeqNo" type="xsd:int" /> + <xsd:attribute name="id" type="xsd:int" /> + <xsd:attribute name="symbol" type="xsd:string" /> + <xsd:attribute name="quantity" type="xsd:int" /> + <xsd:attribute name="actionType" type="xsd:string" /> + <xsd:attribute name="purchaseLotNumber" type="xsd:int" /> + </xsd:complexType> + + </xsd:schema> + </wsdl:types> + <wsdl:message name="getAccountReportRequest"> + <wsdl:part element="account:getAccountReport" + name="getAccountReportRequest" /> + </wsdl:message> + <wsdl:message name="getAccountReportResponse"> + <wsdl:part element="account:getAccountReportResponse" + name="getAccountReportResponse" /> + </wsdl:message> + + <wsdl:message name="getCustomerProfileRequest"> + <wsdl:part element="account:getCustomerProfile" + name="getCustomerProfile" /> + </wsdl:message> + <wsdl:message name="getCustomerProfileResponse"> + <wsdl:part element="account:getCustomerProfileResponse" + name="getCustomerProfileResponse" /> + </wsdl:message> + + <wsdl:message name="withdrawRequest"> + <wsdl:part element="account:withdraw" name="withdrawRequest" /> + </wsdl:message> + + <wsdl:message name="withdrawResponse"> + <wsdl:part element="account:withdrawResponse" + name="withdrawResponse" /> + </wsdl:message> + + <wsdl:message name="depositRequest"> + <wsdl:part element="account:deposit" name="depositRequest" /> + </wsdl:message> + + <wsdl:message name="depositResponse"> + <wsdl:part element="account:depositResponse" + name="depositResponse" /> + </wsdl:message> + + <wsdl:message name="purchaseStockRequest"> + <wsdl:part element="account:purchaseStock" + name="purchaseStockRequest" /> + </wsdl:message> + + <wsdl:message name="purchaseStockResponse"> + <wsdl:part element="account:purchaseStockResponse" + name="purchaseStockResponse" /> + </wsdl:message> + + <wsdl:message name="sellStockRequest"> + <wsdl:part element="account:sellStock" name="sellStockRequest" /> + </wsdl:message> + + <wsdl:message name="createAccountRequest"> + <wsdl:part element="account:createAccount" name="createAccountRequest" /> + </wsdl:message> + + <wsdl:message name="createAccountResponse"> + <wsdl:part element="account:createAccountResponse" name="createAccountResponse" /> + </wsdl:message> + + <wsdl:message name="getAccountLogRequest"> + <wsdl:part element="account:getAccountLog" + name="getAccountLogRequest" /> + </wsdl:message> + + <wsdl:message name="getAccountLogResponse"> + <wsdl:part element="account:getAccountLogResponse" + name="getAccountLogResponse" /> + </wsdl:message> + + <wsdl:portType name="AccountService"> + <wsdl:operation name="getAccountReport"> + <wsdl:input message="account:getAccountReportRequest" /> + <wsdl:output message="account:getAccountReportResponse" /> + </wsdl:operation> + + <wsdl:operation name="getCustomerProfile"> + <wsdl:input message="account:getCustomerProfileRequest" /> + <wsdl:output message="account:getCustomerProfileResponse" /> + </wsdl:operation> + + <wsdl:operation name="withdraw"> + <wsdl:input message="account:withdrawRequest" /> + <wsdl:output message="account:withdrawResponse" /> + </wsdl:operation> + + <wsdl:operation name="deposit"> + <wsdl:input message="account:depositRequest" /> + <wsdl:output message="account:depositResponse" /> + </wsdl:operation> + + <wsdl:operation name="purchaseStock"> + <wsdl:input message="account:purchaseStockRequest" /> + <wsdl:output message="account:purchaseStockResponse" /> + </wsdl:operation> + + <wsdl:operation name="sellStock"> + <wsdl:input message="account:sellStockRequest" /> + <wsdl:output message="account:purchaseStockResponse" /> + </wsdl:operation> + + + <wsdl:operation name="createAccount"> + <wsdl:input message="account:createAccountRequest" /> + <wsdl:output message="account:createAccountResponse" /> + </wsdl:operation> + + <wsdl:operation name="getAccountLog"> + <wsdl:input message="account:getAccountLogRequest" /> + <wsdl:output message="account:getAccountLogResponse" /> + </wsdl:operation> + + </wsdl:portType> + + + + <wsdl:binding name="AccountServiceSOAP" type="account:AccountService"> + <soap:binding style="document" + transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="getAccountReport"> + <soap:operation + soapAction="http://www.bigbank.com/account/getAccountReport" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="getCustomerProfile"> + <soap:operation + soapAction="http://www.bigbank.com/account/getCustomerProfile" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="withdraw"> + <soap:operation + soapAction="http://www.bigbank.com/account/withdraw" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="deposit"> + <soap:operation + soapAction="http://www.bigbank.com/account/deposit" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="purchaseStock"> + <soap:operation + soapAction="http://www.bigbank.com/account/purchaseStock" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="sellStock"> + <soap:operation + soapAction="http://www.bigbank.com/account/sellStock" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="createAccount"> + <soap:operation + soapAction="http://www.bigbank.com/account/createAccount" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + <wsdl:operation name="getAccountLog"> + <soap:operation + soapAction="http://www.bigbank.com/account/getAccountLog" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + + </wsdl:binding> + <wsdl:service name="AccountService"> + <wsdl:port binding="account:AccountServiceSOAP" + name="AccountServiceSOAP"> + <soap:address + location="http://localhost:8085/services/AccountService" /> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..bc6fe0e89a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,131 @@ +<?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. +--> +<wsdl:definitions targetNamespace="http://helloworld" + xmlns:tns="http://helloworld" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld"> + + <wsdl:types> + <schema elementFormDefault="qualified" + targetNamespace="http://helloworld" + xmlns="http://www.w3.org/2001/XMLSchema"> + + <element name="getGreetings"> + <complexType> + <sequence> + <element name="name" type="xsd:string" /> + </sequence> + </complexType> + </element> + + <element name="getGreetingsResponse"> + <complexType> + <sequence> + <element name="getGreetingsReturn" + type="xsd:string" /> + </sequence> + </complexType> + </element> + + <element name="getMultipleGreetings"> + <complexType> + <sequence> + <element name="name" type="xsd:string" + maxOccurs="unbounded" /> + </sequence> + </complexType> + </element> + + <element name="getMultipleGreetingsResponse"> + <complexType> + <sequence> + <element name="getGreetingsReturn" + type="xsd:string" maxOccurs="unbounded" /> + </sequence> + </complexType> + </element> + </schema> + </wsdl:types> + + <wsdl:message name="getGreetingsRequest"> + <wsdl:part element="tns:getGreetings" name="parameters" /> + </wsdl:message> + + <wsdl:message name="getGreetingsResponse"> + <wsdl:part element="tns:getGreetingsResponse" name="parameters" /> + </wsdl:message> + + <wsdl:message name="getMultipleGreetingsRequest"> + <wsdl:part element="tns:getMultipleGreetings" name="parameters" /> + </wsdl:message> + + <wsdl:message name="getMultipleGreetingsResponse"> + <wsdl:part element="tns:getMultipleGreetingsResponse" + name="parameters" /> + </wsdl:message> + + <wsdl:portType name="HelloWorld"> + <wsdl:operation name="getGreetings"> + <wsdl:input message="tns:getGreetingsRequest" + name="getGreetingsRequest" /> + <wsdl:output message="tns:getGreetingsResponse" + name="getGreetingsResponse" /> + </wsdl:operation> + <wsdl:operation name="getMultipleGreetings"> + <wsdl:input message="tns:getMultipleGreetingsRequest" + name="getMultipleGreetingsRequest" /> + <wsdl:output message="tns:getMultipleGreetingsResponse" + name="getMultipleGreetingsResponse" /> + </wsdl:operation> + + </wsdl:portType> + + <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld"> + <wsdlsoap:binding style="document" + transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="getGreetings"> + <wsdlsoap:operation soapAction="" /> + <wsdl:input name="getGreetingsRequest"> + <wsdlsoap:body use="literal" /> + </wsdl:input> + <wsdl:output name="getGreetingsResponse"> + <wsdlsoap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="getMultipleGreetings"> + <wsdlsoap:operation soapAction="" /> + <wsdl:input name="getMultipleGreetingsRequest"> + <wsdlsoap:body use="literal" /> + </wsdl:input> + <wsdl:output name="getMultipleGreetingsResponse"> + <wsdlsoap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + + <wsdl:service name="HelloWorldService"> + <wsdl:port binding="tns:HelloWorldSoapBinding" + name="HelloWorldSoapPort"> + <wsdlsoap:address location="" /> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java new file mode 100644 index 0000000000..12441753fb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java @@ -0,0 +1,169 @@ +/* + * 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.itest; + +import static junit.framework.Assert.assertEquals; + +import java.rmi.RemoteException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import bigbank.account.services.accountdata.AccountDataService; + +import com.bigbank.account.AccountFactory; +import com.bigbank.account.AccountReport; +import com.bigbank.account.AccountSummary; +import com.bigbank.account.CustomerProfileData; + +/** + * Tests all the combinations of wiring services, components, and references + * which use either interface.java or interface.wsdl. + * + * The tests use a service (1) wired to a components (2) wired to another + * component (3) wired to a reference (4). Each of those uses either + * interface.java (a) or interface.wsdl (b). This results in 16 different + * combinations 1a2a3a4a thru 1b2b3b4b. + */ +public class SDOWSDLTestCase { + + private static SCADomain domain; + + @Test + public void testClient1a2a3a4a() throws RemoteException { + doit("Client1a2a3a4a"); + } + + @Test + public void testClient1a2a3a4b() throws RemoteException { + doit("Client1a2a3a4b"); + } + + @Test + public void testClient1a2a3b4a() throws RemoteException { + doit("Client1a2a3b4a"); + } + + @Test + public void testClient1a2a3b4b() throws RemoteException { + doit("Client1a2a3b4b"); + } + + @Test + public void testClient1a2b3a4a() throws RemoteException { + doit("Client1a2b3a4a"); + } + + @Test + public void testClient1a2b3a4b() throws RemoteException { + doit("Client1a2b3a4b"); + } + + @Test + public void testClient1a2b3b4a() throws RemoteException { + doit("Client1a2b3b4a"); + } + + @Test + public void testClient1a2b3b4b() throws RemoteException { + doit("Client1a2b3b4b"); + } + + @Test + public void testClient1b2a3a4a() throws RemoteException { + doit("Client1b2a3a4a"); + } + + @Test + public void testClient1b2a3a4b() throws RemoteException { + doit("Client1b2a3a4b"); + } + + @Test + public void testClient1b2a3b4a() throws RemoteException { + doit("Client1b2a3b4a"); + } + + @Test + public void testClient1b2a3b4b() throws RemoteException { + doit("Client1b2a3b4b"); + } + + @Test + public void testClient1b2b3a4a() throws RemoteException { + doit("Client1b2b3a4a"); + } + + @Test + public void testClient1b2b3a4b() throws RemoteException { + doit("Client1b2b3a4b"); + } + + @Test + public void testClient1b2b3b4a() throws RemoteException { + doit("Client1b2b3b4a"); + } + + @Test + public void testClient1b2b3b4b() throws RemoteException { + doit("Client1b2b3b4b"); + } + + private void doit(String compName) throws RemoteException { + AccountDataService client = domain.getService(AccountDataService.class, compName); + CustomerProfileData dataIn = AccountFactory.INSTANCE.createCustomerProfileData(); + dataIn.setAddress("home"); + dataIn.setEmail("petra@home"); + dataIn.setFirstName("petra"); + dataIn.setId(1); + dataIn.setLastName("A"); + dataIn.setLoginID("petra"); + dataIn.setPassword("ant"); + + CustomerProfileData dataOut = client.createAccount(dataIn , false, false); + + assertEquals(dataIn.getAddress(), dataOut.getAddress()); + assertEquals(dataIn.getEmail(), dataOut.getEmail()); + assertEquals(dataIn.getFirstName(), dataOut.getFirstName()); + assertEquals(dataIn.getId(), dataOut.getId()); + assertEquals(dataIn.getLastName(), dataOut.getLastName()); + assertEquals(dataIn.getLoginID(), dataOut.getLoginID()); + assertEquals(dataIn.getPassword(), dataOut.getPassword()); + + AccountReport report = client.getAccountReport(12345); + AccountSummary summary1 = (AccountSummary)report.getAccountSummaries().get(0); + assertEquals(summary1.getAccountType(), "checking"); + AccountSummary summary2 = (AccountSummary)report.getAccountSummaries().get(1); + assertEquals(summary2.getBalance(), 2000.f); + } + + @BeforeClass + public static void setUp() throws Exception { + domain = SCADomain.newInstance("SDOWSDLTest.composite"); + } + + @AfterClass + public static void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java new file mode 100644 index 0000000000..82bf7ce650 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.1/itest/wsdlless/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java @@ -0,0 +1,150 @@ +/* + * 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.itest; + +import static junit.framework.Assert.assertEquals; +import helloworld.HelloWorldService; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Tests all the combinations of wiring services, components, and references + * which use either interface.java or interface.wsdl. The tests use a service + * (1) wired to a components (2) wired to another component (3) wired to a + * reference (4). Each of those uses either interface.java (a) or interface.wsdl + * (b). This results in 16 different combinations 1a2a3a4a thru 1b2b3b4b. + */ +public class WSDLTestCase { + + private static SCADomain domain; + + @Test + public void testClient1a2a3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + String[] greetings = client.getMultipleGreetings(new String[] {"John", "Smith"}); + assertEquals(2, greetings.length); + assertEquals("Hi John", greetings[0]); + assertEquals("Hi Smith", greetings[1]); + } + + @Test + public void testClient1a2a3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2a3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2a3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1a2b3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2a3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3a4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3a4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3b4a() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4a"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @Test + public void testClient1b2b3b4b() { + HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4b"); + assertEquals("Hi petra", client.getGreetings("petra")); + } + + @BeforeClass + public static void init() throws Throwable { + domain = SCADomain.newInstance("WSDLTest.composite"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } +} |