Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 96542 invoked from network); 7 Sep 2007 02:45:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Sep 2007 02:45:20 -0000 Received: (qmail 6042 invoked by uid 500); 7 Sep 2007 02:45:15 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 5976 invoked by uid 500); 7 Sep 2007 02:45:14 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 5967 invoked by uid 99); 7 Sep 2007 02:45:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2007 19:45:14 -0700 X-ASF-Spam-Status: No, hits=-98.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Sep 2007 02:45:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8B1B81A983A; Thu, 6 Sep 2007 19:44:51 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r573429 [2/2] - in /incubator/cxf/branches/jliu: ./ maven_repo/ maven_repo/javax/ maven_repo/javax/rs/ maven_repo/javax/rs/jsr311-api/ maven_repo/javax/rs/jsr311-api/0.9/ rt/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/core/src/main/j... Date: Fri, 07 Sep 2007 02:44:47 -0000 To: cxf-commits@incubator.apache.org From: jliu@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070907024451.8B1B81A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactoryImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactoryImpl.java?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactoryImpl.java (added) +++ incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactoryImpl.java Thu Sep 6 19:44:44 2007 @@ -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.cxf.jaxrs.provider; + +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.ext.EntityProvider; +import javax.ws.rs.ext.HeaderProvider; +import javax.ws.rs.ext.ProviderFactory; + + +//NOTE: ProviderFactory should provide a method that can pass in media types +public class ProviderFactoryImpl extends ProviderFactory { + protected List entityProviders = new ArrayList(); + protected List headerProviders = new ArrayList(); + + public ProviderFactoryImpl() { + //TODO: search for EntityProviders from classpath or config file. + entityProviders.add(new JAXBElementProvider()); + //sort(); + } + + public T createInstance(Class type) { + //TODO: + return null; + } + + @SuppressWarnings("unchecked") + public EntityProvider createEntityProvider(Class type) { + for (EntityProvider ep : entityProviders) { + if (ep.supports(type)) { + return ep; + } + } + + return null; + } + + @SuppressWarnings("unchecked") + public HeaderProvider createHeaderProvider(Class type) { + for (HeaderProvider hp : headerProviders) { + if (hp.supports(type)) { + return hp; + } + } + + return null; + } + + /* + * sorts the available providers according to the media types they declare support for. + * Sorting of media types follows the general rule: x/y < * x < *, i.e. a provider that + * explicitly lists a media types is sorted before a provider that lists *. + * Quality parameter values are also used such that x/y;q=1.0 < x/y;q=0.7. + */ + protected void sort() { + + } + +} Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactoryImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactoryImpl.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/bus-extensions.xml URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/bus-extensions.xml?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/bus-extensions.xml (added) +++ incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/bus-extensions.xml Thu Sep 6 19:44:44 2007 @@ -0,0 +1,27 @@ + + + + + + http://apache.org/cxf/binding/jaxrs + + + Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/bus-extensions.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/bus-extensions.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/bus-extensions.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml (added) +++ incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml Thu Sep 6 19:44:44 2007 @@ -0,0 +1,35 @@ + + + + + + + + + http://apache.org/cxf/binding/jaxrs + + + + + Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf-extension-jaxrs-binding.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf.extension URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf.extension?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf.extension (added) +++ incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/cxf/cxf.extension Thu Sep 6 19:44:44 2007 @@ -0,0 +1 @@ +META-INF/cxf/cxf-extension-jaxrs-binding.xml \ No newline at end of file Added: incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.ext.ProviderFactory URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.ext.ProviderFactory?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.ext.ProviderFactory (added) +++ incubator/cxf/branches/jliu/rt/frontend/jaxrs/src/main/resources/META-INF/services/javax.ws.rs.ext.ProviderFactory Thu Sep 6 19:44:44 2007 @@ -0,0 +1 @@ +org.apache.cxf.jaxrs.provider.ProviderFactoryImpl \ No newline at end of file Modified: incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java?rev=573429&r1=573428&r2=573429&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java (original) +++ incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractServiceFactory.java Thu Sep 6 19:44:44 2007 @@ -23,7 +23,8 @@ import org.apache.cxf.service.ServiceBuilder; import org.apache.cxf.service.model.ServiceInfo; -public abstract class AbstractServiceFactory extends AbstractEndpointFactory implements ServiceBuilder { +public abstract class AbstractServiceFactory extends AbstractWSDLBasedEndpointFactory implements + ServiceBuilder { public ServiceInfo createService() { try { return createEndpoint().getEndpointInfo().getService(); Modified: incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java?rev=573429&r1=573428&r2=573429&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java (original) +++ incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java Thu Sep 6 19:44:44 2007 @@ -31,7 +31,7 @@ import org.apache.cxf.service.factory.ReflectionServiceFactoryBean; import org.apache.cxf.service.factory.ServiceConstructionException; -public class ClientFactoryBean extends AbstractEndpointFactory { +public class ClientFactoryBean extends AbstractWSDLBasedEndpointFactory { private Client client; public ClientFactoryBean() { Modified: incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?rev=573429&r1=573428&r2=573429&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java (original) +++ incubator/cxf/branches/jliu/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java Thu Sep 6 19:44:44 2007 @@ -78,7 +78,7 @@ * sf.create(); * */ -public class ServerFactoryBean extends AbstractEndpointFactory { +public class ServerFactoryBean extends AbstractWSDLBasedEndpointFactory { private static final Logger LOG = LogUtils.getL7dLogger(ServerFactoryBean.class); private Server server; Modified: incubator/cxf/branches/jliu/rt/pom.xml URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/rt/pom.xml?rev=573429&r1=573428&r2=573429&view=diff ============================================================================== --- incubator/cxf/branches/jliu/rt/pom.xml (original) +++ incubator/cxf/branches/jliu/rt/pom.xml Thu Sep 6 19:44:44 2007 @@ -39,6 +39,7 @@ bindings frontend/simple frontend/jaxws + frontend/jaxrs frontend/js transports/http transports/http-jetty Modified: incubator/cxf/branches/jliu/systests/pom.xml URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/systests/pom.xml?rev=573429&r1=573428&r2=573429&view=diff ============================================================================== --- incubator/cxf/branches/jliu/systests/pom.xml (original) +++ incubator/cxf/branches/jliu/systests/pom.xml Thu Sep 6 19:44:44 2007 @@ -289,6 +289,11 @@ ${project.version} + org.apache.cxf + cxf-rt-frontend-jaxrs + ${project.version} + + org.apache.cxf cxf-integration-jca ${project.version} Added: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java (added) +++ incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java Thu Sep 6 19:44:44 2007 @@ -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.cxf.systest.jaxrs; + +import javax.xml.bind.annotation.XmlRootElement; + + +@XmlRootElement(name = "Book") +public class Book { + private String name; + private long id; + + public Book() { + } + + public void setName(String n) { + name = n; + } + + public String getName() { + return name; + } + + public void setId(long i) { + id = i; + } + public long getId() { + return id; + } + +} Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/Book.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java (added) +++ incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java Thu Sep 6 19:44:44 2007 @@ -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.cxf.systest.jaxrs; + + +import org.apache.cxf.jaxrs.JAXRSBindingFactory; +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; +import org.apache.cxf.testutil.common.AbstractBusTestServerBase; + +public class BookServer extends AbstractBusTestServerBase { + + protected void run() { + JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); + sf.setResourceClasses(BookStore.class); + sf.setBindingId(JAXRSBindingFactory.JAXRS_BINDING_ID); + sf.setAddress("http://localhost:9080/xml/"); + + sf.create(); + } + + public static void main(String[] args) { + try { + BookServer s = new BookServer(); + s.start(); + } catch (Exception ex) { + ex.printStackTrace(); + System.exit(-1); + } finally { + System.out.println("done!"); + } + } +} Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java (added) +++ incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java Thu Sep 6 19:44:44 2007 @@ -0,0 +1,81 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +package org.apache.cxf.systest.jaxrs; + + +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.HttpMethod; +import javax.ws.rs.UriParam; +import javax.ws.rs.UriTemplate; +import javax.ws.rs.core.HttpContext; +import javax.ws.rs.core.UriInfo; + + +@UriTemplate("/bookstore/") +public class BookStore { + + @HttpContext UriInfo uriInfo; + + public BookStore() { + } + + @HttpMethod("GET") + public List getBooks() { + System.out.println("----invoking getBooks"); + List books = new ArrayList(1); + Book book = new Book(); + book.setId(123); + book.setName("CXF in Action"); + books.add(book); +/* + Book book1 = new Book(); + book1.setId(124); + book1.setName("CXF in Action - 2"); + books.add(book1);*/ + + return books; + } + + @HttpMethod("GET") + @UriTemplate("/{bookId}/") + public Book getBook(@UriParam("bookId") String bookId) { + System.out.println("----invoking getBook with bookId: " + bookId); + + Book book = new Book(); + book.setId(123); + book.setName("CXF in Action"); + + return book; + } + + @UriTemplate("/cd/{CDId}/") + public CD getCD(@UriParam("CDId") String cdId) { + System.out.println("----invoking getCD with cdId: " + cdId); + CD cd = new CD(); + cd.setId(223); + cd.setName("BOHEMIAN RHAYSODY"); + + return cd; + } + +} Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/CD.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/CD.java?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/CD.java (added) +++ incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/CD.java Thu Sep 6 19:44:44 2007 @@ -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.cxf.systest.jaxrs; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "CD") +public class CD { + private String name; + private long id; + + public CD() { + } + + public void setName(String n) { + name = n; + } + + public String getName() { + return name; + } + + public void setId(long i) { + id = i; + } + + public long getId() { + return id; + } + +} Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/CD.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/CD.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java?rev=573429&view=auto ============================================================================== --- incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java (added) +++ incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java Thu Sep 6 19:44:44 2007 @@ -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 org.apache.cxf.systest.jaxrs; + +import java.io.InputStream; +import java.net.URL; +import java.util.logging.Logger; + + +import org.apache.cxf.helpers.IOUtils; +import org.apache.cxf.io.CachedOutputStream; +import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; +import org.junit.BeforeClass; +import org.junit.Test; + + +public class JAXRSClientServerBookTest extends AbstractBusClientServerTestBase { + + @BeforeClass + public static void startServers() throws Exception { + assertTrue("server did not launch correctly", launchServer(BookServer.class)); + } + + @Test + public void testGetBookWrapped() throws Exception { + String endpointAddress = + "http://localhost:9080/xmlwrapped/books/123"; + URL url = new URL(endpointAddress); + InputStream in = url.openStream(); + assertNotNull(in); + + InputStream expected = getClass() + .getResourceAsStream("resources/expected_get_book123_xmlwrapped.txt"); + + //System.out.println("---" + getStringFromInputStream(in)); + assertEquals(getStringFromInputStream(expected), getStringFromInputStream(in)); + } + + private String getStringFromInputStream(InputStream in) throws Exception { + CachedOutputStream bos = new CachedOutputStream(); + IOUtils.copy(in, bos); + in.close(); + bos.close(); + //System.out.println(bos.getOut().toString()); + return bos.getOut().toString(); + } + +} Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/branches/jliu/systests/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date