Skip to content

Commit

Permalink
checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
ikhoon committed Jan 31, 2024
1 parent 6a8253c commit 419801f
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@

/**
* A {@link ReactorHttpExchangeAdapter} implementation for the Armeria {@link WebClient}.
*
* <p><pre>{@code
* import com.linecorp.armeria.client.WebClient;
* import org.springframework.web.service.invoker.HttpServiceProxyFactory;
*
* WebClient webClient = ...;
* ArmeriaHttpExchangeAdapter adapter = ArmeriaHttpExchangeAdapter.of(webClient);
* MyService service =
* HttpServiceProxyFactory.builderFor(adapter)
* .build()
* .createClient(MyService.class);
* }</pre>
*/
public final class ArmeriaHttpExchangeAdapter extends AbstractReactorHttpExchangeAdapter {

Expand Down Expand Up @@ -144,13 +156,13 @@ public boolean supportsRequestAttributes() {
* Sends the specified {@link HttpRequestValues} to the {@link WebClient} and returns the response.
*
* <p><h4>Implementation note</h4>
* In order to encode {@link HttpRequestValues#getBodyValue()} to {@link HttpData}, we
* need to convert the {@link HttpRequestValues} to {@link ClientRequest} first. The serialization process
* is delegated to the {@link ClientRequest}. After that, the request is written to
* {@link ArmeriaClientHttpRequest} to send the request via the {@link WebClient}.
* In order to encode {@link HttpRequestValues#getBodyValue()} to {@link HttpData}, we need to convert
* the {@link HttpRequestValues} to {@link ClientRequest} first. The serialization process is delegated to
* the {@link ClientRequest}. After that, the request is written to {@link ArmeriaClientHttpRequest} to send
* the request via the {@link WebClient}.
*
* <p>The response handling has to be done in the reverse order. Armeria {@link HttpResponse} is converted into
* {@link ArmeriaClientHttpResponse} first and then converted into {@link ClientResponse}.
* <p>The response handling has to be done in the reverse order. Armeria {@link HttpResponse} is converted
* into {@link ArmeriaClientHttpResponse} first and then converted into {@link ClientResponse}.
*/
private Mono<ClientResponse> execute(HttpRequestValues requestValues) {
final URI uri;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2016 LINE Corporation
*
* LINE Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

/**
* <a href="https://docs.spring.io/spring-framework/reference/integration/rest-clients.html#rest-http-interface">
* Spring 6 HTTP interface</a> integration.
*/
@NonNullByDefault
package com.linecorp.armeria.spring.client;

import com.linecorp.armeria.common.annotation.NonNullByDefault;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2016 LINE Corporation
*
* LINE Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

/**
* Various classes used internally. Anything in this package can be changed or removed at any time.
*/
@NonNullByDefault
package com.linecorp.armeria.spring.internal.client;

import com.linecorp.armeria.common.annotation.NonNullByDefault;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2016 LINE Corporation
*
* LINE Corporation licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

/**
* Various classes used internally. Anything in this package can be changed or removed at any time.
*/
@NonNullByDefault
package com.linecorp.armeria.spring.internal.common;

import com.linecorp.armeria.common.annotation.NonNullByDefault;
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
* limitations under the License.
*/


package com.linecorp.armeria.spring.client;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -184,13 +183,13 @@ void uriBuilderFactoryWithPathVariableAndRequestParam() throws Exception {
assertThat(server.takeRequest(1, TimeUnit.SECONDS)).isNull();
}


@Test
void ignoredUriBuilderFactory() throws Exception {
final String expectedResponseBody = "hello";
prepareResponse(response -> response.status(200).content(expectedResponseBody));
final URI dynamicUri = server.httpUri().resolve("/greeting/123");
final UriBuilderFactory factory = new DefaultUriBuilderFactory(anotherServer.httpUri().resolve("/").toString());
final UriBuilderFactory factory = new DefaultUriBuilderFactory(
anotherServer.httpUri().resolve("/").toString());

final String actualBody = initService().getWithIgnoredUriBuilderFactory(dynamicUri, factory);

Expand Down Expand Up @@ -246,6 +245,5 @@ String getWithUriBuilderFactory(UriBuilderFactory uriBuilderFactory,

@GetExchange("/greeting")
String getWithIgnoredUriBuilderFactory(URI uri, UriBuilderFactory uriBuilderFactory);

}
}

0 comments on commit 419801f

Please sign in to comment.