From b7856ddc3837ed51a36c5a5182717485a1b3e6ac Mon Sep 17 00:00:00 2001 From: Andrea Patricelli Date: Thu, 28 Mar 2024 12:27:24 +0100 Subject: [PATCH 1/3] moving to cxf-rt-transports-http-hc5 --- client/idrepo/lib/pom.xml | 2 +- .../syncope/client/lib/SyncopeClient.java | 2 +- .../syncope/client/lib/WebClientBuilder.java | 2 +- common/keymaster/self/client-self/pom.xml | 2 +- .../client/self/SelfKeymasterOps.java | 2 +- .../enduser/rest/UserRequestRestClient.java | 2 +- .../syncope/fit/core/UserRequestITCase.java | 18 +++++++++--------- pom.xml | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/client/idrepo/lib/pom.xml b/client/idrepo/lib/pom.xml index a7bde1493a..33453c9459 100644 --- a/client/idrepo/lib/pom.xml +++ b/client/idrepo/lib/pom.xml @@ -48,7 +48,7 @@ under the License. org.apache.cxf - cxf-rt-transports-http-hc + cxf-rt-transports-http-hc5 diff --git a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java index c737404fbc..c03197a191 100644 --- a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java +++ b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java @@ -39,7 +39,7 @@ 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.transport.http.asyncclient.hc5.AsyncHTTPConduit; import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; import org.apache.syncope.client.lib.batch.BatchRequest; import org.apache.syncope.common.lib.SyncopeConstants; diff --git a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/WebClientBuilder.java b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/WebClientBuilder.java index 003a467134..b1a9691c3d 100644 --- a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/WebClientBuilder.java +++ b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/WebClientBuilder.java @@ -22,7 +22,7 @@ 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; +import org.apache.cxf.transport.http.asyncclient.hc5.AsyncHTTPConduit; public final class WebClientBuilder { diff --git a/common/keymaster/self/client-self/pom.xml b/common/keymaster/self/client-self/pom.xml index bd07a65755..025fc1c232 100644 --- a/common/keymaster/self/client-self/pom.xml +++ b/common/keymaster/self/client-self/pom.xml @@ -60,7 +60,7 @@ under the License. org.apache.cxf - cxf-rt-transports-http-hc + cxf-rt-transports-http-hc5 diff --git a/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterOps.java b/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterOps.java index 8b98c77e90..e0da2d17b1 100644 --- a/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterOps.java +++ b/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterOps.java @@ -31,7 +31,7 @@ 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.transport.http.asyncclient.hc5.AsyncHTTPConduit; import org.apache.cxf.transports.http.configuration.ConnectionType; import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; diff --git a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java index e136f978bd..a0a2164362 100644 --- a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java +++ b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java @@ -23,7 +23,7 @@ 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.cxf.transport.http.asyncclient.hc5.AsyncHTTPConduit; import org.apache.syncope.client.enduser.SyncopeEnduserSession; import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.to.UserRequest; diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java index 44f5a6f8ea..ffd2d107c3 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java @@ -18,21 +18,13 @@ */ package org.apache.syncope.fit.core; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; -import static org.junit.jupiter.api.Assumptions.assumeFalse; -import static org.junit.jupiter.api.Assumptions.assumeTrue; - import jakarta.ws.rs.core.GenericType; import jakarta.ws.rs.core.MediaType; import java.io.IOException; 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.cxf.transport.http.asyncclient.hc5.AsyncHTTPConduit; import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.client.lib.SyncopeClientFactoryBean; import org.apache.syncope.common.lib.SyncopeClientException; @@ -52,6 +44,14 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assumptions.assumeFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + public class UserRequestITCase extends AbstractITCase { @BeforeAll diff --git a/pom.xml b/pom.xml index 4cb53cbfe9..f1ab1de1fd 100644 --- a/pom.xml +++ b/pom.xml @@ -579,7 +579,7 @@ under the License. org.apache.cxf - cxf-rt-transports-http-hc + cxf-rt-transports-http-hc5 ${cxf.version} From 7e53ed28dac4e21f7e257364b12bd6aa12a2bfa7 Mon Sep 17 00:00:00 2001 From: Andrea Patricelli Date: Thu, 28 Mar 2024 12:29:07 +0100 Subject: [PATCH 2/3] restoring imports --- .../syncope/fit/core/UserRequestITCase.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java index ffd2d107c3..4027ab0c8e 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java @@ -18,6 +18,14 @@ */ package org.apache.syncope.fit.core; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assumptions.assumeFalse; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + import jakarta.ws.rs.core.GenericType; import jakarta.ws.rs.core.MediaType; import java.io.IOException; @@ -44,14 +52,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; -import static org.junit.jupiter.api.Assumptions.assumeFalse; -import static org.junit.jupiter.api.Assumptions.assumeTrue; - public class UserRequestITCase extends AbstractITCase { @BeforeAll From a3e045f1ed165afed2b458db2c40590fb99226a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francesco=20Chicchiricc=C3=B2?= Date: Wed, 8 May 2024 16:52:33 +0200 Subject: [PATCH 3/3] Removing USE_ASYNC --- .../apache/syncope/client/lib/SyncopeClient.java | 2 -- .../syncope/client/lib/WebClientBuilder.java | 15 +++------------ .../keymaster/client/self/SelfKeymasterOps.java | 2 -- .../enduser/rest/UserRequestRestClient.java | 11 +---------- .../syncope/fit/core/UserRequestITCase.java | 15 --------------- fit/core-reference/src/test/resources/log4j2.xml | 3 +++ 6 files changed, 7 insertions(+), 41 deletions(-) diff --git a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java index c03197a191..7874d8cf9a 100644 --- a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java +++ b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java @@ -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.hc5.AsyncHTTPConduit; import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; import org.apache.syncope.client.lib.batch.BatchRequest; import org.apache.syncope.common.lib.SyncopeConstants; @@ -298,7 +297,6 @@ public T getService(final Class 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()); diff --git a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/WebClientBuilder.java b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/WebClientBuilder.java index 6daac89e18..a712c5fa50 100644 --- a/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/WebClientBuilder.java +++ b/client/idrepo/lib/src/main/java/org/apache/syncope/client/lib/WebClientBuilder.java @@ -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.hc5.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() { diff --git a/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterOps.java b/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterOps.java index e0da2d17b1..6cc5ec259b 100644 --- a/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterOps.java +++ b/common/keymaster/self/client-self/src/main/java/org/apache/syncope/common/keymaster/client/self/SelfKeymasterOps.java @@ -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.hc5.AsyncHTTPConduit; import org.apache.cxf.transports.http.configuration.ConnectionType; import org.apache.cxf.transports.http.configuration.HTTPClientPolicy; @@ -67,7 +66,6 @@ public T client(final Class serviceClass, final Map 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()); diff --git a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java index a0a2164362..86990402af 100644 --- a/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java +++ b/ext/flowable/client-enduser/src/main/java/org/apache/syncope/client/enduser/rest/UserRequestRestClient.java @@ -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.hc5.AsyncHTTPConduit; import org.apache.syncope.client.enduser.SyncopeEnduserSession; import org.apache.syncope.common.lib.to.ProvisioningResult; import org.apache.syncope.common.lib.to.UserRequest; @@ -89,14 +87,7 @@ public ProvisioningResult 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) { diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java index 4027ab0c8e..926884f219 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserRequestITCase.java @@ -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.hc5.AsyncHTTPConduit; import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.client.lib.SyncopeClientFactoryBean; import org.apache.syncope.common.lib.SyncopeClientException; @@ -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; @@ -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 @@ -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()); diff --git a/fit/core-reference/src/test/resources/log4j2.xml b/fit/core-reference/src/test/resources/log4j2.xml index 7f66aab5d8..224d7bc93d 100644 --- a/fit/core-reference/src/test/resources/log4j2.xml +++ b/fit/core-reference/src/test/resources/log4j2.xml @@ -54,6 +54,9 @@ under the License. + + +