diff options
Diffstat (limited to 'branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate')
7 files changed, 491 insertions, 0 deletions
diff --git a/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm b/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm new file mode 100644 index 0000000000..b2346aa973 --- /dev/null +++ b/branches/sca-java-1.3/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/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm b/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm new file mode 100644 index 0000000000..88616cc997 --- /dev/null +++ b/branches/sca-java-1.3/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/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm b/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm new file mode 100644 index 0000000000..77a12e92ec --- /dev/null +++ b/branches/sca-java-1.3/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 automatically 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/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm b/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm new file mode 100644 index 0000000000..ee73db6152 --- /dev/null +++ b/branches/sca-java-1.3/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/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm b/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm new file mode 100644 index 0000000000..aab564dc1e --- /dev/null +++ b/branches/sca-java-1.3/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 automatically 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/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm b/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm new file mode 100644 index 0000000000..5507a0b747 --- /dev/null +++ b/branches/sca-java-1.3/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 automatically 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/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/generate.xsd b/branches/sca-java-1.3/itest/databindings/common/src/main/resources/generate/generate.xsd new file mode 100644 index 0000000000..1fabedf55f --- /dev/null +++ b/branches/sca-java-1.3/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> |