use of org.apache.cxf.jaxrs.model.OperationResourceInfo in project camel by apache.
the class CxfRsInvoker method performInvocation.
protected Object performInvocation(Exchange cxfExchange, final Object serviceObject, Method method, Object[] paramArray) throws Exception {
Object response = null;
if (endpoint.isPerformInvocation()) {
response = super.performInvocation(cxfExchange, serviceObject, method, paramArray);
}
paramArray = insertExchange(method, paramArray, cxfExchange);
OperationResourceInfo ori = cxfExchange.get(OperationResourceInfo.class);
if (ori.isSubResourceLocator()) {
// don't delegate the sub resource locator call to camel processor
return method.invoke(serviceObject, paramArray);
}
Continuation continuation;
if (!endpoint.isSynchronous() && (continuation = getContinuation(cxfExchange)) != null) {
LOG.trace("Calling the Camel async processors.");
return asyncInvoke(cxfExchange, serviceObject, method, paramArray, continuation, response);
} else {
LOG.trace("Calling the Camel sync processors.");
return syncInvoke(cxfExchange, serviceObject, method, paramArray, response);
}
}
use of org.apache.cxf.jaxrs.model.OperationResourceInfo in project ddf by codice.
the class TestEndpointOperationInfoResourceComparator method setUp.
@Before
public void setUp() throws NoSuchMethodException {
firstOperation = new OperationResourceInfo(getClass().getMethod(FIRST_OPERATION), null);
secondOperation = new OperationResourceInfo(getClass().getMethod(SECOND_OPERATION), null);
unknownService = new OperationResourceInfo(getClass().getMethod(UNKNOWN_SERVICE), null);
unknownOperation = new OperationResourceInfo(getClass().getMethod(UNKNOWN_OPERATION), null);
}
use of org.apache.cxf.jaxrs.model.OperationResourceInfo in project opencast by opencast.
the class RestPublisherTest method testResourceComparatorSameClass.
@Test
public void testResourceComparatorSameClass() {
Message message = new MessageImpl();
ClassResourceInfo cri1 = new ClassResourceInfo(this.getClass());
ClassResourceInfo cri2 = new ClassResourceInfo(this.getClass());
OperationResourceInfo oper1 = new OperationResourceInfo(this.getClass().getMethods()[0], cri1);
OperationResourceInfo oper2 = new OperationResourceInfo(this.getClass().getMethods()[0], cri2);
Assert.assertEquals(0, rc.compare(cri1, cri2, message));
Assert.assertEquals(0, rc.compare(oper1, oper2, message));
}
use of org.apache.cxf.jaxrs.model.OperationResourceInfo in project opencast by opencast.
the class RestPublisherTest method testResourceComparatorSameNonMatchEqualEndpoint.
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testResourceComparatorSameNonMatchEqualEndpoint() {
ServiceReference serviceReference = EasyMock.createNiceMock(ServiceReference.class);
EasyMock.expect(serviceReference.getProperty(SERVICE_PATH_PROPERTY)).andReturn("/events").anyTimes();
EasyMock.replay(serviceReference);
BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
EasyMock.expect(bc.getServiceReference(EasyMock.anyString())).andReturn(serviceReference).anyTimes();
EasyMock.replay(bc);
ComponentContext cc = EasyMock.createNiceMock(ComponentContext.class);
EasyMock.expect(cc.getBundleContext()).andReturn(bc).anyTimes();
EasyMock.replay(cc);
componentContext = cc;
Message message = new MessageImpl();
ExchangeImpl exchange = new ExchangeImpl();
message.setExchange(exchange);
message.put(Message.ENDPOINT_ADDRESS, "http://localhost:8080/series");
ClassResourceInfo cri1 = new ClassResourceInfo(this.getClass());
ClassResourceInfo cri2 = new ClassResourceInfo(RestPublisher.class.getClass());
OperationResourceInfo oper1 = new OperationResourceInfo(this.getClass().getMethods()[0], cri1);
OperationResourceInfo oper2 = new OperationResourceInfo(RestPublisher.class.getClass().getMethods()[0], cri2);
Assert.assertEquals(0, rc.compare(cri1, cri2, message));
Assert.assertEquals(0, rc.compare(oper1, oper2, message));
}
use of org.apache.cxf.jaxrs.model.OperationResourceInfo in project opencast by opencast.
the class RestPublisherTest method testResourceComparatorSameMatch.
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void testResourceComparatorSameMatch() {
ServiceReference serviceReference = EasyMock.createNiceMock(ServiceReference.class);
EasyMock.expect(serviceReference.getProperty(SERVICE_PATH_PROPERTY)).andReturn("/events").once();
EasyMock.expect(serviceReference.getProperty(SERVICE_PATH_PROPERTY)).andReturn("/series").once();
EasyMock.replay(serviceReference);
BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
EasyMock.expect(bc.getServiceReference(EasyMock.anyString())).andReturn(serviceReference).anyTimes();
EasyMock.replay(bc);
ComponentContext cc = EasyMock.createNiceMock(ComponentContext.class);
EasyMock.expect(cc.getBundleContext()).andReturn(bc).anyTimes();
EasyMock.replay(cc);
componentContext = cc;
Message message = new MessageImpl();
ExchangeImpl exchange = new ExchangeImpl();
message.setExchange(exchange);
message.put(Message.ENDPOINT_ADDRESS, "http://localhost:8080/series");
ClassResourceInfo cri1 = new ClassResourceInfo(this.getClass());
ClassResourceInfo cri2 = new ClassResourceInfo(RestPublisher.class.getClass());
OperationResourceInfo oper1 = new OperationResourceInfo(this.getClass().getMethods()[0], cri1);
OperationResourceInfo oper2 = new OperationResourceInfo(RestPublisher.class.getClass().getMethods()[0], cri2);
Assert.assertEquals(1, rc.compare(cri1, cri2, message));
Assert.assertEquals(1, rc.compare(oper1, oper2, message));
}
Aggregations