diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-28 22:29:36 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-28 22:29:36 +0000 |
commit | a8d60f6c4a9f815e83ccf4b6dc494ae003951982 (patch) | |
tree | c14203545609bbb4a46e8737932e80f169e5ef35 | |
parent | 2488e01d282682a91c22b7077dab3a619408e148 (diff) |
TUSCANY-3166 - Adding testcase to reproduce the problem described
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@798724 13f79535-47bb-0310-9956-ffa450edef68
6 files changed, 655 insertions, 0 deletions
diff --git a/branches/sca-java-1.5.1/itest/atom/pom.xml b/branches/sca-java-1.5.1/itest/atom/pom.xml new file mode 100644 index 0000000000..a46ca17109 --- /dev/null +++ b/branches/sca-java-1.5.1/itest/atom/pom.xml @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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.5.1-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <artifactId>itest-atom</artifactId> + <name>Apache Tuscany SCA iTest Atom Binding</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.5.1-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-interface-wsdl-xml</artifactId> + <version>1.5.1-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.5.1-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-abdera</artifactId> + <version>1.5.1-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sdo</groupId> + <artifactId>tuscany-sdo-impl</artifactId> + <version>1.1.1</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <!-- Using WS-Import --> + <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> + <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>jaxws-maven-plugin</artifactId> + <version>1.9</version> + <!-- Explicitly add the transitive dependencies for jaxws-api + http://jira.codehaus.org/browse/MEV-498 + --> + <dependencies> + <dependency> + <groupId>javax.jws</groupId> + <artifactId>jsr181-api</artifactId> + <version>1.0-MR1</version> + </dependency> + <dependency> + <groupId>javax.annotation</groupId> + <artifactId>jsr250-api</artifactId> + <version>1.0</version> + </dependency> + </dependencies> + <executions> + <execution> + <id>wsimport</id> + <phase>generate-test-sources</phase> + <goals> + <goal>wsimport</goal> + </goals> + <configuration> + <packageName>test.abdera</packageName> + <wsdlDirectory>${basedir}/src/test/resources/news</wsdlDirectory> + <wsdlFiles> + <wsdlFile>news.wsdl</wsdlFile> + </wsdlFiles> + <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir> + <verbose>false</verbose> + <xnocompile>true</xnocompile> + </configuration> + </execution> + </executions> + + </plugin> + </plugins> + </build> + +</project> diff --git a/branches/sca-java-1.5.1/itest/atom/src/main/java/test/abdera/impl/NewsServiceImpl.java b/branches/sca-java-1.5.1/itest/atom/src/main/java/test/abdera/impl/NewsServiceImpl.java new file mode 100644 index 0000000000..7d1b6e4347 --- /dev/null +++ b/branches/sca-java-1.5.1/itest/atom/src/main/java/test/abdera/impl/NewsServiceImpl.java @@ -0,0 +1,58 @@ +package test.abdera.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.osoa.sca.annotations.Init; + +import test.abdera.Entry; +import test.abdera.Item; +import test.abdera.NewsService; +import test.abdera.NotFoundException_Exception; + +public class NewsServiceImpl implements NewsService { + private static Map<String, Entry> collection = new HashMap<String, Entry>(); + + @Init + public void init() { + Item item = new Item(); + item.setName("Item Name 01"); + item.setTitle("Item title 01"); + + Entry entry = new Entry(); + entry.setKey("1"); + entry.setData(item); + + collection.put((String)entry.getKey(), entry); + } + + public List<Entry> getAll() { + return (List<Entry>) collection.values(); + } + + public Item get(String arg0) throws NotFoundException_Exception { + return (Item) collection.get(arg0).getData(); + } + + public String post(String arg0, Item arg1) { + // TODO Auto-generated method stub + return null; + } + + public void put(String arg0, Item arg1) throws NotFoundException_Exception { + // TODO Auto-generated method stub + + } + + public void delete(String arg0) throws NotFoundException_Exception { + // TODO Auto-generated method stub + + } + + public List<Entry> query(String arg0) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/branches/sca-java-1.5.1/itest/atom/src/test/java/test/abdera/NewsServiceTestCase.java b/branches/sca-java-1.5.1/itest/atom/src/test/java/test/abdera/NewsServiceTestCase.java new file mode 100644 index 0000000000..0d9c1c11b3 --- /dev/null +++ b/branches/sca-java-1.5.1/itest/atom/src/test/java/test/abdera/NewsServiceTestCase.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 test.abdera; + +import java.net.Socket; +import java.util.List; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class NewsServiceTestCase { + private static SCADomain domain; + private static NewsService newsService; + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("news/news.composite"); + Assert.assertNotNull(domain); + newsService = domain.getService(NewsService.class, "NewsServiceComponent"); + Assert.assertNotNull(newsService); + } + + @AfterClass + public static void destroy() throws Exception { + if(domain != null) { + domain.close(); + } + } + + @Test + public void testPing() throws Exception { + new Socket("127.0.0.1", 8085); + System.in.read(); + } + + @Test + public void testNewsServicesGetAll() throws Exception { + List<Entry> entries = newsService.getAll(); + + Assert.assertNotNull(entries); + Assert.assertTrue(entries.size() > 0); + + for(Entry entry : entries) { + System.out.println(">>> Entry - " + ((Item)entry.getData()).getTitle()); + } + } + + @Test + public void testNewsServicesGet() throws Exception { + Item item = newsService.get("1"); + + Assert.assertNotNull(item); + System.out.println(">>> Entry - " + item.getTitle()); + } +} diff --git a/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.composite b/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.composite new file mode 100644 index 0000000000..f3a3b165cc --- /dev/null +++ b/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:tns="http://abdera.test/" + targetNamespace="http://abdera.test/" + name="news"> + + <component name="NewsServiceComponent"> + <implementation.java class="test.abdera.impl.NewsServiceImpl"/> + <service name="NewsService"> + <interface.wsdl interface="http://abdera.test/#wsdl.interface(NewsService)"/> + <tuscany:binding.atom uri="http://localhost:8085/NewsService"/> + </service> + </component> + +</composite> diff --git a/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.wsdl b/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.wsdl new file mode 100644 index 0000000000..62d46e66c9 --- /dev/null +++ b/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.wsdl @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.1 in JDK 6. --> +<definitions targetNamespace="http://abdera.test/" name="NewsServiceImplService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://abdera.test/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + <types> + <xsd:schema> + <xsd:import namespace="http://abdera.test/" schemaLocation="news.xsd"/> + </xsd:schema> + </types> + <message name="getAll"> + <part name="parameters" element="tns:getAll"/> + </message> + <message name="getAllResponse"> + <part name="parameters" element="tns:getAllResponse"/> + </message> + <message name="get"> + <part name="parameters" element="tns:get"/> + </message> + <message name="getResponse"> + <part name="parameters" element="tns:getResponse"/> + </message> + <message name="NotFoundException"> + <part name="fault" element="tns:NotFoundException"/> + </message> + <message name="post"> + <part name="parameters" element="tns:post"/> + </message> + <message name="postResponse"> + <part name="parameters" element="tns:postResponse"/> + </message> + <message name="put"> + <part name="parameters" element="tns:put"/> + </message> + <message name="putResponse"> + <part name="parameters" element="tns:putResponse"/> + </message> + <message name="delete"> + <part name="parameters" element="tns:delete"/> + </message> + <message name="deleteResponse"> + <part name="parameters" element="tns:deleteResponse"/> + </message> + <message name="query"> + <part name="parameters" element="tns:query"/> + </message> + <message name="queryResponse"> + <part name="parameters" element="tns:queryResponse"/> + </message> + <portType name="NewsService"> + <operation name="getAll"> + <input message="tns:getAll"/> + <output message="tns:getAllResponse"/> + </operation> + <operation name="get"> + <input message="tns:get"/> + <output message="tns:getResponse"/> + <fault message="tns:NotFoundException" name="NotFoundException"/> + </operation> + <operation name="post"> + <input message="tns:post"/> + <output message="tns:postResponse"/> + </operation> + <operation name="put"> + <input message="tns:put"/> + <output message="tns:putResponse"/> + <fault message="tns:NotFoundException" name="NotFoundException"/> + </operation> + <operation name="delete"> + <input message="tns:delete"/> + <output message="tns:deleteResponse"/> + <fault message="tns:NotFoundException" name="NotFoundException"/> + </operation> + <operation name="query"> + <input message="tns:query"/> + <output message="tns:queryResponse"/> + </operation> + </portType> + <binding name="NewsServiceImplPortBinding" type="tns:NewsService"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> + <operation name="getAll"> + <soap:operation soapAction=""/> + <input> + <soap:body use="literal"/> + </input> + <output> + <soap:body use="literal"/> + </output> + </operation> + <operation name="get"> + <soap:operation soapAction=""/> + <input> + <soap:body use="literal"/> + </input> + <output> + <soap:body use="literal"/> + </output> + <fault name="NotFoundException"> + <soap:fault name="NotFoundException" use="literal"/> + </fault> + </operation> + <operation name="post"> + <soap:operation soapAction=""/> + <input> + <soap:body use="literal"/> + </input> + <output> + <soap:body use="literal"/> + </output> + </operation> + <operation name="put"> + <soap:operation soapAction=""/> + <input> + <soap:body use="literal"/> + </input> + <output> + <soap:body use="literal"/> + </output> + <fault name="NotFoundException"> + <soap:fault name="NotFoundException" use="literal"/> + </fault> + </operation> + <operation name="delete"> + <soap:operation soapAction=""/> + <input> + <soap:body use="literal"/> + </input> + <output> + <soap:body use="literal"/> + </output> + <fault name="NotFoundException"> + <soap:fault name="NotFoundException" use="literal"/> + </fault> + </operation> + <operation name="query"> + <soap:operation soapAction=""/> + <input> + <soap:body use="literal"/> + </input> + <output> + <soap:body use="literal"/> + </output> + </operation> + </binding> + <service name="NewsService"> + <port name="NewsServicePort" binding="tns:NewsServiceImplPortBinding"> + <soap:address location="http://localhost:8085/NewsService"/> + </port> + </service> +</definitions>
\ No newline at end of file diff --git a/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.xsd b/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.xsd new file mode 100644 index 0000000000..0a59f9311e --- /dev/null +++ b/branches/sca-java-1.5.1/itest/atom/src/test/resources/news/news.xsd @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT 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 version="1.0" targetNamespace="http://abdera.test/" xmlns:tns="http://abdera.test/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:element name="NotFoundException" type="tns:NotFoundException"/> + + <xs:element name="delete" type="tns:delete"/> + + <xs:element name="deleteResponse" type="tns:deleteResponse"/> + + <xs:element name="get" type="tns:get"/> + + <xs:element name="getAll" type="tns:getAll"/> + + <xs:element name="getAllResponse" type="tns:getAllResponse"/> + + <xs:element name="getResponse" type="tns:getResponse"/> + + <xs:element name="post" type="tns:post"/> + + <xs:element name="postResponse" type="tns:postResponse"/> + + <xs:element name="put" type="tns:put"/> + + <xs:element name="putResponse" type="tns:putResponse"/> + + <xs:element name="query" type="tns:query"/> + + <xs:element name="queryResponse" type="tns:queryResponse"/> + + <xs:complexType name="post"> + <xs:sequence> + <xs:element name="arg0" type="xs:string" minOccurs="0"/> + <xs:element name="arg1" type="tns:Item" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="Item"> + <xs:sequence> + <xs:element name="name" type="xs:string" minOccurs="0"/> + <xs:element name="title" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="postResponse"> + <xs:sequence> + <xs:element name="return" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="get"> + <xs:sequence> + <xs:element name="arg0" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="getResponse"> + <xs:sequence> + <xs:element name="return" type="tns:Item" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="NotFoundException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="query"> + <xs:sequence> + <xs:element name="arg0" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="queryResponse"> + <xs:sequence> + <xs:element name="return" type="tns:entry" nillable="true" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="entry"> + <xs:sequence> + <xs:element name="data" type="xs:anyType" minOccurs="0"/> + <xs:element name="dummy" type="tns:Item" minOccurs="0"/> + <xs:element name="key" type="xs:anyType" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="delete"> + <xs:sequence> + <xs:element name="arg0" type="xs:string" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="deleteResponse"> + <xs:sequence/> + </xs:complexType> + + <xs:complexType name="getAll"> + <xs:sequence/> + </xs:complexType> + + <xs:complexType name="getAllResponse"> + <xs:sequence> + <xs:element name="return" type="tns:entry" nillable="true" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="put"> + <xs:sequence> + <xs:element name="arg0" type="xs:string" minOccurs="0"/> + <xs:element name="arg1" type="tns:Item" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="putResponse"> + <xs:sequence/> + </xs:complexType> +</xs:schema> + |