Author: sergeyb Date: Tue Dec 14 13:34:53 2010 New Revision: 1049081 URL: http://svn.apache.org/viewvc?rev=1049081&view=rev Log: Merged revisions 1049078 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk
........ r1049078 | sergeyb | 2010-12-14 13:30:54 +0000 (Tue, 14 Dec 2010) | 1 line [JAX-RS] Support for oneways in user models ........ Modified: cxf/branches/2.3.x-fixes/ (props changed) cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml Propchange: cxf/branches/2.3.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Dec 14 13:34:53 2010 @@ -1 +1 @@ -/cxf/trunk:1041183,1041790,1041993,1042346,1042571,1042724,1042805,1042821,1043225,1043229,1043902,1043907,1043954,1044085,1044238-1044305,1045024,1048915,1048919,1048930 +/cxf/trunk:1041183,1041790,1041993,1042346,1042571,1042724,1042805,1042821,1043225,1043229,1043902,1043907,1043954,1044085,1044238-1044305,1045024,1048915,1048919,1048930,1049078 Propchange: cxf/branches/2.3.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java (original) +++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/OperationResourceInfo.java Tue Dec 14 13:34:53 2010 @@ -77,13 +77,16 @@ public class OperationResourceInfo { checkOneway(); } + //CHECKSTYLE:OFF public OperationResourceInfo(Method m, ClassResourceInfo cri, URITemplate template, String httpVerb, String consumeMediaTypes, String produceMediaTypes, - List<Parameter> params) { + List<Parameter> params, + boolean oneway) { + //CHECKSTYLE:ON methodToInvoke = m; annotatedMethod = null; classResourceInfo = cri; @@ -91,8 +94,9 @@ public class OperationResourceInfo { httpMethod = httpVerb; checkMediaTypes(consumeMediaTypes, produceMediaTypes); parameters = params; + this.oneway = oneway; } - + private void checkOneway() { if (annotatedMethod != null) { oneway = AnnotationUtils.getAnnotation(annotatedMethod.getAnnotations(), Oneway.class) != null; Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java (original) +++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/UserOperation.java Tue Dec 14 13:34:53 2010 @@ -31,6 +31,7 @@ public class UserOperation { private String consumesTypes; private String producesTypes; private List<Parameter> params; + private boolean oneway; public UserOperation() { @@ -108,4 +109,12 @@ public class UserOperation { return params == null ? CastUtils.cast(Collections.emptyList(), Parameter.class) : Collections.unmodifiableList(params); } + + public void setOneway(boolean oneway) { + this.oneway = oneway; + } + + public boolean isOneway() { + return oneway; + } } Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java (original) +++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java Tue Dec 14 13:34:53 2010 @@ -166,7 +166,8 @@ public final class ResourceUtils { OperationResourceInfo ori = new OperationResourceInfo(m, cri, URITemplate.createTemplate(op.getPath()), op.getVerb(), op.getConsumes(), op.getProduces(), - op.getParameters()); + op.getParameters(), + op.isOneway()); String rClassName = m.getReturnType().getName(); if (op.getVerb() == null) { if (resources.containsKey(rClassName)) { @@ -499,6 +500,7 @@ public final class ResourceUtils { op.setName(e.getAttribute("name")); op.setVerb(e.getAttribute("verb")); op.setPath(e.getAttribute("path")); + op.setOneway(Boolean.parseBoolean(e.getAttribute("oneway"))); op.setConsumes(e.getAttribute("consumes")); op.setProduces(e.getAttribute("produces")); List<Element> paramEls = Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java (original) +++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsImpl.java Tue Dec 14 13:34:53 2010 @@ -73,5 +73,9 @@ public class BookStoreNoAnnotationsImpl public List<Book> getBooks(List<Book> thebooks) { return thebooks; } + + public void pingBookStore() { + // complete + } } Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java (original) +++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreNoAnnotationsInterface.java Tue Dec 14 13:34:53 2010 @@ -28,6 +28,8 @@ public interface BookStoreNoAnnotationsI List<Book> getBooks(List<Book> thebooks); + void pingBookStore(); + ChapterNoAnnotations getBookChapter(Long id) throws BookNotFoundFault; } Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java (original) +++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerNonSpringBookTest.java Tue Dec 14 13:34:53 2010 @@ -41,7 +41,7 @@ public class JAXRSClientServerNonSpringB @BeforeClass public static void startServers() throws Exception { assertTrue("server did not launch correctly", - launchServer(BookNonSpringServer.class)); + launchServer(BookNonSpringServer.class, true)); } @@ -83,7 +83,6 @@ public class JAXRSClientServerNonSpringB JAXRSClientFactory.createFromModel("http://localhost:" + PORT + "/usermodel2", BookStoreNoAnnotationsInterface.class, "classpath:org/apache/cxf/systest/jaxrs/resources/resources2.xml", null); - WebClient.getConfig(proxy).getHttpConduit().getClient().setReceiveTimeout(10000000); Book book = new Book("From Model", 1L); List<Book> books = new ArrayList<Book>(); books.add(book); @@ -95,6 +94,17 @@ public class JAXRSClientServerNonSpringB } @Test + public void testUserModelInterfaceOneWay() throws Exception { + BookStoreNoAnnotationsInterface proxy = + JAXRSClientFactory.createFromModel("http://localhost:" + PORT + "/usermodel2", + BookStoreNoAnnotationsInterface.class, + "classpath:org/apache/cxf/systest/jaxrs/resources/resources2.xml", null); + + proxy.pingBookStore(); + assertEquals(202, WebClient.client(proxy).getResponse().getStatus()); + } + + @Test public void testGetBook123ApplicationSingleton() throws Exception { getAndCompareAsStrings("http://localhost:" + PORT + "/application/bookstore/books/123", "resources/expected_get_book123.txt", Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml (original) +++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/resources2.xml Tue Dec 14 13:34:53 2010 @@ -8,7 +8,8 @@ </operation> <operation name="getBookChapter" path="/books/{id}/chapter"> <param name="id" type="PATH"/> - </operation> + </operation> + <operation name="pingBookStore" path="/oneway" verb="POST" oneway="true"/> </resource> <resource name="org.apache.cxf.systest.jaxrs.ChapterNoAnnotations"> <operation name="getItself" verb="GET"/> Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml (original) +++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/resources2.xml Tue Dec 14 13:34:53 2010 @@ -8,9 +8,11 @@ </operation> <operation name="getBookChapter" path="/books/{id}/chapter"> <param name="id" type="PATH"/> - </operation> + </operation> + <operation name="pingBookStore" path="/oneway" verb="POST" oneway="true"/> </resource> <resource name="org.apache.cxf.systest.jaxrs.ChapterNoAnnotations"> <operation name="getItself" verb="GET"/> </resource> + </model> \ No newline at end of file Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml?rev=1049081&r1=1049080&r2=1049081&view=diff ============================================================================== --- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml (original) +++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs_simple_security/WEB-INF/web.xml Tue Dec 14 13:34:53 2010 @@ -65,7 +65,7 @@ </login-config> <!-- <security-role> -<role-name>JBossAdmin</role-name> +<role-name>ROLE_BOOK_OWNER</role-name> </security-role> --> </web-app>