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 2017/06/05 14:18:04 UTC
[2/4] syncope git commit: Simplifying test logic
Simplifying test logic
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d3e23f67
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d3e23f67
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d3e23f67
Branch: refs/heads/master
Commit: d3e23f675a584fa070af6ecb02a57c360124a385
Parents: 75af369
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Jun 5 16:15:34 2017 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Jun 5 16:15:42 2017 +0200
----------------------------------------------------------------------
.../core/provisioning/java/ConnectorManagerTest.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/d3e23f67/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
index 1b2e060..0434619 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/ConnectorManagerTest.java
@@ -20,6 +20,8 @@ package org.apache.syncope.core.provisioning.java;
import static org.junit.Assert.assertEquals;
+import org.apache.commons.collections4.IterableUtils;
+import org.apache.commons.collections4.Predicate;
import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
@@ -57,15 +59,16 @@ public class ConnectorManagerTest extends AbstractTest {
connManager.load();
// only consider local connector bundles
- int expected = 0;
- for (ExternalResource resource : resourceDAO.findAll()) {
- if (resource.getConnector().getLocation().startsWith("file")) {
- expected++;
+ long expected = IterableUtils.countMatches(resourceDAO.findAll(), new Predicate<ExternalResource>() {
+
+ @Override
+ public boolean evaluate(final ExternalResource resource) {
+ return resource.getConnector().getLocation().startsWith("file");
}
- }
+ });
assertEquals(expected,
ApplicationContextProvider.getBeanFactory().
- getBeanNamesForType(Connector.class, false, true).length);
+ getBeanNamesForType(Connector.class, false, true).length);
}
}