Repository: syncope Updated Branches: refs/heads/master 073e29a16 -> 2030cd27b
http://git-wip-us.apache.org/repos/asf/syncope/blob/2030cd27/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java index d05f446..e346e95 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CLIITCase.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.SystemUtils; @@ -108,14 +109,14 @@ public class CLIITCase extends AbstractITCase { PROCESS_BUILDER.command(getCommand("entitlement", "--list")); Process process = PROCESS_BUILDER.start(); - int entitlements = CollectionUtils.countMatches(IOUtils.readLines(process.getInputStream()), + long entitlements = IterableUtils.countMatches(IOUtils.readLines(process.getInputStream()), new Predicate<String>() { - @Override - public boolean evaluate(final String line) { - return line.startsWith("-"); - } - }); + @Override + public boolean evaluate(final String line) { + return line.startsWith("-"); + } + }); assertEquals(syncopeService.info().getEntitlements().size(), entitlements); process.destroy(); @@ -130,14 +131,14 @@ public class CLIITCase extends AbstractITCase { PROCESS_BUILDER.command(getCommand("connector", "--list-bundles")); Process process = PROCESS_BUILDER.start(); - int bundles = CollectionUtils.countMatches(IOUtils.readLines(process.getInputStream()), + long bundles = IterableUtils.countMatches(IOUtils.readLines(process.getInputStream()), new Predicate<String>() { - @Override - public boolean evaluate(final String line) { - return line.startsWith(" > BUNDLE NAME:"); - } - }); + @Override + public boolean evaluate(final String line) { + return line.startsWith(" > BUNDLE NAME:"); + } + }); assertEquals(connectorService.getBundles(null).size(), bundles); process.destroy(); @@ -155,30 +156,30 @@ public class CLIITCase extends AbstractITCase { final long userId5 = 5; try { PROCESS_BUILDER.command(getCommand("user", "--read", String.valueOf(userId1))); - final Process process = PROCESS_BUILDER.start(); - final String result = IOUtils.toString(process.getInputStream()); + Process process = PROCESS_BUILDER.start(); + String result = IOUtils.toString(process.getInputStream()); assertTrue(result.contains("username: " + userService.read(userId1).getUsername())); process.destroy(); PROCESS_BUILDER.command(getCommand("user", "--read", String.valueOf(userId1), String.valueOf(userId2), String.valueOf(userId3), String.valueOf(userId4), String.valueOf(userId5))); - final Process process2 = PROCESS_BUILDER.start(); - int users = CollectionUtils.countMatches(IOUtils.readLines(process2.getInputStream()), + Process process2 = PROCESS_BUILDER.start(); + long users = IterableUtils.countMatches(IOUtils.readLines(process2.getInputStream()), new Predicate<String>() { - @Override - public boolean evaluate(final String line) { - return line.startsWith(" > USER ID:"); - } - }); + @Override + public boolean evaluate(final String line) { + return line.startsWith(" > USER ID:"); + } + }); assertEquals(5, users); process2.destroy(); PROCESS_BUILDER.command(getCommand("user", "--read", String.valueOf(userId1), String.valueOf(userId2), String.valueOf(userId3), String.valueOf(userId4), String.valueOf(userId5))); - final Process process3 = PROCESS_BUILDER.start(); - final String result3 = IOUtils.toString(process3.getInputStream()); + Process process3 = PROCESS_BUILDER.start(); + String result3 = IOUtils.toString(process3.getInputStream()); assertTrue( result3.contains("username: " + userService.read(userId1).getUsername()) && result3.contains("username: " + userService.read(userId2).getUsername()) http://git-wip-us.apache.org/repos/asf/syncope/blob/2030cd27/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java index 7b18109..0ef0dd5 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/CamelRouteITCase.java @@ -22,7 +22,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.List; -import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.to.AnyTypeClassTO; import org.apache.syncope.common.lib.to.CamelRouteTO; @@ -166,7 +166,7 @@ public class CamelRouteITCase extends AbstractITCase { userTO = createUser(userTO).getAny(); assertNotNull(userTO); - assertEquals("true", CollectionUtils.get(userTO.getPlainAttrs(), 3).getValues().get(0)); + assertEquals("true", IterableUtils.get(userTO.getPlainAttrs(), 3).getValues().get(0)); } finally { doUpdate(oldRoute.getKey(), oldRoute.getContent()); } http://git-wip-us.apache.org/repos/asf/syncope/blob/2030cd27/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java index 052262c..811d2bd 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/GroupITCase.java @@ -36,7 +36,7 @@ import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; -import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -198,7 +198,7 @@ public class GroupITCase extends AbstractITCase { List<GroupTO> groups = groupService2.own(); assertNotNull(groups); - assertTrue(CollectionUtils.exists(groups, new Predicate<GroupTO>() { + assertTrue(IterableUtils.matchesAny(groups, new Predicate<GroupTO>() { @Override public boolean evaluate(final GroupTO group) { http://git-wip-us.apache.org/repos/asf/syncope/blob/2030cd27/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java index 6a697b9..edd32ec 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/PlainSchemaITCase.java @@ -28,7 +28,7 @@ import static org.junit.Assert.fail; import java.util.List; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; -import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.lang3.SerializationUtils; import org.apache.syncope.common.lib.SyncopeClientException; @@ -172,7 +172,7 @@ public class PlainSchemaITCase extends AbstractITCase { List<PlainSchemaTO> userSchemas = schemaService.list( new SchemaQuery.Builder().type(SchemaType.PLAIN).anyTypeClass(clazz).build()); - assertTrue(CollectionUtils.exists(userSchemas, new Predicate<PlainSchemaTO>() { + assertTrue(IterableUtils.matchesAny(userSchemas, new Predicate<PlainSchemaTO>() { @Override public boolean evaluate(final PlainSchemaTO object) { @@ -180,7 +180,7 @@ public class PlainSchemaITCase extends AbstractITCase { } })); - assertFalse(CollectionUtils.exists(userSchemas, new Predicate<PlainSchemaTO>() { + assertFalse(IterableUtils.matchesAny(userSchemas, new Predicate<PlainSchemaTO>() { @Override public boolean evaluate(final PlainSchemaTO object) { http://git-wip-us.apache.org/repos/asf/syncope/blob/2030cd27/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java index c203272..11892af 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/RealmITCase.java @@ -27,7 +27,7 @@ import static org.junit.Assert.fail; import java.util.List; import javax.ws.rs.core.Response; -import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.SyncopeConstants; @@ -44,7 +44,7 @@ import org.junit.runners.MethodSorters; public class RealmITCase extends AbstractITCase { private RealmTO getRealm(final String fullPath) { - return CollectionUtils.find(realmService.list(fullPath), new Predicate<RealmTO>() { + return IterableUtils.find(realmService.list(fullPath), new Predicate<RealmTO>() { @Override public boolean evaluate(final RealmTO object) { @@ -105,7 +105,7 @@ public class RealmITCase extends AbstractITCase { assertNotNull(actual); assertEquals("/odd/last", actual.getFullPath()); - assertEquals(1, CollectionUtils.countMatches(realmService.list(), new Predicate<RealmTO>() { + assertEquals(1, IterableUtils.countMatches(realmService.list(), new Predicate<RealmTO>() { @Override public boolean evaluate(final RealmTO object) { http://git-wip-us.apache.org/repos/asf/syncope/blob/2030cd27/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java index bd749e2..db9156a 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SearchITCase.java @@ -26,6 +26,7 @@ import static org.junit.Assert.assertTrue; import java.util.Collection; import javax.ws.rs.core.Response; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.common.lib.SyncopeConstants; @@ -107,7 +108,7 @@ public class SearchITCase extends AbstractITCase { assertNotNull(matchingUsers); assertFalse(matchingUsers.getResult().isEmpty()); - assertTrue(CollectionUtils.exists(matchingUsers.getResult(), new Predicate<UserTO>() { + assertTrue(IterableUtils.matchesAny(matchingUsers.getResult(), new Predicate<UserTO>() { @Override public boolean evaluate(final UserTO user) { @@ -130,7 +131,7 @@ public class SearchITCase extends AbstractITCase { assertNotNull(matchingUsers); assertFalse(matchingUsers.getResult().isEmpty()); - assertTrue(CollectionUtils.exists(matchingUsers.getResult(), new Predicate<UserTO>() { + assertTrue(IterableUtils.matchesAny(matchingUsers.getResult(), new Predicate<UserTO>() { @Override public boolean evaluate(final UserTO user) { @@ -148,7 +149,7 @@ public class SearchITCase extends AbstractITCase { assertNotNull(matchingUsers); assertFalse(matchingUsers.getResult().isEmpty()); - assertTrue(CollectionUtils.exists(matchingUsers.getResult(), new Predicate<UserTO>() { + assertTrue(IterableUtils.matchesAny(matchingUsers.getResult(), new Predicate<UserTO>() { @Override public boolean evaluate(final UserTO user) { @@ -172,7 +173,7 @@ public class SearchITCase extends AbstractITCase { assertNotNull(matchingUsers); assertFalse(matchingUsers.getResult().isEmpty()); - assertTrue(CollectionUtils.exists(matchingUsers.getResult(), new Predicate<UserTO>() { + assertTrue(IterableUtils.matchesAny(matchingUsers.getResult(), new Predicate<UserTO>() { @Override public boolean evaluate(final UserTO user) { @@ -190,7 +191,7 @@ public class SearchITCase extends AbstractITCase { assertNotNull(matchingUsers); assertFalse(matchingUsers.getResult().isEmpty()); - assertTrue(CollectionUtils.exists(matchingUsers.getResult(), new Predicate<UserTO>() { + assertTrue(IterableUtils.matchesAny(matchingUsers.getResult(), new Predicate<UserTO>() { @Override public boolean evaluate(final UserTO user) { @@ -283,7 +284,7 @@ public class SearchITCase extends AbstractITCase { inRelationships(2L).query()). build()); assertNotNull(anyObjects); - assertTrue(CollectionUtils.exists(anyObjects.getResult(), new Predicate<AnyObjectTO>() { + assertTrue(IterableUtils.matchesAny(anyObjects.getResult(), new Predicate<AnyObjectTO>() { @Override public boolean evaluate(final AnyObjectTO anyObject) { @@ -296,7 +297,7 @@ public class SearchITCase extends AbstractITCase { fiql(SyncopeClient.getUserSearchConditionBuilder().inRelationships(1L).query()). build()); assertNotNull(users); - assertTrue(CollectionUtils.exists(users.getResult(), new Predicate<UserTO>() { + assertTrue(IterableUtils.matchesAny(users.getResult(), new Predicate<UserTO>() { @Override public boolean evaluate(final UserTO user) { @@ -313,14 +314,14 @@ public class SearchITCase extends AbstractITCase { inRelationshipTypes("neighborhood").query()). build()); assertNotNull(anyObjects); - assertTrue(CollectionUtils.exists(anyObjects.getResult(), new Predicate<AnyObjectTO>() { + assertTrue(IterableUtils.matchesAny(anyObjects.getResult(), new Predicate<AnyObjectTO>() { @Override public boolean evaluate(final AnyObjectTO anyObject) { return anyObject.getKey() == 1L; } })); - assertTrue(CollectionUtils.exists(anyObjects.getResult(), new Predicate<AnyObjectTO>() { + assertTrue(IterableUtils.matchesAny(anyObjects.getResult(), new Predicate<AnyObjectTO>() { @Override public boolean evaluate(final AnyObjectTO anyObject) { @@ -333,7 +334,7 @@ public class SearchITCase extends AbstractITCase { fiql(SyncopeClient.getUserSearchConditionBuilder().inRelationshipTypes("neighborhood").query()). build()); assertNotNull(users); - assertTrue(CollectionUtils.exists(users.getResult(), new Predicate<UserTO>() { + assertTrue(IterableUtils.matchesAny(users.getResult(), new Predicate<UserTO>() { @Override public boolean evaluate(final UserTO user) { @@ -350,14 +351,14 @@ public class SearchITCase extends AbstractITCase { and("name").equalTo("*").query()). build()); assertNotNull(groups); - assertTrue(CollectionUtils.exists(groups.getResult(), new Predicate<GroupTO>() { + assertTrue(IterableUtils.matchesAny(groups.getResult(), new Predicate<GroupTO>() { @Override public boolean evaluate(final GroupTO group) { return group.getKey() == 15L; } })); - assertFalse(CollectionUtils.exists(groups.getResult(), new Predicate<GroupTO>() { + assertFalse(IterableUtils.matchesAny(groups.getResult(), new Predicate<GroupTO>() { @Override public boolean evaluate(final GroupTO group) { @@ -371,7 +372,7 @@ public class SearchITCase extends AbstractITCase { and("name").equalTo("*").query()). build()); assertNotNull(anyObjects); - assertFalse(CollectionUtils.exists(anyObjects.getResult(), new Predicate<AnyObjectTO>() { + assertFalse(IterableUtils.matchesAny(anyObjects.getResult(), new Predicate<AnyObjectTO>() { @Override public boolean evaluate(final AnyObjectTO anyObject) { http://git-wip-us.apache.org/repos/asf/syncope/blob/2030cd27/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java index cea4752..eeabd8f 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/SyncTaskITCase.java @@ -30,7 +30,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import javax.ws.rs.core.Response; -import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.tuple.Pair; @@ -199,7 +199,7 @@ public class SyncTaskITCase extends AbstractTaskITCase { // Unmatching --> Assign (link) - SYNCOPE-658 assertTrue(userTO.getResources().contains(RESOURCE_NAME_CSV)); - assertEquals(1, CollectionUtils.countMatches(userTO.getDerAttrs(), new Predicate<AttrTO>() { + assertEquals(1, IterableUtils.countMatches(userTO.getDerAttrs(), new Predicate<AttrTO>() { @Override public boolean evaluate(final AttrTO attributeTO) { @@ -382,7 +382,7 @@ public class SyncTaskITCase extends AbstractTaskITCase { try { provision.setSyncToken(null); - MappingItemTO mappingItem = CollectionUtils.find( + MappingItemTO mappingItem = IterableUtils.find( provision.getMapping().getItems(), new Predicate<MappingItemTO>() { @Override http://git-wip-us.apache.org/repos/asf/syncope/blob/2030cd27/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 2a7ca21..4ed8c84 100644 --- a/pom.xml +++ b/pom.xml @@ -357,7 +357,7 @@ under the License. <commons-codec.version>1.10</commons-codec.version> <commons-jexl.version>2.1.1</commons-jexl.version> <commons-lang.version>3.4</commons-lang.version> - <commons-collection.version>4.0</commons-collection.version> + <commons-collection.version>4.1</commons-collection.version> <commons-logging.version>1.1.3</commons-logging.version> <h2.version>1.4.190</h2.version>
