diff --git a/.gitignore b/.gitignore index 02df3c0..06d9bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,7 @@ nbproject # VS Code **/.vscode/ +.cache/ + # macOS Files .DS_Store diff --git a/config/src/main/java/org/jboss/resteasy/microprofile/config/FilterConfigSource.java b/config/src/main/java/org/jboss/resteasy/microprofile/config/FilterConfigSource.java index 1e7bc5d..f180da5 100644 --- a/config/src/main/java/org/jboss/resteasy/microprofile/config/FilterConfigSource.java +++ b/config/src/main/java/org/jboss/resteasy/microprofile/config/FilterConfigSource.java @@ -25,6 +25,7 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; + import javax.servlet.FilterConfig; import javax.servlet.ServletContext; diff --git a/config/src/main/java/org/jboss/resteasy/microprofile/config/ServletConfigSource.java b/config/src/main/java/org/jboss/resteasy/microprofile/config/ServletConfigSource.java index a6d97b2..6f26c24 100644 --- a/config/src/main/java/org/jboss/resteasy/microprofile/config/ServletConfigSource.java +++ b/config/src/main/java/org/jboss/resteasy/microprofile/config/ServletConfigSource.java @@ -25,6 +25,7 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; + import javax.servlet.ServletConfig; import javax.servlet.ServletContext; diff --git a/config/src/main/java/org/jboss/resteasy/microprofile/config/ServletContextConfigSource.java b/config/src/main/java/org/jboss/resteasy/microprofile/config/ServletContextConfigSource.java index 70aafca..022ca46 100644 --- a/config/src/main/java/org/jboss/resteasy/microprofile/config/ServletContextConfigSource.java +++ b/config/src/main/java/org/jboss/resteasy/microprofile/config/ServletContextConfigSource.java @@ -25,6 +25,7 @@ import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; + import javax.servlet.ServletContext; import org.jboss.resteasy.core.ResteasyContext; diff --git a/ide-config/pom.xml b/ide-config/pom.xml new file mode 100644 index 0000000..8d9fb13 --- /dev/null +++ b/ide-config/pom.xml @@ -0,0 +1,38 @@ + + + + + + + org.jboss + jboss-parent + 38 + + 4.0.0 + + org.jboss.resteasy.microprofile + ide-config + 1.0.0-SNAPSHOT + RESTEasy MicroProfile IDE Configuration + jar + + \ No newline at end of file diff --git a/ide-config/src/main/resources/eclipse-format.xml b/ide-config/src/main/resources/eclipse-format.xml new file mode 100644 index 0000000..e1ae9fd --- /dev/null +++ b/ide-config/src/main/resources/eclipse-format.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ide-config/src/main/resources/eclipse.importorder b/ide-config/src/main/resources/eclipse.importorder new file mode 100644 index 0000000..1b6c1ec --- /dev/null +++ b/ide-config/src/main/resources/eclipse.importorder @@ -0,0 +1,5 @@ +# Organize Import Order +0=java +1=javax +2=org +3=com diff --git a/pom.xml b/pom.xml index 472399d..7cc2c1e 100644 --- a/pom.xml +++ b/pom.xml @@ -82,6 +82,8 @@ 4.2.8.Final 5.2.0.Final + 2.17.0 + 1.6.2 1.0.0.Final @@ -98,6 +100,7 @@ false ${maven.test.skip} + false true @@ -106,6 +109,7 @@ + ide-config resteasy-microprofile-bom resteasy-microprofile-test-bom config @@ -207,6 +211,57 @@ + + net.revelc.code.formatter + formatter-maven-plugin + ${version.formatter-maven-plugin} + + + ${project.groupId} + ide-config + ${project.version} + + + + + .cache + eclipse-format.xml + LF + true + ${skip.format} + + + + format + + format + + process-sources + + + + + net.revelc.code + impsort-maven-plugin + ${version.impsort-maven-plugin} + + + .cache + java.,javax.,org.,com. + * + ${skip.format} + true + + + + sort-imports + + sort + + process-sources + + + diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ConfigurationWrapper.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ConfigurationWrapper.java index f99500d..a845987 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ConfigurationWrapper.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ConfigurationWrapper.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; + import javax.ws.rs.RuntimeType; import javax.ws.rs.core.Configuration; import javax.ws.rs.core.Feature; diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/DefaultResponseExceptionMapper.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/DefaultResponseExceptionMapper.java index 29ea805..ce15648 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/DefaultResponseExceptionMapper.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/DefaultResponseExceptionMapper.java @@ -38,13 +38,15 @@ public Throwable toThrowable(Response response) { response.bufferEntity(); } catch (Exception ignored) { } - return WebApplicationExceptionWrapper.wrap(new WebApplicationException("Unknown error, status code " + response.getStatus(), response)); + return WebApplicationExceptionWrapper + .wrap(new WebApplicationException("Unknown error, status code " + response.getStatus(), response)); } @Override public boolean handles(int status, MultivaluedMap headers) { final Config config = ConfigProvider.getConfig(); - final boolean originalBehavior = config.getOptionalValue(ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR, boolean.class) + final boolean originalBehavior = config + .getOptionalValue(ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR, boolean.class) .orElse(false); final boolean serverSide = ResteasyDeployment.onServer(); return status >= (originalBehavior || !serverSide ? 400 : 300); diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ExceptionMapping.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ExceptionMapping.java index 0d2bb83..b6cdff3 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ExceptionMapping.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ExceptionMapping.java @@ -23,6 +23,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; + import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientResponseContext; import javax.ws.rs.client.ClientResponseFilter; @@ -38,7 +39,7 @@ * This implementation is a bit of a hack and dependent on Resteasy internals. * We throw a ResponseProcessingExceptoin that hides the Response object */ -@SuppressWarnings({"rawtypes", "unchecked"}) +@SuppressWarnings({ "rawtypes", "unchecked" }) public class ExceptionMapping implements ClientResponseFilter { public static class HandlerException extends ResponseProcessingException { private static final Logger LOGGER = Logger.getLogger(HandlerException.class); @@ -57,8 +58,10 @@ public void mapException(final Method method) throws Exception { handled.bufferEntity(); for (ResponseExceptionMapper mapper : candidates) { Throwable exception = mapper.toThrowable(handled); - if (exception instanceof RuntimeException) throw (RuntimeException) exception; - if (exception instanceof Error) throw (Error) exception; + if (exception instanceof RuntimeException) + throw (RuntimeException) exception; + if (exception instanceof Error) + throw (Error) exception; for (Class exc : method.getExceptionTypes()) { if (exception != null && exc.isAssignableFrom(exception.getClass())) { throw (Exception) exception; @@ -91,11 +94,11 @@ public void filter(ClientRequestContext requestContext, ClientResponseContext re } } } - if (candidates.isEmpty()) return; + if (candidates.isEmpty()) + return; candidates.sort( - (m1, m2) -> Integer.compare(m1.getPriority(), m2.getPriority()) - ); + (m1, m2) -> Integer.compare(m1.getPriority(), m2.getPriority())); throw new HandlerException(responseContext, candidates); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/InvocationContextImpl.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/InvocationContextImpl.java index e01b7ae..60e0977 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/InvocationContextImpl.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/InvocationContextImpl.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.CompletionException; + import javax.enterprise.inject.spi.InterceptionType; import javax.enterprise.inject.spi.Interceptor; import javax.interceptor.InvocationContext; @@ -46,12 +47,12 @@ public class InvocationContextImpl implements InvocationContext { private final List chain; public InvocationContextImpl(final Object target, final Method method, final Object[] args, - final List chain) { + final List chain) { this(target, method, args, chain, 0); } private InvocationContextImpl(final Object target, final Method method, final Object[] args, - final List chain, final int position) { + final List chain, final int position) { this.target = target; this.method = method; this.args = args; diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/MethodInjectionFilter.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/MethodInjectionFilter.java index 16b1fec..2733fcb 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/MethodInjectionFilter.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/MethodInjectionFilter.java @@ -22,11 +22,11 @@ import static org.jboss.resteasy.microprofile.client.utils.ClientRequestContextUtils.getMethod; import java.lang.reflect.Method; + import javax.annotation.Priority; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; - @Priority(Integer.MIN_VALUE) public class MethodInjectionFilter implements ClientRequestFilter { @Override diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/PartialResponse.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/PartialResponse.java index 8ee0d64..d5db732 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/PartialResponse.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/PartialResponse.java @@ -34,6 +34,7 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; + import javax.ws.rs.WebApplicationException; import javax.ws.rs.client.ClientResponseContext; import javax.ws.rs.core.EntityTag; @@ -72,7 +73,6 @@ private RuntimeException notSupported() { return ex; } - @SuppressWarnings("unchecked") @Override public synchronized T readEntity(Class entityType) { @@ -94,7 +94,6 @@ public static String readStringEntity(InputStream input) { } } - @Override public T readEntity(GenericType entityType) { throw notSupported(); @@ -206,7 +205,7 @@ public Link.Builder getLinkBuilder(String relation) { } @Override - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) public MultivaluedMap getMetadata() { return (MultivaluedMap) responseContext.getHeaders(); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ProxyInvocationHandler.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ProxyInvocationHandler.java index 3475dc0..166bff2 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ProxyInvocationHandler.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/ProxyInvocationHandler.java @@ -19,7 +19,6 @@ package org.jboss.resteasy.microprofile.client; - import java.lang.annotation.Annotation; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; @@ -36,6 +35,7 @@ import java.util.concurrent.CompletionException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; + import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.inject.spi.BeanManager; import javax.enterprise.inject.spi.CDI; @@ -68,9 +68,9 @@ public class ProxyInvocationHandler implements InvocationHandler { private final AtomicBoolean closed; public ProxyInvocationHandler(final Class restClientInterface, - final Object target, - final Set providerInstances, - final ResteasyClient client, final BeanManager beanManager) { + final Object target, + final Set providerInstances, + final ResteasyClient client, final BeanManager beanManager) { this.target = target; this.providerInstances = providerInstances; this.client = client; @@ -114,7 +114,8 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl } if (parameterAnnotations[index].length > 0) { // does a parameter converter apply? - ParamConverter converter = ((ParamConverterProvider) p).getConverter(arg.getClass(), null, parameterAnnotations[index]); + ParamConverter converter = ((ParamConverterProvider) p).getConverter(arg.getClass(), null, + parameterAnnotations[index]); if (converter != null) { Type[] genericTypes = getGenericTypes(converter.getClass()); if (genericTypes.length == 1) { @@ -243,7 +244,8 @@ private static BeanManager getBeanManager(Class restClientInterface) { CDI current = CDI.current(); return current != null ? current.getBeanManager() : null; } catch (IllegalStateException e) { - LOGGER.warnf("CDI container is not available - interceptor bindings declared on %s will be ignored", restClientInterface.getSimpleName()); + LOGGER.warnf("CDI container is not available - interceptor bindings declared on %s will be ignored", + restClientInterface.getSimpleName()); return null; } } @@ -267,12 +269,14 @@ private static Map> in Annotation[] interceptorBindings = merge(methodLevelBindings, classLevelBindings); - List> interceptors = beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, interceptorBindings); + List> interceptors = beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, + interceptorBindings); if (!interceptors.isEmpty()) { List chain = new ArrayList<>(); for (Interceptor interceptor : interceptors) { chain.add(new InvocationContextImpl.InterceptorInvocation(interceptor, - interceptorInstances.computeIfAbsent(interceptor, i -> beanManager.getReference(i, i.getBeanClass(), creationalContext)))); + interceptorInstances.computeIfAbsent(interceptor, + i -> beanManager.getReference(i, i.getBeanClass(), creationalContext)))); } chains.put(method, chain); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java index b66081a..bb0c60f 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientBuilderImpl.java @@ -52,6 +52,7 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; + import javax.enterprise.inject.spi.BeanManager; import javax.enterprise.inject.spi.CDI; import javax.net.ssl.HostnameVerifier; @@ -197,7 +198,6 @@ public RestClientBuilder readTimeout(long time, TimeUnit timeUnit) { return this; } - @Override public RestClientBuilder sslContext(SSLContext sslContext) { this.sslContext = sslContext; @@ -232,7 +232,8 @@ public RestClientBuilder executorService(ExecutorService executor) { return this; } - public T build(Class aClass, ClientHttpEngine httpEngine) throws IllegalStateException, RestClientDefinitionException { + public T build(Class aClass, ClientHttpEngine httpEngine) + throws IllegalStateException, RestClientDefinitionException { RestClientListeners.get().forEach(listener -> listener.onNewClient(aClass, this)); @@ -259,7 +260,6 @@ public T build(Class aClass, ClientHttpEngine httpEngine) throws IllegalS ClassLoader classLoader = aClass.getClassLoader(); - T actualClient; ResteasyClient client; @@ -335,7 +335,6 @@ public T build(Class aClass, ClientHttpEngine httpEngine) throws IllegalS resteasyClientBuilder.connectTimeout(connectTimeout, connectTimeoutUnit); } - if (httpEngine != null) { resteasyClientBuilder.httpEngine(httpEngine); } else { @@ -343,10 +342,10 @@ public T build(Class aClass, ClientHttpEngine httpEngine) throws IllegalS if (propEngine instanceof ClientHttpEngine) { resteasyClientBuilder.httpEngine((ClientHttpEngine) propEngine); - } - else if (useURLConnection()) { - resteasyClientBuilder.httpEngine(new URLConnectionClientEngineBuilder().resteasyClientBuilder(resteasyClientBuilder) - .build()); + } else if (useURLConnection()) { + resteasyClientBuilder + .httpEngine(new URLConnectionClientEngineBuilder().resteasyClientBuilder(resteasyClientBuilder) + .build()); resteasyClientBuilder.sslContext(null); resteasyClientBuilder.trustStore(null); resteasyClientBuilder.keyStore(null, ""); @@ -381,14 +380,15 @@ else if (useURLConnection()) { @SuppressWarnings("unchecked") @Override public T build(Class aClass) throws IllegalStateException, RestClientDefinitionException { - return build(aClass, null); + return build(aClass, null); } /** * Get the users list of proxy hosts. Translate list to regex format + * * @return list of proxy hosts */ - private List getProxyHostsAsRegex(){ + private List getProxyHostsAsRegex() { String noProxyHostsSysProps = getSystemProperty("http.nonProxyHosts", null); if (noProxyHostsSysProps == null) { noProxyHostsSysProps = "localhost|127.*|[::1]"; @@ -406,7 +406,8 @@ private List getProxyHostsAsRegex(){ */ private boolean useURLConnection() { if (useURLConnection == null) { - String defaultToURLConnection = getSystemProperty("org.jboss.resteasy.microprofile.defaultToURLConnectionHttpClient", "false"); + String defaultToURLConnection = getSystemProperty( + "org.jboss.resteasy.microprofile.defaultToURLConnectionHttpClient", "false"); useURLConnection = defaultToURLConnection.equalsIgnoreCase("true"); } return useURLConnection; @@ -433,8 +434,7 @@ private void checkQueryParamStyleProperty(Class aClass) { prop.get().trim().toUpperCase())); } else { - RegisterRestClient registerRestClient = - (RegisterRestClient) aClass.getAnnotation(RegisterRestClient.class); + RegisterRestClient registerRestClient = (RegisterRestClient) aClass.getAnnotation(RegisterRestClient.class); if (registerRestClient != null && registerRestClient.configKey() != null && !registerRestClient.configKey().isEmpty()) { @@ -468,8 +468,7 @@ private void checkFollowRedirectProperty(Class aClass) { followRedirects(prop.get()); } } else { - RegisterRestClient registerRestClient = - aClass.getAnnotation(RegisterRestClient.class); + RegisterRestClient registerRestClient = aClass.getAnnotation(RegisterRestClient.class); if (registerRestClient != null && registerRestClient.configKey() != null && !registerRestClient.configKey().isEmpty()) { @@ -490,7 +489,8 @@ private void checkFollowRedirectProperty(Class aClass) { private boolean isMapperDisabled() { boolean disabled = false; - Optional defaultMapperProp = config == null ? Optional.empty() : config.getOptionalValue(DEFAULT_MAPPER_PROP, Boolean.class); + Optional defaultMapperProp = config == null ? Optional.empty() + : config.getOptionalValue(DEFAULT_MAPPER_PROP, Boolean.class); // disabled through config api if (defaultMapperProp.isPresent() && defaultMapperProp.get().equals(Boolean.TRUE)) { @@ -520,7 +520,8 @@ private String getReflectName(AnnotatedElement element) { return ((Field) element).getName(); } else if (element instanceof Method) { Method m = (Method) element; - if (!m.getName().startsWith("get")) return null; + if (!m.getName().startsWith("get")) + return null; return Character.toLowerCase(m.getName().charAt(3)) + m.getName().substring(4); } return null; @@ -531,8 +532,10 @@ private String getPathParamName(AnnotatedElement element) { PathParam pp = element.getAnnotation(PathParam.class); return pp.value(); } else if (element.isAnnotationPresent(org.jboss.resteasy.annotations.jaxrs.PathParam.class)) { - org.jboss.resteasy.annotations.jaxrs.PathParam pp = element.getAnnotation(org.jboss.resteasy.annotations.jaxrs.PathParam.class); - if (pp.value().length() > 0) return pp.value(); + org.jboss.resteasy.annotations.jaxrs.PathParam pp = element + .getAnnotation(org.jboss.resteasy.annotations.jaxrs.PathParam.class); + if (pp.value().length() > 0) + return pp.value(); return getReflectName(element); } return null; @@ -580,7 +583,8 @@ private void verifyInterface(Class typeDef) { Path methodPathAnno = method.getAnnotation(Path.class); if (methodPathAnno != null) { template = classPathAnno == null ? (ResteasyUriBuilder) new ResteasyUriBuilderImpl().uri(methodPathAnno.value()) - : (ResteasyUriBuilder) new ResteasyUriBuilderImpl().uri(classPathAnno.value() + "/" + methodPathAnno.value()); + : (ResteasyUriBuilder) new ResteasyUriBuilderImpl() + .uri(classPathAnno.value() + "/" + methodPathAnno.value()); } else if (classPathAnno != null) { template = (ResteasyUriBuilder) new ResteasyUriBuilderImpl().uri(classPathAnno.value()); } else { @@ -601,7 +605,8 @@ private void verifyInterface(Class typeDef) { if (pathParam != null) { paramMap.put(pathParam.value(), "foobar"); } else if (p.isAnnotationPresent(org.jboss.resteasy.annotations.jaxrs.PathParam.class)) { - org.jboss.resteasy.annotations.jaxrs.PathParam rePathParam = p.getAnnotation(org.jboss.resteasy.annotations.jaxrs.PathParam.class); + org.jboss.resteasy.annotations.jaxrs.PathParam rePathParam = p + .getAnnotation(org.jboss.resteasy.annotations.jaxrs.PathParam.class); String name = rePathParam.value() == null || rePathParam.value() .length() == 0 ? p.getName() : rePathParam.value(); paramMap.put(name, "foobar"); @@ -611,13 +616,15 @@ private void verifyInterface(Class typeDef) { } if (allVariables.size() != paramMap.size()) { - throw new RestClientDefinitionException("Parameters and variables don't match on " + typeDef + "::" + method.getName()); + throw new RestClientDefinitionException( + "Parameters and variables don't match on " + typeDef + "::" + method.getName()); } try { template.resolveTemplates(paramMap, false).build(); } catch (IllegalArgumentException ex) { - throw new RestClientDefinitionException("Parameter names don't match variable names on " + typeDef + "::" + method.getName(), ex); + throw new RestClientDefinitionException( + "Parameter names don't match variable names on " + typeDef + "::" + method.getName(), ex); } } @@ -645,10 +652,12 @@ public RestClientBuilder property(String name, Object value) { if (value instanceof List) { arguments = ((List) value).toArray(); } else { - throw new IllegalArgumentException("Value must be an instance of List<> for ResteasyClientBuilder setter method: " + builderMethodName); + throw new IllegalArgumentException( + "Value must be an instance of List<> for ResteasyClientBuilder setter method: " + + builderMethodName); } } else { - arguments = new Object[] {value}; + arguments = new Object[] { value }; } try { builderMethod.invoke(builderDelegate, arguments); diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientDelegateBean.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientDelegateBean.java index e26e589..4735bee 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientDelegateBean.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientDelegateBean.java @@ -44,6 +44,7 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Stream; + import javax.enterprise.context.Dependent; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.inject.Any; @@ -88,7 +89,6 @@ public class RestClientDelegateBean implements Bean, PassivationCapable public static final String HOSTNAME_VERIFIER = "%s/mp-rest/hostnameVerifier"; - private static final String PROPERTY_PREFIX = "%s/property/"; private final Class proxyType; @@ -104,7 +104,7 @@ public class RestClientDelegateBean implements Bean, PassivationCapable private final Optional configKey; RestClientDelegateBean(final Class proxyType, final BeanManager beanManager, final Optional baseUri, - final Optional configKey) { + final Optional configKey) { this.proxyType = proxyType; this.beanManager = beanManager; this.baseUri = baseUri; @@ -169,9 +169,11 @@ private void registerHostnameVerifier(String verifier, RestClientBuilder builder } catch (ClassNotFoundException e) { throw new RuntimeException("Could not find hostname verifier class" + verifier, e); } catch (InstantiationException | IllegalAccessException e) { - throw new RuntimeException("Failed to instantiate hostname verifier class. Make sure it has a public, no-argument constructor", e); + throw new RuntimeException( + "Failed to instantiate hostname verifier class. Make sure it has a public, no-argument constructor", e); } catch (ClassCastException e) { - throw new RuntimeException("The provided hostname verifier " + verifier + " is not an instance of HostnameVerifier", e); + throw new RuntimeException("The provided hostname verifier " + verifier + " is not an instance of HostnameVerifier", + e); } } @@ -181,12 +183,14 @@ private void registerKeyStore(String keyStorePath, RestClientBuilder builder) { try { KeyStore keyStore = KeyStore.getInstance(keyStoreType.orElse("JKS")); - String password = keyStorePassword.orElseThrow(() -> new IllegalArgumentException("No password provided for keystore")); + String password = keyStorePassword + .orElseThrow(() -> new IllegalArgumentException("No password provided for keystore")); try (InputStream input = locateStream(keyStorePath)) { keyStore.load(input, password.toCharArray()); } catch (IOException | CertificateException | NoSuchAlgorithmException e) { - throw new IllegalArgumentException("Failed to initialize trust store from classpath resource " + keyStorePath, e); + throw new IllegalArgumentException("Failed to initialize trust store from classpath resource " + keyStorePath, + e); } builder.keyStore(keyStore, password); @@ -201,12 +205,14 @@ private void registerTrustStore(String trustStorePath, RestClientBuilder builder try { KeyStore trustStore = KeyStore.getInstance(maybeTrustStoreType.orElse("JKS")); - String password = maybeTrustStorePassword.orElseThrow(() -> new IllegalArgumentException("No password provided for truststore")); + String password = maybeTrustStorePassword + .orElseThrow(() -> new IllegalArgumentException("No password provided for truststore")); try (InputStream input = locateStream(trustStorePath)) { trustStore.load(input, password.toCharArray()); } catch (IOException | CertificateException | NoSuchAlgorithmException e) { - throw new IllegalArgumentException("Failed to initialize trust store from classpath resource " + trustStorePath, e); + throw new IllegalArgumentException("Failed to initialize trust store from classpath resource " + trustStorePath, + e); } builder.trustStore(trustStore); @@ -223,7 +229,8 @@ private InputStream locateStream(String path) throws FileNotFoundException { resultStream = getClass().getResourceAsStream(path); } if (resultStream == null) { - throw new IllegalArgumentException("Classpath resource " + path + " not found for MicroProfile Rest Client SSL configuration"); + throw new IllegalArgumentException( + "Classpath resource " + path + " not found for MicroProfile Rest Client SSL configuration"); } return resultStream; } else { @@ -232,7 +239,8 @@ private InputStream locateStream(String path) throws FileNotFoundException { } File certificateFile = new File(path); if (!certificateFile.isFile()) { - throw new IllegalArgumentException("Certificate file: " + path + " not found for MicroProfile Rest Client SSL configuration"); + throw new IllegalArgumentException( + "Certificate file: " + path + " not found for MicroProfile Rest Client SSL configuration"); } return new FileInputStream(certificateFile); } @@ -281,7 +289,8 @@ private void configureUri(RestClientBuilder builder) { private Optional getOptionalProperty(String propertyFormat, Class type) { Optional value = config.getOptionalValue(String.format(propertyFormat, proxyType.getName()), type); - if (value.isPresent() || !configKey.isPresent()) return value; + if (value.isPresent() || !configKey.isPresent()) + return value; return config.getOptionalValue(String.format(propertyFormat, configKey.get()), type); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientExtension.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientExtension.java index d4c2cf4..9203d76 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientExtension.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/RestClientExtension.java @@ -25,6 +25,7 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; + import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.event.Observes; import javax.enterprise.inject.spi.AfterBeanDiscovery; @@ -44,8 +45,7 @@ public class RestClientExtension implements Extension { private final Set errors = new LinkedHashSet<>(); - public void registerRestClient(@Observes - @WithAnnotations(RegisterRestClient.class) ProcessAnnotatedType type) { + public void registerRestClient(@Observes @WithAnnotations(RegisterRestClient.class) ProcessAnnotatedType type) { Class javaClass = type.getAnnotatedType().getJavaClass(); if (javaClass.isInterface()) { RegisterRestClient annotation = type.getAnnotatedType().getAnnotation(RegisterRestClient.class); @@ -71,7 +71,8 @@ private Optional extractConfigKey(RegisterRestClient annotation) { public void createProxy(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) { for (RestClientData clientData : proxyTypes) { - afterBeanDiscovery.addBean(new RestClientDelegateBean(clientData.javaClass, beanManager, clientData.baseUri, clientData.configKey)); + afterBeanDiscovery.addBean( + new RestClientDelegateBean(clientData.javaClass, beanManager, clientData.baseUri, clientData.configKey)); } } @@ -112,7 +113,7 @@ private static class RestClientData { private final Optional configKey; private RestClientData(final Class javaClass, final Optional baseUri, - final Optional configKey) { + final Optional configKey) { this.javaClass = javaClass; this.baseUri = baseUri; this.configKey = configKey; @@ -120,8 +121,10 @@ private RestClientData(final Class javaClass, final Optional baseUri, @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; RestClientData that = (RestClientData) o; return javaClass.equals(that.javaClass); } @@ -156,7 +159,7 @@ public static Object construct(Class clazz) { modifiableBeans.addAll(beans); // Ambiguous dependency may occur if a resource has subclasses // Therefore we remove those beans - for (Iterator> iterator = modifiableBeans.iterator(); iterator.hasNext(); ) { + for (Iterator> iterator = modifiableBeans.iterator(); iterator.hasNext();) { Bean bean = iterator.next(); if (!bean.getBeanClass().equals(clazz) && !bean.isAlternative()) { // remove Beans that have clazz in their type closure but not as a base class diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/async/AsyncInterceptorRxInvoker.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/async/AsyncInterceptorRxInvoker.java index 32865ed..90de55a 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/async/AsyncInterceptorRxInvoker.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/async/AsyncInterceptorRxInvoker.java @@ -23,6 +23,7 @@ import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutorService; + import javax.ws.rs.client.Entity; import javax.ws.rs.client.SyncInvoker; import javax.ws.rs.core.GenericType; @@ -36,7 +37,7 @@ /** * @author Bill Burke * @author Alessio Soldano - *

