Package de.hybris.platform.stock
Class StockServiceTest
java.lang.Object
de.hybris.platform.testframework.HybrisJUnit4Test
de.hybris.platform.servicelayer.ServicelayerBaseTest
de.hybris.platform.servicelayer.ServicelayerTest
de.hybris.platform.stock.StockServiceTest
- All Implemented Interfaces:
JaloSessionHolder
Test for
StockService-
Field Summary
Fields inherited from class de.hybris.platform.servicelayer.ServicelayerTest
importServiceFields inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
jaloSession -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetUp()Setup of the test: retrieves 3 products, retrieves 3 warehouses.voidTests create stock level with no history created.voidTests to create the same product in the same warehouse twice.voidTests the creation of stock levels.voidTests the enabling and disabling of in stock function.voidTests stock level update of multi-reservations.voidTests the enabling and disabling of out of stock function.voidTest of product availability by invoking default strategy for calculating product availability, passing product, quantity and warehouse/store as parameters, Test of availability date by invoking default strategy for calculating product availability, passing product, quantity and warehouse/store as parameters (TODO), Test of "bestOf" implementationvoidTests stock level status.voidTests release of stock level.voidTests release of stock level with no history created.voidTests reserve stock level with no history created.voidvoidTests the search for all stock levels and the total actual amount.voidTests an unsuccessful reservation and a successful one in sequence.voidTests actual stock level update.voidTest update actual stock level with negative amount.voidTest update actual stock level with zero amount.Methods inherited from class de.hybris.platform.servicelayer.ServicelayerTest
createCoreData, createDefaultCatalog, createDefaultUsers, createHardwareCatalog, getApplicationContext, importCsv, importData, importData, importData, importStream, importStream, isPrefetchModeNoneMethods inherited from class de.hybris.platform.servicelayer.ServicelayerBaseTest
autowireProperties, getBeanName, prepareApplicationContextAndSessionMethods inherited from class de.hybris.platform.testframework.HybrisJUnit4Test
establishJaloSession, finish, getOrCreateCurrency, getOrCreateLanguage, init, intenseChecksActivated, takeJaloSession
-
Constructor Details
-
StockServiceTest
public StockServiceTest()
-
-
Method Details
-
setUp
Setup of the test:- retrieves 3 products,
- retrieves 3 warehouses.
- Throws:
Exception
-
testCreateStockLevel
public void testCreateStockLevel()Tests the creation of stock levels.- creates stockLlevel1,
- name, warehouse, availability, and history size check,
- creates stockLevel2,
- name, warehouse, availability, and history size check.
-
testCreateSameStockLevel
public void testCreateSameStockLevel()Tests to create the same product in the same warehouse twice. The first time succeeds, and the second time throws a RuntimeException. -
testTotalActualAmount
Tests the search for all stock levels and the total actual amount.- creates 3 stock levels: productCode1 in both warehouse1 and warehouse2, and productCode2 in warehouse2 only,
- sets the first stock level as FORCE_IN_STOCK,
- checks the result of the search for productCode1,
- checks the result of the search for productCode1 in 3 specified warehouses,
- creates another 2 stock levels: productCode1 and productCode3 in warehouse3,
- checks the result of the search for productCode1 in 3 specified warehouses,
- reserves productCode1, and test the negative stock level.
- Throws:
BusinessException
-
testInStockStatus
public void testInStockStatus()Tests the enabling and disabling of in stock function.- sets the status for a non-existing stock level, and there should be no exceptions,
- creates the first stock level and enables in stock, and tests it,
- creates another stock level and enables in stock, and tests it,
- disables both stock levels, and test them.
-
testOutOfStock
public void testOutOfStock()Tests the enabling and disabling of out of stock function.- sets the status for a non-existing stock level, and there should be no exceptions,
- creates the first stock level and enables out of stock, and tests it,
- creates another stock level and enables out of stock, and tests it,
- disables both stock levels, and tests them
-
testProductStockStatus
Tests stock level status.- creates a stock level, and tests the in stock status,
- reserves the product, and tests the in stock status.
- Throws:
BusinessException
-
testUpdateActualStockLevel
Tests actual stock level update.- creates a stock level, and updates the actual stock level with multi-threads,
- thread pool: 50, and rounds: 150,
- tests the stock level history entry size
- Throws:
Exception
-
testUpdateActualStockLevelNegativeAmount
public void testUpdateActualStockLevelNegativeAmount()Test update actual stock level with negative amount. Should display warn in console. -
testUpdateActualStockLevelZeroAmount
public void testUpdateActualStockLevelZeroAmount()Test update actual stock level with zero amount. Should not display any text in the console. -
testRelease
Tests release of stock level.- Throws:
BusinessException
-
testMultiReservations
Tests stock level update of multi-reservations.- creates a stock level, and reserves the corresponding product with multi-threads,
- thread pool: 200, and rounds: 600,
- tests the total stock level history entry size,
- tests reserved value of the last stock level history entry.
- Throws:
Exception
-
testUnsuccessfulReservations
Tests an unsuccessful reservation and a successful one in sequence.- creates a stock level with 100 pieces in stock,
- tries to reserve 200 pieces, must be unsuccessful,
- tries to reserve 10 pieces, must be successful this time.
- Throws:
BusinessException
-
testSuccessfulReservations
- Throws:
BusinessException
-
testProductAvailability
public void testProductAvailability()- Test of product availability by invoking default strategy for calculating product availability, passing product, quantity and warehouse/store as parameters,
- Test of availability date by invoking default strategy for calculating product availability, passing product, quantity and warehouse/store as parameters (TODO),
- Test of "bestOf" implementation
-
testCreateNoHistoryCreated
Tests create stock level with no history created.- Throws:
Exception
-
testReleaseNoHistoryCreated
Tests release of stock level with no history created. Defaults to 0- Throws:
BusinessException
-
testReserveNoHistoryCreated
Tests reserve stock level with no history created. Defaults to 0- Throws:
Exception
-