use of org.apache.cxf.service.model.Extensible in project cxf by apache.
the class ContextUtilsTest method testGetActionFromExtensible.
@Test
public void testGetActionFromExtensible() {
Map<QName, Object> attributes = new HashMap<>();
Extensible ext = control.createMock(Extensible.class);
EasyMock.expect(ext.getExtensionAttributes()).andReturn(attributes).anyTimes();
attributes.put(WSA_ACTION_QNAME, "urn:foo:test:2");
EasyMock.expect(ext.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME)).andReturn("urn:foo:test:1");
control.replay();
String action = InternalContextUtils.getAction(ext);
assertEquals("urn:foo:test:1", action);
control.reset();
attributes.clear();
EasyMock.expect(ext.getExtensionAttributes()).andReturn(attributes).anyTimes();
EasyMock.expect(ext.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME)).andReturn(null);
attributes.put(WSA_ACTION_QNAME, "urn:foo:test:2");
control.replay();
action = InternalContextUtils.getAction(ext);
assertEquals("urn:foo:test:2", action);
control.reset();
attributes.clear();
EasyMock.expect(ext.getExtensionAttributes()).andReturn(attributes).anyTimes();
EasyMock.expect(ext.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME)).andReturn(null);
attributes.put(OLD_WSDL_WSA_ACTION_QNAME, "urn:foo:test:3");
control.replay();
action = InternalContextUtils.getAction(ext);
assertEquals("urn:foo:test:3", action);
control.reset();
attributes.clear();
EasyMock.expect(ext.getExtensionAttributes()).andReturn(attributes).anyTimes();
EasyMock.expect(ext.getExtensionAttribute(JAXWSAConstants.WSAW_ACTION_QNAME)).andReturn(null);
control.replay();
action = InternalContextUtils.getAction(ext);
assertEquals(null, action);
}
use of org.apache.cxf.service.model.Extensible in project cxf by apache.
the class Wsdl11AttachmentPolicyProvider method getEffectivePolicy.
/**
* The effective policy for a specific WSDL message (input or output) is calculated
* in relation to a specific port, and includes the element policy of the wsdl:message
* element that defines the message's type merged with the element policy of the
* wsdl11:binding and wsdl11:portType message definitions that describe the message.
* For example, the effective policy of a specific input message for a specific port
* would be the (element policies of the) wsdl11:message element defining the message type,
* the wsdl11:portType/wsdl11:operation/wsdl11:input element and the corresponding
* wsdl11:binding/wsdl11:operation/wsdl11:input element for that message.
*
* @param bmi the BindingMessageInfo identifiying the message
* @return the effective policy
*/
public Policy getEffectivePolicy(BindingMessageInfo bmi, Message m) {
ServiceInfo si = bmi.getBindingOperation().getBinding().getService();
DescriptionInfo di = si.getDescription();
Policy p = getElementPolicy(bmi, false, di);
MessageInfo mi = bmi.getMessageInfo();
p = mergePolicies(p, getElementPolicy(mi, true, di));
Extensible ex = getMessageTypeInfo(mi.getName(), di);
p = mergePolicies(p, getElementPolicy(ex, false, di));
return p;
}
use of org.apache.cxf.service.model.Extensible in project cxf by apache.
the class Wsdl11AttachmentPolicyProvider method getEffectivePolicy.
public Policy getEffectivePolicy(BindingFaultInfo bfi, Message m) {
ServiceInfo si = bfi.getBindingOperation().getBinding().getService();
DescriptionInfo di = si.getDescription();
Policy p = getElementPolicy(bfi, false, di);
FaultInfo fi = bfi.getFaultInfo();
p = mergePolicies(p, getElementPolicy(fi, true, di));
Extensible ex = getMessageTypeInfo(fi.getName(), di);
p = mergePolicies(p, getElementPolicy(ex, false, di));
return p;
}
Aggregations