diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-13 01:42:27 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-13 01:42:27 +0000 |
commit | 3c7c4a749baafcf375f4785a7668d3a25c9063e3 (patch) | |
tree | a66b8b031c5dc6c7744f44b44b6bcd371bd0b8df /sca-java-1.x/trunk/itest/atom/src | |
parent | eb03ff672236cddf65533f39b83ddd5e2984a2bb (diff) |
Moving 1.x trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835700 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/itest/atom/src')
5 files changed, 462 insertions, 0 deletions
diff --git a/sca-java-1.x/trunk/itest/atom/src/main/java/test/abdera/impl/NewsServiceImpl.java b/sca-java-1.x/trunk/itest/atom/src/main/java/test/abdera/impl/NewsServiceImpl.java new file mode 100644 index 0000000000..09789b4bb5 --- /dev/null +++ b/sca-java-1.x/trunk/itest/atom/src/main/java/test/abdera/impl/NewsServiceImpl.java @@ -0,0 +1,63 @@ +package test.abdera.impl; + +import java.util.ArrayList; +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() { + List<Entry> entries = new ArrayList<Entry>(); + for(Entry entry : collection.values()) { + entries.add(entry); + } + return entries; + } + + 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/sca-java-1.x/trunk/itest/atom/src/test/java/test/abdera/NewsServiceTestCase.java b/sca-java-1.x/trunk/itest/atom/src/test/java/test/abdera/NewsServiceTestCase.java new file mode 100644 index 0000000000..b9f2b4e2fc --- /dev/null +++ b/sca-java-1.x/trunk/itest/atom/src/test/java/test/abdera/NewsServiceTestCase.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 test.abdera; + +import java.net.Socket; + +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 testNewsServicesGet() throws Exception { + Item item = newsService.get("1"); + + Assert.assertNotNull(item); + System.out.println(">>> Entry - " + item.getTitle()); + } +} diff --git a/sca-java-1.x/trunk/itest/atom/src/test/resources/news/news.composite b/sca-java-1.x/trunk/itest/atom/src/test/resources/news/news.composite new file mode 100644 index 0000000000..f3a3b165cc --- /dev/null +++ b/sca-java-1.x/trunk/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/sca-java-1.x/trunk/itest/atom/src/test/resources/news/news.wsdl b/sca-java-1.x/trunk/itest/atom/src/test/resources/news/news.wsdl new file mode 100644 index 0000000000..62d46e66c9 --- /dev/null +++ b/sca-java-1.x/trunk/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/sca-java-1.x/trunk/itest/atom/src/test/resources/news/news.xsd b/sca-java-1.x/trunk/itest/atom/src/test/resources/news/news.xsd new file mode 100644 index 0000000000..0a59f9311e --- /dev/null +++ b/sca-java-1.x/trunk/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> + |