Search in sources :

Example 1 with SimpleMethodDispatcher

use of org.apache.cxf.service.factory.SimpleMethodDispatcher in project cxf by apache.

the class AegisDatabinding method getMethod.

private Method getMethod(Service s, OperationInfo op) {
    Method m = op.getProperty(Method.class.getName(), Method.class);
    if (m != null) {
        return m;
    }
    MethodDispatcher md = (MethodDispatcher) s.get(MethodDispatcher.class.getName());
    // dependency as long as this null check is here.
    if (md == null) {
        return null;
    }
    SimpleMethodDispatcher smd = (SimpleMethodDispatcher) md;
    return smd.getPrimaryMethod(op);
}
Also used : SimpleMethodDispatcher(org.apache.cxf.service.factory.SimpleMethodDispatcher) Method(java.lang.reflect.Method) MethodDispatcher(org.apache.cxf.service.invoker.MethodDispatcher) SimpleMethodDispatcher(org.apache.cxf.service.factory.SimpleMethodDispatcher)

Example 2 with SimpleMethodDispatcher

use of org.apache.cxf.service.factory.SimpleMethodDispatcher in project cxf by apache.

the class MessageUtilsTest method getTargetMethodFromBindingOperationInfo.

@Test
public void getTargetMethodFromBindingOperationInfo() throws Exception {
    Method method = MessageUtilsTest.class.getMethod("getTargetMethodFromBindingOperationInfo");
    Message message = new MessageImpl();
    Exchange exchange = new ExchangeImpl();
    message.setExchange(exchange);
    OperationInfo oi = new OperationInfo();
    oi.setName(QName.valueOf("getTargetMethod_fromBindingOperationInfo"));
    BindingOperationInfo boi = new BindingOperationInfo(null, oi);
    ServiceImpl serviceImpl = new ServiceImpl();
    MethodDispatcher md = new SimpleMethodDispatcher();
    md.bind(oi, method);
    serviceImpl.put(MethodDispatcher.class.getName(), md);
    exchange.put(Service.class, serviceImpl);
    exchange.put(BindingOperationInfo.class, boi);
    Optional<Method> optMethod = MessageUtils.getTargetMethod(message);
    assertTrue(optMethod.isPresent());
    assertEquals(method, optMethod.get());
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) SimpleMethodDispatcher(org.apache.cxf.service.factory.SimpleMethodDispatcher) ServiceImpl(org.apache.cxf.service.ServiceImpl) Method(java.lang.reflect.Method) MethodDispatcher(org.apache.cxf.service.invoker.MethodDispatcher) SimpleMethodDispatcher(org.apache.cxf.service.factory.SimpleMethodDispatcher) Test(org.junit.Test)

Aggregations

Method (java.lang.reflect.Method)2 SimpleMethodDispatcher (org.apache.cxf.service.factory.SimpleMethodDispatcher)2 MethodDispatcher (org.apache.cxf.service.invoker.MethodDispatcher)2 ServiceImpl (org.apache.cxf.service.ServiceImpl)1 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)1 OperationInfo (org.apache.cxf.service.model.OperationInfo)1 Test (org.junit.Test)1