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 13:03:39 UTC

[syncope] branch master updated: [SYNCOPE-1639] Fixing edge cases

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


The following commit(s) were added to refs/heads/master by this push:
     new bdbb8d3  [SYNCOPE-1639] Fixing edge cases
bdbb8d3 is described below

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

    [SYNCOPE-1639] Fixing edge cases
---
 .../java/org/apache/syncope/common/lib/Attr.java   |  2 +-
 .../org/apache/syncope/common/lib/AttrTest.java    | 55 ++++++++++++++++++++++
 .../common/rest/api/service/TaskService.java       |  2 +-
 3 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/Attr.java b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/Attr.java
index 5b920ff..a53838f 100644
--- a/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/Attr.java
+++ b/common/idrepo/lib/src/main/java/org/apache/syncope/common/lib/Attr.java
@@ -104,7 +104,7 @@ public class Attr implements Comparable<Attr>, BaseBean {
                 ? 0
                 : new CompareToBuilder().
                         append(schema, other.schema).
-                        append(values, other.values).
+                        append(values.toArray(), other.values.toArray()).
                         toComparison();
     }
 
diff --git a/common/idrepo/lib/src/test/java/org/apache/syncope/common/lib/AttrTest.java b/common/idrepo/lib/src/test/java/org/apache/syncope/common/lib/AttrTest.java
new file mode 100644
index 0000000..7d21798
--- /dev/null
+++ b/common/idrepo/lib/src/test/java/org/apache/syncope/common/lib/AttrTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.junit.jupiter.api.Test;
+
+public class AttrTest {
+
+    @Test
+    public void compareTo_equals() {
+        Attr first = new Attr.Builder("schema").value("value").build();
+        Attr second = new Attr.Builder("schema").value("value").build();
+        assertEquals(0, first.compareTo(second));
+    }
+
+    @Test
+    public void compareTo_different() {
+        Attr first = new Attr.Builder("schema1").value("value1").build();
+        Attr second = new Attr.Builder("schema2").value("value2").build();
+        assertEquals(-1, first.compareTo(second));
+        assertEquals(1, second.compareTo(first));
+    }
+
+    @Test
+    public void compareTo_differentSchema_sameValue() {
+        Attr first = new Attr.Builder("schema1").value("value").build();
+        Attr second = new Attr.Builder("schema2").value("value").build();
+        assertEquals(-1, first.compareTo(second));
+    }
+
+    @Test
+    public void compareTo_sameSchema_differentValue() {
+        Attr first = new Attr.Builder("schema").value("value1").build();
+        Attr second = new Attr.Builder("schema").value("value2").build();
+        assertEquals(-1, first.compareTo(second));
+    }
+}
diff --git a/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
index 92ab611..caa1695 100644
--- a/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
+++ b/common/idrepo/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
      */