Class DocumentNumberGeneration
- java.lang.Object
-
- org.openbravo.test.base.OBBaseTest
-
- org.openbravo.advpaymentmngt.test.DocumentNumberGeneration
-
public class DocumentNumberGeneration extends OBBaseTest
Defines test cases to guarantee uniqueness in document number generation. There are 2 methods to obtain document numbers: Utility.getDocumentNo and FIN_Uilitiy.getDocumentNo; first one uses PL function to obtain it, whereas second one uses only DAL. In case of concurrent requests for the same document type, locks should occur to ensure the returned document number is unique. This locks should be seen in both directions DAL <--> PL. In case of 1st concurrent thread commits, 2nd thread should get a different doc number than first one, if 1st rolls back, 2nd should get same number.- Author:
- alostale
-
-
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 DocumentNumberGeneration(boolean commitTrx)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dalFirstThenPL()
dal and pl concurrently, dal startsstatic Collection<Object[]>
params()
parameterize whether transaction should be committed (true) or rolled back (false)void
plFirstThenDal()
pl and dal concurrently, pl startsvoid
twoDalCalls()
2 concurrent dal callsvoid
twoDalCallsSequential()
one dal, wait till it finishes, another dal callvoid
twoPLCalls()
2 concurrent PL calls-
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, setUp, setUserContext, shouldMockServletContext, staticInitializeDalLayer, testDone
-
-
-
-
Method Detail
-
params
public static Collection<Object[]> params()
parameterize whether transaction should be committed (true) or rolled back (false)
-
twoDalCalls
public void twoDalCalls() throws InterruptedException, ExecutionException
2 concurrent dal calls
-
twoPLCalls
public void twoPLCalls() throws InterruptedException, ExecutionException
2 concurrent PL calls
-
twoDalCallsSequential
public void twoDalCallsSequential() throws InterruptedException, ExecutionException
one dal, wait till it finishes, another dal call
-
dalFirstThenPL
public void dalFirstThenPL() throws InterruptedException, ExecutionException
dal and pl concurrently, dal starts
-
plFirstThenDal
public void plFirstThenDal() throws InterruptedException, ExecutionException
pl and dal concurrently, pl starts
-
-