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:59 UTC
[syncope] 02/02: [SYNCOPE-1639] Fixing edge cases
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
*/