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 2015/08/13 16:18:27 UTC
[1/2] syncope git commit: Removing unused interface
Repository: syncope
Updated Branches:
refs/heads/SYNCOPE-652 f03ffb300 -> a82d98880
Removing unused interface
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/a404f51c
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a404f51c
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a404f51c
Branch: refs/heads/SYNCOPE-652
Commit: a404f51ca51f3f0aa321796d89e62167a0152bff
Parents: f03ffb3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Aug 13 12:59:07 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Aug 13 12:59:07 2015 +0200
----------------------------------------------------------------------
.../core/misc/policy/AccountPolicyEnforcer.java | 3 +-
.../misc/policy/PasswordPolicyEnforcer.java | 3 +-
.../core/misc/policy/PolicyEnforcer.java | 35 --------------------
3 files changed, 2 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/a404f51c/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
index 13ddc84..23740d6 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java
@@ -25,11 +25,10 @@ import org.apache.syncope.core.persistence.api.entity.user.User;
import org.springframework.stereotype.Component;
@Component
-public class AccountPolicyEnforcer implements PolicyEnforcer<AccountPolicySpec, User> {
+public class AccountPolicyEnforcer {
private static final Pattern DEFAULT_PATTERN = Pattern.compile("[a-zA-Z0-9-_@. ]+");
- @Override
public boolean enforce(final AccountPolicySpec policy, final PolicyType type, final User user) {
if (user.getUsername() == null) {
throw new PolicyEnforceException("Invalid account");
http://git-wip-us.apache.org/repos/asf/syncope/blob/a404f51c/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java
index 1313d2e..1458bf3 100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java
@@ -24,9 +24,8 @@ import org.apache.syncope.core.persistence.api.entity.user.User;
import org.springframework.stereotype.Component;
@Component
-public class PasswordPolicyEnforcer implements PolicyEnforcer<PasswordPolicySpec, User> {
+public class PasswordPolicyEnforcer {
- @Override
public boolean enforce(final PasswordPolicySpec policy, final PolicyType type, final User user) {
final String clearPassword = user.getClearPassword();
final String password = user.getPassword();
http://git-wip-us.apache.org/repos/asf/syncope/blob/a404f51c/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java
----------------------------------------------------------------------
diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java
deleted file mode 100644
index 86e6583..0000000
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.core.misc.policy;
-
-import org.apache.syncope.common.lib.types.PolicySpec;
-import org.apache.syncope.common.lib.types.PolicyType;
-
-public interface PolicyEnforcer<T extends PolicySpec, E> {
-
- /**
- * Check the given entity to see if it conforms with the indicated policy.
- *
- * @param policy
- * @param type
- * @param entity
- * @return whether user is to be suspended
- */
- boolean enforce(final T policy, final PolicyType type, final E entity);
-}
[2/2] syncope git commit: [SYNCOPE-652] Fixing test execution
Posted by il...@apache.org.
[SYNCOPE-652] Fixing test execution
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/a82d9888
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a82d9888
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a82d9888
Branch: refs/heads/SYNCOPE-652
Commit: a82d9888031708fa531641b977802b1d5f0fddaf
Parents: a404f51
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Aug 13 16:18:20 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Aug 13 16:18:20 2015 +0200
----------------------------------------------------------------------
.../org/apache/syncope/core/logic/DomainLogic.java | 2 +-
.../syncope/fit/core/reference/DomainITCase.java | 17 ++++++++++-------
2 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/a82d9888/core/logic/src/main/java/org/apache/syncope/core/logic/DomainLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/DomainLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/DomainLogic.java
index c946fb1..e95f70b 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/DomainLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/DomainLogic.java
@@ -76,7 +76,7 @@ public class DomainLogic extends AbstractTransactionalLogic<DomainTO> {
+ "T(org.apache.syncope.common.lib.SyncopeConstants).MASTER_DOMAIN")
public DomainTO create(final DomainTO domainTO) {
if (!domainsHolder.getDomains().keySet().contains(domainTO.getKey())) {
- throw new NotFoundException("No configuration is available for domain '" + domainTO.getKey());
+ throw new NotFoundException("No configuration is available for domain " + domainTO.getKey());
}
return binder.getDomainTO(domainDAO.save(binder.create(domainTO)));
http://git-wip-us.apache.org/repos/asf/syncope/blob/a82d9888/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DomainITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DomainITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DomainITCase.java
index e6b1984..51d4aaf 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DomainITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/reference/DomainITCase.java
@@ -25,7 +25,6 @@ import static org.junit.Assert.fail;
import java.security.AccessControlException;
import java.util.List;
-import org.apache.commons.lang3.SerializationUtils;
import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.DomainTO;
@@ -63,11 +62,18 @@ public class DomainITCase extends AbstractITCase {
}
}
+ private void restoreTwo() {
+ DomainTO two = new DomainTO();
+ two.setKey("Two");
+ two.setAdminCipherAlgorithm(CipherAlgorithm.SHA);
+ two.setAdminPwd("password2");
+ domainService.create(two);
+ }
+
@Test
public void update() {
DomainTO two = domainService.read("Two");
assertNotNull(two);
- DomainTO origTwo = SerializationUtils.clone(two);
try {
// 1. change admin pwd for domain Two
@@ -87,8 +93,7 @@ public class DomainITCase extends AbstractITCase {
new SyncopeClientFactoryBean().setAddress(ADDRESS).setDomain("Two").
create(ADMIN_UNAME, "password3").self();
} finally {
- // restore old password
- domainService.create(origTwo);
+ restoreTwo();
}
}
@@ -107,9 +112,7 @@ public class DomainITCase extends AbstractITCase {
assertEquals(ClientExceptionType.NotFound, e.getType());
}
} finally {
- // restore old password
- two.setAdminPwd("password2");
- domainService.create(two);
+ restoreTwo();
}
}
}