class MESUnitTestUtils extends java.lang.Object
Convenience utilities for MES unit tests. Used to create common data structures. Can also be used for GUI/Integration tests with proper transaction settings. Currently, you should use the static methods. The internal instance methods are used to allow sub-classing.
Type | Name and description |
---|---|
private static MESUnitTestUtils |
instance A singleton, used to allow sub-classes to provide additional features. |
private static java.lang.String |
originalUserOverride |
Constructor and description |
---|
MESUnitTestUtils
() |
Type Params | Return Type | Name and description |
---|---|---|
|
protected void |
adjustOperation(ProductOperation operation, java.util.Map options) Allows sub-classes to adjust the ProductOperation before it is saved. |
|
protected void |
adjustOperation(MasterOperation operation, java.util.Map options) Allows sub-classes to adjust the MasterOperation before it is saved. |
|
protected void |
adjustOrder(Order order, java.util.Map options) Allows sub-classes to adjust the Order before it is saved. |
|
protected void |
adjustProduct(Product product, java.util.Map options) Allows sub-classes to adjust the Product before it is saved. |
|
static MasterRouting |
buildMasterRouting(java.util.Map options) Build a simple master routing the given operations. |
|
static Product |
buildSimpleProductWithRouting(java.util.Map options) Build a product with a simple 3 operation routing for use in an product. |
|
static void |
clearLoginUser() Resets the user override to the value we found on setLoginUser(). |
|
protected void |
forceQtyDone(Order order, BigDecimal qtyDone) Forces the qty to done for the given order (and LSNs if any). |
|
protected void |
forceQtyInWork(Order order, BigDecimal qtyInWork) Forces the qty to in work for the given order (and LSNs if any). |
|
static java.lang.Object |
loadOrderInitialDataNeeded(java.util.Map options) Loads any initial data needed for order release. |
|
static Order |
releaseOrder(java.util.Map options) Create and release a single order, optionally on a routing with or without LSNs. |
|
static java.util.List<Order> |
releaseOrders(java.util.Map options) Create and release orders, optionally on a routing with or without LSNs. |
|
protected java.util.List<Order> |
releaseOrdersInternal(java.util.Map options) Internal create and release orders. |
|
static java.lang.Object |
resetCodeSequences() Resets all of the codeSequences for the test database. |
|
static java.lang.Object |
resetSequence(java.lang.Class sequenceClass, long newSequence) Resets the currentSequence for thie given CodeSequenceTrait to the given sequence. |
|
protected long |
setDates(WorkStateTrait workState, long timeStamp) Sets the date queued/started (if already set) to the given timestamp and then increments the timestamp. |
|
static void |
setLoginUser() Sets the current user for order release and other actions. |
|
protected void |
spreadDates(java.util.List<Order> orders) Utility method to set the dates queued/started to a known value for a list of orders/LSNs. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
A singleton, used to allow sub-classes to provide additional features.
Allows sub-classes to adjust the ProductOperation before it is saved.
operation
- The un-saved operation.options
- the options for the order release.Allows sub-classes to adjust the MasterOperation before it is saved.
operation
- The un-saved operation.options
- the options for the order release.Allows sub-classes to adjust the Order before it is saved.
product
- The un-saved order.options
- the options for the order release.Allows sub-classes to adjust the Product before it is saved.
product
- The un-saved product.options
- the options for the order release.Build a simple master routing the given operations.
options
- The options used to build the routing.Build a product with a simple 3 operation routing for use in an product.
options
- The options used to build the product. Supports operations(List of sequences (integers))Resets the user override to the value we found on setLoginUser().
Forces the qty to done for the given order (and LSNs if any).
order
- The order.qtyDone
- The qty to take from inQueue and move to done. Only moved if the qtyInQueue is large enough.Forces the qty to in work for the given order (and LSNs if any).
order
- The order.qtyInWork
- The qty to take from inQueue and move to in work. Only moved if the qtyInQueue is large enough.Loads any initial data needed for order release. Always loads the OrderStatus.
options
- Uses the lsnTrackingOption to decide if LSN Sequence and Status must be loaded.Create and release a single order, optionally on a routing with or without LSNs. This is a convenience function that calls releaseOrders(java.util.Map).
This method creates a transaction (if needed)..
options
- See for the releaseOrders(java.util.Map) for details. (Optional)Create and release orders, optionally on a routing with or without LSNs.
This method creates a transaction (if needed)..
Note: The records created by this utility should be cleaned up using this option (for sub-classes of the test specs).
static dirtyDomains = [ActionLog, Order, Product]
options
- See options above. (Optional)Internal create and release orders. This is used as a non-static method to allow sub-classes to alter the objects created.
This method creates a transaction (if needed)..
options
- See for the releaseOrders(java.util.Map) for details. (Optional)Resets all of the codeSequences for the test database.
Resets the currentSequence for thie given CodeSequenceTrait to the given sequence. This is used to clean up after tests
sequenceClass
- The sequence to reset all sequences for.newSequence
- The new current sequence to use. (Default: 1000)Sets the date queued/started (if already set) to the given timestamp and then increments the timestamp.
workState
- The state object to update.timeStamp
- The time to set the dates to.Sets the current user for order release and other actions.
Utility method to set the dates queued/started to a known value for a list of orders/LSNs. Processes all LSNs in the orders for all possible routing steps.
orders
- The orders to set the dates on.Groovy Documentation