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

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

@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 SchemaUpgradeIntegrationTest
extends AbstractDaoIntegrationTest

This test is HSQLDB-specific because it uses a SQL script with the HSQLDB dialect to restore the database to a known state. The DirtiesContext annotation ensures that the Spring context created for this test is not reused by any other test (such as SchemaCreationIntegrationTest). 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
SchemaUpgradeIntegrationTest()
           
 
Method Summary
 void existingDataIsPreservedBySchemaUpgradeAndNewDataCanBeInserted()
          DAOs must be run within a transaction.
 AliasDAO getAliasDao()
           
 ApplicationDAO getApplicationDao()
           
 DirectoryDao getDirectoryDao()
           
 GroupDao getGroupDao()
           
 MembershipDao getMembershipDao()
           
 PropertyDAO getPropertyDao()
           
 TokenDAOHibernate getTokenDao()
           
 UserDao getUserDao()
           
 void restoreDatabaseAndUpgradeSchema()
          The database needs to be restored and upgraded before a transaction is started, because otherwise Hibernate's SessionFactory will initialise it with the new schema.
 
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

SchemaUpgradeIntegrationTest

public SchemaUpgradeIntegrationTest()
Method Detail

restoreDatabaseAndUpgradeSchema

@BeforeTransaction
public void restoreDatabaseAndUpgradeSchema()
                                     throws Exception
The database needs to be restored and upgraded before a transaction is started, because otherwise Hibernate's SessionFactory will initialise it with the new schema.

Throws:
Exception

existingDataIsPreservedBySchemaUpgradeAndNewDataCanBeInserted

@Transactional
public void existingDataIsPreservedBySchemaUpgradeAndNewDataCanBeInserted()
                                                                   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

getAliasDao

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

getPropertyDao

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

getDirectoryDao

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


Copyright © 2013 Atlassian. All Rights Reserved.