use of javax.ws.rs.ext.RuntimeDelegate in project jersey by jersey.
the class InboundMessageContext method iterableToList.
private static List<String> iterableToList(final Iterable<?> values) {
final LinkedList<String> linkedList = new LinkedList<String>();
final RuntimeDelegate rd = RuntimeDelegate.getInstance();
for (Object element : values) {
linkedList.add(HeaderUtils.asString(element, rd));
}
return linkedList;
}
use of javax.ws.rs.ext.RuntimeDelegate in project cxf by apache.
the class RuntimeDelegateImplTest method testRuntimeDelegate.
@Test
public void testRuntimeDelegate() throws Exception {
RuntimeDelegate rd = RuntimeDelegate.getInstance();
assertSame(rd.getClass(), RuntimeDelegateImpl.class);
}
use of javax.ws.rs.ext.RuntimeDelegate in project jbpm by kiegroup.
the class BasicAuthRestWorkItemHandlerTest method initialize.
@SuppressWarnings({ "rawtypes" })
@BeforeClass
public static void initialize() throws Exception {
SimpleRESTApplication application = new SimpleRESTApplication();
RuntimeDelegate delegate = RuntimeDelegate.getInstance();
JAXRSServerFactoryBean bean = delegate.createEndpoint(application, JAXRSServerFactoryBean.class);
bean.setProvider(new JAXBElementProvider());
bean.setAddress("http://localhost:9998" + bean.getAddress());
// disabled logging interceptor by default but proves to be useful
// bean.getInInterceptors().add(new LoggingInInterceptor(new PrintWriter(System.out, true)));
bean.setProvider(new AuthenticationFilter());
server = bean.create();
server.start();
}
use of javax.ws.rs.ext.RuntimeDelegate in project scout.rt by eclipse.
the class DefaultExceptionMapperTest method beforeClass.
@BeforeClass
public static void beforeClass() {
// Setup mocked JAX-RS runtime (without a mock, a real JAX-RS runtime needs to be on the classpath during test execution)
RuntimeDelegate runtimeDelegate = mock(RuntimeDelegate.class);
RuntimeDelegate.setInstance(runtimeDelegate);
final ResponseBuilder responseBuilder = mock(ResponseBuilder.class);
when(runtimeDelegate.createResponseBuilder()).thenReturn(responseBuilder);
when((responseBuilder).status(Mockito.any(Response.Status.class))).then(new Answer<ResponseBuilder>() {
@Override
public ResponseBuilder answer(InvocationOnMock invocation) throws Throwable {
return addStatus(responseBuilder, ((Response.Status) invocation.getArgument(0)).getStatusCode());
}
});
when((responseBuilder.status(Mockito.any(StatusType.class)))).then(new Answer<ResponseBuilder>() {
@Override
public ResponseBuilder answer(InvocationOnMock invocation) throws Throwable {
return addStatus(responseBuilder, ((Response.StatusType) invocation.getArgument(0)).getStatusCode());
}
});
when((responseBuilder.status(Mockito.anyInt()))).then(new Answer<ResponseBuilder>() {
@Override
public ResponseBuilder answer(InvocationOnMock invocation) throws Throwable {
return addStatus(responseBuilder, ((int) invocation.getArgument(0)));
}
});
}
Aggregations