Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java?view=diff&rev=509980&r1=509979&r2=509980 ============================================================================== --- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java (original) +++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java Wed Feb 21 04:02:05 2007 @@ -42,9 +42,10 @@ import org.apache.cxf.ws.policy.AssertionBuilderRegistry; import org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl; import org.apache.cxf.ws.policy.PolicyBuilderImpl; +import org.apache.cxf.ws.policy.PolicyConstants; import org.apache.cxf.ws.policy.PolicyException; import org.apache.cxf.ws.policy.PolicyRegistryImpl; -import org.apache.cxf.ws.policy.builders.xml.XMLPrimitiveAssertionBuilder; +import org.apache.cxf.ws.policy.builder.xml.XMLPrimitiveAssertionBuilder; import org.apache.cxf.wsdl.WSDLManager; import org.apache.cxf.wsdl11.WSDLManagerImpl; import org.apache.cxf.wsdl11.WSDLServiceBuilder; @@ -64,7 +65,8 @@ private static final QName OPERATION_NAME = new QName(NAMESPACE_URI, "add"); private static ServiceInfo[] services; private static EndpointInfo[] endpoints; - private Wsdl11AttachmentPolicyProvider app; + private Wsdl11AttachmentPolicyProvider app; + private String originalNamespace; public static Test suite() { @@ -101,7 +103,7 @@ EasyMock.expect(bfm.getBindingFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes(); control.replay(); - int n = 17; + int n = 18; services = new ServiceInfo[n]; endpoints = new EndpointInfo[n]; for (int i = 0; i < n; i++) { @@ -140,6 +142,14 @@ app = new Wsdl11AttachmentPolicyProvider(); app.setBuilder(pb); app.setRegistry(new PolicyRegistryImpl()); + + // test data uses 2004/09 namespace + originalNamespace = PolicyConstants.getNamespace(); + PolicyConstants.setNamespace(PolicyConstants.NAMESPACE_XMLSOAP_200409); + } + + public void tearDown() { + PolicyConstants.setNamespace(originalNamespace); } public void testElementPolicies() throws WSDLException { @@ -358,21 +368,33 @@ fail("Expected PolicyException not thrown."); } catch (PolicyException ex) { // expected - } + } + } + + public void testResolveExternal() { + // service has one extension of type PolicyReference, reference is external + Policy p = app.getElementPolicy(services[17]); + verifyAssertionsOnly(p, 2); - // binding has one extension of type PolicyReference, reference is external + // port has one extension of type PolicyReference, reference cannot be resolved because + // referenced document does not contain policy with the required if try { - app.getElementPolicy(endpoints[16].getBinding()); + app.getElementPolicy(endpoints[17]); fail("Expected PolicyException not thrown."); } catch (PolicyException ex) { // expected - } + } + // binding has one extension of type PolicyReference, reference cannot be resolved because + // referenced document cannot be found + try { + app.getElementPolicy(endpoints[17].getBinding()); + fail("Expected PolicyException not thrown."); + } catch (PolicyException ex) { + // expected + } } - public void testResolveExternal() { - - } private void verifyAssertionsOnly(Policy p, int expectedAssertions) { List<PolicyComponent> pcs;
Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java?view=diff&rev=509980&r1=509965&r2=509980 ============================================================================== --- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java (original) +++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java Wed Feb 21 04:02:05 2007 @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.cxf.ws.policy.builders.primitive; +package org.apache.cxf.ws.policy.builder.primitive; import java.io.InputStream; import java.util.ArrayList; @@ -31,6 +31,7 @@ import org.apache.cxf.ws.policy.AssertionBuilderRegistry; import org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl; import org.apache.cxf.ws.policy.PolicyBuilderImpl; +import org.apache.cxf.ws.policy.PolicyConstants; import org.apache.cxf.ws.policy.util.PolicyComparator; import org.apache.neethi.Assertion; import org.apache.neethi.Policy; @@ -46,6 +47,8 @@ private static final QName TEST_NAME1 = new QName(TEST_NAMESPACE, "Addressing"); private static final QName TEST_NAME2 = new QName(TEST_NAMESPACE, "AnonymousResponses"); private static final QName TEST_NAME3 = new QName(TEST_NAMESPACE, "NonAnonymousResponses"); + + private String originalNamespace; private PolicyBuilderImpl builder; @@ -66,6 +69,13 @@ pab.setKnownElements(known); abr.register(TEST_NAME2, pab); abr.register(TEST_NAME3, pab); + + originalNamespace = PolicyConstants.getNamespace(); + PolicyConstants.setNamespace(PolicyConstants.NAMESPACE_XMLSOAP_200409); + } + + public void tearDown() { + PolicyConstants.setNamespace(originalNamespace); } public void testBuildNonNested() throws Exception { Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml?view=diff&rev=509980&r1=509979&r2=509980 ============================================================================== --- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml (original) +++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/policy-bus.xml Wed Feb 21 04:02:05 2007 @@ -33,5 +33,11 @@ <bean class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor"/> <bean class="org.apache.cxf.bus.spring.BusExtensionPostProcessor"/> <import resource="../../../../../META-INF/cxf/cxf-extension-policy.xml"/> + + <!-- + <bean class="org.apache.cxf.ws.policy.attachment.external.ExternalAttachmentProvider"> + <property name="uri" value="test-externals.xml"/> + </bean> + --> </beans> Modified: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test16.wsdl URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test16.wsdl?view=diff&rev=509980&r1=509979&r2=509980 ============================================================================== --- incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test16.wsdl (original) +++ incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test16.wsdl Wed Feb 21 04:02:05 2007 @@ -57,7 +57,7 @@ <soap12:fault name="addNumbersFault" use="literal" /> </fault> </operation> - <wsp:PolicyReference URI="http://example.org/test.wsdl#PolicyC"/> + <wsp:PolicyReference URI="test16-ext.wsdl#PolicyC"/> </binding> <service name="CalculatorService"> Added: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17-ext.wsdl URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17-ext.wsdl?view=auto&rev=509980 ============================================================================== --- incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17-ext.wsdl (added) +++ incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17-ext.wsdl Wed Feb 21 04:02:05 2007 @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> + +<definitions name="Calculator" + targetNamespace="http://apache.org/cxf/calculator" + xmlns:tns="http://apache.org/cxf/calculator" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:x1="http://apache.org/cxf/calculator/types" + xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" + xmlns:ta="http://cxf.apache.org/test/assertions" + xmlns:rmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" + xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy" + xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" + xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > + + <wsp:Policy wsu:Id="PolicyA"> + <ta:A>A</ta:A> + <ta:B>B></ta:B> + </wsp:Policy> + + <wsp:Policy wsu:Id="PolicyC"> + <ta:C>C</ta:C> + </wsp:Policy> + +</definitions> Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17-ext.wsdl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17-ext.wsdl ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17-ext.wsdl ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17.wsdl URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17.wsdl?view=auto&rev=509980 ============================================================================== --- incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17.wsdl (added) +++ incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17.wsdl Wed Feb 21 04:02:05 2007 @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> + +<definitions name="Calculator" + targetNamespace="http://apache.org/cxf/calculator" + xmlns:tns="http://apache.org/cxf/calculator" + xmlns="http://schemas.xmlsoap.org/wsdl/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:x1="http://apache.org/cxf/calculator/types" + xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" + xmlns:ta="http://cxf.apache.org/test/assertions" + xmlns:rmp="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" + xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy" + xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" + xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > + + <import namespace="http://apache.org/cxf/calculator" + location="calculator-abstract.wsdl" /> + + <binding name="CalculatorBinding" type="tns:CalculatorPortType"> + <soap12:binding transport="http://www.w3.org/2003/05/soap/bindings/HTTP/" style="document" /> + <operation name="add"> + <soap12:operation soapAction="" /> + <input> + <soap12:body use="literal" /> + </input> + <output> + <soap12:body use="literal" /> + </output> + <fault name="addNumbersFault"> + <soap12:fault name="addNumbersFault" use="literal" /> + </fault> + </operation> + <wsp:PolicyReference URI="test17-ex.wsdl#PolicyC"/> + </binding> + + <service name="CalculatorService"> + <wsp:PolicyReference URI="test17-ext.wsdl#PolicyA"/> + <port name="CalculatorPort" binding="tns:CalculatorBinding"> + <wsp:PolicyReference URI="test17-ext.wsdl#PolicyB"/> + <soap12:address location="http://localhost:9000/CalculatorService/SoapPort" /> + </port> + </service> + +</definitions> Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17.wsdl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17.wsdl ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/resources/attachment/wsdl11/test17.wsdl ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml?view=diff&rev=509980&r1=509979&r2=509980 ============================================================================== --- incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml (original) +++ incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml Wed Feb 21 04:02:05 2007 @@ -29,60 +29,56 @@ <!-- global definition of interceptors, may need to switch qualified names --> - <bean id="mapAggregator" class="org.apache.cxf.ws.addressing.MAPAggregator"/> - <bean id="mapCodec" class="org.apache.cxf.ws.addressing.soap.MAPCodec"/> - <bean id="rmLogicalOut" class="org.apache.cxf.ws.rm.RMOutInterceptor"> + <bean class="org.apache.cxf.ws.rm.RMOutInterceptor"> <property name="bus" ref="cxf"/> </bean> - <bean id="rmLogicalIn" class="org.apache.cxf.ws.rm.RMInInterceptor"> + <bean class="org.apache.cxf.ws.rm.RMInInterceptor"> <property name="bus" ref="cxf"/> </bean> - <bean id="rmCodec" class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/> + <bean class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/> - <bean class="org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider"> + <bean class="org.apache.cxf.ws.policy.PolicyInterceptorProviderImpl"> + <constructor-arg> + <list> + <bean class="javax.xml.namespace.QName"> + <constructor-arg value="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"/> + <constructor-arg value="RMAssertion"/> + </bean> + </list> + </constructor-arg> <property name="inInterceptors"> <list> - <ref bean="mapAggregator"/> - <ref bean="mapCodec"/> - <ref bean="rmLogicalIn"/> - <ref bean="rmCodec"/> + <ref bean="org.apache.cxf.ws.rm.RMInInterceptor"/> + <ref bean="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/> </list> </property> <property name="inFaultInterceptors"> <list> - <ref bean="mapAggregator"/> - <!-- - <ref bean="mapCodec"/> - --> - <ref bean="rmLogicalIn"/> - <ref bean="rmCodec"/> + <ref bean="org.apache.cxf.ws.rm.RMInInterceptor"/> + <ref bean="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/> </list> </property> <property name="outInterceptors"> <list> - <ref bean="mapAggregator"/> - <ref bean="mapCodec"/> - <ref bean="rmLogicalOut"/> - <ref bean="rmCodec"/> + <ref bean="org.apache.cxf.ws.rm.RMOutInterceptor"/> + <ref bean="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/> </list> </property> <property name="outFaultInterceptors"> <list> - <ref bean="mapAggregator"/> - <ref bean="mapCodec"/> - <ref bean="rmLogicalOut"/> - <ref bean="rmCodec"/> + <ref bean="org.apache.cxf.ws.rm.RMOutInterceptor"/> + <ref bean="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/> </list> </property> </bean> - <bean id="org.apache.cxf.ws.rm.RMAssertionBuilder" class="org.apache.cxf.ws.policy.builders.jaxb.JaxbAssertionBuilder"> + <bean id="org.apache.cxf.ws.rm.RMAssertionBuilder" class="org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder"> <constructor-arg value="org.apache.cxf.ws.rm.policy.RMAssertion"/> <constructor-arg> <bean class="javax.xml.namespace.QName"> - <constructor-arg value="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"/> - <constructor-arg value="RMAssertion"/> - </bean> + <constructor-arg value="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"/> + <constructor-arg value="RMAssertion"/> + </bean> </constructor-arg> </bean>
