Search in sources :

Example 1 with Extensible

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);
}
Also used : Extensible(org.apache.cxf.service.model.Extensible) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) Test(org.junit.Test)

Example 2 with Extensible

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;
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) Policy(org.apache.neethi.Policy) Extensible(org.apache.cxf.service.model.Extensible) DescriptionInfo(org.apache.cxf.service.model.DescriptionInfo) MessageInfo(org.apache.cxf.service.model.MessageInfo) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo)

Example 3 with Extensible

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;
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) Policy(org.apache.neethi.Policy) BindingFaultInfo(org.apache.cxf.service.model.BindingFaultInfo) FaultInfo(org.apache.cxf.service.model.FaultInfo) Extensible(org.apache.cxf.service.model.Extensible) DescriptionInfo(org.apache.cxf.service.model.DescriptionInfo)

Aggregations

Extensible (org.apache.cxf.service.model.Extensible)3 DescriptionInfo (org.apache.cxf.service.model.DescriptionInfo)2 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)2 Policy (org.apache.neethi.Policy)2 HashMap (java.util.HashMap)1 QName (javax.xml.namespace.QName)1 BindingFaultInfo (org.apache.cxf.service.model.BindingFaultInfo)1 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)1 FaultInfo (org.apache.cxf.service.model.FaultInfo)1 MessageInfo (org.apache.cxf.service.model.MessageInfo)1 Test (org.junit.Test)1