You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ds...@apache.org on 2013/07/02 23:46:41 UTC
svn commit: r1499123 - in /cxf/trunk/rt/ws/rm: ./
src/main/java/org/apache/cxf/ws/rm/
src/main/java/org/apache/cxf/ws/rm/feature/
src/main/java/org/apache/cxf/ws/rm/policy/ src/main/resources/META-INF/cxf/
src/test/java/org/apache/cxf/ws/rm/
Author: dsosnoski
Date: Tue Jul 2 21:46:40 2013
New Revision: 1499123
URL: http://svn.apache.org/r1499123
Log:
CXF-4139 Restructure policy handling to work with WS-RMP 1.2, use
configuration adjusted by policy to control operation.
Removed:
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12Assertion.java
Modified:
cxf/trunk/rt/ws/rm/pom.xml
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/feature/RMFeature.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10AssertionBuilder.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java
cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
Modified: cxf/trunk/rt/ws/rm/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/pom.xml?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/pom.xml (original)
+++ cxf/trunk/rt/ws/rm/pom.xml Tue Jul 2 21:46:40 2013
@@ -91,6 +91,11 @@
<artifactId>cxf-rt-management</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.wss4j</groupId>
+ <artifactId>wss4j-policy</artifactId>
+ <version>${cxf.wss4j.version}</version>
+ </dependency>
<dependency>
<groupId>junit</groupId>
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java Tue Jul 2 21:46:40 2013
@@ -41,7 +41,6 @@ import org.apache.cxf.ws.rm.RMConfigurat
import org.apache.cxf.ws.rm.manager.AcksPolicyType;
import org.apache.cxf.ws.rm.persistence.RMMessage;
import org.apache.cxf.ws.rm.persistence.RMStore;
-import org.apache.cxf.ws.rm.policy.RMPolicyUtilities;
import org.apache.cxf.ws.rm.v200702.Identifier;
import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement;
import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement.AcknowledgementRange;
@@ -174,11 +173,10 @@ public class DestinationSequence extends
store.persistIncoming(this, msg);
}
- RMConfiguration cfg = destination.getManager().getConfiguration();
- cfg = RMPolicyUtilities.getRMConfiguration(cfg, message);
+ RMEndpoint reliableEndpoint = destination.getReliableEndpoint();
+ RMConfiguration cfg = reliableEndpoint.getConfiguration();
- long acknowledgementInterval = cfg.getAcknowledgementIntervalTime();
- scheduleAcknowledgement(acknowledgementInterval);
+ scheduleAcknowledgement(cfg.getAcknowledgementIntervalTime());
long inactivityTimeout = cfg.getInactivityTimeoutTime();
scheduleSequenceTermination(inactivityTimeout);
@@ -237,7 +235,7 @@ public class DestinationSequence extends
*/
boolean applyDeliveryAssurance(long mn, Message message) throws RMException {
Continuation cont = getContinuation(message);
- RMConfiguration config = destination.getManager().getConfiguration();
+ RMConfiguration config = destination.getReliableEndpoint().getConfiguration();
DeliveryAssurance da = config.getDeliveryAssurance();
boolean canSkip = da != DeliveryAssurance.AT_LEAST_ONCE && da != DeliveryAssurance.EXACTLY_ONCE;
boolean robust = false;
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConfiguration.java Tue Jul 2 21:46:40 2013
@@ -19,7 +19,6 @@
package org.apache.cxf.ws.rm;
-import org.apache.cxf.ws.rm.manager.RM10AddressingNamespaceType;
/**
* Configuration parameters for reliable messaging. These may be defined by a combination of Spring/Blueprint
@@ -39,7 +38,7 @@ public class RMConfiguration {
private boolean inOrder;
private DeliveryAssurance deliveryAssurance;
private String rmNamespace;
- private RM10AddressingNamespaceType rm10AddressingNamespace;
+ private String rm10AddressingNamespace;
/**
* Constructor.
@@ -59,6 +58,7 @@ public class RMConfiguration {
exponentialBackoff = base.exponentialBackoff;
sequenceSTRRequired = base.sequenceSTRRequired;
sequenceTransportSecurityRequired = base.sequenceTransportSecurityRequired;
+ inOrder = base.inOrder;
deliveryAssurance = base.deliveryAssurance;
rmNamespace = base.rmNamespace;
rm10AddressingNamespace = base.rm10AddressingNamespace;
@@ -201,19 +201,11 @@ public class RMConfiguration {
rmNamespace = uri;
}
- public RM10AddressingNamespaceType getRM10AddressingNamespace() {
+ public String getRM10AddressingNamespace() {
return rm10AddressingNamespace;
}
- public void setRM10AddressingNamespace(RM10AddressingNamespaceType addrns) {
+ public void setRM10AddressingNamespace(String addrns) {
rm10AddressingNamespace = addrns;
}
-
- /**
- * @return protocol variation
- */
- public ProtocolVariation getConfiguredProtocol() {
- String addrns = rm10AddressingNamespace == null ? null : rm10AddressingNamespace.getUri();
- return ProtocolVariation.findVariant(getRMNamespace(), addrns);
- }
}
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Tue Jul 2 21:46:40 2013
@@ -103,6 +103,7 @@ public class RMEndpoint {
private AtomicInteger controlMessageCount;
private InstrumentationManager instrumentationManager;
private ManagedRMEndpoint managedEndpoint;
+ private RMConfiguration configuration;
/**
* Constructor.
@@ -252,6 +253,15 @@ public class RMEndpoint {
public Conduit getConduit() {
return conduit;
}
+
+ /**
+ * Get the RM configuration applied to this endpoint.
+ *
+ * @return configuration
+ */
+ public RMConfiguration getConfiguration() {
+ return configuration;
+ }
/**
* Returns the replyTo address of the first application request, i.e. the
@@ -264,9 +274,9 @@ public class RMEndpoint {
return replyTo;
}
- void initialise(Conduit c,
- EndpointReferenceType r,
- org.apache.cxf.transport.Destination d) {
+ void initialise(RMConfiguration config, Conduit c, EndpointReferenceType r,
+ org.apache.cxf.transport.Destination d) {
+ configuration = config;
conduit = c;
replyTo = r;
createServices();
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Tue Jul 2 21:46:40 2013
@@ -67,6 +67,7 @@ import org.apache.cxf.ws.rm.manager.RM10
import org.apache.cxf.ws.rm.manager.SourcePolicyType;
import org.apache.cxf.ws.rm.persistence.RMMessage;
import org.apache.cxf.ws.rm.persistence.RMStore;
+import org.apache.cxf.ws.rm.policy.RMPolicyUtilities;
import org.apache.cxf.ws.rm.soap.RetransmissionQueueImpl;
import org.apache.cxf.ws.rm.soap.SoapFaultFactory;
import org.apache.cxf.ws.rm.v200702.CloseSequenceType;
@@ -148,7 +149,7 @@ public class RMManager {
public void setRM10AddressingNamespace(RM10AddressingNamespaceType addrns) {
RMConfiguration cfg = forceConfiguration();
- cfg.setRM10AddressingNamespace(addrns);
+ cfg.setRM10AddressingNamespace(addrns.getUri());
}
public Bus getBus() {
@@ -237,6 +238,8 @@ public class RMManager {
}
/**
+ * Get base configuration for manager. This needs to be modified by endpoint policies to get the effective
+ * configuration.
* @return configuration (non-<code>null</code>)
*/
public RMConfiguration getConfiguration() {
@@ -268,23 +271,7 @@ public class RMManager {
* @param rma The rmAssertion to set.
*/
public void setRMAssertion(org.apache.cxf.ws.rmp.v200502.RMAssertion rma) {
- RMConfiguration cfg = getConfiguration();
- cfg.setExponentialBackoff(rma.getExponentialBackoff() != null);
- org.apache.cxf.ws.rmp.v200502.RMAssertion.InactivityTimeout inactTimeout
- = rma.getInactivityTimeout();
- if (inactTimeout != null) {
- cfg.setInactivityTimeout(inactTimeout.getMilliseconds());
- }
- org.apache.cxf.ws.rmp.v200502.RMAssertion.BaseRetransmissionInterval bri
- = rma.getBaseRetransmissionInterval();
- if (bri != null) {
- cfg.setBaseRetransmissionInterval(bri.getMilliseconds());
- }
- org.apache.cxf.ws.rmp.v200502.RMAssertion.AcknowledgementInterval ackInterval
- = rma.getAcknowledgementInterval();
- if (ackInterval != null) {
- cfg.setAcknowledgementInterval(ackInterval.getMilliseconds());
- }
+ setConfiguration(RMPolicyUtilities.intersect(rma, getConfiguration()));
}
/**
@@ -320,8 +307,9 @@ public class RMManager {
WrappedEndpoint wrappedEndpoint = (WrappedEndpoint)endpoint;
endpoint = wrappedEndpoint.getWrappedEndpoint();
}
- String rmUri = getRMNamespace(message);
- String addrUri = getAddressingNamespace(message);
+ RMConfiguration dflt = getConfiguration();
+ String rmUri = getRMNamespace(dflt, message);
+ String addrUri = getAddressingNamespace(dflt, message);
ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, addrUri);
if (protocol == null) {
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message(
@@ -343,7 +331,8 @@ public class RMManager {
= ei == null ? null : ei.getEndpointInfo()
.getProperty(MAPAggregator.DECOUPLED_DESTINATION,
org.apache.cxf.transport.Destination.class);
- rme.initialise(message.getExchange().getConduit(message), replyTo, dest);
+ RMConfiguration config = RMPolicyUtilities.getRMConfiguration(getConfiguration(), message);
+ rme.initialise(config, message.getExchange().getConduit(message), replyTo, dest);
reliableEndpoints.put(endpoint, rme);
LOG.fine("Created new RMEndpoint.");
}
@@ -352,12 +341,13 @@ public class RMManager {
/**
* Get the WS-Addressing namespace being used for a message. If the WS-Addressing namespace has not been
- * set, this returns the default configured for this manager.
+ * set, this returns the default from the supplied configuration.
*
+ * @param config
* @param message
* @return namespace URI
*/
- public String getAddressingNamespace(Message message) {
+ String getAddressingNamespace(RMConfiguration config, Message message) {
String addrUri = (String)message.getContextualProperty(WSRM_WSA_VERSION_PROPERTY);
if (addrUri == null) {
AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, false, false);
@@ -365,20 +355,40 @@ public class RMManager {
addrUri = maps.getNamespaceURI();
}
if (addrUri == null) {
- addrUri = forceConfiguration().getConfiguredProtocol().getWSANamespace();
+ addrUri = ProtocolVariation.findVariant(config.getRMNamespace(), config.getRM10AddressingNamespace())
+ .getWSANamespace();
}
}
return addrUri;
}
/**
- * Get the WS-RM namespace being used for a message. If the WS-RM namespace has not been set, this returns
- * the default configured for this manager.
+ * Get the WS-Addressing namespace being used for a message. If the WS-Addressing namespace has not been set, this
+ * returns the best default.
*
* @param message
* @return namespace URI
*/
- String getRMNamespace(Message message) {
+ public String getAddressingNamespace(Message message) {
+ RMConfiguration config = null;
+ try {
+ config = getReliableEndpoint(message).getConfiguration();
+ } catch (RMException e) {
+ // only happens with invalid namespace combination, just fall back to manager default
+ config = getConfiguration();
+ }
+ return getAddressingNamespace(config, message);
+ }
+
+ /**
+ * Get the WS-RM namespace being used for a message. If the WS-RM namespace has not been set, this returns the
+ * default from the supplied configuration.
+ *
+ * @param config
+ * @param message
+ * @return namespace URI
+ */
+ String getRMNamespace(RMConfiguration config, Message message) {
String rmUri = (String)message.getContextualProperty(WSRM_VERSION_PROPERTY);
if (rmUri == null) {
RMProperties rmps = RMContextUtils.retrieveRMProperties(message, false);
@@ -386,12 +396,31 @@ public class RMManager {
rmUri = rmps.getNamespaceURI();
}
if (rmUri == null) {
- rmUri = getConfiguration().getRMNamespace();
+ rmUri = ProtocolVariation.findVariant(config.getRMNamespace(), config.getRM10AddressingNamespace())
+ .getWSRMNamespace();
}
}
return rmUri;
}
+ /**
+ * Get the WS-RM namespace being used for a message. If the WS-RM namespace has not been set, this returns the best
+ * default.
+ *
+ * @param message
+ * @return namespace URI
+ */
+ String getRMNamespace(Message message) {
+ RMConfiguration config = null;
+ try {
+ config = getReliableEndpoint(message).getConfiguration();
+ } catch (RMException e) {
+ // only happens with invalid namespace combination, just fall back to manager default
+ config = getConfiguration();
+ }
+ return getRMNamespace(config, message);
+ }
+
public Destination getDestination(Message message) throws RMException {
RMEndpoint rme = getReliableEndpoint(message);
if (null != rme) {
@@ -422,7 +451,7 @@ public class RMManager {
RelatesToType relatesTo = null;
if (isServer) {
AddressingProperties inMaps = RMContextUtils.retrieveMAPs(message, false, false);
- inMaps.exposeAs(getConfiguration().getConfiguredProtocol().getWSANamespace());
+ inMaps.exposeAs(getAddressingNamespace(message));
acksTo = RMUtils.createReference(inMaps.getTo().getValue());
to = inMaps.getReplyTo();
source.getReliableEndpoint().getServant().setUnattachedIdentifier(inSeqId);
@@ -532,7 +561,7 @@ public class RMManager {
LOG.log(Level.FINE, "Recovering {0} endpoint with id: {1}",
new Object[] {null == conduit ? "client" : "server", id});
RMEndpoint rme = createReliableEndpoint(endpoint);
- rme.initialise(conduit, null, null);
+ rme.initialise(getConfiguration(), conduit, null, null);
reliableEndpoints.put(endpoint, rme);
for (SourceSequence ss : sss) {
recoverSourceSequence(endpoint, conduit, rme.getSource(), ss);
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java Tue Jul 2 21:46:40 2013
@@ -64,26 +64,25 @@ public class RMOutInterceptor extends Ab
LogUtils.log(LOG, Level.WARNING, "MAPS_RETRIEVAL_FAILURE_MSG");
return;
}
- String rmUri = getManager().getRMNamespace(msg);
- String addrUri = getManager().getAddressingNamespace(msg);
+
+ String wsaNamespace = getManager().getAddressingNamespace(msg);
if (isRuntimeFault(msg)) {
LogUtils.log(LOG, Level.WARNING, "RUNTIME_FAULT_MSG");
// in case of a SequenceFault or other WS-RM related fault, set action appropriately.
// the received inbound maps is available to extract some values in case if needed.
Throwable cause = msg.getContent(Exception.class).getCause();
if (cause instanceof SequenceFault || cause instanceof RMException) {
- maps.getAction().setValue(RM11Constants.NAMESPACE_URI.equals(rmUri)
- ? RM11Constants.NAMESPACE_URI + "/fault"
- : addrUri + "/fault");
+ maps.getAction().setValue(wsaNamespace + "/fault");
}
return;
}
-
- Source source = getManager().getSource(msg);
- ProtocolVariation protocol = ProtocolVariation.findVariant(rmUri, addrUri);
+ Source source = getManager().getSource(msg);
+
+ String rmNamespace = getManager().getRMNamespace(msg);
+ ProtocolVariation protocol = ProtocolVariation.findVariant(rmNamespace, wsaNamespace);
RMContextUtils.setProtocolVariation(msg, protocol);
- maps.exposeAs(protocol.getWSANamespace());
+ maps.exposeAs(wsaNamespace);
Destination destination = getManager().getDestination(msg);
String action = null;
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/feature/RMFeature.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/feature/RMFeature.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/feature/RMFeature.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/feature/RMFeature.java Tue Jul 2 21:46:40 2013
@@ -107,7 +107,7 @@ public class RMFeature extends AbstractF
manager.getConfiguration().setRMNamespace(rmNamespace);
}
if (null != rm10AddressingNamespace) {
- manager.getConfiguration().setRM10AddressingNamespace(rm10AddressingNamespace);
+ manager.getConfiguration().setRM10AddressingNamespace(rm10AddressingNamespace.getUri());
}
rmLogicalIn.setBus(bus);
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10AssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10AssertionBuilder.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10AssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM10AssertionBuilder.java Tue Jul 2 21:46:40 2013
@@ -27,6 +27,7 @@ import javax.xml.namespace.QName;
import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
+import org.apache.cxf.ws.rm.RM10Constants;
import org.apache.cxf.ws.rm.RM11Constants;
import org.apache.cxf.ws.rmp.v200502.RMAssertion;
import org.apache.neethi.Assertion;
@@ -39,10 +40,10 @@ import org.apache.neethi.PolicyComponent
*/
public class RM10AssertionBuilder extends JaxbAssertionBuilder<RMAssertion> {
public static final List<QName> KNOWN_ELEMENTS
- = Collections.singletonList(RM11Constants.WSRMP_RMASSERTION_QNAME);
+ = Collections.singletonList(RM10Constants.WSRMP_RMASSERTION_QNAME);
public RM10AssertionBuilder() throws JAXBException {
- super(RMAssertion.class, RM11Constants.WSRMP_RMASSERTION_QNAME);
+ super(RMAssertion.class, RM10Constants.WSRMP_RMASSERTION_QNAME);
}
@Override
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RM12AssertionBuilder.java Tue Jul 2 21:46:40 2013
@@ -19,87 +19,117 @@
package org.apache.cxf.ws.rm.policy;
+import java.util.Map;
+
import javax.xml.namespace.QName;
import org.w3c.dom.Element;
-import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
import org.apache.cxf.ws.rm.RM11Constants;
-import org.apache.cxf.ws.rm.policy.RM12Assertion.Order;
import org.apache.neethi.Assertion;
import org.apache.neethi.AssertionBuilderFactory;
-import org.apache.neethi.Constants;
+import org.apache.neethi.Policy;
import org.apache.neethi.builders.AssertionBuilder;
+import org.apache.neethi.builders.PolicyContainingPrimitiveAssertion;
+import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
/**
- * Builds a WS-RMP 1.2 assertion from the raw XML. Unlike WS-RMP 1.0, in WS-RMP 1.2 the actual assertions are
- * nested within layers of <wsp:Policy> operators so need to be handled directly (not by JAXB).
+ * Builds a WS-RMP 1.2 assertion and nested assertions from the raw XML.
*/
public class RM12AssertionBuilder implements AssertionBuilder<Element> {
+
+ public static final String SEQUENCESTR_NAME = "SequenceSTR";
+ public static final String SEQUENCETRANSEC_NAME = "SequenceTransportSecurity";
+ public static final String DELIVERYASSURANCE_NAME = "DeliveryAssurance";
+ public static final String EXACTLYONCE_NAME = "ExactlyOnce";
+ public static final String ATLEASTONCE_NAME = "AtLeastOnce";
+ public static final String ATMOSTONCE_NAME = "AtMostOnce";
+ public static final String INORDER_NAME = "InOrder";
+
+ private static final QName SEQSTR_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, SEQUENCESTR_NAME);
+ private static final QName SEQTRANSSEC_QNAME =
+ new QName(RM11Constants.WSRMP_NAMESPACE_URI, SEQUENCETRANSEC_NAME);
+ private static final QName DELIVERYASSURANCE_QNAME =
+ new QName(RM11Constants.WSRMP_NAMESPACE_URI, DELIVERYASSURANCE_NAME);
+ private static final QName EXACTLYONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, EXACTLYONCE_NAME);
+ private static final QName ATLEASTONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, ATLEASTONCE_NAME);
+ private static final QName ATMOSTONCE_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, ATMOSTONCE_NAME);
+ private static final QName INORDER_QNAME = new QName(RM11Constants.WSRMP_NAMESPACE_URI, INORDER_NAME);
+
+ private static final QName[] KNOWN_ELEMENTS = {
+ RM11Constants.WSRMP_RMASSERTION_QNAME,
+ SEQSTR_QNAME,
+ SEQTRANSSEC_QNAME,
+ DELIVERYASSURANCE_QNAME,
+ EXACTLYONCE_QNAME,
+ ATLEASTONCE_QNAME,
+ ATMOSTONCE_QNAME,
+ INORDER_QNAME
+ };
/**
* @see org.apache.neethi.builders.AssertionBuilder#getKnownElements()
*/
public QName[] getKnownElements() {
- return new QName[] {RM11Constants.WSRMP_RMASSERTION_QNAME};
+ return KNOWN_ELEMENTS;
}
/**
- * @see org.apache.neethi.builders.AssertionBuilder#build(java.lang.Object,
+ * @see org.apache.neethi.builders.AssertionBuilder#build(org.w3c.dom.Element,
* org.apache.neethi.AssertionBuilderFactory)
*/
- public Assertion build(Element element, AssertionBuilderFactory factory) throws IllegalArgumentException {
-
- RM12Assertion assertion = new RM12Assertion();
- assertion.setOptional(PolicyConstants.isOptional(element));
- assertion.setIgnorable(PolicyConstants.isIgnorable(element));
-
- // dig into the nested structure to set property values
- Element elem = DOMUtils.getFirstElement(element);
- while (elem != null) {
- if (DOMUtils.getFirstChildWithName(elem,
- RM11Constants.WSRMP_NAMESPACE_URI, RM12Assertion.DELIVERYASSURANCE_NAME) != null) {
+ public Assertion build(Element elem, AssertionBuilderFactory factory) throws IllegalArgumentException {
+ Assertion assertion = null;
+ if (RM11Constants.WSRMP_NAMESPACE_URI.equals(elem.getNamespaceURI())) {
+ boolean optional = XMLPrimitiveAssertionBuilder.isOptional(elem);
+ String lname = elem.getLocalName();
+ if (RM11Constants.RMASSERTION_NAME.equals(lname)) {
- // find nested policy and definitions within (note this won't handle nested policy operators)
- Element childEl = DOMUtils.getFirstElement(elem);
- while (childEl != null) {
- if (Constants.isPolicyElement(childEl.getNamespaceURI(), childEl.getLocalName())) {
- handlePolicy(childEl, assertion);
+ // top-level RMAssertion, with nested policy
+ XMLPrimitiveAssertionBuilder nesting = new XMLPrimitiveAssertionBuilder() {
+ public Assertion newPrimitiveAssertion(Element element, Map<QName, String> mp) {
+ return new PrimitiveAssertion(RM11Constants.WSRMP_RMASSERTION_QNAME, isOptional(element),
+ isIgnorable(element), mp);
}
- }
-
- } else if (DOMUtils.getFirstChildWithName(elem,
- RM11Constants.WSRMP_NAMESPACE_URI, RM12Assertion.SEQUENCESTR_NAME) != null) {
- assertion.setSequenceSTR(true);
- } else if (DOMUtils.getFirstChildWithName(elem,
- RM11Constants.WSRMP_NAMESPACE_URI, RM12Assertion.SEQUENCETRANSEC_NAME) != null) {
- assertion.setSequenceTransportSecurity(true);
+ public Assertion newPolicyContainingAssertion(Element element, Map<QName, String> mp,
+ Policy policy) {
+ return new PolicyContainingPrimitiveAssertion(RM11Constants.WSRMP_RMASSERTION_QNAME,
+ isOptional(element), isIgnorable(element), mp, policy);
+ }
+ };
+ assertion = nesting.build(elem, factory);
+
+ } else if (SEQUENCESTR_NAME.equals(lname)) {
+ assertion = new PrimitiveAssertion(SEQSTR_QNAME, optional);
+ } else if (SEQUENCETRANSEC_NAME.equals(lname)) {
+ assertion = new PrimitiveAssertion(SEQTRANSSEC_QNAME, optional);
+ } else if (DELIVERYASSURANCE_NAME.equals(lname)) {
+
+ // DeliveryAssurance, with nested policy
+ XMLPrimitiveAssertionBuilder nesting = new XMLPrimitiveAssertionBuilder() {
+ public Assertion newPrimitiveAssertion(Element element, Map<QName, String> mp) {
+ return new PrimitiveAssertion(DELIVERYASSURANCE_QNAME, isOptional(element),
+ isIgnorable(element), mp);
+ }
+ public Assertion newPolicyContainingAssertion(Element element, Map<QName, String> mp,
+ Policy policy) {
+ return new PolicyContainingPrimitiveAssertion(DELIVERYASSURANCE_QNAME,
+ isOptional(element), isIgnorable(element), mp, policy);
+ }
+ };
+ assertion = nesting.build(elem, factory);
+
+ } else if (EXACTLYONCE_NAME.equals(lname)) {
+ assertion = new PrimitiveAssertion(EXACTLYONCE_QNAME, optional);
+ } else if (ATLEASTONCE_NAME.equals(lname)) {
+ assertion = new PrimitiveAssertion(ATLEASTONCE_QNAME, optional);
+ } else if (ATMOSTONCE_NAME.equals(lname)) {
+ assertion = new PrimitiveAssertion(ATMOSTONCE_QNAME, optional);
+ } else if (INORDER_NAME.equals(lname)) {
+ assertion = new PrimitiveAssertion(INORDER_QNAME, optional);
}
- elem = DOMUtils.getNextElement(elem);
}
-
return assertion;
}
-
- /**
- * @param childEl
- * @param assertion
- */
- private void handlePolicy(Element childEl, RM12Assertion assertion) {
-
- // don't check for conflicts or repeats, just use the last values supplied
- Element innerEl = DOMUtils.getFirstElement(childEl);
- if (RM11Constants.WSRMP_NAMESPACE_URI.equals(innerEl.getNamespaceURI())) {
- String lname = innerEl.getLocalName();
- if (RM12Assertion.INORDER_NAME.equals(lname)) {
- assertion.setInOrder(true);
- } else {
- Order order = RM12Assertion.Order.valueOf(lname);
- if (order != null) {
- assertion.setOrder(order);
- }
- }
- }
- }
}
\ No newline at end of file
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyUtilities.java Tue Jul 2 21:46:40 2013
@@ -31,8 +31,8 @@ import org.apache.cxf.ws.rm.RM11Constant
import org.apache.cxf.ws.rm.RMConfiguration;
import org.apache.cxf.ws.rm.RMConfiguration.DeliveryAssurance;
import org.apache.cxf.ws.rm.RMUtils;
-import org.apache.cxf.ws.rm.policy.RM12Assertion.Order;
import org.apache.cxf.ws.rmp.v200502.RMAssertion;
+import org.apache.neethi.builders.PrimitiveAssertion;
/**
* Utilities for working with policies and configurations.
@@ -57,9 +57,11 @@ public final class RMPolicyUtilities {
if (ai.getAssertion() instanceof JaxbAssertion<?>) {
RMAssertion rma = (RMAssertion)((JaxbAssertion<?>)ai.getAssertion()).getData();
compatible = intersect(rma, compatible);
- } else if (ai.getAssertion() instanceof RM12Assertion) {
- RM12Assertion rma = (RM12Assertion) ai.getAssertion();
- compatible = intersect(rma, compatible);
+ } else if (ai.getAssertion() instanceof PrimitiveAssertion) {
+ PrimitiveAssertion assertion = (PrimitiveAssertion)ai.getAssertion();
+ if (RM11Constants.WSRMP_NAMESPACE_URI.equals(assertion.getName().getNamespaceURI())) {
+ compatible = intersect(assertion, compatible);
+ }
}
}
return compatible;
@@ -156,8 +158,7 @@ public final class RMPolicyUtilities {
}
} else if (b.getRM10AddressingNamespace() == null) {
return false;
- } else if (!RMUtils.equalStrings(a.getRM10AddressingNamespace().getUri(),
- b.getRM10AddressingNamespace().getUri())) {
+ } else if (!RMUtils.equalStrings(a.getRM10AddressingNamespace(), b.getRM10AddressingNamespace())) {
return false;
}
if (!RMUtils.equalStrings(a.getRMNamespace(), b.getRMNamespace())) {
@@ -184,7 +185,7 @@ public final class RMPolicyUtilities {
return cfg;
}
- RMConfiguration compatible = new RMConfiguration();
+ RMConfiguration compatible = new RMConfiguration(cfg);
// if supplied, policy value overrides default inactivity timeout
Long aval = cfg.getInactivityTimeout();
@@ -285,40 +286,26 @@ public final class RMPolicyUtilities {
* @param cfg
* @return result configuration
*/
- public static RMConfiguration intersect(RM12Assertion rma, RMConfiguration cfg) {
+ public static RMConfiguration intersect(PrimitiveAssertion rma, RMConfiguration cfg) {
if (isCompatible(rma, cfg)) {
return cfg;
}
RMConfiguration compatible = new RMConfiguration(cfg);
-
- // policy values override supplied settings
- if (rma.isSequenceSTR()) {
+ String lname = rma.getName().getLocalPart();
+ if (RM11Constants.RMASSERTION_NAME.equals(lname)) {
+ compatible.setRMNamespace(RM11Constants.NAMESPACE_URI);
+ } else if (RM12AssertionBuilder.SEQUENCESTR_NAME.equals(lname)) {
compatible.setSequenceSTRRequired(true);
- }
- if (rma.isSequenceTransportSecurity()) {
+ } else if (RM12AssertionBuilder.SEQUENCETRANSEC_NAME.equals(lname)) {
compatible.setSequenceTransportSecurityRequired(true);
- }
- if (rma.isAssuranceSet()) {
- compatible.setInOrder(rma.isInOrder());
- DeliveryAssurance da = null;
- Order order = rma.getOrder();
- if (order != null) {
- switch (order) {
- case AtLeastOnce:
- da = DeliveryAssurance.AT_LEAST_ONCE;
- break;
- case AtMostOnce:
- da = DeliveryAssurance.AT_MOST_ONCE;
- break;
- case ExactlyOnce:
- da = DeliveryAssurance.EXACTLY_ONCE;
- break;
- default:
- // unreachable code, required by checkstyle
- break;
- }
- compatible.setDeliveryAssurance(da);
- }
+ } else if (RM12AssertionBuilder.EXACTLYONCE_NAME.equals(lname)) {
+ compatible.setDeliveryAssurance(DeliveryAssurance.EXACTLY_ONCE);
+ } else if (RM12AssertionBuilder.ATLEASTONCE_NAME.equals(lname)) {
+ compatible.setDeliveryAssurance(DeliveryAssurance.AT_LEAST_ONCE);
+ } else if (RM12AssertionBuilder.ATMOSTONCE_NAME.equals(lname)) {
+ compatible.setDeliveryAssurance(DeliveryAssurance.AT_MOST_ONCE);
+ } else if (RM12AssertionBuilder.INORDER_NAME.equals(lname)) {
+ compatible.setInOrder(true);
}
return compatible;
}
@@ -330,29 +317,24 @@ public final class RMPolicyUtilities {
* @param cfg
* @return <code>true</code> if compatible, <code>false</code> if not
*/
- public static boolean isCompatible(RM12Assertion rma, RMConfiguration cfg) {
- if ((rma.isSequenceSTR() && !cfg.isSequenceSTRRequired())
- || (rma.isSequenceTransportSecurity() && !cfg.isSequenceTransportSecurityRequired())) {
- return false;
- }
- if (rma.isInOrder() != cfg.isInOrder()) {
- return false;
- }
- Order order = rma.getOrder();
- DeliveryAssurance da = cfg.getDeliveryAssurance();
- if (order != null) {
- switch (order) {
- case AtLeastOnce:
- return da == DeliveryAssurance.AT_LEAST_ONCE;
- case AtMostOnce:
- return da == DeliveryAssurance.AT_MOST_ONCE;
- case ExactlyOnce:
- return da == DeliveryAssurance.EXACTLY_ONCE;
- default:
- // unreachable code, required by checkstyle
- break;
- }
+ public static boolean isCompatible(PrimitiveAssertion rma, RMConfiguration cfg) {
+ String lname = rma.getName().getLocalPart();
+ boolean compatible = true;
+ if (RM11Constants.RMASSERTION_NAME.equals(lname)) {
+ compatible = RM11Constants.WSRMP_NAMESPACE_URI.equals(cfg.getRMNamespace());
+ } else if (RM12AssertionBuilder.SEQUENCESTR_NAME.equals(lname)) {
+ compatible = cfg.isSequenceSTRRequired();
+ } else if (RM12AssertionBuilder.SEQUENCETRANSEC_NAME.equals(lname)) {
+ compatible = cfg.isSequenceTransportSecurityRequired();
+ } else if (RM12AssertionBuilder.EXACTLYONCE_NAME.equals(lname)) {
+ compatible = cfg.getDeliveryAssurance() == DeliveryAssurance.EXACTLY_ONCE;
+ } else if (RM12AssertionBuilder.ATLEASTONCE_NAME.equals(lname)) {
+ compatible = cfg.getDeliveryAssurance() == DeliveryAssurance.AT_LEAST_ONCE;
+ } else if (RM12AssertionBuilder.ATMOSTONCE_NAME.equals(lname)) {
+ compatible = cfg.getDeliveryAssurance() == DeliveryAssurance.AT_MOST_ONCE;
+ } else if (RM12AssertionBuilder.INORDER_NAME.equals(lname)) {
+ compatible = cfg.isInOrder();
}
- return true;
+ return compatible;
}
}
\ No newline at end of file
Modified: cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt (original)
+++ cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/bus-extensions.txt Tue Jul 2 21:46:40 2013
@@ -1,5 +1,6 @@
org.apache.cxf.ws.rm.RMManager::true
org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider::true:true
-org.apache.cxf.ws.rm.policy.RMAssertionBuilder::true:true
-org.apache.cxf.ws.rm.policy.RM11AssertionBuilder::true:true
+org.apache.cxf.ws.rm.policy.RM10AssertionBuilder::true:true
+org.apache.cxf.ws.rm.policy.RM12AssertionBuilder::true:true
+org.apache.cxf.ws.rm.policy.WSRMP12PolicyLoader::true:true
Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java Tue Jul 2 21:46:40 2013
@@ -54,6 +54,7 @@ public class DestinationSequenceTest ext
private EndpointReferenceType ref;
private Destination destination;
private RMManager manager;
+ private RMEndpoint endpoint;
private RMConfiguration config;
private AcksPolicyType ap;
private DestinationPolicyType dp;
@@ -477,8 +478,8 @@ public class DestinationSequenceTest ext
control.reset();
ranges.add(r);
- EasyMock.expect(destination.getManager()).andReturn(manager);
- EasyMock.expect(manager.getConfiguration()).andReturn(config);
+ EasyMock.expect(destination.getReliableEndpoint()).andReturn(endpoint);
+ EasyMock.expect(endpoint.getConfiguration()).andReturn(config).anyTimes();
EasyMock.expect(ack.getAcknowledgementRange()).andReturn(ranges);
EasyMock.expect(r.getLower()).andReturn(new Long(5));
EasyMock.expect(r.getUpper()).andReturn(new Long(15));
@@ -709,7 +710,7 @@ public class DestinationSequenceTest ext
setUpDestination(null, null);
}
- private void setUpDestination(Timer timer, RMEndpoint endpoint) {
+ private void setUpDestination(Timer timer, RMEndpoint rme) {
manager = control.createMock(RMManager.class);
@@ -722,15 +723,17 @@ public class DestinationSequenceTest ext
config = new RMConfiguration();
config.setBaseRetransmissionInterval(new Long(3000));
EasyMock.expect(manager.getConfiguration()).andReturn(config).anyTimes();
+ endpoint = rme;
+ if (endpoint == null) {
+ endpoint = control.createMock(RMEndpoint.class);
+ }
+ EasyMock.expect(endpoint.getConfiguration()).andReturn(config).anyTimes();
EasyMock.expect(manager.getDestinationPolicy()).andReturn(dp).anyTimes();
EasyMock.expect(manager.getStore()).andReturn(null).anyTimes();
destination = control.createMock(Destination.class);
EasyMock.expect(destination.getManager()).andReturn(manager).anyTimes();
- if (endpoint == null) {
- endpoint = EasyMock.createMock(RMEndpoint.class);
- }
EasyMock.expect(destination.getReliableEndpoint()).andReturn(endpoint).anyTimes();
if (null != timer) {
Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java Tue Jul 2 21:46:40 2013
@@ -150,7 +150,7 @@ public class RMEndpointTest extends Asse
Conduit c = control.createMock(Conduit.class);
EndpointReferenceType epr = control.createMock(EndpointReferenceType.class);
control.replay();
- rme.initialise(c, epr, null);
+ rme.initialise(new RMConfiguration(), c, epr, null);
assertSame(c, rme.getConduit());
assertSame(epr, rme.getReplyTo());
}
Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerConfigurationTest.java Tue Jul 2 21:46:40 2013
@@ -80,8 +80,7 @@ public class RMManagerConfigurationTest
assertEquals(2000L, manager.getDestinationPolicy().getAcksPolicy().getImmediaAcksTimeout());
assertEquals(10000L, manager.getConfiguration().getBaseRetransmissionInterval().longValue());
assertEquals(10000L, manager.getConfiguration().getAcknowledgementInterval().longValue());
- assertEquals("http://www.w3.org/2005/08/addressing",
- manager.getConfiguration().getRM10AddressingNamespace().getUri());
+ assertEquals("http://www.w3.org/2005/08/addressing", manager.getConfiguration().getRM10AddressingNamespace());
TestStore store = (TestStore)manager.getStore();
assertEquals("here", store.getLocation());
assertTrue(manager.getConfiguration().isInOrder());
Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java Tue Jul 2 21:46:40 2013
@@ -206,16 +206,11 @@ public class RMManagerTest extends Asser
public void testGetReliableEndpointServerSideCreate() throws NoSuchMethodException, RMException {
Method m1 = RMManager.class.getDeclaredMethod("createReliableEndpoint",
new Class[] {Endpoint.class});
- Method m2 = RMManager.class.getDeclaredMethod("getRMNamespace", new Class[] {Message.class});
- Method m3 = RMManager.class.getDeclaredMethod("getAddressingNamespace", new Class[] {Message.class});
- manager = control.createMock(RMManager.class, new Method[] {m1, m2, m3});
+ manager = control.createMock(RMManager.class, new Method[] {m1});
manager.setReliableEndpointsMap(new HashMap<Endpoint, RMEndpoint>());
Message message = control.createMock(Message.class);
Exchange exchange = control.createMock(Exchange.class);
EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes();
- EasyMock.expect(manager.getRMNamespace(message)).andReturn(RM10Constants.NAMESPACE_URI).anyTimes();
- EasyMock.expect(manager.getAddressingNamespace(message)).andReturn(Names200408.WSA_NAMESPACE_NAME)
- .anyTimes();
WrappedEndpoint wre = control.createMock(WrappedEndpoint.class);
EasyMock.expect(exchange.get(Endpoint.class)).andReturn(wre).anyTimes();
EndpointInfo ei = control.createMock(EndpointInfo.class);
@@ -237,7 +232,7 @@ public class RMManagerTest extends Asser
EndpointReferenceType replyTo = RMUtils.createAnonymousReference();
EasyMock.expect(maps.getReplyTo()).andReturn(replyTo).anyTimes();
EasyMock.expect(exchange.getConduit(message)).andReturn(null).anyTimes();
- rme.initialise(null, replyTo, null);
+ rme.initialise(manager.getConfiguration(), null, replyTo, null);
EasyMock.expectLastCall();
control.replay();
@@ -250,9 +245,6 @@ public class RMManagerTest extends Asser
EasyMock.expect(wre.getEndpointInfo()).andReturn(ei);
EasyMock.expect(ei.getName()).andReturn(name);
EasyMock.expect(wre.getWrappedEndpoint()).andReturn(e);
- EasyMock.expect(manager.getRMNamespace(message)).andReturn(RM10Constants.NAMESPACE_URI).anyTimes();
- EasyMock.expect(manager.getAddressingNamespace(message)).andReturn(Names200408.WSA_NAMESPACE_NAME)
- .anyTimes();
control.replay();
assertSame(rme, manager.getReliableEndpoint(message));
@@ -263,9 +255,7 @@ public class RMManagerTest extends Asser
public void testGetReliableEndpointClientSideCreate() throws NoSuchMethodException, RMException {
Method m1 = RMManager.class.getDeclaredMethod("createReliableEndpoint",
new Class[] {Endpoint.class});
- Method m2 = RMManager.class.getDeclaredMethod("getRMNamespace", new Class[] {Message.class});
- Method m3 = RMManager.class.getDeclaredMethod("getAddressingNamespace", new Class[] {Message.class});
- manager = control.createMock(RMManager.class, new Method[] {m1, m2, m3});
+ manager = control.createMock(RMManager.class, new Method[] {m1});
manager.setReliableEndpointsMap(new HashMap<Endpoint, RMEndpoint>());
Message message = control.createMock(Message.class);
Exchange exchange = control.createMock(Exchange.class);
@@ -276,16 +266,13 @@ public class RMManagerTest extends Asser
EasyMock.expect(endpoint.getEndpointInfo()).andReturn(ei);
QName name = new QName("http://x.y.z/a", "GreeterPort");
EasyMock.expect(ei.getName()).andReturn(name);
- EasyMock.expect(manager.getRMNamespace(message)).andReturn(RM10Constants.NAMESPACE_URI).anyTimes();
- EasyMock.expect(manager.getAddressingNamespace(message)).andReturn(Names200408.WSA_NAMESPACE_NAME)
- .anyTimes();
RMEndpoint rme = control.createMock(RMEndpoint.class);
EasyMock.expect(manager.createReliableEndpoint(endpoint))
.andReturn(rme);
EasyMock.expect(exchange.getDestination()).andReturn(null);
Conduit conduit = control.createMock(Conduit.class);
EasyMock.expect(exchange.getConduit(message)).andReturn(conduit);
- rme.initialise(conduit, null, null);
+ rme.initialise(manager.getConfiguration(), conduit, null, null);
EasyMock.expectLastCall();
control.replay();
@@ -297,9 +284,6 @@ public class RMManagerTest extends Asser
EasyMock.expect(exchange.get(Endpoint.class)).andReturn(endpoint);
EasyMock.expect(endpoint.getEndpointInfo()).andReturn(ei);
EasyMock.expect(ei.getName()).andReturn(name);
- EasyMock.expect(manager.getRMNamespace(message)).andReturn(RM10Constants.NAMESPACE_URI).anyTimes();
- EasyMock.expect(manager.getAddressingNamespace(message)).andReturn(Names200408.WSA_NAMESPACE_NAME)
- .anyTimes();
control.replay();
assertSame(rme, manager.getReliableEndpoint(message));
Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java?rev=1499123&r1=1499122&r2=1499123&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java Tue Jul 2 21:46:40 2013
@@ -134,10 +134,6 @@ public class RMOutInterceptorTest extend
andReturn(rmpsOut).anyTimes();
InterceptorChain chain = control.createMock(InterceptorChain.class);
EasyMock.expect(message.getInterceptorChain()).andReturn(chain).anyTimes();
- EasyMock.expect(manager.getRMNamespace(EasyMock.same(message)))
- .andReturn(RM10Constants.NAMESPACE_URI);
- EasyMock.expect(manager.getAddressingNamespace(EasyMock.same(message)))
- .andReturn(Names200408.WSA_NAMESPACE_NAME);
chain.add(EasyMock.isA(RetransmissionInterceptor.class));
EasyMock.expectLastCall();
RetransmissionQueue queue = control.createMock(RetransmissionQueue.class);
@@ -146,6 +142,12 @@ public class RMOutInterceptorTest extend
EasyMock.expectLastCall();
RMEndpoint rme = control.createMock(RMEndpoint.class);
+ RMConfiguration config = new RMConfiguration();
+ config.setRMNamespace(RM10Constants.NAMESPACE_URI);
+ config.setRM10AddressingNamespace(Names200408.WSA_NAMESPACE_NAME);
+ EasyMock.expect(rme.getConfiguration()).andReturn(config).anyTimes();
+ EasyMock.expect(manager.getRMNamespace(message)).andReturn(RM10Constants.NAMESPACE_URI).anyTimes();
+ EasyMock.expect(manager.getAddressingNamespace(message)).andReturn(Names200408.WSA_NAMESPACE_NAME).anyTimes();
Source source = control.createMock(Source.class);
EasyMock.expect(source.getReliableEndpoint()).andReturn(rme).anyTimes();
EasyMock.expect(manager.getSource(message)).andReturn(source).anyTimes();