org.kuali.rice.krad.service
Class PessimisticLockServiceTest

java.lang.Object
  extended by org.kuali.rice.test.BaseRiceTestCase
      extended by org.kuali.rice.test.RiceTestCase
          extended by org.kuali.rice.test.RiceInternalSuiteDataTestCase
              extended by org.kuali.rice.test.BaseModuleTestCase
                  extended by org.kuali.rice.test.BaselineTestCase
                      extended by org.kuali.rice.krad.test.KRADTestCase
                          extended by org.kuali.rice.krad.service.PessimisticLockServiceTest
All Implemented Interfaces:
MethodAware

public class PessimisticLockServiceTest
extends KRADTestCase

PessimisticLockServiceTest tests PessimisticLockServiceImpl

Author:
Kuali Rice Team (rice.collab@kuali.org)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.kuali.rice.krad.test.KRADTestCase
KRADTestCase.BootstrapTest, KRADTestCase.Legacy
 
Nested classes/interfaces inherited from class org.kuali.rice.test.BaselineTestCase
BaselineTestCase.BaselineMode, BaselineTestCase.Mode
 
Field Summary
 
Fields inherited from class org.kuali.rice.krad.test.KRADTestCase
dd, kradTestHarnessSpringResourceLoader
 
Fields inherited from class org.kuali.rice.test.BaselineTestCase
dirty
 
Fields inherited from class org.kuali.rice.test.BaseModuleTestCase
LOG, moduleName
 
Fields inherited from class org.kuali.rice.test.RiceTestCase
DEFAULT_TEST_HARNESS_SPRING_BEANS, failedSuiteTestName, perTestLifeCycles, SUITE_LIFE_CYCLES_FAILED, SUITE_LIFE_CYCLES_RAN, suiteLifeCycles
 
Fields inherited from class org.kuali.rice.test.BaseRiceTestCase
log, method
 
Constructor Summary
PessimisticLockServiceTest()
           
 
Method Summary
 void setUp()
           
 void testDeleteLocks()
          tests deleting PessimisticLock objects.
 void testEstablishLocks()
          tests the PessimisticLockService.establishLocks method and the PessimisticLockService.getDocumentActions method
 void testGenerateNewLocks()
          tests the generation of new PessimisticLock objects
 void testGetPessimisticLocksForDocument()
          tests retrieving PessimisticLock objects by document number
 void testGetPessimisticLocksForSession()
          This method tests retrieving PessimisticLock objects by session id
 void testPessimisticLockingWithCustomDocumentLockDescriptors()
          tests the PessimisticLockService's ability to establish pessimistic locks for documents supporting custom lock descriptors
 void testReleaseAllLocksForUser()
          This method tests releasing PessimisticLock objects for a specific user
 void testSaveLock()
          tests saving PessimisticLock objects
 void testWorkflowPessimisticLocking()
          tests the PessimistLockService's workflow pessimistic locking capabilities
 
Methods inherited from class org.kuali.rice.krad.test.KRADTestCase
getKRADTestHarnessContext, getLoadApplicationLifecycle, getSuiteLifecycles, getTestDictionaryObject, loadSuiteTestData, setUpInternal, setUpLegacyContext, tearDown, tearDownLegacyContext
 
Methods inherited from class org.kuali.rice.test.BaselineTestCase
getClearDbPerTestLifecycles, getMode, getPerTestLifecycles, getPerTestTablesNotToClear, getPerTestTablesToClear, getRollbackClearDbPerTestLifecycles, getRollbackTestLifecycles
 
Methods inherited from class org.kuali.rice.test.BaseModuleTestCase
getModuleName
 
Methods inherited from class org.kuali.rice.test.RiceInternalSuiteDataTestCase
getKIMDataLoadOrderFile, getKIMSqlFileBaseLocation, getKRADDefaultSuiteTestData
 
Methods inherited from class org.kuali.rice.test.RiceTestCase
configureLogging, dumpMemory, getConfigLocations, getFullTestName, getModuleTestConfigLocation, getRiceMasterDefaultConfigFile, getTestHarnessConfig, getTestHarnessSpringBeansLocation, getTestHarnessSpringResourceLoader, getUserDir, loadPerTestData, logAfterRun, logBeforeRun, report, setBaseDirSystemProperty, setClearTables, setModuleName, startLifecycles, startSuiteDataLoaderLifecycles, stopLifecycles
 
Methods inherited from class org.kuali.rice.test.BaseRiceTestCase
getName, getPerTestDataLoaderLifecycle, getTestMethod, resetLogLevels, setLogLevel, setName, setTestMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PessimisticLockServiceTest

public PessimisticLockServiceTest()
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class KRADTestCase
Throws:
Exception

testDeleteLocks

