You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2021/09/28 10:59:24 UTC

[syncope] 01/03: Re-enabling SCIM

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 01b8e28879760f9f30778678c688d3b822db40ce
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Mon Sep 27 17:28:01 2021 +0200

    Re-enabling SCIM
---
 .../core/rest/cxf/service/SCIMConfServiceImpl.java |  1 -
 .../ext/scimv2/cxf/SCIMv2RESTCXFContext.java       |  4 +--
 .../org/apache/syncope/fit/core/SCIMITCase.java    | 29 +++++++++-------------
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/ext/scimv2/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SCIMConfServiceImpl.java b/ext/scimv2/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SCIMConfServiceImpl.java
index f256541..f96c374 100644
--- a/ext/scimv2/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SCIMConfServiceImpl.java
+++ b/ext/scimv2/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/SCIMConfServiceImpl.java
@@ -39,5 +39,4 @@ public class SCIMConfServiceImpl extends AbstractService implements SCIMConfServ
     public void set(final SCIMConf conf) {
         manager.set(conf);
     }
-
 }
diff --git a/ext/scimv2/scim-rest-cxf/src/main/java/org/apache/syncope/ext/scimv2/cxf/SCIMv2RESTCXFContext.java b/ext/scimv2/scim-rest-cxf/src/main/java/org/apache/syncope/ext/scimv2/cxf/SCIMv2RESTCXFContext.java
index c0b9798..1046020 100644
--- a/ext/scimv2/scim-rest-cxf/src/main/java/org/apache/syncope/ext/scimv2/cxf/SCIMv2RESTCXFContext.java
+++ b/ext/scimv2/scim-rest-cxf/src/main/java/org/apache/syncope/ext/scimv2/cxf/SCIMv2RESTCXFContext.java
@@ -67,13 +67,13 @@ public class SCIMv2RESTCXFContext {
         return new SCIMExceptionMapper();
     }
 
-    @ConditionalOnMissingBean
+    @ConditionalOnMissingBean(name = "scimAddETagFilter")
     @Bean
     public AddETagFilter scimAddETagFilter() {
         return new AddETagFilter();
     }
 
-    @ConditionalOnMissingBean
+    @ConditionalOnMissingBean(name = "scimv2Container")
     @Bean
     public Server scimv2Container() {
         SpringJAXRSServerFactoryBean scimv2Container = new SpringJAXRSServerFactoryBean();
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SCIMITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SCIMITCase.java
index 1f334fc..a35e571 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SCIMITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SCIMITCase.java
@@ -63,7 +63,7 @@ import org.apache.syncope.ext.scimv2.api.type.ErrorType;
 import org.apache.syncope.ext.scimv2.api.type.Resource;
 import org.apache.syncope.ext.scimv2.cxf.SCIMJacksonJsonProvider;
 import org.apache.syncope.fit.AbstractITCase;
-import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 
 public class SCIMITCase extends AbstractITCase {
@@ -101,19 +101,19 @@ public class SCIMITCase extends AbstractITCase {
         CONF.getUserConf().getEmails().add(email);
     }
 
-    private static boolean isSCIMAvailable(final WebClient webClient) {
-        synchronized (LOG) {
-            if (ENABLED == null) {
-                try {
-                    Response response = webClient.path("ServiceProviderConfig").get();
-                    ENABLED = response.getStatus() == 200;
-                } catch (Exception e) {
-                    // ignore
-                    ENABLED = false;
-                }
+    @BeforeAll
+    public static void isSCIMAvailable() {
+        if (ENABLED == null) {
+            try {
+                Response response = webClient().path("ServiceProviderConfig").get();
+                ENABLED = response.getStatus() == 200;
+            } catch (Exception e) {
+                // ignore
+                ENABLED = false;
             }
         }
-        return ENABLED;
+
+        assumeTrue(ENABLED);
     }
 
     private static WebClient webClient() {
@@ -123,11 +123,6 @@ public class SCIMITCase extends AbstractITCase {
                 header(HttpHeaders.AUTHORIZATION, "Bearer " + adminClient.getJWT());
     }
 
-    @BeforeEach
-    public void check() {
-        assumeTrue(isSCIMAvailable(webClient()));
-    }
-
     @Test
     public void serviceProviderConfig() {
         Response response = webClient().path("ServiceProviderConfig").get();