+ *

*/ public class AsyncInterceptorRxInvoker extends CompletionStageRxInvokerImpl { private Method method; diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/async/AsyncInterceptorRxInvokerProvider.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/async/AsyncInterceptorRxInvokerProvider.java index 6f00ed4..f1cf572 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/async/AsyncInterceptorRxInvokerProvider.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/async/AsyncInterceptorRxInvokerProvider.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.client.async; import java.util.concurrent.ExecutorService; + import javax.ws.rs.client.CompletionStageRxInvoker; import javax.ws.rs.client.RxInvokerProvider; import javax.ws.rs.client.SyncInvoker; diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderGenerator.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderGenerator.java index 087df72..72f5193 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderGenerator.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderGenerator.java @@ -22,6 +22,7 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Stream; + import javax.ws.rs.core.MultivaluedMap; import org.eclipse.microprofile.rest.client.RestClientDefinitionException; @@ -40,7 +41,7 @@ class ClientHeaderGenerator { private final List staticValues; ClientHeaderGenerator(final ClientHeaderParam anno, final Class interfaceClass, final Object clientProxy, - final HeaderFillerFactory fillerFactory) { + final HeaderFillerFactory fillerFactory) { headerName = anno.name(); required = anno.required(); String[] values = anno.value(); @@ -58,7 +59,7 @@ class ClientHeaderGenerator { } private void checkForMethodCallsInHeaderValues(final String[] values, final Class location, - final String headerName) { + final String headerName) { if (Stream.of(values).anyMatch(this::isMethodCall)) { throw new RestClientDefinitionException("A method call defined as one multiple values for header on " + location.getSimpleName() + " for header '" + headerName + "'"); @@ -72,10 +73,9 @@ private boolean isMethodCall(final String headerValue) { } public void fillHeaders(final MultivaluedMap headers) { - List headerValues = - filler != null - ? filler.generateValues() - : staticValues; + List headerValues = filler != null + ? filler.generateValues() + : staticValues; if (!headerValues.isEmpty() && headers.get(headerName) == null) { headers.put(headerName, headerValues); diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderProvider.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderProvider.java index 00847af..769915c 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderProvider.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderProvider.java @@ -28,6 +28,7 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Stream; + import javax.ws.rs.core.MultivaluedMap; import org.eclipse.microprofile.rest.client.RestClientDefinitionException; @@ -36,7 +37,7 @@ public class ClientHeaderProvider { static Optional forMethod(final Method method, final Object clientProxy, - HeaderFillerFactory fillerFactory) { + HeaderFillerFactory fillerFactory) { Class declaringClass = method.getDeclaringClass(); ClientHeaderParam[] methodAnnotations = method.getAnnotationsByType(ClientHeaderParam.class); @@ -49,14 +50,16 @@ static Optional forMethod(final Method method, final Objec throw new RestClientDefinitionException("Duplicate " + ClientHeaderParam.class.getSimpleName() + " annotation definitions found on " + method); } - generators.put(annotation.name(), new ClientHeaderGenerator(annotation, declaringClass, clientProxy, fillerFactory)); + generators.put(annotation.name(), + new ClientHeaderGenerator(annotation, declaringClass, clientProxy, fillerFactory)); } checkForDuplicateClassLevelAnnotations(classAnnotations, declaringClass); Stream.of(classAnnotations) .filter(a -> !generators.containsKey(a.name())) - .forEach(a -> generators.put(a.name(), new ClientHeaderGenerator(a, declaringClass, clientProxy, fillerFactory))); + .forEach(a -> generators.put(a.name(), + new ClientHeaderGenerator(a, declaringClass, clientProxy, fillerFactory))); return generators.isEmpty() ? Optional.empty() @@ -64,7 +67,7 @@ static Optional forMethod(final Method method, final Objec } private static void checkForDuplicateClassLevelAnnotations(final ClientHeaderParam[] classAnnotations, - final Class declaringClass) { + final Class declaringClass) { Set headerNames = new HashSet<>(); Arrays.stream(classAnnotations) .map(ClientHeaderParam::name) @@ -75,8 +78,7 @@ private static void checkForDuplicateClassLevelAnnotations(final ClientHeaderPar "Duplicate ClientHeaderParam definition for header name " + name + " on class " + declaringClass.getCanonicalName()); } - } - ); + }); } private final Collection generators; diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderProviders.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderProviders.java index d37d091..c85bdf0 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderProviders.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeaderProviders.java @@ -26,6 +26,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; + import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; @@ -71,7 +72,8 @@ public static Optional getFactory(Class aClass) { /** * Register, in a static map, {@link ClientHeaderProvider}`s for the given class and all of its methods * - * @param clientClass a class to scan for {@link org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam} and {@link RegisterClientHeaders} + * @param clientClass a class to scan for {@link org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam} and + * {@link RegisterClientHeaders} * @param clientProxy proxy of the clientClass, used to handle the default methods * * @deprecated use {@link #registerForClass(Class, Object, BeanManager)} @@ -84,7 +86,8 @@ public static void registerForClass(Class clientClass, Object clientProxy) { /** * Register, in a static map, {@link ClientHeaderProvider}`s for the given class and all of its methods * - * @param clientClass a class to scan for {@link org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam} and {@link RegisterClientHeaders} + * @param clientClass a class to scan for {@link org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam} and + * {@link RegisterClientHeaders} * @param clientProxy proxy of the clientClass, used to handle the default methods * @param beanManager the bean manager used to construct CDI beans */ @@ -104,26 +107,25 @@ private static void registerHeaderFactory(Class aClass, BeanManager beanManag } private static Optional getCustomHeadersFactory(RegisterClientHeaders annotation, - Class source, BeanManager beanManager) { + Class source, BeanManager beanManager) { Class factoryClass = annotation.value(); try { return Optional.of(construct(factoryClass, beanManager)); } catch (InstantiationException | IllegalAccessException e) { throw new RestClientDefinitionException( - "Failed to instantiate " + factoryClass.getCanonicalName() + ", the client header factory for " + source.getCanonicalName(), - e - ); + "Failed to instantiate " + factoryClass.getCanonicalName() + ", the client header factory for " + + source.getCanonicalName(), + e); } } private static void registerForMethod(Method method, Object clientProxy) { ClientHeaderProvider.forMethod(method, clientProxy, fillerFactory).ifPresent( - provider -> providersForMethod.put(method, provider) - ); + provider -> providersForMethod.put(method, provider)); } private static ClientHeadersFactory construct(final Class factory, - final BeanManager manager) + final BeanManager manager) throws IllegalAccessException, InstantiationException { if (manager != null) { Set> beans = manager.getBeans(factory); diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeadersRequestFilter.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeadersRequestFilter.java index 1861e5b..1a73070 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeadersRequestFilter.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/ClientHeadersRequestFilter.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; + import javax.annotation.Priority; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; @@ -36,7 +37,6 @@ import org.jboss.resteasy.microprofile.client.impl.MpClientInvocation; import org.jboss.resteasy.microprofile.client.utils.ClientRequestContextUtils; - /** * First the headers from `@ClientHeaderParam` annotations are applied, * they can be overwritten by JAX-RS `@HeaderParam` (coming in the `requestContext`) @@ -58,14 +58,15 @@ public void filter(ClientRequestContext requestContext) { Optional handler = ClientHeaderProviders.getProvider(method); handler.ifPresent(h -> h.addHeaders(headers)); - Optional factory = ClientHeaderProviders.getFactory(ClientRequestContextUtils.getDeclaringClass(requestContext)); + Optional factory = ClientHeaderProviders + .getFactory(ClientRequestContextUtils.getDeclaringClass(requestContext)); requestContext.getHeaders().forEach( - (key, values) -> headers.put(key, castToListOfStrings(values)) - ); + (key, values) -> headers.put(key, castToListOfStrings(values))); @SuppressWarnings("unchecked") - MultivaluedMap containerHeaders = (MultivaluedMap) requestContext.getProperty(MpClientInvocation.CONTAINER_HEADERS); + MultivaluedMap containerHeaders = (MultivaluedMap) requestContext + .getProperty(MpClientInvocation.CONTAINER_HEADERS); if (containerHeaders == null) containerHeaders = EMPTY_MAP; // stupid final rules @@ -78,8 +79,7 @@ public void filter(ClientRequestContext requestContext) { } factory.ifPresent(f -> f.update(incomingHeaders, headers) - .forEach((key, values) -> requestContext.getHeaders().put(key, castToListOfObjects(values))) - ); + .forEach((key, values) -> requestContext.getHeaders().put(key, castToListOfObjects(values)))); } private static List castToListOfObjects(List values) { diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderFiller.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderFiller.java index 66bec68..62f2a9c 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderFiller.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderFiller.java @@ -25,7 +25,7 @@ * Used to generate header values for Rest Client * * @author Michal Szynkiewicz, michal.l.szynkiewicz@gmail.com - * 2020-07-10 + * 2020-07-10 */ public interface HeaderFiller { /** diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderFillerFactory.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderFillerFactory.java index 0d2a93a..a22d33e 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderFillerFactory.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderFillerFactory.java @@ -21,7 +21,7 @@ /** * @author Michal Szynkiewicz, michal.l.szynkiewicz@gmail.com - * 2020-07-10 + * 2020-07-10 */ public interface HeaderFillerFactory { /** @@ -31,7 +31,6 @@ public interface HeaderFillerFactory { */ int getPriority(); - /** * Creates {@link HeaderFiller}, will be called once for each method with * {@link org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam} annotation @@ -45,8 +44,8 @@ public interface HeaderFillerFactory { * @return an object that can generate the header value */ HeaderFiller createFiller(String value, - String headerName, - boolean required, - Class interfaceClass, - Object clientProxy); + String headerName, + boolean required, + Class interfaceClass, + Object clientProxy); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HttpHeadersContextProvider.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HttpHeadersContextProvider.java index b0e892d..2782598 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HttpHeadersContextProvider.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/header/HttpHeadersContextProvider.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; + import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.core.Cookie; import javax.ws.rs.core.HttpHeaders; @@ -60,9 +61,7 @@ public MultivaluedMap getRequestHeaders() { MultivaluedMap headers = context.getHeaders(); MultivaluedMap result = new MultivaluedHashMap<>(); headers.forEach( - (key, values) -> - result.put(key, castToListOfStrings(values)) - ); + (key, values) -> result.put(key, castToListOfStrings(values))); return result; } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClient.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClient.java index a34af12..f426790 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClient.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClient.java @@ -22,6 +22,7 @@ import java.net.URI; import java.util.concurrent.ExecutorService; import java.util.concurrent.ScheduledExecutorService; + import javax.ws.rs.core.UriBuilder; import org.eclipse.microprofile.rest.client.ext.QueryParamStyle; @@ -30,28 +31,27 @@ import org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration; import org.jboss.resteasy.client.jaxrs.internal.ResteasyClientImpl; - public class MpClient extends ResteasyClientImpl { private QueryParamStyle queryParamStyle = null; public MpClient(final ClientHttpEngine engine, final ExecutorService executor, final boolean cleanupExecutor, - final ScheduledExecutorService scheduledExecutorService, final ClientConfiguration config) { + final ScheduledExecutorService scheduledExecutorService, final ClientConfiguration config) { super(engine, executor, cleanupExecutor, scheduledExecutorService, config); } protected ResteasyWebTarget createClientWebTarget(ResteasyClientImpl client, String uri, - ClientConfiguration configuration) { + ClientConfiguration configuration) { return new MpClientWebTarget(client, uri, configuration, queryParamStyle); } protected ResteasyWebTarget createClientWebTarget(ResteasyClientImpl client, URI uri, - ClientConfiguration configuration) { + ClientConfiguration configuration) { return new MpClientWebTarget(client, uri, configuration, queryParamStyle); } protected ResteasyWebTarget createClientWebTarget(ResteasyClientImpl client, UriBuilder uriBuilder, - ClientConfiguration configuration) { + ClientConfiguration configuration) { return new MpClientWebTarget(client, uriBuilder, configuration, queryParamStyle); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientBuilderImpl.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientBuilderImpl.java index b432db8..14115cd 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientBuilderImpl.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientBuilderImpl.java @@ -27,14 +27,13 @@ import org.jboss.resteasy.client.jaxrs.internal.ClientConfiguration; import org.jboss.resteasy.client.jaxrs.internal.ResteasyClientBuilderImpl; - public class MpClientBuilderImpl extends ResteasyClientBuilderImpl { @Override protected ResteasyClient createResteasyClient(ClientHttpEngine engine, ExecutorService executor, - boolean cleanupExecutor, - ScheduledExecutorService scheduledExecutorService, - ClientConfiguration config) { + boolean cleanupExecutor, + ScheduledExecutorService scheduledExecutorService, + ClientConfiguration config) { return new MpClient(engine, executor, cleanupExecutor, scheduledExecutorService, config); } } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientInvocation.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientInvocation.java index 45ed16d..28a963c 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientInvocation.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientInvocation.java @@ -21,6 +21,7 @@ import java.net.URI; import java.util.List; + import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MultivaluedMap; @@ -33,7 +34,6 @@ import org.jboss.resteasy.client.jaxrs.internal.ClientResponse; import org.jboss.resteasy.core.ResteasyContext; - public class MpClientInvocation extends ClientInvocation { public static final String CONTAINER_HEADERS = "MP_CLIENT_CONTAINER_HEADERS"; @@ -47,7 +47,7 @@ protected MpClientInvocation(final ClientInvocation clientInvocation) { } protected MpClientInvocation(final ResteasyClient client, final URI uri, final ClientRequestHeaders headers, - final ClientConfiguration parent) { + final ClientConfiguration parent) { super(client, uri, headers, parent); captureContainerHeaders(); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientInvocationBuilder.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientInvocationBuilder.java index cc43b71..72f4ef2 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientInvocationBuilder.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientInvocationBuilder.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.client.impl; import java.net.URI; + import javax.ws.rs.client.CompletionStageRxInvoker; import org.jboss.resteasy.client.jaxrs.ResteasyClient; @@ -29,11 +30,10 @@ import org.jboss.resteasy.client.jaxrs.internal.ClientRequestHeaders; import org.jboss.resteasy.microprofile.client.async.AsyncInterceptorRxInvoker; - public class MpClientInvocationBuilder extends ClientInvocationBuilder { public MpClientInvocationBuilder(final ResteasyClient client, final URI uri, - final ClientConfiguration configuration) { + final ClientConfiguration configuration) { super(client, uri, configuration); } @@ -49,7 +49,7 @@ protected ClientInvocation createClientInvocation(ClientInvocation invocation) { @Override protected ClientInvocation createClientInvocation(ResteasyClient client, URI uri, ClientRequestHeaders headers, - ClientConfiguration parent) { + ClientConfiguration parent) { return new MpClientInvocation(client, uri, headers, parent); } } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientWebTarget.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientWebTarget.java index 90b7952..6e021eb 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientWebTarget.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpClientWebTarget.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.client.impl; import java.net.URI; + import javax.ws.rs.core.UriBuilder; import org.eclipse.microprofile.rest.client.ext.QueryParamStyle; @@ -33,40 +34,40 @@ public class MpClientWebTarget extends ClientWebTarget { private final QueryParamStyle queryParamStyle; protected MpClientWebTarget(final ResteasyClient client, final ClientConfiguration configuration, - final QueryParamStyle queryParamStyle) { + final QueryParamStyle queryParamStyle) { super(client, configuration); this.queryParamStyle = queryParamStyle; } public MpClientWebTarget(final ResteasyClient client, final String uri, final ClientConfiguration configuration, - final QueryParamStyle queryParamStyle) + final QueryParamStyle queryParamStyle) throws IllegalArgumentException, NullPointerException { super(client, new MpUriBuilder().uri(uri, queryParamStyle), configuration); this.queryParamStyle = queryParamStyle; } public MpClientWebTarget(final ResteasyClient client, final URI uri, final ClientConfiguration configuration, - final QueryParamStyle queryParamStyle) throws NullPointerException { + final QueryParamStyle queryParamStyle) throws NullPointerException { super(client, new MpUriBuilder().uri(uri, queryParamStyle), configuration); this.queryParamStyle = queryParamStyle; } public MpClientWebTarget(final ResteasyClient client, final UriBuilder uriBuilder, - final ClientConfiguration configuration, - final QueryParamStyle queryParamStyle) throws NullPointerException { + final ClientConfiguration configuration, + final QueryParamStyle queryParamStyle) throws NullPointerException { super(client, uriBuilder, configuration); this.queryParamStyle = queryParamStyle; } @Override protected ClientWebTarget newInstance(ResteasyClient client, UriBuilder uriBuilder, - ClientConfiguration configuration) { + ClientConfiguration configuration) { return new MpClientWebTarget(client, uriBuilder, configuration, queryParamStyle); } @Override protected ClientInvocationBuilder createClientInvocationBuilder(ResteasyClient client, URI uri, - ClientConfiguration configuration) { + ClientConfiguration configuration) { return new MpClientInvocationBuilder(client, uri, configuration); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpUriBuilder.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpUriBuilder.java index 6236faa..0b362d7 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpUriBuilder.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/impl/MpUriBuilder.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.client.impl; import java.net.URI; + import javax.ws.rs.core.UriBuilder; import org.eclipse.microprofile.rest.client.ext.QueryParamStyle; @@ -40,8 +41,8 @@ public MpUriBuilder() { * set properly. */ public MpUriBuilder(final String host, final String scheme, final int port, - final String userInfo, final String path, final String query, - final String fragment, final String ssp, final String authority) { + final String userInfo, final String path, final String query, + final String fragment, final String ssp, final String authority) { super(host, scheme, port, userInfo, path, query, fragment, ssp, authority); } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/MpPublisherMessageBodyReader.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/MpPublisherMessageBodyReader.java index 49aac3c..f9ede8f 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/MpPublisherMessageBodyReader.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/MpPublisherMessageBodyReader.java @@ -19,12 +19,12 @@ package org.jboss.resteasy.microprofile.client.publisher; - import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.Map; import java.util.concurrent.ExecutorService; + import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; @@ -62,8 +62,8 @@ public boolean isReadable(Class type, Type genericType, Annotation[] annotati @Override public Publisher readFrom(Class> type, Type genericType, Annotation[] annotations, - MediaType mediaType, - MultivaluedMap httpHeaders, InputStream entityStream) + MediaType mediaType, + MultivaluedMap httpHeaders, InputStream entityStream) throws WebApplicationException { MediaType streamType = mediaType; if (mediaType.getParameters() != null) { diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/SSEPublisher.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/SSEPublisher.java index a940142..0a3bd38 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/SSEPublisher.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/SSEPublisher.java @@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; + import javax.ws.rs.ext.Providers; import javax.ws.rs.sse.InboundSseEvent; @@ -58,7 +59,7 @@ public class SSEPublisher implements Publisher { private static final Logger LOGGER = Logger.getLogger(SSEPublisher.class); public SSEPublisher(final Type genericType, final Providers providers, final SseEventInputImpl input, - final ExecutorService es) { + final ExecutorService es) { this.genericType = genericType; this.input = input; this.providers = providers; @@ -80,7 +81,7 @@ public void subscribe(final Subscriber downstream) { * @param processor the stream * @param input the SSE input */ - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings({ "rawtypes", "unchecked" }) private void pump(final SSEProcessor processor, final SseEventInputImpl input) { Runnable readEventTask = new Runnable() { @Override diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/SpscLinkedArrayQueue.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/SpscLinkedArrayQueue.java index 3e34716..312e70e 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/SpscLinkedArrayQueue.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/SpscLinkedArrayQueue.java @@ -108,14 +108,14 @@ public boolean offer(final E e) { } private boolean writeToQueue(final AtomicReferenceArray buffer, final E e, final long index, - final int offset) { + final int offset) { soElement(buffer, offset, e); // StoreStore soProducerIndex(index + 1); // this ensures atomic write of long on 32bit platforms return true; } private void resize(final AtomicReferenceArray oldBuffer, final long currIndex, final int offset, final E e, - final long mask) { + final long mask) { final int capacity = oldBuffer.length(); final AtomicReferenceArray newBuffer = new AtomicReferenceArray<>(capacity); producerBuffer = newBuffer; diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/Subscriptions.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/Subscriptions.java index 6026dd9..23260a8 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/Subscriptions.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/publisher/Subscriptions.java @@ -33,7 +33,7 @@ public class Subscriptions { * @return the original value before the add */ public static long add(AtomicLong requested, long requests) { - for (; ; ) { + for (;;) { long r = requested.get(); if (r == Long.MAX_VALUE) { return Long.MAX_VALUE; @@ -61,7 +61,6 @@ public static long add(long a, long b) { return u; } - /** * Concurrent subtraction bound to 0, mostly used to decrement a request tracker by * the amount produced by the operator. @@ -101,5 +100,4 @@ public static long subOrZero(long a, long b) { return res; } - } diff --git a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/utils/ClientRequestContextUtils.java b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/utils/ClientRequestContextUtils.java index a008f99..7b0033a 100644 --- a/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/utils/ClientRequestContextUtils.java +++ b/rest-client-base/src/main/java/org/jboss/resteasy/microprofile/client/utils/ClientRequestContextUtils.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.client.utils; import java.lang.reflect.Method; + import javax.ws.rs.client.ClientRequestContext; import org.jboss.resteasy.client.jaxrs.internal.ClientInvocation; @@ -39,7 +40,8 @@ public class ClientRequestContextUtils { */ public static Method getMethod(ClientRequestContext requestContext) { if (requestContext instanceof ClientRequestContextImpl == false) { - throw new RuntimeException("Failed to get ClientInvocation from request context. Is RestEasy client used underneath?"); + throw new RuntimeException( + "Failed to get ClientInvocation from request context. Is RestEasy client used underneath?"); } ClientInvocation invocation = ((ClientRequestContextImpl) requestContext).getInvocation(); return invocation.getClientInvoker().getMethod(); @@ -54,7 +56,8 @@ public static Method getMethod(ClientRequestContext requestContext) { */ public static Class getDeclaringClass(ClientRequestContext requestContext) { if (requestContext instanceof ClientRequestContextImpl == false) { - throw new RuntimeException("Failed to get ClientInvocation from request context. Is RestEasy client used underneath?"); + throw new RuntimeException( + "Failed to get ClientInvocation from request context. Is RestEasy client used underneath?"); } ClientInvocation invocation = ((ClientRequestContextImpl) requestContext).getInvocation(); return invocation.getClientInvoker().getDeclaring(); diff --git a/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/DefaultHeaderFiller.java b/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/DefaultHeaderFiller.java index dd08b4b..539fd89 100644 --- a/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/DefaultHeaderFiller.java +++ b/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/DefaultHeaderFiller.java @@ -32,7 +32,8 @@ import org.jboss.logging.Logger; /** - * Generates a value for dynamically computed headers (using {someMethod} as value in {@link org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam}) + * Generates a value for dynamically computed headers (using {someMethod} as value in + * {@link org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam}) */ class DefaultHeaderFiller implements HeaderFiller { @@ -45,22 +46,20 @@ class DefaultHeaderFiller implements HeaderFiller { private final boolean withParam; DefaultHeaderFiller(final String methodSpecifierString, - final String headerName, - final boolean required, - final Class interfaceClass, - final Object clientProxy) { + final String headerName, + final boolean required, + final Class interfaceClass, + final Object clientProxy) { this.required = required; this.headerName = headerName; - String methodSpecifier = - methodSpecifierString.substring(1, methodSpecifierString.length() - 1); + String methodSpecifier = methodSpecifierString.substring(1, methodSpecifierString.length() - 1); method = resolveMethod(methodSpecifier, interfaceClass, headerName); methodHandle = method.isDefault() ? createMethodHandle(method, clientProxy) : null; withParam = method.getParameterCount() == 1; } - public List generateValues() { try { Object result; diff --git a/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/DefaultHeaderFillerFactory.java b/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/DefaultHeaderFillerFactory.java index 7c783ec..938766e 100644 --- a/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/DefaultHeaderFillerFactory.java +++ b/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/DefaultHeaderFillerFactory.java @@ -21,7 +21,7 @@ /** * @author Michal Szynkiewicz, michal.l.szynkiewicz@gmail.com - * 2020-07-10 + * 2020-07-10 */ public class DefaultHeaderFillerFactory implements HeaderFillerFactory { @Override @@ -31,10 +31,10 @@ public int getPriority() { @Override public HeaderFiller createFiller(String value, - String headerName, - boolean required, - Class interfaceClass, - Object clientProxy) { + String headerName, + boolean required, + Class interfaceClass, + Object clientProxy) { return new DefaultHeaderFiller(value, headerName, required, interfaceClass, clientProxy); } } diff --git a/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderUtils.java b/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderUtils.java index 0cee748..efcb50c 100644 --- a/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderUtils.java +++ b/rest-client/src/main/java/org/jboss/resteasy/microprofile/client/header/HeaderUtils.java @@ -28,7 +28,7 @@ /** * @author Michal Szynkiewicz, michal.l.szynkiewicz@gmail.com - * 2020-07-10 + * 2020-07-10 */ public class HeaderUtils { private HeaderUtils() { @@ -56,8 +56,8 @@ public static MethodHandle createMethodHandle(final Method method, final Object * @return method to be called */ public static Method resolveMethod(String methodSpecifier, - Class interfaceClass, - String headerName) { + Class interfaceClass, + String headerName) { int lastDot = methodSpecifier.lastIndexOf('.'); if (lastDot == methodSpecifier.length()) { throw new RestClientDefinitionException("Invalid string to specify method: " + methodSpecifier + diff --git a/rest-client/src/main/java9/src/org/jboss/resteasy/microprofile/client/header/JdkSpecific.java b/rest-client/src/main/java9/src/org/jboss/resteasy/microprofile/client/header/JdkSpecific.java index d9e651d..f9d920a 100644 --- a/rest-client/src/main/java9/src/org/jboss/resteasy/microprofile/client/header/JdkSpecific.java +++ b/rest-client/src/main/java9/src/org/jboss/resteasy/microprofile/client/header/JdkSpecific.java @@ -37,7 +37,8 @@ static MethodHandle createMethodHandle(final Method method, final Object clientP try { final Class proxyType = method.getDeclaringClass(); return MethodHandles.lookup() - .findSpecial(proxyType, method.getName(), MethodType.methodType(method.getReturnType(), method.getParameterTypes()), proxyType) + .findSpecial(proxyType, method.getName(), + MethodType.methodType(method.getReturnType(), method.getParameterTypes()), proxyType) .bindTo(clientProxy); } catch (IllegalAccessException | NoSuchMethodException e) { throw new RestClientDefinitionException("Failed to generate method handle for " + method, e); diff --git a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/ClientHeadersDefaultFactoryCDITest.java b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/ClientHeadersDefaultFactoryCDITest.java index 97c4b42..37e1f93 100644 --- a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/ClientHeadersDefaultFactoryCDITest.java +++ b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/ClientHeadersDefaultFactoryCDITest.java @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; + import javax.inject.Inject; import javax.ws.rs.ApplicationPath; import javax.ws.rs.GET; diff --git a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/ClientHeadersFactoryCDITest.java b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/ClientHeadersFactoryCDITest.java index ee5fe41..74c0eda 100644 --- a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/ClientHeadersFactoryCDITest.java +++ b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/ClientHeadersFactoryCDITest.java @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; + import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.ApplicationPath; @@ -94,7 +95,7 @@ public static class TestClientHeadersFactory implements ClientHeadersFactory { private Counter counter; public MultivaluedMap update(MultivaluedMap incomingHeaders, - MultivaluedMap clientOutgoingHeaders) { + MultivaluedMap clientOutgoingHeaders) { counter.count(); return new MultivaluedHashMap<>(); } diff --git a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/ClientHeaderFillingTest.java b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/ClientHeaderFillingTest.java index d9cf3e6..8ac4f81 100644 --- a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/ClientHeaderFillingTest.java +++ b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/ClientHeaderFillingTest.java @@ -23,6 +23,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; + import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.ApplicationPath; diff --git a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/HighPrioClientHeadersFactory.java b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/HighPrioClientHeadersFactory.java index ae462e7..6888166 100644 --- a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/HighPrioClientHeadersFactory.java +++ b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/HighPrioClientHeadersFactory.java @@ -19,7 +19,6 @@ package org.jboss.resteasy.microprofile.client.headers; - import java.util.Arrays; import org.jboss.resteasy.microprofile.client.header.HeaderFiller; @@ -33,7 +32,7 @@ public int getPriority() { @Override public HeaderFiller createFiller(String value, String headerName, boolean required, Class interfaceClass, - Object clientProxy) { + Object clientProxy) { return () -> Arrays.asList("high", "prio"); } } diff --git a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/LowPrioClientHeadersFactory.java b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/LowPrioClientHeadersFactory.java index 9a4abf4..340bda7 100644 --- a/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/LowPrioClientHeadersFactory.java +++ b/rest-client/src/test/java/org/jboss/resteasy/microprofile/client/headers/LowPrioClientHeadersFactory.java @@ -19,7 +19,6 @@ package org.jboss.resteasy.microprofile.client.headers; - import java.util.Arrays; import org.jboss.resteasy.microprofile.client.header.HeaderFiller; @@ -33,7 +32,7 @@ public int getPriority() { @Override public HeaderFiller createFiller(String value, String headerName, boolean required, Class interfaceClass, - Object clientProxy) { + Object clientProxy) { return () -> Arrays.asList("low", "prio"); } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ClientWebApplicationExceptionConstants.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ClientWebApplicationExceptionConstants.java index 63336c4..20689cf 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ClientWebApplicationExceptionConstants.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ClientWebApplicationExceptionConstants.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Map; + import javax.ws.rs.BadRequestException; import javax.ws.rs.ClientErrorException; import javax.ws.rs.ForbiddenException; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ClientWebApplicationExceptionMicroProfileProxyTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ClientWebApplicationExceptionMicroProfileProxyTest.java index 1877d55..75bb84c 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ClientWebApplicationExceptionMicroProfileProxyTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ClientWebApplicationExceptionMicroProfileProxyTest.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.exception; import java.net.URL; + import javax.ws.rs.RedirectionException; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; @@ -47,11 +48,12 @@ * @tpChapter Client throws ResteasyWebApplicationException on server side * @tpSince RESTEasy 4.6.0.Final * @tpTestCaseDetails Test WebApplicationExceptions and WebApplicationExceptionWrappers in various circumstances, - * calls made by MicroProfile REST Client proxies. + * calls made by MicroProfile REST Client proxies. * - * NOTE. Unlike RESTEasy Clients and RESTEasy Client proxies, which throws the subtree of WebApplicationExceptions - * and WebApplicationExceptionWrappers, MicroProfile REST Client proxies throw only WebApplicationExceptions - * and WebApplicationExceptionWrappers. + * NOTE. Unlike RESTEasy Clients and RESTEasy Client proxies, which throws the subtree of + * WebApplicationExceptions + * and WebApplicationExceptionWrappers, MicroProfile REST Client proxies throw only WebApplicationExceptions + * and WebApplicationExceptionWrappers. */ @RunWith(Arquillian.class) @RunAsClient @@ -62,11 +64,10 @@ public class ClientWebApplicationExceptionMicroProfileProxyTest { @ArquillianResource private URL url; - @Deployment public static Archive deploy() throws Exception { return TestEnvironment.createWarWithConfigUrl(ClientWebApplicationExceptionMicroProfileProxyTest.class, - ClientWebApplicationExceptionProxyResourceInterface.class, "/app/test/") + ClientWebApplicationExceptionProxyResourceInterface.class, "/app/test/") .addClass(ClientWebApplicationExceptionConstants.class) .addClass(ClientWebApplicationExceptionMicroProfileProxyApplication.class) .addClass(ClientWebApplicationExceptionMicroProfileProxyResource.class) @@ -85,8 +86,8 @@ public void createProxy() throws Exception { /** * @tpTestDetails For each WebApplicationException in oldExceptions, calls the resource method oldException() to throw - * that WebApplicationException. Since it is running on the client side, the standard behavior of throwing a - * WebApplicationException will occur. + * that WebApplicationException. Since it is running on the client side, the standard behavior of throwing a + * WebApplicationException will occur. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -128,9 +129,11 @@ public void testOldExceptionsDirectly() { } /** - * @tpTestDetails For each ResteasyWebApplicationException in newExceptions, calls the resource method newException() to throw - * that WebApplicationExceptionWrapper. Since it is running on the client side, the standard behavior of throwing a - * WebApplicationException will occur. + * @tpTestDetails For each ResteasyWebApplicationException in newExceptions, calls the resource method newException() to + * throw + * that WebApplicationExceptionWrapper. Since it is running on the client side, the standard behavior of + * throwing a + * WebApplicationException will occur. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -173,19 +176,22 @@ public void testNewExceptionsDirectly() throws Exception { /** * @tpTestDetails 1. The value of ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR is - * set to "true" to compel the original Client behavior on the server side. + * set to "true" to compel the original Client behavior on the server side. * - * 2. For each WebApplicationException in oldExceptions, the resource method noCatchOld() is called. + * 2. For each WebApplicationException in oldExceptions, the resource method noCatchOld() is called. * - * 3. noCatchOld() calls oldException(), which throws the chosen member of oldExceptions. The resulting - * HTTP response contains the status, headers, and entity in that WebApplicationException. + * 3. noCatchOld() calls oldException(), which throws the chosen member of oldExceptions. The resulting + * HTTP response contains the status, headers, and entity in that WebApplicationException. * - * 4. In noCatchOld(), the original behavior causes the HTTP response to be turned into a WebApplicationException, - * which is thrown by the Client. The resulting HTTP response contains the status, headers, and entity in that - * WebApplicationException. + * 4. In noCatchOld(), the original behavior causes the HTTP response to be turned into a + * WebApplicationException, + * which is thrown by the Client. The resulting HTTP response contains the status, headers, and entity in + * that + * WebApplicationException. * - * 5. The client side Client constructs and throws a WebApplicationException which is checked against the matching - * WebApplicationException in oldExceptins. + * 5. The client side Client constructs and throws a WebApplicationException which is checked against the + * matching + * WebApplicationException in oldExceptins. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -233,18 +239,20 @@ public void testNoCatchOldBehaviorOldExceptions() { /** * @tpTestDetails 1. The value of ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR is - * set to "true" to compel the original Client behavior on the server side. + * set to "true" to compel the original Client behavior on the server side. * - * 2. For each ResteasyWebApplicationException in ClientWebApplicationExceptionTest.newExceptions, the resource method noCatchNew() is called. + * 2. For each ResteasyWebApplicationException in ClientWebApplicationExceptionTest.newExceptions, the + * resource method noCatchNew() is called. * - * 3. noCatchNew() calls newException(), which throws the matching member of newExceptions. The resulting - * Response is sanitized. + * 3. noCatchNew() calls newException(), which throws the matching member of newExceptions. The resulting + * Response is sanitized. * - * 4. In noCatchNew(), the original behavior causes the HTTP response to be turned into a WebApplicationException, - * which is thrown by the Client. The resulting HTTP response is sanitized. + * 4. In noCatchNew(), the original behavior causes the HTTP response to be turned into a + * WebApplicationException, + * which is thrown by the Client. The resulting HTTP response is sanitized. * - * 5. The client side Client constructs and throws a WebApplicationException which is checked for a sanitized - * Response and matching status. + * 5. The client side Client constructs and throws a WebApplicationException which is checked for a sanitized + * Response and matching status. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -293,14 +301,15 @@ public void testNoCatchOldBehaviorNewExceptions() { /** * @tpTestDetails 1. For each WebApplicationException in oldExceptions, the resource method noCatchOld() is called. * - * 2. noCatchOld() calls oldException(), which throws the matching member of oldExceptions. The resulting - * HTTP response contains the status, headers, and entity in that WebApplicationException. + * 2. noCatchOld() calls oldException(), which throws the matching member of oldExceptions. The resulting + * HTTP response contains the status, headers, and entity in that WebApplicationException. * - * 3. In noCatchOld(), the new behavior causes the HTTP response to be turned into a WebApplicationExceptionWrapper, - * which is thrown by the Client. WebApplicationExceptionWrapper.getResponse() returns a sanitized Response + * 3. In noCatchOld(), the new behavior causes the HTTP response to be turned into a + * WebApplicationExceptionWrapper, + * which is thrown by the Client. WebApplicationExceptionWrapper.getResponse() returns a sanitized Response * - * 4. The client side Client constructs and throws a WebApplicationException which is checked for a sanitized - * Response and matching status. + * 4. The client side Client constructs and throws a WebApplicationException which is checked for a sanitized + * Response and matching status. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -344,13 +353,15 @@ public void testNoCatchNewBehaviorOldExceptions() { /** * @tpTestDetails 1. For each ResteasyWebApplicationException in newExceptions, the resource method noCatchNew() is called. * - * 2. noCatchNew() calls newException(), which throws the matching member of newExceptions. + * 2. noCatchNew() calls newException(), which throws the matching member of newExceptions. * - * 3. In noCatchNew(), the new behavior causes the HTTP response to be turned into a WebApplicationExceptionWrapper, - * which is thrown by the Client. + * 3. In noCatchNew(), the new behavior causes the HTTP response to be turned into a + * WebApplicationExceptionWrapper, + * which is thrown by the Client. * - * 4. The client side Client constructs and throws a WebApplicationException which is checked for matching status, no - * added headers, and empty entity. + * 4. The client side Client constructs and throws a WebApplicationException which is checked for matching + * status, no + * added headers, and empty entity. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -393,20 +404,22 @@ public void testNoCatchNewBehaviorNewExceptions() { /** * @tpTestDetails 1. The value of ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR is - * set to "true" to compel the original Client behavior on the server side. + * set to "true" to compel the original Client behavior on the server side. * - * 2. For each WebApplicationException in oldExceptions, the resource method catchOldOld() is called. + * 2. For each WebApplicationException in oldExceptions, the resource method catchOldOld() is called. * - * 3. catchOldOld() calls oldException(), which throws the chosen member of oldExceptions. The resulting - * HTTP response contains the status, headers, and entity in that WebApplicationException. + * 3. catchOldOld() calls oldException(), which throws the chosen member of oldExceptions. The resulting + * HTTP response contains the status, headers, and entity in that WebApplicationException. * - * 4. In catchOldOld(), the original behavior causes the HTTP response to be turned into a WebApplicationException, - * which is thrown by the Client. That WebApplicationException is caught, verified to match the matching - * WebApplicationException in oldExceptins, and then rethrown. The resulting HTTP response contains the - * status, headers, and entity in that WebApplicationException. + * 4. In catchOldOld(), the original behavior causes the HTTP response to be turned into a + * WebApplicationException, + * which is thrown by the Client. That WebApplicationException is caught, verified to match the matching + * WebApplicationException in oldExceptins, and then rethrown. The resulting HTTP response contains the + * status, headers, and entity in that WebApplicationException. * - * 5. The client side Client constructs and throws a WebApplicationException which is checked against the matching - * WebApplicationException in oldExceptins. + * 5. The client side Client constructs and throws a WebApplicationException which is checked against the + * matching + * WebApplicationException in oldExceptins. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -458,19 +471,20 @@ public void testCatchOldBehaviorOldExceptions() { /** * @tpTestDetails 1. The value of ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR is - * set to "true" to compel the original Client behavior on the server side. + * set to "true" to compel the original Client behavior on the server side. * - * 2. For each ResteasyWebApplicationException in newExceptions, the resource method catchOldNew() is called. + * 2. For each ResteasyWebApplicationException in newExceptions, the resource method catchOldNew() is called. * - * 3. catchOldNew() calls newException(), which throws the chosen member of newExceptions - * WebApplicationExceptionWrapper.getResponse() returns a sanitized Response. + * 3. catchOldNew() calls newException(), which throws the chosen member of newExceptions + * WebApplicationExceptionWrapper.getResponse() returns a sanitized Response. * - * 4. In catchOldNew(), the original behavior causes the HTTP response to be turned into a WebApplicationException, - * which is thrown by the Client. That WebApplicationException is caught, verified to - * have matching status, no added headers, and an empty entity, and then rethrown. + * 4. In catchOldNew(), the original behavior causes the HTTP response to be turned into a + * WebApplicationException, + * which is thrown by the Client. That WebApplicationException is caught, verified to + * have matching status, no added headers, and an empty entity, and then rethrown. * - * 5. The client side Client constructs and throws a WebApplicationException which is verified to have - * matching status, no added headers, and an empty entity. + * 5. The client side Client constructs and throws a WebApplicationException which is verified to have + * matching status, no added headers, and an empty entity. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -521,14 +535,15 @@ public void testCatchOldBehaviorNewExceptions() { /** * @tpTestDetails 1. For each WebApplicationException in oldExceptions, the resource method catchNewOld() is called. * - * 2. catchNewOld() calls oldException(), which throws the matching member of oldExceptions. The resulting - * HTTP response contains the status, headers, and entity in that WebApplicationException. + * 2. catchNewOld() calls oldException(), which throws the matching member of oldExceptions. The resulting + * HTTP response contains the status, headers, and entity in that WebApplicationException. * - * 3. In catchNewOld(), the new behavior causes the HTTP response to be turned into a WebApplicationExceptionWrapper, - * which is thrown by the Client, caught, tested, and rethrown. + * 3. In catchNewOld(), the new behavior causes the HTTP response to be turned into a + * WebApplicationExceptionWrapper, + * which is thrown by the Client, caught, tested, and rethrown. * - * 4. The client side Client constructs and throws a WebApplicationException which is checked for a sanitized - * Response and matching status. + * 4. The client side Client constructs and throws a WebApplicationException which is checked for a sanitized + * Response and matching status. * @tpSince RESTEasy 4.6.0.Final */ @Test @@ -573,13 +588,15 @@ public void testCatchNewBehaviorOldExceptions() { /** * @tpTestDetails 1. For each ResteasyWebApplicationException in newExceptions, the resource method catchNewNew() is called. * - * 2. catchNewNew() calls newException(), which throws the matching member of newExceptions. + * 2. catchNewNew() calls newException(), which throws the matching member of newExceptions. * - * 3. In catchNewNew(), the new behavior causes the HTTP response to be turned into a WebApplicationExceptionWrapper, - * which is thrown by the Client, caught, tested, and rethrown. + * 3. In catchNewNew(), the new behavior causes the HTTP response to be turned into a + * WebApplicationExceptionWrapper, + * which is thrown by the Client, caught, tested, and rethrown. * - * 4. The client side Client constructs and throws a WebApplicationException which is checked for matching status, no - * added headers, and empty entity. + * 4. The client side Client constructs and throws a WebApplicationException which is checked for matching + * status, no + * added headers, and empty entity. * @tpSince RESTEasy 4.6.0.Final */ @Test diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ResponseExceptionMapperRuntimeExceptionTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ResponseExceptionMapperRuntimeExceptionTest.java index aee98ed..625b00a 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ResponseExceptionMapperRuntimeExceptionTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/ResponseExceptionMapperRuntimeExceptionTest.java @@ -22,6 +22,7 @@ import static org.junit.Assert.fail; import java.net.URL; + import javax.ws.rs.WebApplicationException; import org.eclipse.microprofile.rest.client.RestClientBuilder; @@ -100,5 +101,4 @@ public void testRuntimeAException() throws Exception { } } - } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionMicroProfileProxyApplication.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionMicroProfileProxyApplication.java index 108c85e..df71f34 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionMicroProfileProxyApplication.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionMicroProfileProxyApplication.java @@ -21,6 +21,7 @@ import java.util.HashSet; import java.util.Set; + import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionMicroProfileProxyResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionMicroProfileProxyResource.java index f661992..deff978 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionMicroProfileProxyResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionMicroProfileProxyResource.java @@ -178,7 +178,7 @@ public String catchOldNew(@PathParam("i") int i) throws Exception { * It is assumed that ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR holds * "false" when this method is invoked. * - * Uses a Client to call oldException(). Since the new behavior is configured, the proxy will throw a + * Uses a Client to call oldException(). Since the new behavior is configured, the proxy will throw a * WebApplicationExceptionWrapper, which is caught and examined. getResponse() should return a sanitized * Response, but the unwrapped Response should match the WebApplicationException * thrown by oldException(). That WebApplicationExceptionWrapper is then rethrown. diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionProxyResourceInterface.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionProxyResourceInterface.java index 869454d..abfbb57 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionProxyResourceInterface.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ClientWebApplicationExceptionProxyResourceInterface.java @@ -64,7 +64,8 @@ public interface ClientWebApplicationExceptionProxyResourceInterface { /** * Uses a Client or proxy to call oldException() to get an HTTP response derived from a WebApplicationException. - * Based on that response, the Client or proxy will throw either a WebApplicationException or ResteasyWebApplicationException, + * Based on that response, the Client or proxy will throw either a WebApplicationException or + * ResteasyWebApplicationException, * depending on the value of ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR. * * @param i determines element of oldExceptions to be thrown by oldException() @@ -77,7 +78,8 @@ public interface ClientWebApplicationExceptionProxyResourceInterface { /** * Uses a Client or proxy to call newException() to get an HTTP response derived from a ResteasyWebApplicationException. - * Based on that response, the Client or proxy will throw either a WebApplicationException or ResteasyWebApplicationException, + * Based on that response, the Client or proxy will throw either a WebApplicationException or + * ResteasyWebApplicationException, * depending on the value of ResteasyContextParameters.RESTEASY_ORIGINAL_WEBAPPLICATIONEXCEPTION_BEHAVIOR. * * @param i determines element of newExceptions to be thrown by newException() diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ResponseExceptionMapperRuntimeExceptionResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ResponseExceptionMapperRuntimeExceptionResource.java index fe129c9..d2cf475 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ResponseExceptionMapperRuntimeExceptionResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/exception/resource/ResponseExceptionMapperRuntimeExceptionResource.java @@ -22,7 +22,8 @@ import javax.ws.rs.Path; @Path("/test") -public class ResponseExceptionMapperRuntimeExceptionResource implements ResponseExceptionMapperRuntimeExceptionResourceInterface { +public class ResponseExceptionMapperRuntimeExceptionResource + implements ResponseExceptionMapperRuntimeExceptionResourceInterface { public String get() { throw new RuntimeException("Test error"); diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/ExceptionMapperReturnsNullTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/ExceptionMapperReturnsNullTest.java index eb2e902..bc160eb 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/ExceptionMapperReturnsNullTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/ExceptionMapperReturnsNullTest.java @@ -39,10 +39,10 @@ * @tpSubChapter MicroProfile rest client * @tpChapter Integration tests * @tpTestCaseDetails The microprofile-rest-client 2.0 specification describes use of a custom - * ResponseExceptionMapper implementation and a default ResponseExceptionMapper. - * There is a scenario in which the default ResponseExceptionMapper has been disabled - * and the custom ResponseExceptionMapper returns null. This test verifies the proper - * behavior for this scenario and when the default ResponseExceptionMapper is present. + * ResponseExceptionMapper implementation and a default ResponseExceptionMapper. + * There is a scenario in which the default ResponseExceptionMapper has been disabled + * and the custom ResponseExceptionMapper returns null. This test verifies the proper + * behavior for this scenario and when the default ResponseExceptionMapper is present. * @tpSince RESTEasy 4.7.0 */ @RunWith(Arquillian.class) diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/FollowRedirectMPConfigPropertyTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/FollowRedirectMPConfigPropertyTest.java index 010b1b9..7572ddc 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/FollowRedirectMPConfigPropertyTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/FollowRedirectMPConfigPropertyTest.java @@ -22,6 +22,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; + import javax.ws.rs.core.Response; import org.eclipse.microprofile.rest.client.RestClientBuilder; @@ -102,8 +103,8 @@ public void badValue() throws Exception { } private void testRedirected(final FollowRedirectsServiceIntf followRedirectsServiceIntf, - final Response.Status expectedStatus, - final String expectedText) { + final Response.Status expectedStatus, + final String expectedText) { try (Response response = followRedirectsServiceIntf.redirectPing()) { Assert.assertEquals(expectedStatus.getStatusCode(), response.getStatus()); Assert.assertEquals(expectedText, response.readEntity(String.class)); diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/FollowRedirectsTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/FollowRedirectsTest.java index 2cc979c..fb3b34e 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/FollowRedirectsTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/FollowRedirectsTest.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration; import java.net.URL; + import javax.ws.rs.core.Response; import org.eclipse.microprofile.rest.client.RestClientBuilder; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/JsonpMPTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/JsonpMPTest.java index 2db4f95..13bcaa4 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/JsonpMPTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/JsonpMPTest.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration; import java.net.URL; + import javax.json.Json; import javax.json.JsonArray; import javax.json.JsonNumber; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/MPClientCollectionTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/MPClientCollectionTest.java index 7c5cdd2..d669129 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/MPClientCollectionTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/MPClientCollectionTest.java @@ -23,6 +23,7 @@ import java.net.URL; import java.util.Collections; import java.util.List; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.GenericType; @@ -50,7 +51,7 @@ * @tpSubChapter MicroProfile Config * @tpChapter Integration tests * @tpTestCaseDetails Show how to use injection to get access to the service. - * Show configuration required for a GenericType return type. + * Show configuration required for a GenericType return type. * @tpSince RESTEasy 4.6.0 */ @RunWith(Arquillian.class) @@ -69,11 +70,10 @@ public static Archive serviceDeploy() { @Deployment(name = WAR_CLIENT) public static Archive clientDeploy() throws IOException { return TestEnvironment.addConfigProperties(TestEnvironment.createWar(WAR_CLIENT) - .addClasses(MPCollectionActivator.class, MPCollectionResource.class, - MPCollectionServiceIntf.class), + .addClasses(MPCollectionActivator.class, MPCollectionResource.class, + MPCollectionServiceIntf.class), Collections.singletonMap(MPCollectionServiceIntf.class.getCanonicalName() + "/mp-rest/url", TestEnvironment - .getHttpUrl() + WAR_SERVICE) - ); + .getHttpUrl() + WAR_SERVICE)); } static Client client; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientContextProviderTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientContextProviderTest.java index 288f179..6bd0299 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientContextProviderTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientContextProviderTest.java @@ -26,6 +26,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; + import javax.ws.rs.core.Response; import org.eclipse.microprofile.rest.client.RestClientBuilder; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProviderPriorityTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProviderPriorityTest.java index a03c61e..20bdff7 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProviderPriorityTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProviderPriorityTest.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.net.URL; + import javax.annotation.Priority; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -60,20 +61,18 @@ public static Archive deploy() { @Test public void helloNaruto() throws Exception { - HelloClient helloClient = - RestClientBuilder.newBuilder() - .baseUri(TestEnvironment.generateUri(url, "test-app")) - .build(HelloClient.class); + HelloClient helloClient = RestClientBuilder.newBuilder() + .baseUri(TestEnvironment.generateUri(url, "test-app")) + .build(HelloClient.class); assertEquals("Hello Naruto", helloClient.hello("Naruto")); } @Test public void helloBar() throws Exception { - HelloClient helloClient = - RestClientBuilder.newBuilder() - .baseUri(TestEnvironment.generateUri(url, "test-app")) - .build(HelloClient.class); + HelloClient helloClient = RestClientBuilder.newBuilder() + .baseUri(TestEnvironment.generateUri(url, "test-app")) + .build(HelloClient.class); assertEquals("Hello Bar", helloClient.hello(null)); } @@ -81,7 +80,8 @@ public void helloBar() throws Exception { @Path("/") @Produces("text/plain") // Bar should execute first due to lower priority 1 vs Integer.MAX - @RegisterProviders({@RegisterProvider(HelloFooProvider.class), @RegisterProvider(value = HelloBarProvider.class, priority = 1)}) + @RegisterProviders({ @RegisterProvider(HelloFooProvider.class), + @RegisterProvider(value = HelloBarProvider.class, priority = 1) }) public interface HelloClient { @GET @Path("/hello") diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProxyRedeployTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProxyRedeployTest.java index f821a20..c099cbb 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProxyRedeployTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProxyRedeployTest.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.net.URL; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProxyTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProxyTest.java index 6aca59a..25807c0 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProxyTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/RestClientProxyTest.java @@ -37,15 +37,13 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; + import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ParamConverter; import javax.ws.rs.ext.ParamConverterProvider; import javax.ws.rs.ext.Provider; -import io.vertx.core.Vertx; -import io.vertx.core.http.HttpClientOptions; -import io.vertx.core.http.HttpVersion; import org.eclipse.microprofile.rest.client.RestClientBuilder; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.RunAsClient; @@ -64,6 +62,10 @@ import org.junit.Test; import org.junit.runner.RunWith; +import io.vertx.core.Vertx; +import io.vertx.core.http.HttpClientOptions; +import io.vertx.core.http.HttpVersion; + @RunWith(Arquillian.class) @RunAsClient public class RestClientProxyTest { @@ -81,8 +83,7 @@ public static Archive deploy() throws IOException { HeaderPropagator.class, TestParamConverter.class, TestParamConverterProvider.class, - NgHTTP2.class - ) + NgHTTP2.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } @@ -290,7 +291,7 @@ public static class TestParamConverterProvider implements ParamConverterProvider @Override @SuppressWarnings("unchecked") public ParamConverter getConverter(final Class rawType, final Type genericType, - final Annotation[] annotations) { + final Annotation[] annotations) { if (Objects.equals(rawType, CharSequence.class)) { return (ParamConverter) converter; } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/Dog.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/Dog.java index 4aacbce..c4ebaca 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/Dog.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/Dog.java @@ -24,7 +24,7 @@ /** * Created by tterem. */ -@JsonbPropertyOrder({"name", "sort"}) +@JsonbPropertyOrder({ "name", "sort" }) public class Dog { private String name; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsResource.java index 1cbabf1..11869ae 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsResource.java @@ -34,7 +34,6 @@ public Response redirected() { return Response.ok("OK").build(); } - @GET @Path("redirectedDirectResponse") public String redirectedDirectResponse() { diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsService.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsService.java index 2991f57..dffc60c 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsService.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsService.java @@ -22,6 +22,7 @@ import java.net.URI; import java.util.ArrayList; import java.util.List; + import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -48,9 +49,9 @@ public List getList() { @GET @Path("tmpRedirect/{p}/{testname}") public Response tmpRedirect(@PathParam("p") String p, - @PathParam("testname") String testname) { + @PathParam("testname") String testname) { return Response.temporaryRedirect( - createUri("/" + p + "/redirected", testname)) + createUri("/" + p + "/redirected", testname)) .build(); } @@ -58,26 +59,25 @@ public Response tmpRedirect(@PathParam("p") String p, @POST public Response postRedirect(String testname) { return Response.seeOther( - createUri(prefix + "/redirected", testname)) + createUri(prefix + "/redirected", testname)) .build(); } @GET @Path("movedPermanently/{p}/{testname}") public Response movedPermanently(@PathParam("p") String p, - @PathParam("testname") String testname) { + @PathParam("testname") String testname) { return Response.status(301).header("location", - createUri("/" + p + "/redirectedDirectResponse", testname)) + createUri("/" + p + "/redirectedDirectResponse", testname)) .build(); } - @GET @Path("found/{p}/{testname}") public Response found(@PathParam("p") String p, - @PathParam("testname") String testname) { + @PathParam("testname") String testname) { return Response.status(302).header("location", - createUri("/" + p + "/redirectedDirectResponse", testname)) + createUri("/" + p + "/redirectedDirectResponse", testname)) .build(); } @@ -91,7 +91,7 @@ public String ping() { @Path("redirect/ping") public Response redirectPing() { return Response.temporaryRedirect( - URI.create(uriInfo.getBaseUri() + uriInfo.getPathSegments().get(0).getPath() + "/ping")) + URI.create(uriInfo.getBaseUri() + uriInfo.getPathSegments().get(0).getPath() + "/ping")) .build(); } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsServiceIntf.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsServiceIntf.java index 2327497..7963b6a 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsServiceIntf.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/FollowRedirectsServiceIntf.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.util.List; + import javax.inject.Singleton; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -40,7 +41,7 @@ public interface FollowRedirectsServiceIntf { @GET @Path("tmpRedirect/{p}/{testname}") Response tmpRedirect(@PathParam("p") String p, - @PathParam("testname") String testname); + @PathParam("testname") String testname); @Path("post-redirect") @POST @@ -49,12 +50,12 @@ Response tmpRedirect(@PathParam("p") String p, @GET @Path("movedPermanently/{p}/{testname}") Response movedPermanently(@PathParam("p") String p, - @PathParam("testname") String testname); + @PathParam("testname") String testname); @GET @Path("found/{p}/{testname}") Response found(@PathParam("p") String p, - @PathParam("testname") String testname); + @PathParam("testname") String testname); @GET @Path("ping") diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HeaderPropagator.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HeaderPropagator.java index ba500ac..e8a7ae4 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HeaderPropagator.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HeaderPropagator.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.util.List; + import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MultivaluedMap; @@ -30,7 +31,7 @@ public class HeaderPropagator implements ClientHeadersFactory { @Override public MultivaluedMap update(MultivaluedMap containerRequestHeaders, - MultivaluedMap clientRequestHeaders) { + MultivaluedMap clientRequestHeaders) { Assert.assertNull(ResteasyContext.getContextData(HttpHeaders.class)); List prop = containerRequestHeaders.get("X-Propagated"); if (prop != null) diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HealthService.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HealthService.java index 31cbc33..74aec5b 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HealthService.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HealthService.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.io.Closeable; + import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -28,7 +29,7 @@ public interface HealthService extends Closeable { @GET - @Produces({MediaType.APPLICATION_JSON}) + @Produces({ MediaType.APPLICATION_JSON }) @Path("/health") HealthCheckData getHealthData() throws WebApplicationException; } \ No newline at end of file diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HelloClient.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HelloClient.java index 20374ab..6325afb 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HelloClient.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HelloClient.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.util.concurrent.CompletionStage; + import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HelloResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HelloResource.java index 30d181e..be67bfd 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HelloResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/HelloResource.java @@ -21,6 +21,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; + import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; @@ -74,7 +75,7 @@ public CompletionStage cs(@PathParam("id") String id) { @GET @Path("async-client-target") public CompletionStage asyncClientTarget(@HeaderParam("X-Propagated") String propagatedHeader, - @HeaderParam("X-Not-Propagated") String nonPropagatedHeader) { + @HeaderParam("X-Not-Propagated") String nonPropagatedHeader) { Assert.assertNull(nonPropagatedHeader); Assert.assertEquals("got-a-value", propagatedHeader); return CompletableFuture.completedFuture("OK"); @@ -83,7 +84,7 @@ public CompletionStage asyncClientTarget(@HeaderParam("X-Propagated") St @GET @Path("async-client") public CompletionStage asyncClient(@HeaderParam("X-Propagated") String propagatedHeader, - @HeaderParam("X-Not-Propagated") String nonPropagatedHeader) { + @HeaderParam("X-Not-Propagated") String nonPropagatedHeader) { Assert.assertEquals("got-a-value", propagatedHeader); Assert.assertEquals("got-a-value", nonPropagatedHeader); return rest.asyncClientTarget(); @@ -92,7 +93,7 @@ public CompletionStage asyncClient(@HeaderParam("X-Propagated") String p @GET @Path("client-target") public String clientTarget(@HeaderParam("X-Propagated") String propagatedHeader, - @HeaderParam("X-Not-Propagated") String nonPropagatedHeader) { + @HeaderParam("X-Not-Propagated") String nonPropagatedHeader) { Assert.assertNull(nonPropagatedHeader); Assert.assertEquals("got-a-value", propagatedHeader); return "OK"; @@ -101,7 +102,7 @@ public String clientTarget(@HeaderParam("X-Propagated") String propagatedHeader, @GET @Path("client") public String client(@HeaderParam("X-Propagated") String propagatedHeader, - @HeaderParam("X-Not-Propagated") String nonPropagatedHeader) { + @HeaderParam("X-Not-Propagated") String nonPropagatedHeader) { Assert.assertEquals("got-a-value", propagatedHeader); Assert.assertEquals("got-a-value", nonPropagatedHeader); return rest.clientTarget(); diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/JsonpMPService.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/JsonpMPService.java index 1d3e7ec..9497e31 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/JsonpMPService.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/JsonpMPService.java @@ -60,11 +60,11 @@ public JsonArray array(JsonArray array) { @Consumes("application/json") public JsonObject object(JsonObject obj) { Assert.assertTrue("The field 'name' didn't propagated correctly from the request", obj.containsKey("name")); - Assert.assertEquals("The value of field 'name' didn't propagated correctly from the request" - , obj.getJsonString("name").getString(), "Bill"); + Assert.assertEquals("The value of field 'name' didn't propagated correctly from the request", + obj.getJsonString("name").getString(), "Bill"); if (obj.containsKey("id")) { - Assert.assertEquals("The value of field 'id' didn't propagated correctly from the request" - , obj.getJsonNumber("id").longValue(), 10001); + Assert.assertEquals("The value of field 'id' didn't propagated correctly from the request", + obj.getJsonNumber("id").longValue(), 10001); } return obj; } @@ -81,7 +81,6 @@ public JsonStructure object(JsonStructure struct) { return obj; } - @Path("number") @POST @Consumes(MediaType.APPLICATION_JSON) diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionResource.java index 0f9772e..9bfd631 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionResource.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.util.List; + import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.ws.rs.GET; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionService.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionService.java index ded8b17..f5db378 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionService.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionService.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; + import javax.ws.rs.GET; import javax.ws.rs.Path; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionServiceIntf.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionServiceIntf.java index 053369c..6da42e0 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionServiceIntf.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/MPCollectionServiceIntf.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.util.List; + import javax.inject.Singleton; import javax.ws.rs.GET; import javax.ws.rs.Path; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/NgHTTP2.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/NgHTTP2.java index 1537604..192f01d 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/NgHTTP2.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/NgHTTP2.java @@ -1,10 +1,10 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; -import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; - import javax.ws.rs.GET; import javax.ws.rs.Path; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + @RegisterRestClient public interface NgHTTP2 { @GET diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/QueryParamStyleService.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/QueryParamStyleService.java index 3662220..cdec645 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/QueryParamStyleService.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/QueryParamStyleService.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; + import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.QueryParam; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/QueryParamStyleServiceIntf.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/QueryParamStyleServiceIntf.java index 7514f2c..2f72ec2 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/QueryParamStyleServiceIntf.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/QueryParamStyleServiceIntf.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.util.List; + import javax.inject.Singleton; import javax.ws.rs.GET; import javax.ws.rs.Path; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncClient.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncClient.java index 7a697db..624eb51 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncClient.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncClient.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.util.concurrent.CompletionStage; + import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncFilter.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncFilter.java index 7e68c73..718b93d 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncFilter.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncFilter.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.client.integration.resource; import java.io.IOException; + import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientResponseContext; import javax.ws.rs.client.ClientResponseFilter; @@ -33,6 +34,7 @@ public class TestAsyncFilter implements ClientResponseFilter { @Override public void filter(final ClientRequestContext requestContext, final ClientResponseContext responseContext) throws IOException { - responseContext.getHeaders().putSingle("test1-state", TestAsyncInvocationInterceptorFactory.localState.get().toString()); + responseContext.getHeaders().putSingle("test1-state", + TestAsyncInvocationInterceptorFactory.localState.get().toString()); } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncResource.java index 497800c..60824ce 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/integration/resource/TestAsyncResource.java @@ -21,6 +21,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; + import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.Response; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/RESTEasyParamBasicTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/RESTEasyParamBasicTest.java index e642a46..97e93c8 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/RESTEasyParamBasicTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/RESTEasyParamBasicTest.java @@ -41,7 +41,7 @@ * @tpSubChapter Parameters * @tpChapter Integration tests * @tpTestCaseDetails Test for RESTEasy param annotations (https://issues.jboss.org/browse/RESTEASY-1880) - * Test logic is in the end-point in deployment. + * Test logic is in the end-point in deployment. * @tpSince RESTEasy 3.6 */ @RunWith(Arquillian.class) @@ -51,21 +51,21 @@ public class RESTEasyParamBasicTest { @ArquillianResource private URL url; - @Deployment public static Archive deploySimpleResource() { return TestEnvironment.createWar(RESTEasyParamBasicTest.class) .addClasses( ProxyBeanParamResource.class, Params.class, - ProxyParameterAnotationsResource.class - ); + ProxyParameterAnotationsResource.class); } /** - * @tpTestDetails Basic check of new query parameters, matrix parameters, header parameters, cookie parameters and form parameters in proxy clients - * Test checks that RESTEasy can inject correct values to method attributes in proxy clients - * This test uses new annotations without any annotation value in the proxy, however the annotation values are used in the server side resource. + * @tpTestDetails Basic check of new query parameters, matrix parameters, header parameters, cookie parameters and form + * parameters in proxy clients + * Test checks that RESTEasy can inject correct values to method attributes in proxy clients + * This test uses new annotations without any annotation value in the proxy, however the annotation values + * are used in the server side resource. * @tpSince RESTEasy 4.0 */ @Test @@ -86,8 +86,8 @@ public void proxyClientAllParamsTest() throws Exception { /** * @tpTestDetails Basic check of the Resteasy Microprofile client with BeanParam. - * Test checks that Resteasy Microprofile client can inject correct values when BeanParam is used. - * This test uses new annotation only without any annotation value. + * Test checks that Resteasy Microprofile client can inject correct values when BeanParam is used. + * This test uses new annotation only without any annotation value. * @tpSince RESTEasy 3.7 */ @Test diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/resource/ProxyParameterAnnotations.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/resource/ProxyParameterAnnotations.java index bec1fa3..2fe7aee 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/resource/ProxyParameterAnnotations.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/resource/ProxyParameterAnnotations.java @@ -40,9 +40,9 @@ public interface ProxyParameterAnnotations { @Path("AllParams/{pathParam}") @POST String executeAllParams(@QueryParam String queryParam, - @HeaderParam String headerParam, - @CookieParam String cookieParam, - @PathParam("pathParam") String pathParam, - @FormParam String formParam, - @MatrixParam String matrixParam); + @HeaderParam String headerParam, + @CookieParam String cookieParam, + @PathParam("pathParam") String pathParam, + @FormParam String formParam, + @MatrixParam String matrixParam); } \ No newline at end of file diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/resource/ProxyParameterAnotationsResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/resource/ProxyParameterAnotationsResource.java index fd3542b..ae18418 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/resource/ProxyParameterAnotationsResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/client/param/resource/ProxyParameterAnotationsResource.java @@ -38,11 +38,11 @@ public class ProxyParameterAnotationsResource { @Path("AllParams/{pathParam}") @POST public String executeAllParams(@QueryParam String queryParam, - @HeaderParam String headerParam, - @CookieParam String cookieParam, - @PathParam("pathParam") String pathParam, - @FormParam String formParam, - @MatrixParam String matrixParam) { + @HeaderParam String headerParam, + @CookieParam String cookieParam, + @PathParam("pathParam") String pathParam, + @FormParam String formParam, + @MatrixParam String matrixParam) { return queryParam + " " + headerParam + " " + cookieParam + " " + pathParam + " " + formParam + " " + matrixParam; } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalFilterTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalFilterTest.java index e6795e5..a1cd8dc 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalFilterTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalFilterTest.java @@ -24,6 +24,7 @@ import java.net.URL; import java.util.Map; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.GenericType; @@ -69,8 +70,7 @@ public static Archive deploy() { .setWebXML(ConfigSourceDefaultOrdinalFilterTest.class.getPackage(), "web_default_ordinal_filter.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -120,9 +120,11 @@ private void checkBuiltInConfigSourcesOrdinal(Map builtInConfig Integer filterConfigSourceDefaultOrdinal = 50; Integer servletContextConfigSourceDefaultOrdinal = 40; - Assert.assertEquals(filterConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(FilterConfigSource.class.getName())); - Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class - .getName())); + Assert.assertEquals(filterConfigSourceDefaultOrdinal, + builtInConfigSourcesOrdinal.get(FilterConfigSource.class.getName())); + Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, + builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class + .getName())); } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalServletContextListenerTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalServletContextListenerTest.java index c802ca2..7bb4a2b 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalServletContextListenerTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalServletContextListenerTest.java @@ -24,6 +24,7 @@ import java.net.URL; import java.util.Map; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.GenericType; @@ -66,11 +67,11 @@ public class ConfigSourceDefaultOrdinalServletContextListenerTest { public static Archive deploy() { return TestEnvironment.createWar(ConfigSourceDefaultOrdinalServletContextListenerTest.class) .addClasses(TestConfigApplication.class, MicroProfileConfigFilter.class, MicroProfileConfigResource.class) - .setWebXML(ConfigSourceDefaultOrdinalServletContextListenerTest.class.getPackage(), "web_default_ordinal_servlet_context_listener.xml") + .setWebXML(ConfigSourceDefaultOrdinalServletContextListenerTest.class.getPackage(), + "web_default_ordinal_servlet_context_listener.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -122,8 +123,9 @@ private void checkBuiltInConfigSourcesOrdinal(Map builtInConfig Assert.assertEquals(servletConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletConfigSource.class .getName())); - Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class - .getName())); + Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, + builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class + .getName())); } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalServletTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalServletTest.java index cb0dba7..91fca2a 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalServletTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceDefaultOrdinalServletTest.java @@ -24,6 +24,7 @@ import java.net.URL; import java.util.Map; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.GenericType; @@ -69,8 +70,7 @@ public static Archive deploy() { .setWebXML(ConfigSourceDefaultOrdinalServletTest.class.getPackage(), "web_default_ordinal_servlet.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -122,8 +122,9 @@ private void checkBuiltInConfigSourcesOrdinal(Map builtInConfig Assert.assertEquals(servletConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletConfigSource.class .getName())); - Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class - .getName())); + Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, + builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class + .getName())); } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalFilterTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalFilterTest.java index 558893f..215166e 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalFilterTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalFilterTest.java @@ -24,6 +24,7 @@ import java.net.URL; import java.util.Map; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.GenericType; @@ -69,8 +70,7 @@ public static Archive deploy() { .setWebXML(ConfigSourceOverrideOrdinalFilterTest.class.getPackage(), "web_override_ordinal_filter.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -120,9 +120,11 @@ private void checkBuiltInConfigSourcesOrdinal(Map builtInConfig Integer filterConfigSourceDefaultOrdinal = 20; Integer servletContextConfigSourceDefaultOrdinal = 10; - Assert.assertEquals(filterConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(FilterConfigSource.class.getName())); - Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class - .getName())); + Assert.assertEquals(filterConfigSourceDefaultOrdinal, + builtInConfigSourcesOrdinal.get(FilterConfigSource.class.getName())); + Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, + builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class + .getName())); } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalServletContextListenerTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalServletContextListenerTest.java index 76ef60f..9301056 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalServletContextListenerTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalServletContextListenerTest.java @@ -24,6 +24,7 @@ import java.net.URL; import java.util.Map; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.GenericType; @@ -66,11 +67,11 @@ public class ConfigSourceOverrideOrdinalServletContextListenerTest { public static Archive deploy() { return TestEnvironment.createWar(ConfigSourceOverrideOrdinalServletContextListenerTest.class) .addClasses(TestConfigApplication.class, MicroProfileConfigFilter.class, MicroProfileConfigResource.class) - .setWebXML(ConfigSourceOverrideOrdinalServletContextListenerTest.class.getPackage(), "web_override_ordinal_servlet_context_listener.xml") + .setWebXML(ConfigSourceOverrideOrdinalServletContextListenerTest.class.getPackage(), + "web_override_ordinal_servlet_context_listener.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -122,8 +123,9 @@ private void checkBuiltInConfigSourcesOrdinal(Map builtInConfig Assert.assertEquals(servletConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletConfigSource.class .getName())); - Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class - .getName())); + Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, + builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class + .getName())); } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalServletTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalServletTest.java index d728e81..88e6227 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalServletTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/ConfigSourceOverrideOrdinalServletTest.java @@ -24,6 +24,7 @@ import java.net.URL; import java.util.Map; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.GenericType; @@ -69,8 +70,7 @@ public static Archive deploy() { .setWebXML(ConfigSourceOverrideOrdinalServletTest.class.getPackage(), "web_override_ordinal_servlet.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -122,8 +122,9 @@ private void checkBuiltInConfigSourcesOrdinal(Map builtInConfig Assert.assertEquals(servletConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletConfigSource.class .getName())); - Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class - .getName())); + Assert.assertEquals(servletContextConfigSourceDefaultOrdinal, + builtInConfigSourcesOrdinal.get(ServletContextConfigSource.class + .getName())); } } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigFilterTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigFilterTest.java index 94fb4fe..de6c153 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigFilterTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigFilterTest.java @@ -23,6 +23,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; @@ -66,8 +67,7 @@ public static Archive deploy() { .setWebXML(MicroProfileConfigFilterTest.class.getPackage(), "web_filter.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -107,7 +107,8 @@ public void testSystemInject() throws Exception { } /** - * @tpTestDetails Verify web.xml filter params are accessible and have higher priority than context params; get Config programmatically. + * @tpTestDetails Verify web.xml filter params are accessible and have higher priority than context params; get Config + * programmatically. * @tpSince RESTEasy 4.0.0 */ @Test @@ -118,7 +119,8 @@ public void testFilterProgrammatic() throws Exception { } /** - * @tpTestDetails Verify web.xml filter params are accessible and have higher priority than context params; get Config by injection. + * @tpTestDetails Verify web.xml filter params are accessible and have higher priority than context params; get Config by + * injection. * @tpSince RESTEasy 4.0.0 */ @Test diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigServletContextListenerTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigServletContextListenerTest.java index 8e03ce0..2d799dd 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigServletContextListenerTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigServletContextListenerTest.java @@ -23,6 +23,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; @@ -66,8 +67,7 @@ public static Archive deploy() { .setWebXML(MicroProfileConfigServletContextListenerTest.class.getPackage(), "web_servlet_context_listener.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -107,7 +107,8 @@ public void testSystemInject() throws Exception { } /** - * @tpTestDetails Verify web.xml servlet init params are accessible and have higher priority than filter params and context params; get Config programmatically. + * @tpTestDetails Verify web.xml servlet init params are accessible and have higher priority than filter params and context + * params; get Config programmatically. * @tpSince RESTEasy 4.0.0 */ @Test @@ -118,7 +119,8 @@ public void testInitProgrammatic() throws Exception { } /** - * @tpTestDetails Verify web.xml servlet init params are accessible and have higher priority than filter params and context params; get Config by injection. + * @tpTestDetails Verify web.xml servlet init params are accessible and have higher priority than filter params and context + * params; get Config by injection. * @tpSince RESTEasy 4.0.0 */ @Test diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigServletTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigServletTest.java index 868a4af..3dfa3bb 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigServletTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigServletTest.java @@ -23,6 +23,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.util.PropertyPermission; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; @@ -65,8 +66,7 @@ public static Archive deploy() { .setWebXML(MicroProfileConfigServletTest.class.getPackage(), "web_servlet.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( - new PropertyPermission("system", "write") - ), "permissions.xml"); + new PropertyPermission("system", "write")), "permissions.xml"); } @BeforeClass @@ -106,7 +106,8 @@ public void testSystemInject() throws Exception { } /** - * @tpTestDetails Verify web.xml servlet init params are accessible and have higher priority than filter params and context params; get Config programmatically. + * @tpTestDetails Verify web.xml servlet init params are accessible and have higher priority than filter params and context + * params; get Config programmatically. * @tpSince RESTEasy 4.0.0 */ @Test @@ -117,7 +118,8 @@ public void testInitProgrammatic() throws Exception { } /** - * @tpTestDetails Verify web.xml servlet init params are accessible and have higher priority than filter params and context params; get Config by injection. + * @tpTestDetails Verify web.xml servlet init params are accessible and have higher priority than filter params and context + * params; get Config by injection. * @tpSince RESTEasy 4.0.0 */ @Test diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigUseGlobalTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigUseGlobalTest.java index 8710443..5a7b65c 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigUseGlobalTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/MicroProfileConfigUseGlobalTest.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.config; import java.net.URL; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/OptionalConfigPropertyInjectionTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/OptionalConfigPropertyInjectionTest.java index eaabb88..1759c26 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/OptionalConfigPropertyInjectionTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/OptionalConfigPropertyInjectionTest.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.config; import java.net.URL; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.MediaType; @@ -72,21 +73,23 @@ public static void cleanup() { /** * @tpTestDetails This test checks injection of optional config properties when: - * - optional property does not exist - * - optional property exists + * - optional property does not exist + * - optional property exists * @tpSince RESTEasy 4.6.0 */ @Test public void testOptionalPropertiesInjection() throws Exception { String missingOptionalPropertyValue = client.target( - TestEnvironment.generateUri(url, "test-app", OptionalConfigPropertyInjectionResource.MISSING_OPTIONAL_PROPERTY_PATH)) + TestEnvironment.generateUri(url, "test-app", + OptionalConfigPropertyInjectionResource.MISSING_OPTIONAL_PROPERTY_PATH)) .request(MediaType.TEXT_PLAIN_TYPE) .get(String.class); Assert.assertNull(missingOptionalPropertyValue); String presentOptionalPropertyValue = client.target( - TestEnvironment.generateUri(url, "test-app", OptionalConfigPropertyInjectionResource.PRESENT_OPTIONAL_PROPERTY_PATH)) + TestEnvironment.generateUri(url, "test-app", + OptionalConfigPropertyInjectionResource.PRESENT_OPTIONAL_PROPERTY_PATH)) .request(MediaType.TEXT_PLAIN_TYPE) .get(String.class); Assert.assertEquals(OptionalConfigPropertyInjectionResource.OPTIONAL_PROPERTY_VALUE, presentOptionalPropertyValue); diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/MicroProfileConfigFilter.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/MicroProfileConfigFilter.java index e0e58e3..b54d958 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/MicroProfileConfigFilter.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/MicroProfileConfigFilter.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.config.resource; import java.io.IOException; + import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.ServletException; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/MicroProfileConfigResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/MicroProfileConfigResource.java index 742ed3d..5fe97a8 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/MicroProfileConfigResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/MicroProfileConfigResource.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Map; + import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/OptionalConfigPropertyInjectionResource.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/OptionalConfigPropertyInjectionResource.java index 5e2acfd..a6eab7b 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/OptionalConfigPropertyInjectionResource.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/OptionalConfigPropertyInjectionResource.java @@ -20,6 +20,7 @@ package org.jboss.resteasy.microprofile.test.config.resource; import java.util.Optional; + import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.InternalServerErrorException; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/TestConfigApplication.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/TestConfigApplication.java index 66540e4..9935ded 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/TestConfigApplication.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/config/resource/TestConfigApplication.java @@ -21,6 +21,7 @@ import java.util.Collections; import java.util.Set; + import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import javax.ws.rs.ext.Provider; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/util/PermissionUtil.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/util/PermissionUtil.java index b8aee1d..32f2366 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/util/PermissionUtil.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/util/PermissionUtil.java @@ -26,17 +26,18 @@ import java.nio.charset.StandardCharsets; import java.security.Permission; +import org.jboss.shrinkwrap.api.asset.Asset; +import org.jboss.shrinkwrap.api.asset.StringAsset; + import nu.xom.Attribute; import nu.xom.Document; import nu.xom.Element; import nu.xom.Serializer; -import org.jboss.shrinkwrap.api.asset.Asset; -import org.jboss.shrinkwrap.api.asset.StringAsset; /** * @author David M. Lloyd - * Taken from: - * https://github.com/wildfly/wildfly-core/blob/master/testsuite/shared/src/main/java/org/jboss/as/test/shared/PermissionUtils.java + * Taken from: + * https://github.com/wildfly/wildfly-core/blob/master/testsuite/shared/src/main/java/org/jboss/as/test/shared/PermissionUtils.java */ public final class PermissionUtil { public static Asset createPermissionsXmlAsset(Permission... permissions) { diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/util/TestEnvironment.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/util/TestEnvironment.java index b7e5fc4..8e7af24 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/util/TestEnvironment.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/microprofile/test/util/TestEnvironment.java @@ -57,20 +57,25 @@ public static WebArchive createWarWithConfigUrl(final Class test, final Class public static WebArchive createWarWithConfigUrl(final Class test, final Class resource, final String path) throws IOException { - final String url = getHttpUrl() + test.getSimpleName() + (path == null ? "" : (path.charAt(0) == '/' ? path : "/" + path)); - return addConfigProperties(createWar(test), Collections.singletonMap(resource.getCanonicalName() + "/mp-rest/url", url)); + final String url = getHttpUrl() + test.getSimpleName() + + (path == null ? "" : (path.charAt(0) == '/' ? path : "/" + path)); + return addConfigProperties(createWar(test), + Collections.singletonMap(resource.getCanonicalName() + "/mp-rest/url", url)); } public static WebArchive createWarWithConfigUrl(final String deploymentName, final Class resource, - final String path) throws IOException { + final String path) throws IOException { final String url = getHttpUrl() + deploymentName + (path == null ? "" : (path.charAt(0) == '/' ? path : "/" + path)); - return addConfigProperties(createWar(deploymentName), Collections.singletonMap(resource.getCanonicalName() + "/mp-rest/url", url)); + return addConfigProperties(createWar(deploymentName), + Collections.singletonMap(resource.getCanonicalName() + "/mp-rest/url", url)); } public static WebArchive createWarWithConfigUrl(final Class test, final String deploymentNameSuffix, - final Class resource, final String path) throws IOException { - final String url = getHttpUrl() + test.getSimpleName() + (path == null ? "" : (path.charAt(0) == '/' ? path : "/" + path)); - return addConfigProperties(createWar(test, deploymentNameSuffix), Collections.singletonMap(resource.getCanonicalName() + "/mp-rest/url", url)); + final Class resource, final String path) throws IOException { + final String url = getHttpUrl() + test.getSimpleName() + + (path == null ? "" : (path.charAt(0) == '/' ? path : "/" + path)); + return addConfigProperties(createWar(test, deploymentNameSuffix), + Collections.singletonMap(resource.getCanonicalName() + "/mp-rest/url", url)); } public static > T addConfigProperties(final T archive, final Map props)