@Override protected Object enrichByType(Class<?> clazz, Method method, ArquillianResteasyResource annotation, Consumes consumes, Produces produces) { Object value; Client client = JerseyClientBuilder.newClient(); WebTarget webTarget = client.target(getBaseURL() + annotation.value()); final Map<String, String> headers = getHeaders(clazz, method); if (!headers.isEmpty()) { webTarget.register(new HeaderFilter(headers)); } JerseyWebTarget jerseyWebTarget = (JerseyWebTarget) webTarget; if (WebTarget.class.isAssignableFrom(clazz)) { value = jerseyWebTarget; } else { final Class<?> parameterType; try { final Annotation[] methodDeclaredAnnotations = method.getDeclaredAnnotations(); // This is test method so if it only contains @Test annotation then we don't need to hassel with substitutions parameterType = methodDeclaredAnnotations.length <= 1 ? clazz : ClassModifier.getModifiedClass(clazz, methodDeclaredAnnotations); } catch (Exception e) { throw new RuntimeException("Cannot substitute annotations for method " + method.getName(), e); } value = WebResourceFactory.newResource(parameterType, jerseyWebTarget); } return value; }
@Override protected Object enrichByType(Class<?> clazz, Method method, ArquillianResteasyResource annotation, Consumes consumes, Produces produces) { Object value; Client client = JerseyClientBuilder.newClient(); WebTarget webTarget = client.target(getBaseURL() + annotation.value()); final Map<String, String> headers = getHeaders(clazz, method); if (!headers.isEmpty()) { webTarget.register(new HeaderFilter(headers)); } JerseyWebTarget jerseyWebTarget = (JerseyWebTarget) webTarget; if (WebTarget.class.isAssignableFrom(clazz)) { value = jerseyWebTarget; } else { final Class<?> parameterType; try { final Annotation[] methodDeclaredAnnotations = method.getDeclaredAnnotations(); // This is test method so if it only contains @Test annotation then we don't need to hassel with substitutions parameterType = methodDeclaredAnnotations.length <= 1 ? clazz : ClassModifier.getModifiedClass(clazz, methodDeclaredAnnotations); } catch (Exception e) { throw new RuntimeException("Cannot substitute annotations for method " + method.getName(), e); } value = WebResourceFactory.newResource(parameterType, jerseyWebTarget); } return value; }
: ClassModifier.getModifiedClass(clazz, methodDeclaredAnnotations); } catch (Exception e) { throw new RuntimeException("Cannot substitute annotations for method " + method.getName(), e);
final Annotation[] methodDeclaredAnnotations = method.getDeclaredAnnotations(); parameterType = methodDeclaredAnnotations.length <= 1 ? clazz : ClassModifier.getModifiedClass(clazz, methodDeclaredAnnotations); } catch (Exception e) { throw new RuntimeException("Cannot substitute annotations for method " + method.getName(), e);
final Annotation[] methodDeclaredAnnotations = method.getDeclaredAnnotations(); parameterType = methodDeclaredAnnotations.length <= 1 ? clazz : ClassModifier.getModifiedClass(clazz, methodDeclaredAnnotations); } catch (Exception e) { throw new RuntimeException("Cannot substitute annotations for method " + method.getName(), e);
: ClassModifier.getModifiedClass(clazz, methodDeclaredAnnotations); } catch (Exception e) { throw new RuntimeException("Cannot substitute annotations for method " + method.getName(), e);