You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2018/01/19 13:01:59 UTC

[cxf] branch master updated (716fdf4 -> 5b03b98)

This is an automated email from the ASF dual-hosted git repository.

sergeyb pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from 716fdf4  Optionally disabling gzip for the out payloads of non-matching CTs
     new 8c85660  [CXF-7614] Resolving Object subresources when enableStaticResolution is set
     new 5b03b98  [CXF-7614] Adding test resource

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/cxf/jaxrs/model/ClassResourceInfo.java  |  2 +-
 ...ourceCreatedOutside.java => BookServerSub.java} | 24 +++++++++++-----------
 ...AtomBookStore3.java => BookStoreSubObject.java} | 13 +++++-------
 ...Test.java => JAXRSClientServerSubBookTest.java} | 23 +++++++++------------
 4 files changed, 28 insertions(+), 34 deletions(-)
 copy systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/{BookServerResourceCreatedOutside.java => BookServerSub.java} (73%)
 copy systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/{AtomBookStore3.java => BookStoreSubObject.java} (80%)
 copy systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/{JAXRSServletFilterTest.java => JAXRSClientServerSubBookTest.java} (69%)

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].

[cxf] 01/02: [CXF-7614] Resolving Object subresources when enableStaticResolution is set

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sergeyb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 8c85660cd1d6f479722bbc0c5dab0ebce9a9c554
Author: Sergey Beryozkin <sb...@gmail.com>
AuthorDate: Fri Jan 19 13:00:49 2018 +0000

    [CXF-7614] Resolving Object subresources when enableStaticResolution is set
---
 .../src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
index 8b6ffad..3512e43 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ClassResourceInfo.java
@@ -140,7 +140,7 @@ public class ClassResourceInfo extends BeanResourceInfo {
     }
 
     public ClassResourceInfo getSubResource(Class<?> typedClass, Class<?> instanceClass, Object instance) {
-        instanceClass = enableStatic ? typedClass : instanceClass;
+        instanceClass = enableStatic && typedClass != Object.class ? typedClass : instanceClass;
         return getSubResource(typedClass, instanceClass, instance, enableStatic, JAXRSUtils.getCurrentMessage());
     }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@cxf.apache.org" <co...@cxf.apache.org>.

[cxf] 02/02: [CXF-7614] Adding test resource

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sergeyb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 5b03b98d4de710fe6d36c520ccf4269177ef21c4
Author: Sergey Beryozkin <sb...@gmail.com>
AuthorDate: Fri Jan 19 13:01:36 2018 +0000

    [CXF-7614] Adding test resource
---
 .../apache/cxf/systest/jaxrs/BookServerSub.java    | 59 ++++++++++++++++++++++
 .../cxf/systest/jaxrs/BookStoreSubObject.java      | 34 +++++++++++++
 .../jaxrs/JAXRSClientServerSubBookTest.java        | 49 ++++++++++++++++++
 3 files changed, 142 insertions(+)

diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerSub.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerSub.java
new file mode 100644
index 0000000..0156cd2
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServerSub.java
@@ -0,0 +1,59 @@
+/**
+ * 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.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class BookServerSub extends AbstractBusTestServerBase {
+    public static final String PORT = allocatePort(BookServerSub.class);
+
+    org.apache.cxf.endpoint.Server server;
+    
+    protected void run() {
+        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
+        sf.setStaticSubresourceResolution(true);
+        sf.setResourceClasses(BookStoreSubObject.class);
+        sf.setResourceProvider(BookStoreSubObject.class,
+                               new SingletonResourceProvider(new BookStoreSubObject(), true));
+        sf.setAddress("http://localhost:" + PORT + "/");
+        server = sf.create();
+    }
+
+    public void tearDown() throws Exception {
+        server.stop();
+        server.destroy();
+        server = null;
+    }
+
+    public static void main(String[] args) {
+        try {
+            BookServerSub s = new BookServerSub();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }
+
+}
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSubObject.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSubObject.java
new file mode 100644
index 0000000..34b8101
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStoreSubObject.java
@@ -0,0 +1,34 @@
+/**
+ * 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.ws.rs.Path;
+
+@Path("/bookstore")
+public class BookStoreSubObject {
+
+    @Path("/booksubresourceobject")
+    public Object getBookSubResourceObject() throws BookNotFoundFault {
+        return new Book();
+    }
+}
+
+
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSubBookTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSubBookTest.java
new file mode 100644
index 0000000..ea79fd9
--- /dev/null
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSubBookTest.java
@@ -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.client.WebClient;
+import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JAXRSClientServerSubBookTest extends AbstractBusClientServerTestBase {
+    public static final String PORT = BookServerSub.PORT;
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        AbstractResourceInfo.clearAllMaps();
+        assertTrue("server did not launch correctly",
+                   launchServer(BookServerSub.class, true));
+        createStaticBus();
+    }
+
+    @Test
+    public void testGetChapterFromBookSubObject() throws Exception {
+        WebClient wc = 
+            WebClient.create("http://localhost:" + PORT + "/bookstore/booksubresourceobject/chaptersobject/sub/1");
+        WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(100000000L);
+        Chapter c = wc.accept("application/xml").get(Chapter.class);
+        assertNotNull(c);
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@cxf.apache.org" <co...@cxf.apache.org>.