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/10/12 12:26:57 UTC

[syncope] branch 2_1_X updated (fc4dc2a -> e1a7780)

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

ilgrosso pushed a change to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git.


    from fc4dc2a  Upgrading Mockito and Wicket jQueryUI
     new c7a2c7f  Removing deprecation
     new e1a7780  [SYNCOPE-1639] Fixing edge cases

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/syncope/common/lib/to/AttrTO.java   |  2 +-
 .../org/apache/syncope/common/lib/AttrTOTest.java  | 56 ++++++++++++++++++++++
 .../common/rest/api/service/TaskService.java       |  2 +-
 .../camel/producer/CreateProducer.java             |  7 ++-
 .../camel/producer/DeprovisionProducer.java        |  6 +--
 .../camel/producer/ProvisionProducer.java          |  4 +-
 .../camel/producer/StatusProducer.java             |  2 +-
 .../camel/producer/UpdateProducer.java             |  4 +-
 8 files changed, 69 insertions(+), 14 deletions(-)
 create mode 100644 common/lib/src/test/java/org/apache/syncope/common/lib/AttrTOTest.java

[syncope] 01/02: Removing deprecation

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c7a2c7f59f63fd4b26c51bcd9f898477e5192fd6
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Mon Oct 11 14:50:51 2021 +0200

    Removing deprecation
---
 .../syncope/core/provisioning/camel/producer/CreateProducer.java   | 7 +++----
 .../core/provisioning/camel/producer/DeprovisionProducer.java      | 6 +++---
 .../core/provisioning/camel/producer/ProvisionProducer.java        | 4 ++--
 .../syncope/core/provisioning/camel/producer/StatusProducer.java   | 2 +-
 .../syncope/core/provisioning/camel/producer/UpdateProducer.java   | 4 ++--
 5 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
index a8b3cbc..79413e2 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/CreateProducer.java
@@ -63,8 +63,7 @@ public class CreateProducer extends AbstractProducer {
                         excludedResources);
                 PropagationReporter reporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
 
-                exchange.getOut().setBody(
-                        Pair.of(created.getResult().getKey(), reporter.getStatuses()));
+                exchange.getMessage().setBody(Pair.of(created.getResult().getKey(), reporter.getStatuses()));
             } else if (actual instanceof AnyTO) {
                 WorkflowResult<String> created = (WorkflowResult<String>) exchange.getIn().getBody();
 
@@ -82,7 +81,7 @@ public class CreateProducer extends AbstractProducer {
                             excludedResources);
                     getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
 
-                    exchange.getOut().setBody(Pair.of(created.getResult(), null));
+                    exchange.getMessage().setBody(Pair.of(created.getResult(), null));
                 } else {
                     List<PropagationTaskInfo> taskInfos = getPropagationManager().getCreateTasks(
                             actual instanceof AnyObjectTO ? AnyTypeKind.ANY_OBJECT : AnyTypeKind.GROUP,
@@ -93,7 +92,7 @@ public class CreateProducer extends AbstractProducer {
                             excludedResources);
                     PropagationReporter reporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
 
-                    exchange.getOut().setBody(Pair.of(created.getResult(), reporter.getStatuses()));
+                    exchange.getMessage().setBody(Pair.of(created.getResult(), reporter.getStatuses()));
                 }
             }
         }
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java
index cc91946..8560220 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/DeprovisionProducer.java
@@ -83,7 +83,7 @@ public class DeprovisionProducer extends AbstractProducer {
                             userDAO.findAllResourceKeys(key).stream().
                                     filter(resource -> !resources.contains(resource)).collect(Collectors.toList()));
                     propagationReporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
-                    exchange.getOut().setBody(propagationReporter.getStatuses());
+                    exchange.getMessage().setBody(propagationReporter.getStatuses());
                     break;
 
                 case GROUP:
@@ -96,7 +96,7 @@ public class DeprovisionProducer extends AbstractProducer {
                             groupDAO.findAllResourceKeys(key).stream().
                                     filter(resource -> !resources.contains(resource)).collect(Collectors.toList()));
                     propagationReporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
-                    exchange.getOut().setBody(propagationReporter.getStatuses());
+                    exchange.getMessage().setBody(propagationReporter.getStatuses());
                     break;
 
                 case ANY_OBJECT:
@@ -109,7 +109,7 @@ public class DeprovisionProducer extends AbstractProducer {
                             anyObjectDAO.findAllResourceKeys(key).stream().
                                     filter(resource -> !resources.contains(resource)).collect(Collectors.toList()));
                     propagationReporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
