Author: bdaw
Date: 2009-04-03 06:03:06 -0400 (Fri, 03 Apr 2009)
New Revision: 423
Removed:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APIJBossUnitTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APILDAPJBossUnitTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationJBossUnitTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPJBossUnitTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreJBossUnitTest.java
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java
Log:
- some cleanup
- limit binary data size in tests so testsuite passes on oracle (need config option to
check the limits)
Deleted:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APIJBossUnitTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APIJBossUnitTest.java 2009-04-03
08:52:13 UTC (rev 422)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APIJBossUnitTest.java 2009-04-03
10:03:06 UTC (rev 423)
@@ -1,110 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import junit.framework.TestCase;
-import org.jboss.identity.idm.impl.HibernateTestSupport;
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
-import org.jboss.identity.idm.opends.OpenDSService;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.opends.server.tools.LDAPModify;
-
-import javax.naming.directory.DirContext;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.Binding;
-import javax.naming.ldap.InitialLdapContext;
-import java.util.Hashtable;
-import java.io.File;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
- * @version : 0.1 $
- */
-public class APIJBossUnitTest extends IdentityTestPOJO implements APITestContext
-{
-
- PersistenceManagerTest persistenceManagerTest;
-
- RelationshipManagerTest relationshipManagerTest;
-
- RoleManagerTest roleManagerTest;
-
- IdentitySessionFactory identitySessionFactory;
-
- @Create
- public void start() throws Exception
- {
- super.start();
- persistenceManagerTest = new PersistenceManagerTest(this);
- relationshipManagerTest = new RelationshipManagerTest(this);
- roleManagerTest = new RoleManagerTest(this);
-
- begin();
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
-
- commit();
- }
-
- @Destroy
- public void stop() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testPersistenceManager() throws Exception
- {
- persistenceManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManager() throws Exception
- {
- relationshipManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManagerMergedRoleAssociations() throws Exception
- {
- relationshipManagerTest.testMergedRoleAssociations(getRealmName());
- }
-
- @Test
- public void testRoleManager() throws Exception
- {
- roleManagerTest.testMethods(getRealmName());
- }
-}
\ No newline at end of file
Deleted:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APILDAPJBossUnitTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APILDAPJBossUnitTest.java 2009-04-03
08:52:13 UTC (rev 422)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/APILDAPJBossUnitTest.java 2009-04-03
10:03:06 UTC (rev 423)
@@ -1,113 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import junit.framework.TestCase;
-import org.jboss.identity.idm.impl.HibernateTestSupport;
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.LDAPTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
-import org.jboss.identity.idm.opends.OpenDSService;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.opends.server.tools.LDAPModify;
-
-import javax.naming.directory.DirContext;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.Binding;
-import javax.naming.ldap.InitialLdapContext;
-import java.util.Hashtable;
-import java.io.File;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
- * @version : 0.1 $
- */
-public class APILDAPJBossUnitTest extends LDAPTestPOJO implements APITestContext
-{
-
- PersistenceManagerTest persistenceManagerTest;
-
- RelationshipManagerTest relationshipManagerTest;
-
- RoleManagerTest roleManagerTest;
-
- IdentitySessionFactory identitySessionFactory;
-
- @Create
- public void start() throws Exception
- {
- super.start();
- persistenceManagerTest = new PersistenceManagerTest(this);
- relationshipManagerTest = new RelationshipManagerTest(this);
- roleManagerTest = new RoleManagerTest(this);
-
- populateClean();
-
- begin();
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
-
- commit();
- }
-
- @Destroy
- public void stop() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testPersistenceManager() throws Exception
- {
- persistenceManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManager() throws Exception
- {
- relationshipManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManagerMergedRoleAssociations() throws Exception
- {
- relationshipManagerTest.testMergedRoleAssociations(getRealmName());
- }
-
- @Test
- public void testRoleManager() throws Exception
- {
- roleManagerTest.testMethods(getRealmName());
- }
-}
\ No newline at end of file
Deleted:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationJBossUnitTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationJBossUnitTest.java 2009-04-03
08:52:13 UTC (rev 422)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationJBossUnitTest.java 2009-04-03
10:03:06 UTC (rev 423)
@@ -1,110 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
- * @version : 0.1 $
- */
-public class OrganizationJBossUnitTest extends IdentityTestPOJO implements
APITestContext
-{
- private OrganizationTest orgTest;
-
- private IdentitySessionFactory identitySessionFactory;
-
- private String samplePortalRealmName;
-
- private String sampleOrganizationRealmName;
-
-
- @Create
- public void start() throws Exception
- {
- super.start();
-
- orgTest = new OrganizationTest(this);
-
- begin();
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
-
- commit();
- }
-
- @Destroy
- public void stop() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testOrganization() throws Exception
- {
-
- orgTest.testRedHatOrganization(getSampleOrganizationRealmName());
- }
-
- @Test
- public void testSamplePortal() throws Exception
- {
-
- orgTest.testSamplePortal(getSamplePortalRealmName());
-
- }
-
- public String getSamplePortalRealmName()
- {
- return samplePortalRealmName;
- }
-
- @Parameter
- public void setSamplePortalRealmName(String samplePortalRealmName)
- {
- this.samplePortalRealmName = samplePortalRealmName;
- }
-
- public String getSampleOrganizationRealmName()
- {
- return sampleOrganizationRealmName;
- }
-
- @Parameter
- public void setSampleOrganizationRealmName(String sampleOrganizationRealmName)
- {
- this.sampleOrganizationRealmName = sampleOrganizationRealmName;
- }
-}
\ No newline at end of file
Deleted:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPJBossUnitTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPJBossUnitTest.java 2009-04-03
08:52:13 UTC (rev 422)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPJBossUnitTest.java 2009-04-03
10:03:06 UTC (rev 423)
@@ -1,113 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.LDAPTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
- * @version : 0.1 $
- */
-public class OrganizationLDAPJBossUnitTest extends LDAPTestPOJO implements
APITestContext
-{
- private OrganizationTest orgTest;
-
- private IdentitySessionFactory identitySessionFactory;
-
- private String samplePortalRealmName;
-
- private String sampleOrganizationRealmName;
-
-
- @Create
- public void start() throws Exception
- {
- super.start();
-
- orgTest = new OrganizationTest(this);
-
- populateClean();
-
- begin();
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
-
- commit();
- }
-
- @Destroy
- public void stop() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testOrganization() throws Exception
- {
-
- orgTest.testRedHatOrganization(getSampleOrganizationRealmName());
- }
-
- @Test
- public void testSamplePortal() throws Exception
- {
-
- orgTest.testSamplePortal(getSamplePortalRealmName());
-
- }
-
- public String getSamplePortalRealmName()
- {
- return samplePortalRealmName;
- }
-
- @Parameter
- public void setSamplePortalRealmName(String samplePortalRealmName)
- {
- this.samplePortalRealmName = samplePortalRealmName;
- }
-
- public String getSampleOrganizationRealmName()
- {
- return sampleOrganizationRealmName;
- }
-
- @Parameter
- public void setSampleOrganizationRealmName(String sampleOrganizationRealmName)
- {
- this.sampleOrganizationRealmName = sampleOrganizationRealmName;
- }
-}
\ No newline at end of file
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-04-03
08:52:13 UTC (rev 422)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-04-03
10:03:06 UTC (rev 423)
@@ -282,7 +282,7 @@
// Generate random binary data for binary attribute
Random random = new Random();
- byte[] picture = new byte[5120];
+ byte[] picture = new byte[255];
random.nextBytes(picture);
// User attributes
@@ -335,7 +335,7 @@
if (session.getAttributesManager().hasCredential(anotherOne,
BinaryCredential.TYPE))
{
- byte[] cert = new byte[5120];
+ byte[] cert = new byte[255];
random.nextBytes(cert);
Credential binaryCredential = new BinaryCredential(cert);
session.getAttributesManager().updateCredential(anotherOne, binaryCredential);
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java 2009-04-03
08:52:13 UTC (rev 422)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java 2009-04-03
10:03:06 UTC (rev 423)
@@ -330,9 +330,9 @@
Random random = new Random();
- byte[] data1 = new byte[5120];
+ byte[] data1 = new byte[255];
random.nextBytes(data1);
- byte[] data2 = new byte[1024];
+ byte[] data2 = new byte[128];
random.nextBytes(data2);
IdentityObjectCredential binaryCredential1 = new BinaryCredential(data1);
Deleted:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreJBossUnitTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreJBossUnitTest.java 2009-04-03
08:52:13 UTC (rev 422)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreJBossUnitTest.java 2009-04-03
10:03:06 UTC (rev 423)
@@ -1,301 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.store.hibernate;
-
-import org.jboss.identity.idm.spi.model.IdentityObject;
-import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
-import org.jboss.identity.idm.spi.store.IdentityStore;
-import org.jboss.identity.idm.spi.store.IdentityStoreSession;
-import
org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
-import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
-import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
-import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
-import org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl;
-import org.jboss.identity.idm.impl.store.IdentityTypeEnum;
-import org.jboss.identity.idm.impl.store.CommonIdentityStoreTest;
-import org.jboss.identity.idm.impl.store.IdentityStoreTestContext;
-import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
-import org.jboss.identity.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.impl.api.SimpleAttribute;
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.exception.IdentityException;
-import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Test;
-import static org.jboss.unit.api.Assert.*;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-
-import java.util.Map;
-import java.io.File;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
- * @version : 0.1 $
- */
-public class HibernateIdentityStoreJBossUnitTest extends IdentityTestPOJO implements
IdentityStoreTestContext
-{
-
- protected HibernateIdentityStoreImpl store;
-
- protected IdentityStoreInvocationContext ctx;
-
- protected CommonIdentityStoreTest commonTest;
-
- public HibernateIdentityStoreJBossUnitTest()
- {
-
- }
-
- @Create
- public void start() throws Exception
- {
- super.start();
-
- commonTest = new CommonIdentityStoreTest(this);
-
- begin();
-
- IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
- .createConfigurationMetaData(getIdentityConfig());
-
- IdentityConfigurationContextRegistry identityConfiguration =
(IdentityConfigurationContextRegistry)
- new IdentityConfigurationImpl().configure(configurationMD);
-
- IdentityStoreConfigurationMetaData storeMD = null;
-
- for (IdentityStoreConfigurationMetaData metaData :
configurationMD.getIdentityStores())
- {
- if (metaData.getId().equals("HibernateTestStore"))
- {
- storeMD = metaData;
- break;
- }
- }
-
- IdentityStoreConfigurationContext context =
- new IdentityStoreConfigurationContextImpl(configurationMD,
identityConfiguration, storeMD);
-
- store = new HibernateIdentityStoreImpl("HibernateTestStore")
- {
-
- @Override
- protected Session getHibernateSession(IdentityStoreInvocationContext ctx)
- {
- return getHibernateSupport().getSessionFactory().getCurrentSession();
- }
-
- @Override
- protected SessionFactory
bootstrapHibernateSessionFactory(IdentityStoreConfigurationContext configurationContext)
throws IdentityException
- {
- return getHibernateSupport().getSessionFactory();
- }
-
- };
-
- store.bootstrap(context);
-
-
- ctx = new IdentityStoreInvocationContext()
- {
- public IdentityStoreSession getIdentityStoreSession()
- {
- return null;
- }
-
- public String getRealmId()
- {
- return "testRealm";
- }
- };
-
- commit();
-
-
- }
-
- public void begin()
- {
- getHibernateSupport().openSession();
- }
-
- public void commit()
- {
- assertTrue(getHibernateSupport().commitTransaction());
- }
-
- public void flush() throws Exception
- {
-
- getHibernateSupport().getSessionFactory().getCurrentSession().flush();
- }
-
- public IdentityStore getStore()
- {
- return store;
- }
-
- public IdentityStoreInvocationContext getCtx()
- {
- return ctx;
- }
-
- // Tests
-
- @Test
- public void testStorePersistence() throws Exception
- {
-
- commonTest.testStorePersistence();
-
- }
-
- @Test
- public void testFindMethods() throws Exception
- {
-
- commonTest.testFindMethods();
-
- }
-
- @Test
- public void testAttributes() throws Exception
- {
-
- begin();
-
- IdentityObject user1 = store.createIdentityObject(ctx, "Adam",
IdentityTypeEnum.USER);
- IdentityObject user2 = store.createIdentityObject(ctx, "Eva",
IdentityTypeEnum.USER);
-
- flush();
-
- IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key1", new String[]{"val1",
"val2", "val3"}),
- new SimpleAttribute("key2", new String[]{"val1",
"val2", "val3", "val4"})
- };
-
- store.addAttributes(ctx, user1, attrs);
-
- flush();
-
- Map<String, IdentityObjectAttribute> persistedAttrs =
store.getAttributes(ctx, user1);
-
- assertEquals(2, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").getSize());
-
- assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").getSize());
-
- flush();
-
- attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key3", new String[]{"val1"})
- };
-
-
- store.addAttributes(ctx, user1, attrs);
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").getSize());
-
- assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").getSize());
-
- assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").getSize());
-
- flush();
-
- attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key3", new String[]{"val2"})
- };
-
- store.addAttributes(ctx, user1, attrs);
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(2, persistedAttrs.get("key3").getSize());
-
- flush();
-
- store.updateAttributes(ctx, user1, attrs);
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").getSize());
-
- flush();
-
- store.removeAttributes(ctx, user1, new String[] {"key3"});
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(2, persistedAttrs.keySet().size());
-
-
- commit();
-
- }
-
- @Test
- public void testRelationships() throws Exception
- {
- commonTest.testRelationships();
- }
-
- @Test
- public void testCredentials() throws Exception
- {
- commonTest.testPasswordCredential();
- commonTest.testBinaryCredential();
- }
-
- @Test
- public void testControls() throws Exception
- {
- commonTest.testControls();
- }
-
-}
\ No newline at end of file