com.atlassian.crowd.acceptance.tests.persistence.migration
Class SchemaCreationIntegrationTest

java.lang.Object
  extended by com.atlassian.crowd.acceptance.tests.persistence.migration.AbstractDaoIntegrationTest
      extended by com.atlassian.crowd.acceptance.tests.persistence.migration.SchemaCreationIntegrationTest

@ContextConfiguration(locations={"classpath:/applicationContext-schemahelper-config.xml","classpath:/applicationContext-CrowdDAO.xml"})
@TestExecutionListeners(value={org.springframework.test.context.support.DependencyInjectionTestExecutionListener.class,org.springframework.test.context.transaction.TransactionalTestExecutionListener.class,org.springframework.test.context.support.DirtiesContextTestExecutionListener.class})
@TransactionConfiguration(defaultRollback=true)
@DirtiesContext(classMode=AFTER_CLASS)
public class SchemaCreationIntegrationTest
extends AbstractDaoIntegrationTest

This test is HSQLDB-specific because it uses a HSQLDB-specific statement to delete any existing previous schema. The DirtiesContext annotation ensures that the Spring context created for this test is not reused by any other test (such as SchemaUpgradeIntegrationTest). Each test class requires a fresh instance of the HSQL database, a fresh instance of the SessionFactory and a reset of the auto-increment ID generators.


Constructor Summary
SchemaCreationIntegrationTest()
           
 
Method Summary
 void createSchema()
          The database schema must be created before a transaction is started, because otherwise Hibernate's SessionFactory will initialise it for us (or validate it, depending on how it is configured).
 AliasDAO getAliasDao()
           
 ApplicationDAO getApplicationDao()
           
 DirectoryDao getDirectoryDao()
           
 GroupDao getGroupDao()
           
 MembershipDao getMembershipDao()
           
 PropertyDAO getPropertyDao()
           
 TokenDAOHibernate getTokenDao()
           
 UserDao getUserDao()
           
 void testDaosCanInsertNewDataAfterSchemaCreation()
          DAOs must be run within a transaction.
 
Methods inherited from class com.atlassian.crowd.acceptance.tests.persistence.migration.AbstractDaoIntegrationTest
_testAliasDaoCanInsert, _testApplicationDaoCanInsert, _testDirectoryDaoCanInsert, _testGroupDaoCanInsert, _testMembershipDaoCanInsert, _testPropertyDaoCanInsert, _testTokenDaoCanInsert, _testUserDaoCanInsert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaCreationIntegrationTest

public SchemaCreationIntegrationTest()
Method Detail

createSchema

@BeforeTransaction
public void createSchema()
                  throws Exception
The database schema must be created before a transaction is started, because otherwise Hibernate's SessionFactory will initialise it for us (or validate it, depending on how it is configured).

Throws:
Exception

testDaosCanInsertNewDataAfterSchemaCreation

@Transactional
public void testDaosCanInsertNewDataAfterSchemaCreation()
                                                 throws Exception
DAOs must be run within a transaction.

Throws:
Exception

getTokenDao

public TokenDAOHibernate getTokenDao()
Specified by:
getTokenDao in class AbstractDaoIntegrationTest

getApplicationDao

public ApplicationDAO getApplicationDao()
Specified by:
getApplicationDao in class AbstractDaoIntegrationTest

getUserDao

public UserDao getUserDao()
Specified by:
getUserDao in class AbstractDaoIntegrationTest

getGroupDao

public GroupDao getGroupDao()
Specified by:
getGroupDao in class AbstractDaoIntegrationTest

getMembershipDao

public MembershipDao getMembershipDao()
Specified by:
getMembershipDao in class AbstractDaoIntegrationTest

getDirectoryDao

public DirectoryDao getDirectoryDao()
Specified by:
getDirectoryDao in class AbstractDaoIntegrationTest

getAliasDao

public AliasDAO getAliasDao()
Specified by:
getAliasDao in class AbstractDaoIntegrationTest

getPropertyDao

public PropertyDAO getPropertyDao()
Specified by:
getPropertyDao in class AbstractDaoIntegrationTest


Copyright © 2013 Atlassian. All Rights Reserved.