[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ò <[email protected]> Authored: Thu Aug 13 16:18:20 2015 +0200 Committer: Francesco Chicchiriccò <[email protected]> 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(); } } }