-                    exchange.getOut().setBody(propagationReporter.getStatuses());
+                    exchange.getMessage().setBody(propagationReporter.getStatuses());
                     break;
 
                 default:
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java
index 4bdfbf8..d7f9b44 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/ProvisionProducer.java
@@ -76,7 +76,7 @@ public class ProvisionProducer extends AbstractProducer {
             List<PropagationTaskInfo> taskInfos = getPropagationManager().getUserUpdateTasks(wfResult, changePwd, null);
             PropagationReporter reporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
 
-            exchange.getOut().setBody(reporter.getStatuses());
+            exchange.getMessage().setBody(reporter.getStatuses());
         } else {
             PropagationByResource<String> propByRes = new PropagationByResource<>();
             propByRes.addAll(ResourceOperation.UPDATE, resources);
@@ -104,7 +104,7 @@ public class ProvisionProducer extends AbstractProducer {
                     null);
             PropagationReporter reporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
 
-            exchange.getOut().setBody(reporter.getStatuses());
+            exchange.getMessage().setBody(reporter.getStatuses());
         }
     }
 }
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java
index cc20d93..5642758 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/StatusProducer.java
@@ -110,7 +110,7 @@ public class StatusProducer extends AbstractProducer {
                     null);
             PropagationReporter reporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
 
-            exchange.getOut().setBody(Pair.of(updated.getResult(), reporter.getStatuses()));
+            exchange.getMessage().setBody(Pair.of(updated.getResult(), reporter.getStatuses()));
         }
     }
 }
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java
index 0fd2b9f..3cc91a7 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/producer/UpdateProducer.java
@@ -59,7 +59,7 @@ public class UpdateProducer extends AbstractProducer {
                 }
                 PropagationReporter reporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
 
-                exchange.getOut().setBody(Pair.of(updated.getResult().getLeft(), reporter.getStatuses()));
+                exchange.getMessage().setBody(Pair.of(updated.getResult().getLeft(), reporter.getStatuses()));
             } else if (actual instanceof AnyPatch) {
                 WorkflowResult<? extends AnyPatch> updated =
                         (WorkflowResult<? extends AnyPatch>) exchange.getIn().getBody();
@@ -75,7 +75,7 @@ public class UpdateProducer extends AbstractProducer {
                         excludedResources);
                 PropagationReporter reporter = getPropagationTaskExecutor().execute(taskInfos, nullPriorityAsync);
 
-                exchange.getOut().setBody(Pair.of(updated.getResult(), reporter.getStatuses()));
+                exchange.getMessage().setBody(Pair.of(updated.getResult(), reporter.getStatuses()));
             }
         }
     }

[syncope] 02/02: [SYNCOPE-1639] Fixing edge cases

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e1a77805dfc27118a66aee4b0ae15b929c1701dc
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Tue Oct 12 14:26:35 2021 +0200

    [SYNCOPE-1639] Fixing edge cases
---
 .../org/apache/syncope/common/lib/to/AttrTO.java   |  2 +-
 .../org/apache/syncope/common/lib/AttrTOTest.java  | 56 ++++++++++++++++++++++
 .../common/rest/api/service/TaskService.java       |  2 +-
 3 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
index 5152564..f80b763 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttrTO.java
@@ -112,7 +112,7 @@ public class AttrTO implements Comparable<AttrTO>, Serializable {
                 ? 0
                 : new CompareToBuilder().
                         append(schema, other.schema).
-                        append(values, other.values).
+                        append(values.toArray(), other.values.toArray()).
                         toComparison();
     }
 
diff --git a/common/lib/src/test/java/org/apache/syncope/common/lib/AttrTOTest.java b/common/lib/src/test/java/org/apache/syncope/common/lib/AttrTOTest.java
new file mode 100644
index 0000000..f114b9d
--- /dev/null
+++ b/common/lib/src/test/java/org/apache/syncope/common/lib/AttrTOTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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
+ *
+ *   http://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.
+ */
+package org.apache.syncope.common.lib;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.junit.jupiter.api.Test;
+
+public class AttrTOTest {
+
+    @Test
+    public void compareTo_equals() {
+        AttrTO first = new AttrTO.Builder().schema("schema").value("value").build();
+        AttrTO second = new AttrTO.Builder().schema("schema").value("value").build();
+        assertEquals(0, first.compareTo(second));
+    }
+
+    @Test
+    public void compareTo_different() {
+        AttrTO first = new AttrTO.Builder().schema("schema1").value("value1").build();
+        AttrTO second = new AttrTO.Builder().schema("schema2").value("value2").build();
+        assertEquals(-1, first.compareTo(second));
+        assertEquals(1, second.compareTo(first));
+    }
+
+    @Test
+    public void compareTo_differentSchema_sameValue() {
+        AttrTO first = new AttrTO.Builder().schema("schema1").value("value").build();
+        AttrTO second = new AttrTO.Builder().schema("schema2").value("value").build();
+        assertEquals(-1, first.compareTo(second));
+    }
+
+    @Test
+    public void compareTo_sameSchema_differentValue() {
+        AttrTO first = new AttrTO.Builder().schema("schema").value("value1").build();
+        AttrTO second = new AttrTO.Builder().schema("schema").value("value2").build();
+        assertEquals(-1, first.compareTo(second));
+    }
+}
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
index 92ab611..caa1695 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
@@ -146,7 +146,7 @@ public interface TaskService extends ExecutableService {
      * Deletes all the propagation tasks whose latest execution is matching the given conditions.
      * At least one matching condition must be specified.
      *
-     * @param since
+     * @param since match all executions started afterwards
      * @param statuses execution status(es) to match
      * @return deleted propagation tasks
      */