Package org.openbravo.test.dal
Class DalTest
- java.lang.Object
-
- org.openbravo.test.base.OBBaseTest
-
- org.openbravo.base.weld.test.WeldBaseTest
-
- org.openbravo.test.dal.DalTest
-
public class DalTest extends WeldBaseTest
Test different parts of the DAL API:OBDal
,OBQuery
andOBCriteria
. Note the test cases assume that they are run in the order defined in this class.- Author:
- mtaal
-
-
Field Summary
-
Fields inherited from class org.openbravo.test.base.OBBaseTest
DOLLAR, DOLLAR_ID, EURO, EURO_ID, QA_TEST_ADMIN_USER_ID, QA_TEST_CLIENT_ID, QA_TEST_ORG_ID, TEST_BP_CATEGORY_ID, TEST_CLIENT_ID, TEST_LOCATION_ID, TEST_ORDER_ID, TEST_ORG_ID, TEST_ORG_TREE, TEST_PRODUCT_ID, TEST_ROLE_ID, TEST_US_ORG_ID, TEST_USER_ID, TEST_WAREHOUSE_ID, TEST2_USER_ID, userIds, watchFailures
-
-
Constructor Summary
Constructors Constructor Description DalTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
canDeleteWithOBQuery()
Test to check deletion queries using OBQueryvoid
canRetrieveIdOfNonExistentProxy()
Test to check that it is possible to retrieve the identifier of a proxy that references a non-existent record.void
canUseOBContextParamNotPresentInSession()
Test to check that it is possible to use OBContext cached objects as the value for OBQuery parameters even if they have not been previously loaded into the session.void
countInOBCriteriaInitializesOnce()
void
defaultPoolCanBeUsedAfterClosingReadOnlyPool()
void
defaultPoolCanBeUsedAfterCommit()
void
defaultPoolCanBeUsedAfterRollback()
void
defaultPoolIsClosedAfterCommit()
void
defaultPoolIsClosedAfterRollback()
void
defaultPoolNotClosedAfterCommitReadOnlyPool()
void
evictAnEvictedObjectShouldNotFail()
Test to verify that evict() does not fail when invoking it with an already evicted BaseOBObject.void
getInexistentObjByEntityNameShouldBeNull()
void
getInexistentObjByEntityNameShouldBeNullEvenIfItWasProxied()
void
getInexistentObjShouldBeNull()
void
getInexistentObjShouldBeNullEvenIfItWasProxied()
void
multipleInitializeCallsInOBCriteriaShouldThrowAWarning()
void
nullabilityCheckIsDisabled()
Test to verify that Hibernate's property nullability check is disabled when creating entities through DAL.void
orderByShouldBeAppliedAfterCount()
void
populatingProxyOfInexistentObjShouldFail()
void
proxyShouldBeInitialized()
Test to check that proxies are initialized when retrieving a property different from the identifier.void
proxyShouldNotBeInitialized()
Test to check that proxies are not initialized when retrieving their identifier.void
readOnlyPoolCanBeUsedAfterClosingDefaultPool()
void
readOnlyPoolCanNotDelete()
void
readOnlyPoolCanNotInsert()
void
readOnlyPoolCanNotUpdate()
void
readOnlyPoolNotClosedAfterCommitDefaultPool()
void
testASaveBooleanValue1()
Test to assert save false in a null char(1) column - Part I.void
testBSaveBooleanValue2()
Test to assert save false in a null char(1) column - Part II.void
testCCreateBPGroup()
void
testDRemoveBPGroup()
Test queries for theCategory
created in the previous step and removes it.void
testECheckBPGroupRemoved()
This test checks if theCategory
was removed in the previous step.void
testFUpdateCurrencyByUser()
void
testGUpdateCurrencyByAdmin()
Test updates the description ofCurrency
by the admin user.void
testHToString()
Tests the toString method of the BaseOBObject (BaseOBObject.toString()
).void
testITransaction25PageRead()
Tests a paged read ofMaterialTransaction
objects and print of the identifier.void
testJTransactionAllPagesTime()
Test reads 500 pages of theMaterialTransaction
table and then prints how many milliseconds one page took to retrieve.void
testKCurrencyPageRead()
Tests paged read ofCurrency
objects.void
testLCashBookPageRead()
Tests paged read ofCashBook
objects.void
testMCashBookTrigger()
Tests if a database trigger is fired on creation of aCashBook
.void
testNGetPropertyFromColumnName()
void
testOBQueryWithAlias()
Test to check that an OBQuery with a select clause can be executed properly by defining an alias for the main entity of the query.void
testOBQueryWithLegacyStyleParameters()
Test to check that an OBQuery using legacy-style query parameters ('?') can be executed properly.void
testOBQueryWithoutAlias()
Test to check that an OBQuery with a select clause can be executed properly without setting an alias for the main entity of the query.-
Methods inherited from class org.openbravo.base.weld.test.WeldBaseTest
createTestArchive, getWeldComponent, resetOBInterceptors, setUp
-
Methods inherited from class org.openbravo.test.base.OBBaseTest
addReadWriteAccess, classSetUp, commitTransaction, count, getConnectionProvider, getOneInstance, getRandomUser, getTestLogAppender, initializeDalLayer, initializeDisabledTestCases, initializeTestLogAppender, isErrorOccured, reportException, rollback, setLogStackTraces, setQAAdminContext, setSystemAdministratorContext, setTestAdminContext, setTestLogAppenderLevel, setTestUserContext, setUserContext, shouldMockServletContext, staticInitializeDalLayer, testDone
-
-
-
-
Method Detail
-
testASaveBooleanValue1
public void testASaveBooleanValue1()
Test to assert save false in a null char(1) column - Part I.
-
testBSaveBooleanValue2
public void testBSaveBooleanValue2()
Test to assert save false in a null char(1) column - Part II.
-
testCCreateBPGroup
public void testCCreateBPGroup()
-
testDRemoveBPGroup
public void testDRemoveBPGroup()
Test queries for theCategory
created in the previous step and removes it.
-
testECheckBPGroupRemoved
public void testECheckBPGroupRemoved()
This test checks if theCategory
was removed in the previous step.
-
testFUpdateCurrencyByUser
public void testFUpdateCurrencyByUser()
-
testGUpdateCurrencyByAdmin
public void testGUpdateCurrencyByAdmin()
Test updates the description ofCurrency
by the admin user.
-
testHToString
public void testHToString()
Tests the toString method of the BaseOBObject (BaseOBObject.toString()
).
-
testITransaction25PageRead
public void testITransaction25PageRead()
Tests a paged read ofMaterialTransaction
objects and print of the identifier. The identifier of a transaction has been implemented such that it reads all the references (which are non-null) and uses their identifier to create the identifier of the transaction. Also tests sorting on the name of a related entity (in this case#getName()
.
-
testJTransactionAllPagesTime
public void testJTransactionAllPagesTime()
Test reads 500 pages of theMaterialTransaction
table and then prints how many milliseconds one page took to retrieve.
-
testKCurrencyPageRead
public void testKCurrencyPageRead()
Tests paged read ofCurrency
objects.
-
testLCashBookPageRead
public void testLCashBookPageRead()
Tests paged read ofCashBook
objects.
-
testMCashBookTrigger
public void testMCashBookTrigger()
Tests if a database trigger is fired on creation of aCashBook
.
-
testNGetPropertyFromColumnName
public void testNGetPropertyFromColumnName()
-
getInexistentObjShouldBeNull
public void getInexistentObjShouldBeNull()
-
getInexistentObjByEntityNameShouldBeNull
public void getInexistentObjByEntityNameShouldBeNull()
-
getInexistentObjShouldBeNullEvenIfItWasProxied
public void getInexistentObjShouldBeNullEvenIfItWasProxied()
-
getInexistentObjByEntityNameShouldBeNullEvenIfItWasProxied
public void getInexistentObjByEntityNameShouldBeNullEvenIfItWasProxied()
-
populatingProxyOfInexistentObjShouldFail
public void populatingProxyOfInexistentObjShouldFail()
-
countInOBCriteriaInitializesOnce
public void countInOBCriteriaInitializesOnce()
-
multipleInitializeCallsInOBCriteriaShouldThrowAWarning
public void multipleInitializeCallsInOBCriteriaShouldThrowAWarning()
-
orderByShouldBeAppliedAfterCount
public void orderByShouldBeAppliedAfterCount()
-
defaultPoolIsClosedAfterCommit
public void defaultPoolIsClosedAfterCommit()
-
defaultPoolIsClosedAfterRollback
public void defaultPoolIsClosedAfterRollback()
-
defaultPoolCanBeUsedAfterCommit
public void defaultPoolCanBeUsedAfterCommit()
-
defaultPoolCanBeUsedAfterRollback
public void defaultPoolCanBeUsedAfterRollback()
-
readOnlyPoolNotClosedAfterCommitDefaultPool
public void readOnlyPoolNotClosedAfterCommitDefaultPool()
-
defaultPoolNotClosedAfterCommitReadOnlyPool
public void defaultPoolNotClosedAfterCommitReadOnlyPool()
-
readOnlyPoolCanBeUsedAfterClosingDefaultPool
public void readOnlyPoolCanBeUsedAfterClosingDefaultPool()
-
defaultPoolCanBeUsedAfterClosingReadOnlyPool
public void defaultPoolCanBeUsedAfterClosingReadOnlyPool()
-
readOnlyPoolCanNotInsert
public void readOnlyPoolCanNotInsert()
-
readOnlyPoolCanNotUpdate
public void readOnlyPoolCanNotUpdate()
-
readOnlyPoolCanNotDelete
public void readOnlyPoolCanNotDelete()
-
testOBQueryWithoutAlias
public void testOBQueryWithoutAlias()
Test to check that an OBQuery with a select clause can be executed properly without setting an alias for the main entity of the query.
-
testOBQueryWithAlias
public void testOBQueryWithAlias()
Test to check that an OBQuery with a select clause can be executed properly by defining an alias for the main entity of the query.
-
canDeleteWithOBQuery
public void canDeleteWithOBQuery()
Test to check deletion queries using OBQuery
-
testOBQueryWithLegacyStyleParameters
public void testOBQueryWithLegacyStyleParameters()
Test to check that an OBQuery using legacy-style query parameters ('?') can be executed properly.
-
proxyShouldNotBeInitialized
public void proxyShouldNotBeInitialized()
Test to check that proxies are not initialized when retrieving their identifier.
-
proxyShouldBeInitialized
public void proxyShouldBeInitialized()
Test to check that proxies are initialized when retrieving a property different from the identifier.
-
canRetrieveIdOfNonExistentProxy
public void canRetrieveIdOfNonExistentProxy()
Test to check that it is possible to retrieve the identifier of a proxy that references a non-existent record.
-
canUseOBContextParamNotPresentInSession
public void canUseOBContextParamNotPresentInSession()
Test to check that it is possible to use OBContext cached objects as the value for OBQuery parameters even if they have not been previously loaded into the session.
-
nullabilityCheckIsDisabled
public void nullabilityCheckIsDisabled()
Test to verify that Hibernate's property nullability check is disabled when creating entities through DAL.
-
evictAnEvictedObjectShouldNotFail
public void evictAnEvictedObjectShouldNotFail()
Test to verify that evict() does not fail when invoking it with an already evicted BaseOBObject.
-
-