Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moving to cxf-rt-transports-http-hc5 #668

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/idrepo/lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-hc</artifactId>
<artifactId>cxf-rt-transports-http-hc5</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.apache.cxf.transport.common.gzip.GZIPInInterceptor;
import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.apache.syncope.client.lib.batch.BatchRequest;
import org.apache.syncope.common.lib.SyncopeConstants;
Expand Down Expand Up @@ -298,7 +297,6 @@ public <T> T getService(final Class<T> serviceClass) {

ClientConfiguration config = WebClient.getConfig(client);
config.getRequestContext().put(HEADER_SPLIT_PROPERTY, true);
config.getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
if (useCompression) {
config.getInInterceptors().add(new GZIPInInterceptor());
config.getOutInterceptors().add(new GZIPOutInterceptor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,24 @@

import java.net.URI;
import java.util.List;
import org.apache.cxf.jaxrs.client.ClientConfiguration;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit;

public final class WebClientBuilder {

protected static WebClient setAsync(final WebClient webClient) {
ClientConfiguration config = WebClient.getConfig(webClient);
config.getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);

return webClient;
}

public static WebClient build(final String address,
final String username,
final String password,
final List<?> providers) {

return setAsync(WebClient.create(address, providers, username, password, null));
return WebClient.create(address, providers, username, password, null);
}

public static WebClient build(final String address) {
return setAsync(WebClient.create(address));
return WebClient.create(address);
}

public static WebClient build(final URI uri) {
return setAsync(WebClient.create(uri));
return WebClient.create(uri);
}

private WebClientBuilder() {
Expand Down
2 changes: 1 addition & 1 deletion common/keymaster/self/client-self/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-hc</artifactId>
<artifactId>cxf-rt-transports-http-hc5</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.apache.cxf.transport.common.gzip.GZIPInInterceptor;
import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit;
import org.apache.cxf.transports.http.configuration.ConnectionType;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;

Expand Down Expand Up @@ -67,7 +66,6 @@ public <T> T client(final Class<T> serviceClass, final Map<String, String> heade
client.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);

ClientConfiguration config = WebClient.getConfig(client);
config.getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
config.getInInterceptors().add(new GZIPInInterceptor());
config.getOutInterceptors().add(new GZIPOutInterceptor());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import java.util.List;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserRequest;
Expand Down Expand Up @@ -89,14 +87,7 @@ public ProvisioningResult<UserTO> submitForm(final UserRequestForm form) {
}

public void startRequest(final String bpmnProcess, final String user) {
UserRequestService service = getService(UserRequestService.class);
WebClient.getConfig(WebClient.client(service)).
getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.FALSE);

service.startRequest(bpmnProcess, user, null);

WebClient.getConfig(WebClient.client(service)).
getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
getService(UserRequestService.class).startRequest(bpmnProcess, user, null);
}

public UserRequestForm claimForm(final String taskKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.util.List;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.lib.SyncopeClientException;
Expand All @@ -47,7 +46,6 @@
import org.apache.syncope.common.rest.api.beans.UserRequestQuery;
import org.apache.syncope.common.rest.api.service.UserRequestService;
import org.apache.syncope.fit.AbstractITCase;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -66,15 +64,6 @@ public static void loadBpmnProcesses() throws IOException {
IOUtils.toString(UserRequestITCase.class.getResourceAsStream("/assignPrinterRequest.bpmn20.xml")));
BPMN_PROCESS_SERVICE.set("verifyAddedVariables",
IOUtils.toString(UserRequestITCase.class.getResourceAsStream("/verifyAddedVariables.bpmn20.xml")));

WebClient.getConfig(WebClient.client(USER_REQUEST_SERVICE)).
getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.FALSE);
}

@AfterAll
public static void reset() {
WebClient.getConfig(WebClient.client(USER_REQUEST_SERVICE)).
getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
}

@BeforeEach
Expand Down Expand Up @@ -210,13 +199,9 @@ public void userSelection() {

// start request as user
UserRequestService service = client.getService(UserRequestService.class);
WebClient.getConfig(WebClient.client(service)).
getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.FALSE);

UserRequest req = service.startRequest("assignPrinterRequest", null, null);
assertNotNull(req);
WebClient.getConfig(WebClient.client(service)).
getRequestContext().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);

// check (as admin) that a new form is available
forms = USER_REQUEST_SERVICE.listForms(new UserRequestQuery.Builder().build());
Expand Down
3 changes: 3 additions & 0 deletions fit/core-reference/src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ under the License.
<asyncLogger name="org.apache.curator" additivity="false" level="ERROR">
<appender-ref ref="main"/>
</asyncLogger>
<asyncLogger name="org.apache.hc.client5.http.wire" additivity="false" level="ERROR">
<appender-ref ref="main"/>
</asyncLogger>

<asyncLogger name="org.apache.syncope.fit" additivity="false" level="DEBUG">
<appender-ref ref="main"/>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-hc</artifactId>
<artifactId>cxf-rt-transports-http-hc5</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
Expand Down
Loading