Skip to content

Commit

Permalink
Merge pull request #368 from jamezp/issue360
Browse files Browse the repository at this point in the history
[360] Upgrade the parent to work with newer versions of the Java comp…
  • Loading branch information
Emily-Jiang authored Jan 22, 2024
2 parents 4e356cf + 713993a commit 35438b0
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 36 deletions.
4 changes: 4 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ default RestClientBuilder baseUri(URI uri) {

/**
* Specifies whether client built by this builder should follow HTTP redirect responses (30x) or not.
*
*
* @param follow
* - true if the client should follow HTTP redirects, false if not.
* @return the current builder with the followRedirect property set.
Expand All @@ -227,7 +227,7 @@ default RestClientBuilder baseUri(URI uri) {

/**
* Specifies the HTTP proxy hostname/IP address and port to use for requests from client instances.
*
*
* @param proxyHost
* - hostname or IP address of proxy server - must be non-null
* @param proxyPort
Expand All @@ -241,7 +241,7 @@ default RestClientBuilder baseUri(URI uri) {

/**
* Specifies the URI formatting style to use when multiple query parameter values are passed to the client.
*
*
* @param style
* - the URI formatting style to use for multiple query parameter values
* @return the current builder with the style of query params set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* contain no arguments or a single <code>String</code> argument. The String argument is the name of the header.
* <p>
* Here is an example that explicitly defines a header value and computes a value:
*
*
* <pre>
* public interface MyClient {
*
Expand All @@ -59,7 +59,7 @@
* Response useComputedHeaderValue();
* }
* </pre>
*
*
* The implementation should fail to deploy a client interface if the annotation contains a
* <code>@ClientHeaderParam</code> annotation with a <code>value</code> attribute that references a method that does not
* exist, or contains an invalid signature.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* APIs for annotating MP Rest Client interfaces.
*
* Example:
*
*
* <pre>
* &#064;RegisterProvider(MyMessageBodyReader.class)
* &#064;RegisterProvider(MyMessageBodyWriter.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* interceptors, etc.) is undefined. Implementations of this or the <code>AsyncInvocationInterceptor</code> interface
* should not rely on the order of other providers, as this could change between different implementations of the MP
* Rest Client.
*
*
* @since 1.1
*/
public interface AsyncInvocationInterceptorFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
* A QueryParamStyle enum is used to specify how multiple values are handled when constructing the query portion of the
* URI. For example, a client interface may take a collection of strings as it's query parameter. This enum determines
* the style:
*
*
* <pre>
* public interface MultiParamClient {
* void sendMultipleQueryParams(&#064;QueryParam("foo") List&lt;String&gt; strings);
* }
* </pre>
*
*
* The style selected when building this client instance will determine the format of the query portion of the URI.
*
* @since 2.0
Expand All @@ -35,7 +35,7 @@ public enum QueryParamStyle {

/**
* Multiple parameter instances, e.g.: <code>foo=v1&amp;foot=v2&amp;foo=v3</code>
*
*
* This is the default if no style is configured.
*/
MULTI_PAIRS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ default boolean handles(int status, MultivaluedMap<String, Object> headers) {
/**
* The priority of this mapper. By default, it will use the {@link Priority} annotation's value as the priority. If
* no annotation is present, it uses a default priority of {@link Priorities#USER}.
*
*
* @return the priority of this mapper
*/
default int getPriority() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* APIs for extending MP Rest Client functionality - such as new providers. Example:
*
*
* <pre>
* &#064;RegisterProvider(UnknownWidgetExceptionMapper.class)
* public interface MyClientService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
/**
* Sets the base URI for the rest client interface. This value will be used for the URI unless it is overridden by
* MicroProfile Config.
*
*
* @return the base URI for annotated client interface. An empty value indicates that the base URI must be specified
* in MicroprofileConfig.
* @since 1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* at a specific injection point.
*
* Example:
*
*
* <pre>
* &#064;RegisterProvider
* &#064;Dependent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

/**
* APIs for building a type-safe RESTful client leveraging existing JAX-RS APIs, for example:
*
*
* <pre>
* public interface MyClientService {
* &#064;GET
Expand All @@ -35,7 +35,7 @@
* .build();
* Widget w = service.getWidget(widgetId); // invokes remote service, returns domain object
* </pre>
*
*
* @since 1.0
*/
@org.osgi.annotation.versioning.Version("2.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/**
* A resolver that always picks BuilderImpl1 builder
*
*
* @author Ondrej Mihalyi
*/
public class RestClientBuilder1Resolver extends RestClientBuilderResolver {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/**
* A resolver that should be picked in tests by default
*
*
* @author Ondrej Mihalyi
* @author John D. Ament
*/
Expand Down
22 changes: 15 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>


<parent>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile-parent</artifactId>
<version>2.6</version>
</parent>
<version>3.2</version>
</parent>

<groupId>org.eclipse.microprofile.rest.client</groupId>
<artifactId>microprofile-rest-client-parent</artifactId>
Expand All @@ -35,7 +35,8 @@
<properties>
<version.mp.config>3.0</version.mp.config>
<inceptionYear>2017</inceptionYear>
<version.microprofile.tck.bom>2.6</version.microprofile.tck.bom>
<version.jakarta.ee>10.0.0</version.jakarta.ee>
<version.microprofile.tck.bom>3.2</version.microprofile.tck.bom>
</properties>

<dependencyManagement>
Expand All @@ -54,6 +55,13 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-bom</artifactId>
<version>${version.jakarta.ee}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -69,7 +77,7 @@
<tag>HEAD</tag>
</scm>


<developers>
<developer>
<name>MicroProfile Community</name>
Expand All @@ -85,5 +93,5 @@
</modules>


</project>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

package org.eclipse.microprofile.rest.client.tck;

import static org.testng.Assert.*;

import java.net.URI;

import jakarta.ws.rs.WebApplicationException;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.eclipse.microprofile.rest.client.tck.interfaces.RootResource;
import org.eclipse.microprofile.rest.client.tck.interfaces.SubResource;
import org.eclipse.microprofile.rest.client.tck.providers.ReturnWithURLRequestFilter;
import org.eclipse.microprofile.rest.client.tck.providers.TestResponseExceptionMapper;
import org.eclipse.microprofile.rest.client.tck.providers.TestResponseExceptionMapperOverridePriority;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.testng.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
Expand All @@ -35,10 +35,9 @@
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response;

import static org.testng.Assert.*;

public class SubResourceTest extends Arquillian {
@Deployment
public static Archive<?> createDeployment() {
Expand Down Expand Up @@ -67,14 +66,13 @@ public void canInvokeMethodOnSubResourceInterface() throws Exception {
"Did not invoke expected method/URI. Expected GET .../root/sub ; got " + responseStr);
}


@Test
public void exceptionMappedOnSubResourceInterface() throws Exception {
ReturnWithURLRequestFilter filter = new ReturnWithURLRequestFilter();

RestClientBuilder builder = RestClientBuilder.newBuilder()
.register(filter)
.register(TestResponseExceptionMapper.class);
.register(filter)
.register(TestResponseExceptionMapper.class);

RootResource client = builder.baseUri(new URI("http://localhost/stub")).build(RootResource.class);
SubResource subClient = client.sub();
Expand All @@ -83,14 +81,14 @@ public void exceptionMappedOnSubResourceInterface() throws Exception {
try {
Response response = subClient.getFromSub();
fail("A " + WebApplicationException.class + " should have been thrown via the registered "
+ TestResponseExceptionMapper.class);
+ TestResponseExceptionMapper.class);
} catch (WebApplicationException w) {
assertEquals(w.getMessage(), TestResponseExceptionMapper.MESSAGE,
"The message should be sourced from " + TestResponseExceptionMapper.class);
"The message should be sourced from " + TestResponseExceptionMapper.class);
assertTrue(TestResponseExceptionMapper.isHandlesCalled(),
"The handles method should have been called on " + TestResponseExceptionMapper.class);
"The handles method should have been called on " + TestResponseExceptionMapper.class);
assertTrue(TestResponseExceptionMapper.isThrowableCalled(),
"The toThrowable method should have been called on " + TestResponseExceptionMapper.class);
"The toThrowable method should have been called on " + TestResponseExceptionMapper.class);
}
}
}

0 comments on commit 35438b0

Please sign in to comment.