cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1468045 - in /cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security: JAXRSHttpsBookTest.java jaxrs-https-client4.xml
Date Mon, 15 Apr 2013 13:23:59 GMT
Author: sergeyb
Date: Mon Apr 15 13:23:58 2013
New Revision: 1468045

URL: http://svn.apache.org/r1468045
Log:
[CXF-4958] Updating one of system tests to have jaxrs:client depending on pre-configured 
MBR to read the message

Modified:
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-client4.xml

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java?rev=1468045&r1=1468044&r2=1468045&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
Mon Apr 15 13:23:58 2013
@@ -20,6 +20,7 @@
 package org.apache.cxf.systest.jaxrs.security;
 
 import javax.ws.rs.core.MediaType;
+import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
@@ -78,7 +79,24 @@ public class JAXRSHttpsBookTest extends 
     }
     @Test
     public void testGetBook123ProxyFromSpringWildcard() throws Exception {
-        doTestGetBook123ProxyFromSpring(CLIENT_CONFIG_FILE4);
+        ClassPathXmlApplicationContext ctx =
+            new ClassPathXmlApplicationContext(new String[] {CLIENT_CONFIG_FILE4});
+        Object bean = ctx.getBean("bookService.proxyFactory");
+        assertNotNull(bean);
+        JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
+        
+        BookStore bs = cfb.create(BookStore.class);
+        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
+        
+        WebClient wc = WebClient.fromClient(WebClient.client(bs));
+        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
+        wc.accept("application/xml");
+        wc.path("bookstore/securebooks/123");
+        TheBook b = wc.get(TheBook.class);
+        
+        assertEquals(b.getId(), 123);
+        b = wc.get(TheBook.class);
+        assertEquals(b.getId(), 123);
     }
     
     private void doTestGetBook123ProxyFromSpring(String cfgFile) throws Exception {
@@ -147,4 +165,21 @@ public class JAXRSHttpsBookTest extends 
         assertEquals(123, b.getId());
     }     
     
+    @XmlRootElement(name = "TheBook")
+    public static class TheBook {
+        private String name;
+        private long id;
+        public String getName() {
+            return name;
+        }
+        public void setName(String name) {
+            this.name = name;
+        }
+        public long getId() {
+            return id;
+        }
+        public void setId(long id) {
+            this.id = id;
+        }
+    }
 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-client4.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-client4.xml?rev=1468045&r1=1468044&r2=1468045&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-client4.xml
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/jaxrs-https-client4.xml
Mon Apr 15 13:23:58 2013
@@ -52,6 +52,16 @@ under the License.
 
     <jaxrs:client id="bookService" 
        address="https://localhost:${testutil.ports.jaxrs-https}"
-serviceClass="org.apache.cxf.systest.jaxrs.BookStore"/>
+serviceClass="org.apache.cxf.systest.jaxrs.BookStore">
+        <jaxrs:providers>
+            <bean class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
+                <property name="inTransformElements">
+                 <map>
+                   <entry key="Book" value="TheBook"/>
+                 </map>
+                </property>
+            </bean>
+        </jaxrs:providers>
+    </jaxrs:client>
 
 </beans>



Mime
View raw message