cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1454984 - in /cxf/trunk: rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/
Date Mon, 11 Mar 2013 03:25:27 GMT
Author: ema
Date: Mon Mar 11 03:25:26 2013
New Revision: 1454984

URL: http://svn.apache.org/r1454984
Log:
[CXF-4875]:Fix NPE when resolve the wsrm policy

Added:
    cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpoint.java
  (with props)
    cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpointImpl.java
  (with props)
    cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
  (with props)
    cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml
  (with props)
Modified:
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java?rev=1454984&r1=1454983&r2=1454984&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/WSPolicyFeature.java Mon
Mar 11 03:25:26 2013
@@ -233,7 +233,7 @@ public class WSPolicyFeature extends Abs
     
     Policy resolveLocal(PolicyReference ref, final Bus bus, DescriptionInfo i) {
         String uri = ref.getURI().substring(1);
-        String absoluteURI = i.getBaseURI() + uri;
+        String absoluteURI = i == null ? uri : i.getBaseURI() + uri;
         PolicyRegistry registry = bus.getExtension(PolicyEngine.class).getRegistry();
         Policy resolved = registry.lookup(absoluteURI);
         if (null != resolved) {

Added: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpoint.java?rev=1454984&view=auto
==============================================================================
--- cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpoint.java
(added)
+++ cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpoint.java
Mon Mar 11 03:25:26 2013
@@ -0,0 +1,29 @@
+/**
+ * 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.ws.rm;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService(name = "RMEndpoint", targetNamespace = "http://cxf.apache.org/wsrm")
+public interface BasicDocEndpoint {
+    @WebMethod
+    String echo(String arg0);
+
+}

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpointImpl.java?rev=1454984&view=auto
==============================================================================
--- cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpointImpl.java
(added)
+++ cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpointImpl.java
Mon Mar 11 03:25:26 2013
@@ -0,0 +1,30 @@
+/**
+ * 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.ws.rm;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService(name = "RMEndpoint", targetNamespace = "http://cxf.apache.org/wsrm", serviceName
= "RMService")
+public class BasicDocEndpointImpl implements BasicDocEndpoint {
+    @WebMethod
+    public String echo(String input) {
+        return input;
+    }
+}
\ No newline at end of file

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpointImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/BasicDocEndpointImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java?rev=1454984&view=auto
==============================================================================
--- cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
(added)
+++ cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
Mon Mar 11 03:25:26 2013
@@ -0,0 +1,52 @@
+/**
+ * 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.ws.rm;
+
+
+import org.apache.cxf.test.AbstractCXFSpringTest;
+import org.apache.cxf.testutil.common.TestUtil;
+
+import org.junit.Test;
+
+import org.springframework.context.support.GenericApplicationContext;
+
+
+
+//CXF-4875
+public class WSRMPolicyResolveTest extends AbstractCXFSpringTest {
+    public static final String PORT = TestUtil.getPortNumber(WSRMPolicyResolveTest.class);
+    /** {@inheritDoc}*/
+    @Override
+    protected void additionalSpringConfiguration(GenericApplicationContext context) throws
Exception {
+    }
+    
+    @Test
+    public void testHello() throws Exception {
+        BasicDocEndpoint port = getApplicationContext().getBean("TestClient",
+                  BasicDocEndpoint.class);
+        Object retObj = port.echo("Hello");
+        assertEquals("Hello", retObj);
+    }
+
+    /** {@inheritDoc}*/
+    @Override
+    protected String[] getConfigLocations() {
+        return new String[] {"classpath:/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml"
};
+    }
+}
\ No newline at end of file

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml?rev=1454984&view=auto
==============================================================================
--- cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml
(added)
+++ cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml
Mon Mar 11 03:25:26 2013
@@ -0,0 +1,44 @@
+<beans xmlns='http://www.springframework.org/schema/beans'
+	xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:beans='http://www.springframework.org/schema/beans'
+	xmlns:jaxws='http://cxf.apache.org/jaxws' xmlns:p="http://cxf.apache.org/policy"
+	xsi:schemaLocation='http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd 
+  http://www.w3.org/2006/07/ws-policy http://www.w3.org/2006/07/ws-policy.xsd 
+  http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd'>
+	<bean
+		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
+	<wsp:Policy wsu:Id="RM" xmlns:wsp="http://www.w3.org/2006/07/ws-policy"
+		xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+		<wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
+			<wsp:Policy />
+		</wsam:Addressing>
+		<wsrmp:RMAssertion xmlns:wsrmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy">
+			<wsrmp:BaseRetransmissionInterval
+				Milliseconds="10000" />
+		</wsrmp:RMAssertion>
+	</wsp:Policy>
+
+	<jaxws:endpoint id='RMService'
+		address="http://localhost:${testutil.ports.WSRMPolicyResolveTest}/wsrmPolicyResolve"
+		implementor='org.apache.cxf.systest.ws.rm.BasicDocEndpointImpl'>
+		<jaxws:features>
+			<p:policies>
+				<wsp:PolicyReference URI="#RM"
+					xmlns:wsp="http://www.w3.org/2006/07/ws-policy" />
+			</p:policies>
+		</jaxws:features>
+	</jaxws:endpoint>
+
+	<jaxws:client id="TestClient"
+		serviceClass="org.apache.cxf.systest.ws.rm.BasicDocEndpoint"
+		address="http://localhost:${testutil.ports.WSRMPolicyResolveTest}/wsrmPolicyResolve">
+		<jaxws:features>
+			<p:policies>
+				<wsp:PolicyReference URI="#RM"
+					xmlns:wsp="http://www.w3.org/2006/07/ws-policy" />
+			</p:policies>
+		</jaxws:features>
+	</jaxws:client>
+
+
+</beans>
\ No newline at end of file

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message