cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r935995 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/ systests/jaxrs/src/test/java/or...
Date Tue, 20 Apr 2010 17:06:29 GMT
Author: sergeyb
Date: Tue Apr 20 17:06:28 2010
New Revision: 935995

URL: http://svn.apache.org/viewvc?rev=935995&view=rev
Log:
Fixing CXF JAXRS issue to do with Form beans processing and typo in ws/security/DefaultSecurityContext

Added:
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java   (with
props)
Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/DefaultSecurityContext.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=935995&r1=935994&r2=935995&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
Tue Apr 20 17:06:28 2010
@@ -382,7 +382,7 @@ public class ClientProxyImpl extends Abs
         List<Parameter> fm = getParameters(map, ParameterType.FORM);
         for (Parameter p : fm) {
             if (params[p.getIndex()] != null) {
-                FormUtils.addPropertyToForm(form, p.getName(), params[p.getIndex()].toString());
+                FormUtils.addPropertyToForm(form, p.getName(), params[p.getIndex()]);
             }
         }
         

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java?rev=935995&r1=935994&r2=935995&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java Tue
Apr 20 17:06:28 2010
@@ -47,7 +47,7 @@ public final class FormUtils {
     
     public static void addPropertyToForm(MultivaluedMap<String, Object> map, String
name, Object value) {
         if (!"".equals(name)) {
-            map.add(name, value);
+            map.add(name, value.toString());
         } else {
             MultivaluedMap<String, Object> values = 
                 InjectionUtils.extractValuesFromBean(value, "");

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/DefaultSecurityContext.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/DefaultSecurityContext.java?rev=935995&r1=935994&r2=935995&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/DefaultSecurityContext.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/DefaultSecurityContext.java
Tue Apr 20 17:06:28 2010
@@ -58,13 +58,13 @@ public class DefaultSecurityContext impl
         return false;
     }
 
-    private static boolean checkGroup(Group group, String role) {
+    protected boolean checkGroup(Group group, String role) {
         if (group.getName().equals(role)) {
             return true;
         }
             
         for (Enumeration<? extends Principal> members = group.members(); members.hasMoreElements();)
{
-            // this might be a plain role but could represent a group consisting of the pther
groups/roles
+            // this might be a plain role but could represent a group consisting of other
groups/roles
             Principal member = members.nextElement();
             if (member.getName().equals(role) 
                 || member instanceof Group && checkGroup((Group)member, role)) {

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=935995&r1=935994&r2=935995&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
Tue Apr 20 17:06:28 2010
@@ -291,19 +291,35 @@ public class JAXRSSoapBookTest extends A
                                                               BookStoreJaxrsJaxws.class);
         BookSubresource bs = proxy.getBookSubresource("139");
         Book bean = new Book("CXF Rocks", 139L);
-        Book b = bs.getTheBook4(bean, bean, bean);
+        Book b = bs.getTheBook4(bean, bean, bean, bean);
         assertEquals(139, b.getId());
         assertEquals("CXF Rocks", b.getName());
     }
     
     @Test
+    public void testAddOrderFormBean() throws Exception {
+        
+        String baseAddress = "http://localhost:9092/test/services/rest";
+        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
+                                                              BookStoreJaxrsJaxws.class);
+        BookSubresource bs = proxy.getBookSubresource("139");
+        OrderBean order = new OrderBean();
+        order.setId(123L);
+        order.setWeight(100);
+        OrderBean order2 = bs.addOrder(order);
+        assertEquals(Long.valueOf(123L), Long.valueOf(order2.getId()));
+    }
+    
+    @Test
     public void testGetBookSubresourceWebClientParamExtensions() throws Exception {
         
         WebClient client = WebClient.create("http://localhost:9092/test/services/rest");
         client.type(MediaType.TEXT_PLAIN_TYPE).accept(MediaType.APPLICATION_XML_TYPE);
         client.path("/bookstore/books/139/subresource4/139/CXF Rocks");
         Book bean = new Book("CXF Rocks", 139L);
-        Book b = client.matrix("", bean).query("", bean).get(Book.class);
+        Form form = new Form();
+        form.set("name", "CXF Rocks").set("id", Long.valueOf(139L));
+        Book b = readBook((InputStream)client.matrix("", bean).query("", bean).form(form).getEntity());
         assertEquals(139, b.getId());
         assertEquals("CXF Rocks", b.getName());
     }

Added: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java?rev=935995&view=auto
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java (added)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java Tue
Apr 20 17:06:28 2010
@@ -0,0 +1,41 @@
+/**
+ * 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
+public class OrderBean {
+    
+    private Long id;
+    private int weight;
+    
+    public void setId(Long id) {
+        this.id = id;
+    }
+    public Long getId() {
+        return id;
+    }
+    public void setWeight(int w) {
+        this.weight = w;
+    }
+    public int getWeight() {
+        return weight;
+    }
+}

Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/OrderBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message