@UnitTestData(sqlStatements={@UnitTestSql(value="DELETE FROM KRNS_PESSIMISTIC_LOCK_T"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1111, \'4f6bc9e2-7df8-102c-97b6-ed716fdaf540\', 0, NULL, \'1234\', {d \'2007-07-01\'}, \'employee\', \'aa5d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1112, \'5add9cba-7df8-102c-97b6-ed716fdaf540\', 0, NULL, \'1235\', {d \'2007-10-01\'}, \'frank\', \'dd4d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1113, \'69e42b8e-7df8-102c-97b6-ed716fdaf540\', 0, NULL, \'1236\', {d \'2007-08-01\'}, \'fred\', \'ad4d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1114, \'76504650-7df8-102c-97b6-ed716fdaf540\', 0, NULL, \'1237\', {d \'2007-08-01\'}, \'fred\', \'ad4d6c83-4d0f-4309-a528-c2f81ec00396\')")})
public void testDeleteLocks()
                     throws Exception
tests deleting PessimisticLock objects. Tests that invalid deletes throw exceptions and valid deletes by owner users as well as lock admin users do work as expected

Throws:
Exception

testGenerateNewLocks

public void testGenerateNewLocks()
                          throws Exception
tests the generation of new PessimisticLock objects

Throws:
Exception

testGetPessimisticLocksForDocument

@UnitTestData(sqlStatements={@UnitTestSql(value="DELETE FROM KRNS_PESSIMISTIC_LOCK_T"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1111, \'fbcb0362-7dfb-102c-97b6-ed716fdaf540\', 0, NULL, \'1234\', {d \'2007-07-01\'}, \'fran\', \'aa5d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1112, \'055bef4a-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1237\', {d \'2007-10-01\'}, \'frank\', \'dd5d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1113, \'0e0144ec-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1236\', {d \'2007-10-01\'}, \'frank\', \'dd5d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1114, \'1891526c-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1237\', {d \'2007-08-01\'}, \'fred\', \'ab4d6c83-4d0f-4309-a528-c2f81ec00396\')")})
public void testGetPessimisticLocksForDocument()
                                        throws Exception
tests retrieving PessimisticLock objects by document number

Throws:
Exception

testGetPessimisticLocksForSession

@UnitTestData(sqlStatements={@UnitTestSql(value="DELETE FROM KRNS_PESSIMISTIC_LOCK_T"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1111, \'24c40cd2-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1234\', {d \'2007-07-01\'}, \'fran\', \'ad4d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1112, \'32602e8e-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1235\', {d \'2007-10-01\'}, \'fran\', \'bc5d6c66-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1113, \'3acfc1ce-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1236\', {d \'2007-10-01\'}, \'fran\', \'ad4d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1114, \'463cc642-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1237\', {d \'2007-08-01\'}, \'fran\', \'bc5d6c66-4d0f-4309-a528-c2f81ec00396\')")})
public void testGetPessimisticLocksForSession()
                                       throws Exception
This method tests retrieving PessimisticLock objects by session id

Throws:
Exception

testReleaseAllLocksForUser

@UnitTestData(sqlStatements={@UnitTestSql(value="DELETE FROM KRNS_PESSIMISTIC_LOCK_T"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1111, \'24c40cd2-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1234\', {d \'2007-07-01\'}, \'fran\', \'ad4d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1112, \'32602e8e-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1235\', {d \'2007-10-01\'}, \'frank\', \'bc5d6c66-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1113, \'3acfc1ce-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1236\', {d \'2007-10-01\'}, \'frank\', \'bc5d6c66-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1114, \'463cc642-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1237\', {d \'2007-08-01\'}, \'fred\', \'dd5d6c66-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1115, \'4e66c4b2-7dfc-102c-97b6-ed716fdaf540\', 0, \'Temporary Lock\', \'1234\', {d \'2007-07-01\'}, \'fran\', \'ad4d6c83-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1116, \'55d99b02-7dfc-102c-97b6-ed716fdaf540\', 0, \'Temporary Lock\', \'1235\', {d \'2007-10-01\'}, \'frank\', \'bc5d6c66-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1117, \'5e47fb26-7dfc-102c-97b6-ed716fdaf540\', 0, \'Temporary Lock\', \'1236\', {d \'2007-10-01\'}, \'frank\', \'bc5d6c66-4d0f-4309-a528-c2f81ec00396\')"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1118, \'65c366d8-7dfc-102c-97b6-ed716fdaf540\', 0, \'Temporary Lock\', \'1237\', {d \'2007-08-01\'}, \'fred\', \'dd5d6c66-4d0f-4309-a528-c2f81ec00396\')")})
public void testReleaseAllLocksForUser()
                                throws Exception
This method tests releasing PessimisticLock objects for a specific user

Throws:
Exception

testSaveLock

@UnitTestData(sqlStatements={@UnitTestSql(value="DELETE FROM KRNS_PESSIMISTIC_LOCK_T"),@UnitTestSql(value="INSERT INTO KRNS_PESSIMISTIC_LOCK_T (PESSIMISTIC_LOCK_ID,OBJ_ID,VER_NBR,LOCK_DESC_TXT,DOC_HDR_ID,GNRT_DT,PRNCPL_ID,SESN_ID) VALUES (1111, \'73f340de-7dfc-102c-97b6-ed716fdaf540\', 0, NULL, \'1234\', {d \'2007-07-01\'}, \'fran\', \'ad4d6c83-4d0f-4309-a528-c2f81ec00396\')")})
public void testSaveLock()
                  throws Exception
tests saving PessimisticLock objects

Throws:
Exception

testEstablishLocks

public void testEstablishLocks()
                        throws Exception
tests the PessimisticLockService.establishLocks method and the PessimisticLockService.getDocumentActions method

Throws:
Exception

testWorkflowPessimisticLocking

public void testWorkflowPessimisticLocking()
                                    throws Exception
tests the PessimistLockService's workflow pessimistic locking capabilities

Throws:
Exception

testPessimisticLockingWithCustomDocumentLockDescriptors

public void testPessimisticLockingWithCustomDocumentLockDescriptors()
                                                             throws Exception
tests the PessimisticLockService's ability to establish pessimistic locks for documents supporting custom lock descriptors

Throws:
Exception


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.