This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch 3_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/3_0_X by this push:
new 9826b55199 [SYNCOPE-1924] Fix methods in PropagationByResource (#1217)
9826b55199 is described below
commit 9826b551993def0af222c94c9c68eed2dde85e83
Author: Matteo Tatoni <[email protected]>
AuthorDate: Tue Oct 28 08:23:59 2025 +0100
[SYNCOPE-1924] Fix methods in PropagationByResource (#1217)
---
.../provisioning/api/PropagationByResource.java | 12 ++++-----
.../api/PropagationByResourceTest.java | 29 ++++++++++++++++++++--
2 files changed, 33 insertions(+), 8 deletions(-)
diff --git
a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/PropagationByResource.java
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/PropagationByResource.java
index f2141a068e..50f5a3ef11 100644
---
a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/PropagationByResource.java
+++
b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/PropagationByResource.java
@@ -198,8 +198,8 @@ public class PropagationByResource<T extends Serializable>
implements Serializab
*/
public boolean removeAll(final Collection<T> keys) {
return toBeCreated.removeAll(keys)
- || toBeUpdated.removeAll(keys)
- || toBeDeleted.removeAll(keys);
+ | toBeUpdated.removeAll(keys)
+ | toBeDeleted.removeAll(keys);
}
/**
@@ -211,8 +211,8 @@ public class PropagationByResource<T extends Serializable>
implements Serializab
*/
public boolean removeIf(final Predicate<? super T> filter) {
return toBeCreated.removeIf(filter)
- || toBeUpdated.removeIf(filter)
- || toBeDeleted.removeIf(filter);
+ | toBeUpdated.removeIf(filter)
+ | toBeDeleted.removeIf(filter);
}
/**
@@ -225,8 +225,8 @@ public class PropagationByResource<T extends Serializable>
implements Serializab
*/
public boolean retainAll(final Collection<T> keys) {
return toBeCreated.retainAll(keys)
- || toBeUpdated.retainAll(keys)
- || toBeDeleted.retainAll(keys);
+ | toBeUpdated.retainAll(keys)
+ | toBeDeleted.retainAll(keys);
}
public boolean contains(final ResourceOperation type, final T key) {
diff --git
a/core/provisioning-api/src/test/java/org/apache/syncope/core/provisioning/api/PropagationByResourceTest.java
b/core/provisioning-api/src/test/java/org/apache/syncope/core/provisioning/api/PropagationByResourceTest.java
index 4723ab9558..fbe38200ed 100644
---
a/core/provisioning-api/src/test/java/org/apache/syncope/core/provisioning/api/PropagationByResourceTest.java
+++
b/core/provisioning-api/src/test/java/org/apache/syncope/core/provisioning/api/PropagationByResourceTest.java
@@ -116,13 +116,38 @@ public class PropagationByResourceTest extends
AbstractTest {
@Test
public void removeAll() {
Set<String> keys = new HashSet<>();
- keys.add("testKey1");
- keys.add("testKey2");
+ String key1 = "key1";
+ String key2 = "key2";
+ keys.add(key1);
+ keys.add(key2);
assertFalse(propagationByResource.removeAll(ResourceOperation.CREATE,
keys));
assertFalse(propagationByResource.removeAll(ResourceOperation.UPDATE,
keys));
assertFalse(propagationByResource.removeAll(ResourceOperation.DELETE,
keys));
assertFalse(propagationByResource.removeAll(ResourceOperation.NONE,
keys));
+
+ propagationByResource.add(ResourceOperation.CREATE, key1);
+ propagationByResource.add(ResourceOperation.UPDATE, key2);
+ assertTrue(propagationByResource.removeAll(keys));
+ assertFalse(propagationByResource.contains(key1));
+ assertFalse(propagationByResource.contains(key2));
+ }
+
+ @Test
+ public void retainAll() {
+ Set<String> keys = new HashSet<>();
+ String key1 = "key1";
+ String key2 = "key2";
+ String key3 = "key3";
+ keys.add(key1);
+
+ propagationByResource.add(ResourceOperation.CREATE, key1);
+ propagationByResource.add(ResourceOperation.UPDATE, key2);
+ propagationByResource.add(ResourceOperation.DELETE, key3);
+ assertTrue(propagationByResource.retainAll(keys));
+ assertTrue(propagationByResource.contains(key1));
+ assertFalse(propagationByResource.contains(key2));
+ assertFalse(propagationByResource.contains(key3));
}
@Test