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 2013/01/10 17:52:32 UTC
svn commit: r1431495 [1/2] - in /syncope/trunk/core: ./
src/main/java/org/apache/syncope/core/persistence/beans/
src/main/java/org/apache/syncope/core/sync/
src/test/java/org/apache/syncope/core/connid/
src/test/java/org/apache/syncope/core/persistence...
Author: ilgrosso
Date: Thu Jan 10 16:52:31 2013
New Revision: 1431495
URL: http://svn.apache.org/viewvc?rev=1431495&view=rev
Log:
[SYNCOPE-241] Applying provided patch (SYNCOPE-241-3.patch)
Added:
syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/
syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java (with props)
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java (with props)
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java (with props)
syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/
syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/SyncTaskTest.java (with props)
syncope/trunk/core/src/test/java/org/apache/syncope/core/sync/TestSyncActions.java (with props)
Removed:
syncope/trunk/core/src/test/java/org/apache/syncope/core/quartz/
syncope/trunk/core/src/test/java/org/apache/syncope/core/util/
Modified:
syncope/trunk/core/pom.xml
syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncActions.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java
syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/LDAPMembershipSyncActions.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ConnInstanceTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/MembershipTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ReportTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ResourceTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskExecTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ConnInstanceTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/MembershipTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ReportTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ResourceTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/RoleTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/TaskTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/UserTest.java
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
Modified: syncope/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/pom.xml?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/pom.xml (original)
+++ syncope/trunk/core/pom.xml Thu Jan 10 16:52:31 2013
@@ -418,8 +418,8 @@ under the License.
<exclude name="**/workflow.properties" />
</patternset>
</unzip>
- <copy file="${project.build.directory}/test-classes/org/apache/syncope/core/quartz/TestSyncActions.class"
- todir="${cargo.run.dir}/WEB-INF/classes/org/apache/syncope/core/quartz" />
+ <copy file="${project.build.directory}/test-classes/org/apache/syncope/core/sync/TestSyncActions.class"
+ todir="${cargo.run.dir}/WEB-INF/classes/org/apache/syncope/core/sync" />
<copy file="${project.build.directory}/test-classes/db.jsp" todir="${cargo.run.dir}" />
<copy todir="${cargo.run.dir}/WEB-INF/classes" includeEmptyDirs="false">
<fileset dir="${project.build.directory}/test-classes">
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncActions.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncActions.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncActions.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncActions.java Thu Jan 10 16:52:31 2013
@@ -21,8 +21,8 @@ package org.apache.syncope.core.persiste
import java.util.List;
import org.apache.syncope.client.mod.AbstractAttributableMod;
import org.apache.syncope.client.to.AbstractAttributableTO;
-import org.apache.syncope.core.sync.SyncopeSyncResultHandler;
import org.identityconnectors.framework.common.objects.SyncDelta;
+import org.identityconnectors.framework.common.objects.SyncResultsHandler;
import org.quartz.JobExecutionException;
/**
@@ -36,7 +36,7 @@ public interface SyncActions {
* @param handler synchronization handler being executed.
* @throws JobExecutionException in case of generic failure.
*/
- void beforeAll(final SyncopeSyncResultHandler handler) throws JobExecutionException;
+ void beforeAll(final SyncResultsHandler handler) throws JobExecutionException;
/**
* Action to be executed before to create a synchronized user locally.
@@ -47,7 +47,7 @@ public interface SyncActions {
* @return synchronization information used for user status evaluation and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
- <T extends AbstractAttributableTO> SyncDelta beforeCreate(final SyncopeSyncResultHandler handler,
+ <T extends AbstractAttributableTO> SyncDelta beforeCreate(final SyncResultsHandler handler,
final SyncDelta delta, final T subject) throws JobExecutionException;
/**
@@ -61,7 +61,7 @@ public interface SyncActions {
* @throws JobExecutionException in case of generic failure.
*/
<T extends AbstractAttributableTO, K extends AbstractAttributableMod> SyncDelta beforeUpdate(
- final SyncopeSyncResultHandler handler, final SyncDelta delta, final T subject, final K subjectMod)
+ final SyncResultsHandler handler, final SyncDelta delta, final T subject, final K subjectMod)
throws JobExecutionException;
/**
@@ -73,7 +73,7 @@ public interface SyncActions {
* @return synchronization information used for logging and to be passed to the 'after' method.
* @throws JobExecutionException in case of generic failure
*/
- <T extends AbstractAttributableTO> SyncDelta beforeDelete(final SyncopeSyncResultHandler handler,
+ <T extends AbstractAttributableTO> SyncDelta beforeDelete(final SyncResultsHandler handler,
final SyncDelta delta, final T subject) throws JobExecutionException;
/**
@@ -85,7 +85,7 @@ public interface SyncActions {
* @param result global synchronization results at the current synchronization step
* @throws JobExecutionException in case of generic failure
*/
- <T extends AbstractAttributableTO> void after(final SyncopeSyncResultHandler handler, final SyncDelta delta,
+ <T extends AbstractAttributableTO> void after(final SyncResultsHandler handler, final SyncDelta delta,
final T subject, final SyncResult result) throws JobExecutionException;
/**
@@ -95,5 +95,5 @@ public interface SyncActions {
* @param results synchronization result
* @throws JobExecutionException in case of generic failure
*/
- void afterAll(final SyncopeSyncResultHandler handler, final List<SyncResult> results) throws JobExecutionException;
+ void afterAll(final SyncResultsHandler handler, final List<SyncResult> results) throws JobExecutionException;
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java Thu Jan 10 16:52:31 2013
@@ -24,6 +24,7 @@ import org.apache.syncope.client.to.Abst
import org.apache.syncope.core.persistence.beans.SyncActions;
import org.apache.syncope.core.persistence.beans.SyncResult;
import org.identityconnectors.framework.common.objects.SyncDelta;
+import org.identityconnectors.framework.common.objects.SyncResultsHandler;
import org.quartz.JobExecutionException;
/**
@@ -32,11 +33,11 @@ import org.quartz.JobExecutionException;
public class DefaultSyncActions implements SyncActions {
@Override
- public void beforeAll(final SyncopeSyncResultHandler handler) throws JobExecutionException {
+ public void beforeAll(final SyncResultsHandler handler) throws JobExecutionException {
}
@Override
- public <T extends AbstractAttributableTO> SyncDelta beforeCreate(final SyncopeSyncResultHandler handler,
+ public <T extends AbstractAttributableTO> SyncDelta beforeCreate(final SyncResultsHandler handler,
final SyncDelta delta, final T subject) throws JobExecutionException {
return delta;
@@ -44,7 +45,7 @@ public class DefaultSyncActions implemen
@Override
public <T extends AbstractAttributableTO, K extends AbstractAttributableMod> SyncDelta beforeUpdate(
- final SyncopeSyncResultHandler handler, final SyncDelta delta, final T subject, final K subjectMod)
+ final SyncResultsHandler handler, final SyncDelta delta, final T subject, final K subjectMod)
throws JobExecutionException {
return delta;
@@ -52,18 +53,18 @@ public class DefaultSyncActions implemen
@Override
public <T extends AbstractAttributableTO> SyncDelta beforeDelete(
- final SyncopeSyncResultHandler handler, final SyncDelta delta, final T subject) throws JobExecutionException {
+ final SyncResultsHandler handler, final SyncDelta delta, final T subject) throws JobExecutionException {
return delta;
}
@Override
- public <T extends AbstractAttributableTO> void after(final SyncopeSyncResultHandler handler,
+ public <T extends AbstractAttributableTO> void after(final SyncResultsHandler handler,
final SyncDelta delta, final T subject, final SyncResult result) throws JobExecutionException {
}
@Override
- public void afterAll(final SyncopeSyncResultHandler handler, final List<SyncResult> results)
+ public void afterAll(final SyncResultsHandler handler, final List<SyncResult> results)
throws JobExecutionException {
}
}
Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/LDAPMembershipSyncActions.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/LDAPMembershipSyncActions.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/LDAPMembershipSyncActions.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/LDAPMembershipSyncActions.java Thu Jan 10 16:52:31 2013
@@ -50,6 +50,7 @@ import org.identityconnectors.framework.
import org.identityconnectors.framework.common.objects.ObjectClass;
import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
import org.identityconnectors.framework.common.objects.SyncDelta;
+import org.identityconnectors.framework.common.objects.SyncResultsHandler;
import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
@@ -100,11 +101,13 @@ public class LDAPMembershipSyncActions e
* Keep track of members of the role being updated <b>before</b> actual update takes place. This is not needed on
* <ul> <li>beforeCreate() - because the synchronizing role does not exist yet on Syncope</li> <li>beforeDelete() -
* because role delete cascades as membership removal for all users involved</li> </ul>
+ *
+ * {@inheritDoc}
*/
@Transactional(readOnly = true)
@Override
public <T extends AbstractAttributableTO, K extends AbstractAttributableMod> SyncDelta beforeUpdate(
- final SyncopeSyncResultHandler handler, final SyncDelta delta, final T subject, final K subjectMod)
+ final SyncResultsHandler handler, final SyncDelta delta, final T subject, final K subjectMod)
throws JobExecutionException {
if (subject instanceof RoleTO) {
@@ -268,15 +271,21 @@ public class LDAPMembershipSyncActions e
/**
* Synchronize membership at role synchronization time (because SyncJob first synchronize users then roles).
+ * {@inheritDoc}
*/
@Override
- public <T extends AbstractAttributableTO> void after(final SyncopeSyncResultHandler handler, final SyncDelta delta,
+ public <T extends AbstractAttributableTO> void after(final SyncResultsHandler handler, final SyncDelta delta,
final T subject, final SyncResult result) throws JobExecutionException {
- if (!(subject instanceof RoleTO) || handler.getSyncTask().getResource().getUmapping() == null) {
+ if (!(handler instanceof SyncopeSyncResultHandler)) {
+ return;
+ }
+
+ SyncopeSyncResultHandler intHandler = (SyncopeSyncResultHandler) handler;
+ if (!(subject instanceof RoleTO) || intHandler.getSyncTask().getResource().getUmapping() == null) {
super.after(handler, delta, subject, result);
} else {
- synchronizeMemberships(handler, delta, (RoleTO) subject);
+ synchronizeMemberships(intHandler, delta, (RoleTO) subject);
}
}
}
Added: syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java?rev=1431495&view=auto
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java (added)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java Thu Jan 10 16:52:31 2013
@@ -0,0 +1,168 @@
+/*
+ * 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.connid;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
+import org.apache.syncope.core.persistence.dao.UserDAO;
+import org.apache.syncope.core.policy.PolicyPattern;
+import org.apache.syncope.core.util.IncompatiblePolicyException;
+import org.apache.syncope.types.CipherAlgorithm;
+import org.apache.syncope.types.PasswordPolicySpec;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class PasswordGeneratorTest extends AbstractDAOTest {
+
+ @Autowired
+ private PasswordGenerator passwordGenerator;
+
+ @Autowired
+ private UserDAO userDAO;
+
+ @Test
+ public void issueSYNCOPE226() {
+ SyncopeUser user = userDAO.find(5L);
+ String password = "";
+ try {
+ password = passwordGenerator.generateUserPassword(user);
+ } catch (IncompatiblePolicyException ex) {
+ fail(ex.getMessage());
+ }
+ assertNotNull(password);
+
+ user.setPassword(password, CipherAlgorithm.AES, 0);
+
+ SyncopeUser actual = userDAO.save(user);
+ assertNotNull(actual);
+ }
+
+ @Test
+ public void testPasswordGenerator() {
+ SyncopeUser user = userDAO.find(5L);
+
+ String password = "";
+ try {
+ password = passwordGenerator.generateUserPassword(user);
+
+ } catch (IncompatiblePolicyException ex) {
+ fail(ex.getMessage());
+ }
+ assertNotNull(password);
+ user.setPassword(password, CipherAlgorithm.SHA1, 0);
+ userDAO.save(user);
+ }
+
+ @Test
+ public void startEndWithDigit()
+ throws IncompatiblePolicyException {
+
+ PasswordPolicySpec passwordPolicySpec = createBasePasswordPolicySpec();
+ passwordPolicySpec.setMustStartWithDigit(true);
+
+ PasswordPolicySpec passwordPolicySpec2 = createBasePasswordPolicySpec();
+ passwordPolicySpec.setMustEndWithDigit(true);
+ List<PasswordPolicySpec> passwordPolicySpecs = new ArrayList<PasswordPolicySpec>();
+ passwordPolicySpecs.add(passwordPolicySpec);
+ passwordPolicySpecs.add(passwordPolicySpec2);
+ String generatedPassword = passwordGenerator.generatePasswordFromPwdSpec(passwordPolicySpecs);
+ assertTrue(Character.isDigit(generatedPassword.charAt(0)));
+ assertTrue(Character.isDigit(generatedPassword.charAt(generatedPassword.length() - 1)));
+ }
+
+ @Test
+ public void startWithDigitAndWithAlpha()
+ throws IncompatiblePolicyException {
+
+ PasswordPolicySpec passwordPolicySpec = createBasePasswordPolicySpec();
+ passwordPolicySpec.setMustStartWithDigit(true);
+
+ PasswordPolicySpec passwordPolicySpec2 = createBasePasswordPolicySpec();
+ passwordPolicySpec.setMustEndWithAlpha(true);
+ List<PasswordPolicySpec> passwordPolicySpecs = new ArrayList<PasswordPolicySpec>();
+ passwordPolicySpecs.add(passwordPolicySpec);
+ passwordPolicySpecs.add(passwordPolicySpec2);
+ String generatedPassword = passwordGenerator.generatePasswordFromPwdSpec(passwordPolicySpecs);
+ assertTrue(Character.isDigit(generatedPassword.charAt(0)));
+ assertTrue(Character.isLetter(generatedPassword.charAt(generatedPassword.length() - 1)));
+ }
+
+ @Test
+ public void passwordWithNonAlpha()
+ throws IncompatiblePolicyException {
+
+ PasswordPolicySpec passwordPolicySpec = createBasePasswordPolicySpec();
+ passwordPolicySpec.setNonAlphanumericRequired(true);
+
+ PasswordPolicySpec passwordPolicySpec2 = createBasePasswordPolicySpec();
+ passwordPolicySpec.setMustEndWithAlpha(true);
+ List<PasswordPolicySpec> passwordPolicySpecs = new ArrayList<PasswordPolicySpec>();
+ passwordPolicySpecs.add(passwordPolicySpec);
+ passwordPolicySpecs.add(passwordPolicySpec2);
+ String generatedPassword = passwordGenerator.generatePasswordFromPwdSpec(passwordPolicySpecs);
+ assertTrue(PolicyPattern.NON_ALPHANUMERIC.matcher(generatedPassword).matches());
+ assertTrue(Character.isLetter(generatedPassword.charAt(generatedPassword.length() - 1)));
+ }
+
+ @Test(expected = IncompatiblePolicyException.class)
+ public void incopatiblePolicies()
+ throws IncompatiblePolicyException {
+
+ PasswordPolicySpec passwordPolicySpec = createBasePasswordPolicySpec();
+ passwordPolicySpec.setMinLength(12);
+
+ PasswordPolicySpec passwordPolicySpec2 = createBasePasswordPolicySpec();
+ passwordPolicySpec.setMaxLength(10);
+
+ List<PasswordPolicySpec> passwordPolicySpecs = new ArrayList<PasswordPolicySpec>();
+ passwordPolicySpecs.add(passwordPolicySpec);
+ passwordPolicySpecs.add(passwordPolicySpec2);
+ passwordGenerator.generatePasswordFromPwdSpec(passwordPolicySpecs);
+ }
+
+ private PasswordPolicySpec createBasePasswordPolicySpec() {
+ PasswordPolicySpec basePasswordPolicySpec = new PasswordPolicySpec();
+ basePasswordPolicySpec.setAlphanumericRequired(false);
+ basePasswordPolicySpec.setDigitRequired(false);
+ basePasswordPolicySpec.setLowercaseRequired(false);
+ basePasswordPolicySpec.setMaxLength(1000);
+ basePasswordPolicySpec.setMinLength(8);
+ basePasswordPolicySpec.setMustEndWithAlpha(false);
+ basePasswordPolicySpec.setMustEndWithDigit(false);
+ basePasswordPolicySpec.setMustEndWithNonAlpha(false);
+ basePasswordPolicySpec.setMustStartWithAlpha(false);
+ basePasswordPolicySpec.setMustStartWithDigit(false);
+ basePasswordPolicySpec.setMustStartWithNonAlpha(false);
+ basePasswordPolicySpec.setMustntEndWithAlpha(false);
+ basePasswordPolicySpec.setMustntEndWithDigit(false);
+ basePasswordPolicySpec.setMustntEndWithNonAlpha(false);
+ basePasswordPolicySpec.setMustntStartWithAlpha(false);
+ basePasswordPolicySpec.setMustntStartWithDigit(false);
+ basePasswordPolicySpec.setMustntStartWithNonAlpha(false);
+ basePasswordPolicySpec.setNonAlphanumericRequired(false);
+ basePasswordPolicySpec.setUppercaseRequired(false);
+ return basePasswordPolicySpec;
+ }
+}
Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/connid/PasswordGeneratorTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java?rev=1431495&view=auto
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java (added)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java Thu Jan 10 16:52:31 2013
@@ -0,0 +1,67 @@
+/*
+ * 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.persistence.dao;
+
+import static org.junit.Assert.*;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Properties;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = {"classpath:syncopeContext.xml", "classpath:persistenceContext.xml",
+ "classpath:schedulingContext.xml", "classpath:workflowContext.xml"})
+public abstract class AbstractDAOTest {
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractDAOTest.class);
+
+ protected static String connidSoapVersion;
+
+ protected static String bundlesDirectory;
+
+ @BeforeClass
+ public static void setUpIdentityConnectorsBundles() throws IOException {
+ Properties props = new Properties();
+ InputStream propStream = null;
+ try {
+ propStream = AbstractDAOTest.class.getResourceAsStream("/bundles.properties");
+ props.load(propStream);
+ connidSoapVersion = props.getProperty("connid.soap.version");
+ bundlesDirectory = props.getProperty("bundles.directory");
+ } catch (Exception e) {
+ LOG.error("Could not load bundles.properties", e);
+ } finally {
+ if (propStream != null) {
+ propStream.close();
+ }
+ }
+ assertNotNull(connidSoapVersion);
+ assertNotNull(bundlesDirectory);
+ }
+}
+
Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AbstractDAOTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/AttrTest.java Thu Jan 10 16:52:31 2013
@@ -18,28 +18,24 @@
*/
package org.apache.syncope.core.persistence.dao;
-import org.apache.syncope.core.persistence.dao.UserDAO;
-import org.apache.syncope.core.persistence.dao.SchemaDAO;
-import org.apache.syncope.core.persistence.dao.AttrDAO;
import static org.junit.Assert.*;
-import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
import java.util.List;
import javax.validation.ValidationException;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.persistence.beans.user.UAttr;
-import org.apache.syncope.core.persistence.beans.user.USchema;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.persistence.beans.user.UAttr;
import org.apache.syncope.core.persistence.beans.user.UAttrUniqueValue;
+import org.apache.syncope.core.persistence.beans.user.USchema;
+import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
import org.apache.syncope.core.util.AttributableUtil;
import org.apache.syncope.types.AttributableType;
import org.apache.syncope.types.EntityViolationType;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class AttrTest extends AbstractTest {
+public class AttrTest extends AbstractDAOTest {
@Autowired
private UserDAO userDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ConnInstanceTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ConnInstanceTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ConnInstanceTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ConnInstanceTest.java Thu Jan 10 16:52:31 2013
@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.ConnInstance;
import org.apache.syncope.types.ConnConfPropSchema;
import org.apache.syncope.types.ConnConfProperty;
@@ -33,7 +32,7 @@ import org.springframework.beans.factory
import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class ConnInstanceTest extends AbstractTest {
+public class ConnInstanceTest extends AbstractDAOTest {
@Autowired
private ConnInstanceDAO connInstanceDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerAttrTest.java Thu Jan 10 16:52:31 2013
@@ -28,7 +28,6 @@ import org.apache.syncope.core.persisten
import org.apache.syncope.core.persistence.beans.user.UAttrValue;
import org.apache.syncope.core.persistence.beans.user.UDerAttr;
import org.apache.syncope.core.persistence.beans.user.UDerSchema;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.membership.MAttrValue;
import org.apache.syncope.core.persistence.beans.membership.MDerAttr;
import org.apache.syncope.core.persistence.beans.membership.MDerSchema;
@@ -39,7 +38,7 @@ import org.apache.syncope.core.persisten
import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
@Transactional
-public class DerAttrTest extends AbstractTest {
+public class DerAttrTest extends AbstractDAOTest {
@Autowired
private DerAttrDAO derAttrDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/DerSchemaTest.java Thu Jan 10 16:52:31 2013
@@ -21,16 +21,15 @@ package org.apache.syncope.core.persiste
import static org.junit.Assert.*;
import java.util.List;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.beans.user.UDerSchema;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.util.AttributableUtil;
import org.apache.syncope.types.AttributableType;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class DerSchemaTest extends AbstractTest {
+public class DerSchemaTest extends AbstractDAOTest {
@Autowired
private DerSchemaDAO derSchemaDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java Thu Jan 10 16:52:31 2013
@@ -18,20 +18,17 @@
*/
package org.apache.syncope.core.persistence.dao;
-import org.apache.syncope.core.persistence.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.dao.RoleDAO;
import static org.junit.Assert.*;
import java.util.List;
+import org.apache.syncope.core.persistence.beans.Entitlement;
+import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.persistence.beans.Entitlement;
-import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
-import org.apache.syncope.core.AbstractTest;
@Transactional
-public class EntitlementTest extends AbstractTest {
+public class EntitlementTest extends AbstractDAOTest {
@Autowired
private EntitlementDAO entitlementDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/MembershipTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/MembershipTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/MembershipTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/MembershipTest.java Thu Jan 10 16:52:31 2013
@@ -27,10 +27,9 @@ import org.springframework.transaction.a
import org.apache.syncope.core.persistence.beans.membership.Membership;
import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
-import org.apache.syncope.core.AbstractTest;
@Transactional
-public class MembershipTest extends AbstractTest {
+public class MembershipTest extends AbstractDAOTest {
@Autowired
private MembershipDAO membershipDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/NotificationTest.java Thu Jan 10 16:52:31 2013
@@ -26,7 +26,6 @@ import java.util.Set;
import org.apache.syncope.client.search.AttributeCond;
import org.apache.syncope.client.search.MembershipCond;
import org.apache.syncope.client.search.NodeCond;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.Notification;
import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
import org.apache.syncope.types.EntityViolationType;
@@ -36,7 +35,7 @@ import org.springframework.beans.factory
import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class NotificationTest extends AbstractTest {
+public class NotificationTest extends AbstractDAOTest {
@Autowired
private NotificationDAO notificationDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java Thu Jan 10 16:52:31 2013
@@ -21,20 +21,19 @@ package org.apache.syncope.core.persiste
import static org.junit.Assert.*;
import java.util.List;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.PasswordPolicy;
import org.apache.syncope.core.persistence.beans.Policy;
import org.apache.syncope.core.persistence.beans.SyncPolicy;
import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
-import org.apache.syncope.types.PolicyType;
import org.apache.syncope.types.PasswordPolicySpec;
+import org.apache.syncope.types.PolicyType;
import org.apache.syncope.types.SyncPolicySpec;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class PolicyTest extends AbstractTest {
+public class PolicyTest extends AbstractDAOTest {
@Autowired
private PolicyDAO policyDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ReportTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ReportTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ReportTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ReportTest.java Thu Jan 10 16:52:31 2013
@@ -18,7 +18,6 @@
*/
package org.apache.syncope.core.persistence.dao;
-import org.apache.syncope.core.persistence.dao.ReportDAO;
import static org.junit.Assert.*;
import java.util.List;
@@ -26,11 +25,10 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.client.report.UserReportletConf;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.Report;
@Transactional
-public class ReportTest extends AbstractTest {
+public class ReportTest extends AbstractDAOTest {
@Autowired
private ReportDAO reportDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ResourceTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ResourceTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ResourceTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/ResourceTest.java Thu Jan 10 16:52:31 2013
@@ -22,10 +22,9 @@ import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
-import org.apache.syncope.core.AbstractTest;
+import org.apache.syncope.core.persistence.beans.AbstractMappingItem;
import org.apache.syncope.core.persistence.beans.ConnInstance;
import org.apache.syncope.core.persistence.beans.ExternalResource;
-import org.apache.syncope.core.persistence.beans.AbstractMappingItem;
import org.apache.syncope.core.persistence.beans.user.UMapping;
import org.apache.syncope.core.persistence.beans.user.UMappingItem;
import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
@@ -36,7 +35,7 @@ import org.springframework.beans.factory
import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class ResourceTest extends AbstractTest {
+public class ResourceTest extends AbstractDAOTest {
@Autowired
private ResourceDAO resourceDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/RoleTest.java Thu Jan 10 16:52:31 2013
@@ -25,12 +25,11 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.AccountPolicy;
import org.apache.syncope.core.persistence.beans.PasswordPolicy;
@Transactional
-public class RoleTest extends AbstractTest {
+public class RoleTest extends AbstractDAOTest {
@Autowired
private RoleDAO roleDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java Thu Jan 10 16:52:31 2013
@@ -26,7 +26,6 @@ import org.springframework.beans.factory
import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.beans.role.RSchema;
import org.apache.syncope.core.persistence.beans.user.USchema;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.AbstractSchema;
import org.apache.syncope.core.persistence.beans.role.RAttr;
import org.apache.syncope.core.util.AttributableUtil;
@@ -35,7 +34,7 @@ import org.apache.syncope.types.Attribut
import org.apache.syncope.types.SchemaType;
@Transactional
-public class SchemaTest extends AbstractTest {
+public class SchemaTest extends AbstractDAOTest {
@Autowired
private SchemaDAO schemaDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskExecTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskExecTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskExecTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskExecTest.java Thu Jan 10 16:52:31 2013
@@ -18,14 +18,13 @@
*/
package org.apache.syncope.core.persistence.dao;
-import java.util.Date;
import static org.junit.Assert.*;
+import java.util.Date;
import java.util.List;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.NotificationTask;
import org.apache.syncope.core.persistence.beans.PropagationTask;
import org.apache.syncope.core.persistence.beans.SchedTask;
@@ -34,7 +33,7 @@ import org.apache.syncope.core.persisten
import org.apache.syncope.types.PropagationTaskExecStatus;
@Transactional
-public class TaskExecTest extends AbstractTest {
+public class TaskExecTest extends AbstractDAOTest {
@Autowired
private TaskExecDAO taskExecDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/TaskTest.java Thu Jan 10 16:52:31 2013
@@ -23,15 +23,11 @@ import static org.junit.Assert.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.ExternalResource;
import org.apache.syncope.core.persistence.beans.PropagationTask;
import org.apache.syncope.core.persistence.beans.SchedTask;
import org.apache.syncope.core.persistence.beans.SyncTask;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
-import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
-import org.apache.syncope.core.quartz.TestSyncActions;
import org.apache.syncope.types.AttributableType;
import org.apache.syncope.types.PropagationMode;
import org.apache.syncope.types.ResourceOperation;
@@ -42,7 +38,7 @@ import org.springframework.beans.factory
import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class TaskTest extends AbstractTest {
+public class TaskTest extends AbstractDAOTest {
@Autowired
private TaskDAO taskDAO;
@@ -100,58 +96,6 @@ public class TaskTest extends AbstractTe
}
@Test
- public void saveSyncTask() {
- ExternalResource resource = resourceDAO.find("ws-target-resource-1");
- assertNotNull(resource);
-
- SyncTask task = new SyncTask();
- task.setName("saveSyncTask");
- task.setDescription("SyncTask description");
- task.setUserTemplate(new UserTO());
- task.setCronExpression("BLA BLA");
-
- // this save() fails because of an invalid Cron Expression
- InvalidEntityException exception = null;
- try {
- taskDAO.save(task);
- } catch (InvalidEntityException e) {
- exception = e;
- }
- assertNotNull(exception);
-
- task.setCronExpression(null);
- // this save() fails because a SyncTask requires a target resource
- exception = null;
- try {
- taskDAO.save(task);
- } catch (InvalidEntityException e) {
- exception = e;
- }
- assertNotNull(exception);
-
- task.setResource(resource);
- task.setActionsClassName(getClass().getName());
-
- // this save() fails because jobActionsClassName does not implement
- // the right interface
- exception = null;
- try {
- taskDAO.save(task);
- } catch (InvalidEntityException e) {
- exception = e;
- }
- assertNotNull(exception);
-
- task.setActionsClassName(TestSyncActions.class.getName());
- // this save() finally works
- task = taskDAO.save(task);
- assertNotNull(task);
-
- SyncTask actual = taskDAO.find(task.getId());
- assertEquals(task, actual);
- }
-
- @Test
public void delete() {
PropagationTask task = taskDAO.find(1L);
assertNotNull(task);
@@ -167,33 +111,4 @@ public class TaskTest extends AbstractTe
assertNotNull(resource);
assertFalse(taskDAO.findAll(resource, PropagationTask.class).contains(task));
}
-
- @Test
- public void issueSYNCOPE144() {
- ExternalResource resource = resourceDAO.find("ws-target-resource-1");
- assertNotNull(resource);
-
- SyncTask task = new SyncTask();
-
- task.setResource(resource);
- task.setName("issueSYNCOPE144");
- task.setDescription("issueSYNCOPE144 Description");
- task.setActionsClassName(TestSyncActions.class.getName());
-
- task = taskDAO.save(task);
- assertNotNull(task);
-
- SyncTask actual = taskDAO.find(task.getId());
- assertEquals(task, actual);
- assertEquals("issueSYNCOPE144", actual.getName());
- assertEquals("issueSYNCOPE144 Description", actual.getDescription());
-
- actual.setName("issueSYNCOPE144_2");
- actual.setDescription("issueSYNCOPE144 Description_2");
-
- actual = taskDAO.save(actual);
- assertNotNull(actual);
- assertEquals("issueSYNCOPE144_2", actual.getName());
- assertEquals("issueSYNCOPE144 Description_2", actual.getDescription());
- }
}
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/UserTest.java Thu Jan 10 16:52:31 2013
@@ -23,23 +23,17 @@ import static org.junit.Assert.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
-import org.apache.syncope.core.AbstractTest;
-import org.apache.syncope.core.connid.PasswordGenerator;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
import org.apache.syncope.core.persistence.beans.user.UAttrValue;
import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
import org.apache.syncope.core.util.EntitlementUtil;
-import org.apache.syncope.core.util.IncompatiblePolicyException;
import org.apache.syncope.types.CipherAlgorithm;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class UserTest extends AbstractTest {
-
- @Autowired
- private PasswordGenerator passwordGenerator;
+public class UserTest extends AbstractDAOTest {
@Autowired
private UserDAO userDAO;
@@ -195,20 +189,4 @@ public class UserTest extends AbstractTe
assertNotNull(actual);
}
- @Test
- public void issueSYNCOPE226() {
- SyncopeUser user = userDAO.find(5L);
- String password = "";
- try {
- password = passwordGenerator.generateUserPassword(user);
- } catch (IncompatiblePolicyException ex) {
- fail(ex.getMessage());
- }
- assertNotNull(password);
-
- user.setPassword(password, CipherAlgorithm.AES, 0);
-
- SyncopeUser actual = userDAO.save(user);
- assertNotNull(actual);
- }
}
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirAttrTest.java Thu Jan 10 16:52:31 2013
@@ -18,11 +18,6 @@
*/
package org.apache.syncope.core.persistence.dao;
-import org.apache.syncope.core.persistence.dao.UserDAO;
-import org.apache.syncope.core.persistence.dao.VirSchemaDAO;
-import org.apache.syncope.core.persistence.dao.RoleDAO;
-import org.apache.syncope.core.persistence.dao.VirAttrDAO;
-import org.apache.syncope.core.persistence.dao.MembershipDAO;
import static org.junit.Assert.*;
import java.util.List;
@@ -30,7 +25,6 @@ import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.membership.MVirAttr;
import org.apache.syncope.core.persistence.beans.membership.MVirSchema;
import org.apache.syncope.core.persistence.beans.membership.Membership;
@@ -41,7 +35,7 @@ import org.apache.syncope.core.persisten
import org.apache.syncope.core.persistence.beans.user.UVirSchema;
@Transactional
-public class VirAttrTest extends AbstractTest {
+public class VirAttrTest extends AbstractDAOTest {
@Autowired
private VirAttrDAO virAttrDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/VirSchemaTest.java Thu Jan 10 16:52:31 2013
@@ -18,21 +18,18 @@
*/
package org.apache.syncope.core.persistence.dao;
-import org.apache.syncope.core.persistence.dao.SchemaDAO;
-import org.apache.syncope.core.persistence.dao.VirSchemaDAO;
import static org.junit.Assert.*;
import java.util.List;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.user.UVirSchema;
import org.apache.syncope.core.util.AttributableUtil;
import org.apache.syncope.types.AttributableType;
@Transactional
-public class VirSchemaTest extends AbstractTest {
+public class VirSchemaTest extends AbstractDAOTest {
@Autowired
private VirSchemaDAO virSchemaDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/AttrTest.java Thu Jan 10 16:52:31 2013
@@ -19,22 +19,19 @@
package org.apache.syncope.core.persistence.relationships;
import static org.junit.Assert.*;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.persistence.beans.user.UAttr;
-import org.apache.syncope.core.persistence.beans.user.UAttrValue;
-import org.apache.syncope.core.persistence.dao.AttrDAO;
-import org.apache.syncope.core.persistence.dao.AttrValueDAO;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.AbstractSchema;
import org.apache.syncope.core.persistence.beans.membership.MAttr;
import org.apache.syncope.core.persistence.beans.membership.MSchema;
import org.apache.syncope.core.persistence.beans.membership.Membership;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.persistence.beans.user.UAttr;
+import org.apache.syncope.core.persistence.beans.user.UAttrValue;
import org.apache.syncope.core.persistence.beans.user.UDerAttr;
import org.apache.syncope.core.persistence.beans.user.UDerSchema;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
+import org.apache.syncope.core.persistence.dao.AttrDAO;
+import org.apache.syncope.core.persistence.dao.AttrValueDAO;
import org.apache.syncope.core.persistence.dao.DerAttrDAO;
import org.apache.syncope.core.persistence.dao.DerSchemaDAO;
import org.apache.syncope.core.persistence.dao.MembershipDAO;
@@ -43,9 +40,12 @@ import org.apache.syncope.core.persisten
import org.apache.syncope.core.util.AttributableUtil;
import org.apache.syncope.types.AttributableType;
import org.apache.syncope.types.SchemaType;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class AttrTest extends AbstractTest {
+public class AttrTest extends AbstractDAOTest {
@Autowired
private AttrDAO attrDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ConnInstanceTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ConnInstanceTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ConnInstanceTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ConnInstanceTest.java Thu Jan 10 16:52:31 2013
@@ -21,18 +21,18 @@ package org.apache.syncope.core.persiste
import static org.junit.Assert.*;
import java.util.List;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.beans.ConnInstance;
import org.apache.syncope.core.persistence.beans.ExternalResource;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
import org.apache.syncope.core.persistence.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.dao.ResourceDAO;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.types.ConnectorCapability;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class ConnInstanceTest extends AbstractTest {
+public class ConnInstanceTest extends AbstractDAOTest {
@Autowired
private ResourceDAO resourceDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/DerSchemaTest.java Thu Jan 10 16:52:31 2013
@@ -19,21 +19,21 @@
package org.apache.syncope.core.persistence.relationships;
import static org.junit.Assert.*;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.beans.user.UDerAttr;
import org.apache.syncope.core.persistence.beans.user.UDerSchema;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
import org.apache.syncope.core.persistence.dao.DerAttrDAO;
import org.apache.syncope.core.persistence.dao.DerSchemaDAO;
import org.apache.syncope.core.persistence.dao.UserDAO;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.util.AttributableUtil;
import org.apache.syncope.types.AttributableType;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class DerSchemaTest extends AbstractTest {
+public class DerSchemaTest extends AbstractDAOTest {
@Autowired
private UserDAO userDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/MembershipTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/MembershipTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/MembershipTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/MembershipTest.java Thu Jan 10 16:52:31 2013
@@ -19,25 +19,25 @@
package org.apache.syncope.core.persistence.relationships;
import static org.junit.Assert.*;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.beans.membership.Membership;
import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
import org.apache.syncope.core.persistence.dao.MembershipDAO;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.dao.RoleDAO;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class MembershipTest extends AbstractTest {
+public class MembershipTest extends AbstractDAOTest {
@Autowired
private MembershipDAO membershipDAO;
@Autowired
- private RoleDAO syncopeRoleDAO;
+ private RoleDAO roleDAO;
@Test
public void delete() {
@@ -52,7 +52,7 @@ public class MembershipTest extends Abst
for (Membership m : user.getMemberships()) {
assertTrue(m.getId() != 4L);
}
- for (Membership m : syncopeRoleDAO.findMemberships(role)) {
+ for (Membership m : roleDAO.findMemberships(role)) {
assertTrue(m.getId() != 4L);
}
}
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ReportTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ReportTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ReportTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ReportTest.java Thu Jan 10 16:52:31 2013
@@ -22,18 +22,18 @@ import static org.junit.Assert.*;
import java.util.Date;
import javax.persistence.EntityExistsException;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.Report;
import org.apache.syncope.core.persistence.beans.ReportExec;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
import org.apache.syncope.core.persistence.dao.ReportDAO;
import org.apache.syncope.core.persistence.dao.ReportExecDAO;
import org.apache.syncope.types.ReportExecStatus;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class ReportTest extends AbstractTest {
+public class ReportTest extends AbstractDAOTest {
@Autowired
private ReportDAO reportDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ResourceTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ResourceTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ResourceTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/ResourceTest.java Thu Jan 10 16:52:31 2013
@@ -18,51 +18,36 @@
*/
package org.apache.syncope.core.persistence.relationships;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Arrays;
import static org.junit.Assert.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.apache.syncope.client.to.MappingItemTO;
-import org.apache.syncope.client.to.MappingTO;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.apache.syncope.client.to.ResourceTO;
import org.apache.syncope.core.persistence.beans.ConnInstance;
import org.apache.syncope.core.persistence.beans.ExternalResource;
-import org.apache.syncope.core.persistence.beans.AbstractMappingItem;
-import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
-import org.apache.syncope.core.persistence.beans.user.USchema;
-import org.apache.syncope.core.persistence.dao.ConnInstanceDAO;
-import org.apache.syncope.core.persistence.dao.ResourceDAO;
-import org.apache.syncope.core.persistence.dao.SchemaDAO;
-import org.apache.syncope.core.persistence.dao.UserDAO;
-import org.apache.syncope.core.rest.data.ResourceDataBinder;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.PasswordPolicy;
import org.apache.syncope.core.persistence.beans.PropagationTask;
+import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
import org.apache.syncope.core.persistence.beans.user.UMapping;
import org.apache.syncope.core.persistence.beans.user.UMappingItem;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
+import org.apache.syncope.core.persistence.dao.ConnInstanceDAO;
import org.apache.syncope.core.persistence.dao.PolicyDAO;
+import org.apache.syncope.core.persistence.dao.ResourceDAO;
import org.apache.syncope.core.persistence.dao.TaskDAO;
-import org.apache.syncope.types.PropagationMode;
+import org.apache.syncope.core.persistence.dao.UserDAO;
import org.apache.syncope.types.IntMappingType;
-import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class ResourceTest extends AbstractTest {
+public class ResourceTest extends AbstractDAOTest {
@Autowired
private ResourceDAO resourceDAO;
@Autowired
- private SchemaDAO schemaDAO;
-
- @Autowired
private ConnInstanceDAO connInstanceDAO;
@Autowired
@@ -72,42 +57,9 @@ public class ResourceTest extends Abstra
private TaskDAO taskDAO;
@Autowired
- private ResourceDataBinder resourceDataBinder;
-
- @Autowired
private PolicyDAO policyDAO;
@Test
- public void databinding() throws IOException {
- ExternalResource resource = resourceDAO.find("ws-target-resource-2");
- assertNotNull(resource);
-
- ResourceTO resourceTO = resourceDataBinder.getResourceTO(resource);
- assertNotNull(resourceTO);
-
- ExternalResource fromto = resourceDataBinder.update(resource, resourceTO);
- assertNotNull(fromto);
- assertEquals(resource, fromto);
-
- ObjectMapper mapper = new ObjectMapper();
-
- StringWriter writer = new StringWriter();
- mapper.writeValue(writer, resourceTO);
-
- assertEquals(resourceTO, mapper.readValue(writer.toString(), ResourceTO.class));
-
- List<ResourceTO> resourceTOs = resourceDataBinder.getResourceTOs(resourceDAO.findAll());
- assertNotNull(resourceTOs);
- assertFalse(resourceTOs.isEmpty());
-
- writer = new StringWriter();
- mapper.writeValue(writer, resourceTOs);
-
- ResourceTO[] actual = mapper.readValue(writer.toString(), ResourceTO[].class);
- assertEquals(resourceTOs, Arrays.asList(actual));
- }
-
- @Test
public void createWithPasswordPolicy() {
final String resourceName = "resourceWithPasswordPolicy";
@@ -133,69 +85,6 @@ public class ResourceTest extends Abstra
assertNotNull(policyDAO.find(4L));
}
- /**
- * @see http://code.google.com/p/syncope/issues/detail?id=42
- */
- @Test
- public void issue42() {
- USchema userId = schemaDAO.find("userId", USchema.class);
-
- Set<AbstractMappingItem> beforeUserIdMappings = new HashSet<AbstractMappingItem>();
- for (ExternalResource res : resourceDAO.findAll()) {
- if (res.getUmapping() != null) {
- for (AbstractMappingItem mapItem : res.getUmapping().getItems()) {
- if (userId.getName().equals(mapItem.getIntAttrName())) {
- beforeUserIdMappings.add(mapItem);
- }
- }
- }
- }
-
- ResourceTO resourceTO = new ResourceTO();
- resourceTO.setName("resource-issue42");
- resourceTO.setConnectorId(100L);
- resourceTO.setPropagationMode(PropagationMode.ONE_PHASE);
- resourceTO.setEnforceMandatoryCondition(true);
-
- MappingTO mapping = new MappingTO();
- resourceTO.setUmapping(mapping);
-
- MappingItemTO item = new MappingItemTO();
- item.setIntAttrName("userId");
- item.setIntMappingType(IntMappingType.UserSchema);
- item.setExtAttrName("campo1");
- item.setAccountid(true);
- item.setMandatoryCondition("false");
- mapping.setAccountIdItem(item);
-
- ExternalResource resource = resourceDataBinder.create(resourceTO);
- resource = resourceDAO.save(resource);
- assertNotNull(resource);
- assertNotNull(resource.getUmapping());
- assertEquals(1, resource.getUmapping().getItems().size());
-
- resourceDAO.flush();
-
- ExternalResource actual = resourceDAO.find("resource-issue42");
- assertNotNull(actual);
- assertEquals(resource, actual);
-
- userId = schemaDAO.find("userId", USchema.class);
-
- Set<AbstractMappingItem> afterUserIdMappings = new HashSet<AbstractMappingItem>();
- for (ExternalResource res : resourceDAO.findAll()) {
- if (res.getUmapping() != null) {
- for (AbstractMappingItem mapItem : res.getUmapping().getItems()) {
- if (userId.getName().equals(mapItem.getIntAttrName())) {
- afterUserIdMappings.add(mapItem);
- }
- }
- }
- }
-
- assertEquals(beforeUserIdMappings.size(), afterUserIdMappings.size() - 1);
- }
-
@Test
public void save() {
ExternalResource resource = new ExternalResource();
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/RoleTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/RoleTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/RoleTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/RoleTest.java Thu Jan 10 16:52:31 2013
@@ -21,27 +21,27 @@ package org.apache.syncope.core.persiste
import static org.junit.Assert.*;
import java.util.List;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
+import org.apache.syncope.core.persistence.beans.PasswordPolicy;
import org.apache.syncope.core.persistence.beans.role.RAttr;
import org.apache.syncope.core.persistence.beans.role.RAttrValue;
import org.apache.syncope.core.persistence.beans.role.RSchema;
+import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
+import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
import org.apache.syncope.core.persistence.dao.AttrDAO;
import org.apache.syncope.core.persistence.dao.AttrValueDAO;
import org.apache.syncope.core.persistence.dao.EntitlementDAO;
-import org.apache.syncope.core.persistence.dao.SchemaDAO;
+import org.apache.syncope.core.persistence.dao.PolicyDAO;
import org.apache.syncope.core.persistence.dao.RoleDAO;
+import org.apache.syncope.core.persistence.dao.SchemaDAO;
import org.apache.syncope.core.persistence.dao.UserDAO;
-import org.apache.syncope.core.AbstractTest;
-import org.apache.syncope.core.persistence.beans.PasswordPolicy;
-import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
-import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
-import org.apache.syncope.core.persistence.dao.PolicyDAO;
import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class RoleTest extends AbstractTest {
+public class RoleTest extends AbstractDAOTest {
@Autowired
private UserDAO userDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/SchemaTest.java Thu Jan 10 16:52:31 2013
@@ -22,23 +22,23 @@ import static org.junit.Assert.*;
import java.util.HashSet;
import java.util.Set;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
import org.apache.syncope.core.persistence.beans.AbstractMappingItem;
+import org.apache.syncope.core.persistence.beans.ExternalResource;
import org.apache.syncope.core.persistence.beans.user.UAttr;
import org.apache.syncope.core.persistence.beans.user.USchema;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
import org.apache.syncope.core.persistence.dao.AttrDAO;
import org.apache.syncope.core.persistence.dao.ResourceDAO;
import org.apache.syncope.core.persistence.dao.SchemaDAO;
import org.apache.syncope.core.persistence.dao.UserDAO;
-import org.apache.syncope.core.AbstractTest;
-import org.apache.syncope.core.persistence.beans.ExternalResource;
import org.apache.syncope.core.util.AttributableUtil;
import org.apache.syncope.types.AttributableType;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class SchemaTest extends AbstractTest {
+public class SchemaTest extends AbstractDAOTest {
@Autowired
private UserDAO userDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/TaskTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/TaskTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/TaskTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/TaskTest.java Thu Jan 10 16:52:31 2013
@@ -23,17 +23,12 @@ import static org.junit.Assert.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeBuilder;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.apache.syncope.core.AbstractTest;
import org.apache.syncope.core.persistence.beans.ExternalResource;
import org.apache.syncope.core.persistence.beans.PropagationTask;
-import org.apache.syncope.core.persistence.beans.TaskExec;
import org.apache.syncope.core.persistence.beans.SyncTask;
+import org.apache.syncope.core.persistence.beans.TaskExec;
import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
import org.apache.syncope.core.persistence.dao.ResourceDAO;
import org.apache.syncope.core.persistence.dao.TaskDAO;
import org.apache.syncope.core.persistence.dao.TaskExecDAO;
@@ -42,9 +37,14 @@ import org.apache.syncope.types.Attribut
import org.apache.syncope.types.PropagationMode;
import org.apache.syncope.types.PropagationTaskExecStatus;
import org.apache.syncope.types.ResourceOperation;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class TaskTest extends AbstractTest {
+public class TaskTest extends AbstractDAOTest {
@Autowired
private TaskDAO taskDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/UserTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/UserTest.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/UserTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/relationships/UserTest.java Thu Jan 10 16:52:31 2013
@@ -21,22 +21,22 @@ package org.apache.syncope.core.persiste
import static org.junit.Assert.*;
import java.util.List;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
+import org.apache.syncope.core.persistence.beans.membership.Membership;
import org.apache.syncope.core.persistence.beans.user.UAttr;
import org.apache.syncope.core.persistence.beans.user.UAttrValue;
import org.apache.syncope.core.persistence.beans.user.USchema;
+import org.apache.syncope.core.persistence.dao.AbstractDAOTest;
import org.apache.syncope.core.persistence.dao.AttrDAO;
import org.apache.syncope.core.persistence.dao.AttrValueDAO;
-import org.apache.syncope.core.persistence.dao.SchemaDAO;
import org.apache.syncope.core.persistence.dao.RoleDAO;
+import org.apache.syncope.core.persistence.dao.SchemaDAO;
import org.apache.syncope.core.persistence.dao.UserDAO;
-import org.apache.syncope.core.AbstractTest;
-import org.apache.syncope.core.persistence.beans.membership.Membership;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
@Transactional
-public class UserTest extends AbstractTest {
+public class UserTest extends AbstractDAOTest {
@Autowired
private UserDAO userDAO;
Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java?rev=1431495&r1=1431494&r2=1431495&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/TaskTestITCase.java Thu Jan 10 16:52:31 2013
@@ -41,8 +41,8 @@ import org.apache.syncope.client.to.Task
import org.apache.syncope.client.to.TaskTO;
import org.apache.syncope.client.to.UserTO;
import org.apache.syncope.core.init.SpringContextInitializer;
-import org.apache.syncope.core.quartz.TestSyncActions;
import org.apache.syncope.core.sync.SyncJob;
+import org.apache.syncope.core.sync.TestSyncActions;
import org.apache.syncope.types.IntMappingType;
import org.apache.syncope.types.PropagationTaskExecStatus;
import org.apache.syncope.types.TraceLevel;
Added: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java?rev=1431495&view=auto
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java (added)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/data/ResourceDataTest.java Thu Jan 10 16:52:31 2013
@@ -0,0 +1,149 @@
+/*
+ * 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.rest.data;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.client.to.MappingItemTO;
+import org.apache.syncope.client.to.MappingTO;
+import org.apache.syncope.client.to.ResourceTO;
+import org.apache.syncope.core.AbstractTest;
+import org.apache.syncope.core.persistence.beans.AbstractMappingItem;
+import org.apache.syncope.core.persistence.beans.ExternalResource;
+import org.apache.syncope.core.persistence.beans.user.USchema;
+import org.apache.syncope.core.persistence.dao.ResourceDAO;
+import org.apache.syncope.core.persistence.dao.SchemaDAO;
+import org.apache.syncope.types.IntMappingType;
+import org.apache.syncope.types.PropagationMode;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class ResourceDataTest extends AbstractTest {
+
+ @Autowired
+ private ResourceDAO resourceDAO;
+
+ @Autowired
+ private ResourceDataBinder resourceDataBinder;
+
+ @Autowired
+ private SchemaDAO schemaDAO;
+
+ @Test
+ public void databinding() throws IOException {
+ ExternalResource resource = resourceDAO.find("ws-target-resource-2");
+ assertNotNull(resource);
+
+ ResourceTO resourceTO = resourceDataBinder.getResourceTO(resource);
+ assertNotNull(resourceTO);
+
+ ExternalResource fromto = resourceDataBinder.update(resource, resourceTO);
+ assertNotNull(fromto);
+ assertEquals(resource, fromto);
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ StringWriter writer = new StringWriter();
+ mapper.writeValue(writer, resourceTO);
+
+ assertEquals(resourceTO, mapper.readValue(writer.toString(), ResourceTO.class));
+
+ List<ResourceTO> resourceTOs = resourceDataBinder.getResourceTOs(resourceDAO.findAll());
+ assertNotNull(resourceTOs);
+ assertFalse(resourceTOs.isEmpty());
+
+ writer = new StringWriter();
+ mapper.writeValue(writer, resourceTOs);
+
+ ResourceTO[] actual = mapper.readValue(writer.toString(), ResourceTO[].class);
+ assertEquals(resourceTOs, Arrays.asList(actual));
+ }
+
+ /**
+ * @see http://code.google.com/p/syncope/issues/detail?id=42
+ */
+ @Test
+ public void issue42() {
+ USchema userId = schemaDAO.find("userId", USchema.class);
+
+ Set<AbstractMappingItem> beforeUserIdMappings = new HashSet<AbstractMappingItem>();
+ for (ExternalResource res : resourceDAO.findAll()) {
+ if (res.getUmapping() != null) {
+ for (AbstractMappingItem mapItem : res.getUmapping().getItems()) {
+ if (userId.getName().equals(mapItem.getIntAttrName())) {
+ beforeUserIdMappings.add(mapItem);
+ }
+ }
+ }
+ }
+
+ ResourceTO resourceTO = new ResourceTO();
+ resourceTO.setName("resource-issue42");
+ resourceTO.setConnectorId(100L);
+ resourceTO.setPropagationMode(PropagationMode.ONE_PHASE);
+ resourceTO.setEnforceMandatoryCondition(true);
+
+ MappingTO mapping = new MappingTO();
+ resourceTO.setUmapping(mapping);
+
+ MappingItemTO item = new MappingItemTO();
+ item.setIntAttrName("userId");
+ item.setIntMappingType(IntMappingType.UserSchema);
+ item.setExtAttrName("campo1");
+ item.setAccountid(true);
+ item.setMandatoryCondition("false");
+ mapping.setAccountIdItem(item);
+
+ ExternalResource resource = resourceDataBinder.create(resourceTO);
+ resource = resourceDAO.save(resource);
+ assertNotNull(resource);
+ assertNotNull(resource.getUmapping());
+ assertEquals(1, resource.getUmapping().getItems().size());
+
+ resourceDAO.flush();
+
+ ExternalResource actual = resourceDAO.find("resource-issue42");
+ assertNotNull(actual);
+ assertEquals(resource, actual);
+
+ userId = schemaDAO.find("userId", USchema.class);
+
+ Set<AbstractMappingItem> afterUserIdMappings = new HashSet<AbstractMappingItem>();
+ for (ExternalResource res : resourceDAO.findAll()) {
+ if (res.getUmapping() != null) {
+ for (AbstractMappingItem mapItem : res.getUmapping().getItems()) {
+ if (userId.getName().equals(mapItem.getIntAttrName())) {
+ afterUserIdMappings.add(mapItem);
+ }
+ }
+ }
+ }
+
+ assertEquals(beforeUserIdMappings.size(), afterUserIdMappings.size() - 1);
+ }
+}