From: Jeremy W. <jwi...@ea...> - 2008-03-04 07:10:10
|
Author: jwickers Date: 2008-03-03 23:10:16 -0800 (Mon, 03 Mar 2008) New Revision: 7932 Modified: versions/1.0/trunk/hot-deploy/opentaps-tests/src/org/opentaps/tests/OpentapsTestCase.java Log: Indent Modified: versions/1.0/trunk/hot-deploy/opentaps-tests/src/org/opentaps/tests/OpentapsTestCase.java =================================================================== --- versions/1.0/trunk/hot-deploy/opentaps-tests/src/org/opentaps/tests/OpentapsTestCase.java 2008-03-04 02:32:40 UTC (rev 7931) +++ versions/1.0/trunk/hot-deploy/opentaps-tests/src/org/opentaps/tests/OpentapsTestCase.java 2008-03-04 07:10:16 UTC (rev 7932) @@ -129,6 +129,7 @@ * assert message is the error message from the service. */ public Map runAndAssertServiceSuccess(String serviceName, Map input) { + Debug.logInfo("runAndAssertServiceSuccess: ["+serviceName+"] with input: "+input, module); try { Map results = dispatcher.runSync(serviceName, input); boolean success = !ServiceUtil.isError(results) && !ServiceUtil.isFailure(results); @@ -149,6 +150,7 @@ * they do not cause rollbacks. */ public void runAndAssertServiceError(String serviceName, Map input) { + Debug.logInfo("runAndAssertServiceError: ["+serviceName+"] with input: "+input, module); Map results = null; try { Debug.set(Debug.ERROR, false); @@ -454,9 +456,9 @@ * @return the SalesOrderFactory object */ protected SalesOrderFactory testCreatesSalesOrder(Map<GenericValue, Double> order, GenericValue customer, - String productStoreId) { - return testCreatesSalesOrder(order, customer, productStoreId, "EXT_OFFLINE", null, null); - } + String productStoreId) { + return testCreatesSalesOrder(order, customer, productStoreId, "EXT_OFFLINE", null, null); + } /** * Creates an order for the given Customer with the given products @@ -470,9 +472,9 @@ * @return the SalesOrderFactory object */ protected SalesOrderFactory testCreatesSalesOrder(Map<GenericValue, Double> order, GenericValue customer, - String productStoreId, String paymentMethodTypeId, String shippingAddressId) { - return testCreatesSalesOrder(order, customer, productStoreId, paymentMethodTypeId, null, shippingAddressId); - } + String productStoreId, String paymentMethodTypeId, String shippingAddressId) { + return testCreatesSalesOrder(order, customer, productStoreId, paymentMethodTypeId, null, shippingAddressId); + } /** * Creates an order for the given Customer with the given products @@ -487,97 +489,97 @@ * @return the SalesOrderFactory object */ protected SalesOrderFactory testCreatesSalesOrder(Map<GenericValue, Double> order, GenericValue customer, - String productStoreId, String paymentMethodTypeId, String paymentMethodId, String shippingAddressId) { - // to store ATP, QOH and requirements before and after the order - Map<GenericValue, Double> product_ATP_initial, product_QOH_initial, product_ATP_final, product_QOH_final, product_requirement_initial; - product_ATP_initial = new HashMap<GenericValue, Double>(); - product_QOH_initial = new HashMap<GenericValue, Double>(); - product_ATP_final = new HashMap<GenericValue, Double>(); - product_QOH_final = new HashMap<GenericValue, Double>(); - product_requirement_initial = new HashMap<GenericValue, Double>(); - // store service call results - Map<String, Object> callResults; - - SalesOrderFactory sof = null; - EtmPoint point = null; - - point = etmMonitor.createPoint( module + ":SalesOrderFactory"); - try { - // this throws an exception if it cannot find the ProductStore - sof = new SalesOrderFactory(delegator, dispatcher, User, "Company", (String)customer.get("partyId"), productStoreId); - } catch (GenericEntityException e) { - assertTrue("GenericEntityException:" + e.toString(), false); - } finally { - point.collect(); - } - - Debug.logInfo("Currency as defined by the productStore is: " + sof.getCurrencyUomId(), module); - - if (UtilValidate.isEmpty(paymentMethodTypeId)) { - paymentMethodTypeId = "EXT_OFFLINE"; - } - point = etmMonitor.createPoint( module + ":SalesOrderFactory.addPaymentMethod"); - sof.addPaymentMethod(paymentMethodTypeId, paymentMethodId); + String productStoreId, String paymentMethodTypeId, String paymentMethodId, String shippingAddressId) { + // to store ATP, QOH and requirements before and after the order + Map<GenericValue, Double> product_ATP_initial, product_QOH_initial, product_ATP_final, product_QOH_final, product_requirement_initial; + product_ATP_initial = new HashMap<GenericValue, Double>(); + product_QOH_initial = new HashMap<GenericValue, Double>(); + product_ATP_final = new HashMap<GenericValue, Double>(); + product_QOH_final = new HashMap<GenericValue, Double>(); + product_requirement_initial = new HashMap<GenericValue, Double>(); + // store service call results + Map<String, Object> callResults; + + SalesOrderFactory sof = null; + EtmPoint point = null; + + point = etmMonitor.createPoint( module + ":SalesOrderFactory"); + try { + // this throws an exception if it cannot find the ProductStore + sof = new SalesOrderFactory(delegator, dispatcher, User, "Company", (String)customer.get("partyId"), productStoreId); + } catch (GenericEntityException e) { + assertTrue("GenericEntityException:" + e.toString(), false); + } finally { + point.collect(); + } + + Debug.logInfo("Currency as defined by the productStore is: " + sof.getCurrencyUomId(), module); + + if (UtilValidate.isEmpty(paymentMethodTypeId)) { + paymentMethodTypeId = "EXT_OFFLINE"; + } + point = etmMonitor.createPoint( module + ":SalesOrderFactory.addPaymentMethod"); + sof.addPaymentMethod(paymentMethodTypeId, paymentMethodId); + point.collect(); + + point = etmMonitor.createPoint( module + ":SalesOrderFactory.addShippingGroup"); + if (shippingAddressId == null) { + sof.addShippingGroup("UPS", "NEXT_DAY"); + } else { + sof.addShippingGroup("UPS", "NEXT_DAY", shippingAddressId); + } + point.collect(); + + for (Iterator<GenericValue> iter = order.keySet().iterator(); iter.hasNext();) { + GenericValue product = iter.next(); + // get initial products availability + callResults = getProductAvailability(product); + product_ATP_initial.put(product, (Double) callResults.get("availableToPromiseTotal")); + product_QOH_initial.put(product, (Double) callResults.get("quantityOnHandTotal")); + Debug.logInfo("Initial availability of [" + product.get("productId") + "] : ATP=" + product_ATP_initial.get(product) + " QOH=" + product_QOH_initial.get(product), module); + // get initial requirements + product_requirement_initial.put(product, getPendingRequirements(product, productStoreId)); + // add product to the order + point = etmMonitor.createPoint( module + ":SalesOrderFactory.addShippingGroup"); + try { + sof.addProduct(product, order.get(product)); + } catch (GenericServiceException e) { + assertTrue("GenericServiceException:" + e.toString(), false); + } finally { point.collect(); - - point = etmMonitor.createPoint( module + ":SalesOrderFactory.addShippingGroup"); - if (shippingAddressId == null) { - sof.addShippingGroup("UPS", "NEXT_DAY"); - } else { - sof.addShippingGroup("UPS", "NEXT_DAY", shippingAddressId); - } - point.collect(); - - for (Iterator<GenericValue> iter = order.keySet().iterator(); iter.hasNext();) { - GenericValue product = iter.next(); - // get initial products availability - callResults = getProductAvailability(product); - product_ATP_initial.put(product, (Double) callResults.get("availableToPromiseTotal")); - product_QOH_initial.put(product, (Double) callResults.get("quantityOnHandTotal")); - Debug.logInfo("Initial availability of [" + product.get("productId") + "] : ATP=" + product_ATP_initial.get(product) + " QOH=" + product_QOH_initial.get(product), module); - // get initial requirements - product_requirement_initial.put(product, getPendingRequirements(product, productStoreId)); - // add product to the order - point = etmMonitor.createPoint( module + ":SalesOrderFactory.addShippingGroup"); - try { - sof.addProduct(product, order.get(product)); - } catch (GenericServiceException e) { - assertTrue("GenericServiceException:" + e.toString(), false); - } finally { - point.collect(); - } - } - - // create the order, and approve it - point = etmMonitor.createPoint( module + ":SalesOrderFactory.StoreOrder"); - try { - String orderId = sof.storeOrder(); - Debug.logInfo("Created order [" + orderId + "]", module); - sof.approveOrder(); - } catch (GenericServiceException e) { - assertTrue("GenericServiceException:" + e.toString(), false); - } finally { - point.collect(); - } - - for (Iterator<GenericValue> iter = order.keySet().iterator(); iter.hasNext();) { - GenericValue product = iter.next(); - // get final products availability - callResults = getProductAvailability(product); - product_ATP_final.put(product, (Double) callResults.get("availableToPromiseTotal")); - product_QOH_final.put(product, (Double) callResults.get("quantityOnHandTotal")); - Debug.logInfo("Final availability of [" + product.get("productId") + "] : ATP=" + product_ATP_final.get(product) + " QOH=" + product_QOH_final.get(product), module); - // check QOH are unchanged - assertEquals("QOH of " + product.get("productId"), product_QOH_final.get(product), product_QOH_initial.get(product)); - // check ATP have declined by the ordered qty - Double expected_ATP = product_ATP_initial.get(product) - order.get(product); - assertEquals("ATP of " + product.get("productId"), product_ATP_final.get(product), expected_ATP); - // check requirements have been created as needed - checkRequirements(product, order.get(product), product_requirement_initial.get(product), product_ATP_initial.get(product), productStoreId); - } - - return sof; } + } + + // create the order, and approve it + point = etmMonitor.createPoint( module + ":SalesOrderFactory.StoreOrder"); + try { + String orderId = sof.storeOrder(); + Debug.logInfo("Created order [" + orderId + "]", module); + sof.approveOrder(); + } catch (GenericServiceException e) { + assertTrue("GenericServiceException:" + e.toString(), false); + } finally { + point.collect(); + } + + for (Iterator<GenericValue> iter = order.keySet().iterator(); iter.hasNext();) { + GenericValue product = iter.next(); + // get final products availability + callResults = getProductAvailability(product); + product_ATP_final.put(product, (Double) callResults.get("availableToPromiseTotal")); + product_QOH_final.put(product, (Double) callResults.get("quantityOnHandTotal")); + Debug.logInfo("Final availability of [" + product.get("productId") + "] : ATP=" + product_ATP_final.get(product) + " QOH=" + product_QOH_final.get(product), module); + // check QOH are unchanged + assertEquals("QOH of " + product.get("productId"), product_QOH_final.get(product), product_QOH_initial.get(product)); + // check ATP have declined by the ordered qty + Double expected_ATP = product_ATP_initial.get(product) - order.get(product); + assertEquals("ATP of " + product.get("productId"), product_ATP_final.get(product), expected_ATP); + // check requirements have been created as needed + checkRequirements(product, order.get(product), product_requirement_initial.get(product), product_ATP_initial.get(product), productStoreId); + } + + return sof; + } /** @@ -590,9 +592,9 @@ * @return the PurchaseOrderFactory object */ protected PurchaseOrderFactory testCreatesPurchaseOrder(Map<GenericValue, Double> order, GenericValue supplier, - String productStoreId) { - return testCreatesPurchaseOrder(order, supplier, productStoreId, "EXT_OFFLINE", null, null); - } + String productStoreId) { + return testCreatesPurchaseOrder(order, supplier, productStoreId, "EXT_OFFLINE", null, null); + } /** * Creates an order for the given Supplier with the given products @@ -606,9 +608,9 @@ * @return the PurchaseOrderFactory object */ protected PurchaseOrderFactory testCreatesPurchaseOrder(Map<GenericValue, Double> order, GenericValue supplier, - String productStoreId, String paymentMethodTypeId, String shippingAddressId) { - return testCreatesPurchaseOrder(order, supplier, productStoreId, paymentMethodTypeId, null, shippingAddressId); - } + String productStoreId, String paymentMethodTypeId, String shippingAddressId) { + return testCreatesPurchaseOrder(order, supplier, productStoreId, paymentMethodTypeId, null, shippingAddressId); + } /** * Creates an order for the given Supplier with the given products @@ -623,63 +625,62 @@ * @return the PurchaseOrderFactory object */ protected PurchaseOrderFactory testCreatesPurchaseOrder(Map<GenericValue, Double> order, GenericValue supplier, - String productStoreId, String paymentMethodTypeId, String paymentMethodId, String shippingAddressId) { + String productStoreId, String paymentMethodTypeId, String paymentMethodId, String shippingAddressId) { - PurchaseOrderFactory pof = null; - EtmPoint point = null; + PurchaseOrderFactory pof = null; + EtmPoint point = null; - point = etmMonitor.createPoint( module + ":PurchaseOrderFactory"); - try { - // this throws an exception if it cannot find the ProductStore - pof = new PurchaseOrderFactory(delegator, dispatcher, User, (String)supplier.get("partyId"), "Company", productStoreId); - } catch (GenericEntityException e) { - assertTrue("GenericEntityException:" + e.toString(), false); - } finally { - point.collect(); - } + point = etmMonitor.createPoint( module + ":PurchaseOrderFactory"); + try { + // this throws an exception if it cannot find the ProductStore + pof = new PurchaseOrderFactory(delegator, dispatcher, User, (String)supplier.get("partyId"), "Company", productStoreId); + } catch (GenericEntityException e) { + assertTrue("GenericEntityException:" + e.toString(), false); + } finally { + point.collect(); + } - Debug.logInfo("Currency as defined by the productStore is: " + pof.getCurrencyUomId(), module); - - if (UtilValidate.isEmpty(paymentMethodTypeId)) { - paymentMethodTypeId = "EXT_OFFLINE"; - } - point = etmMonitor.createPoint( module + ":PurchaseOrderFactory.addPaymentMethod"); - pof.addPaymentMethod(paymentMethodTypeId, paymentMethodId); + Debug.logInfo("Currency as defined by the productStore is: " + pof.getCurrencyUomId(), module); + + if (UtilValidate.isEmpty(paymentMethodTypeId)) { + paymentMethodTypeId = "EXT_OFFLINE"; + } + point = etmMonitor.createPoint( module + ":PurchaseOrderFactory.addPaymentMethod"); + pof.addPaymentMethod(paymentMethodTypeId, paymentMethodId); + point.collect(); + + point = etmMonitor.createPoint( module + ":PurchaseOrderFactory.addShippingGroup"); + if (shippingAddressId == null) { + pof.addShippingGroup("UPS", "NEXT_DAY"); + } else { + pof.addShippingGroup("UPS", "NEXT_DAY", shippingAddressId); + } + point.collect(); + + for (Iterator<GenericValue> iter = order.keySet().iterator(); iter.hasNext();) { + GenericValue product = iter.next(); + // add product to the order + point = etmMonitor.createPoint( module + ":PurchaseOrderFactory.addShippingGroup"); + try { + pof.addProduct(product, order.get(product)); + } catch (GenericServiceException e) { + assertTrue("GenericServiceException:" + e.toString(), false); + } finally { point.collect(); - - point = etmMonitor.createPoint( module + ":PurchaseOrderFactory.addShippingGroup"); - if (shippingAddressId == null) { - pof.addShippingGroup("UPS", "NEXT_DAY"); - } else { - pof.addShippingGroup("UPS", "NEXT_DAY", shippingAddressId); - } - point.collect(); - - for (Iterator<GenericValue> iter = order.keySet().iterator(); iter.hasNext();) { - GenericValue product = iter.next(); - // add product to the order - point = etmMonitor.createPoint( module + ":PurchaseOrderFactory.addShippingGroup"); - try { - pof.addProduct(product, order.get(product)); - } catch (GenericServiceException e) { - assertTrue("GenericServiceException:" + e.toString(), false); - } finally { - point.collect(); - } - } - - // create the order - point = etmMonitor.createPoint( module + ":PurchaseOrderFactory.StoreOrder"); - try { - String orderId = pof.storeOrder(); - Debug.logInfo("Created order [" + orderId + "]", module); - } catch (GenericServiceException e) { - assertTrue("GenericServiceException:" + e.toString(), false); - } finally { - point.collect(); - } - - return pof; } - + } + + // create the order + point = etmMonitor.createPoint( module + ":PurchaseOrderFactory.StoreOrder"); + try { + String orderId = pof.storeOrder(); + Debug.logInfo("Created order [" + orderId + "]", module); + } catch (GenericServiceException e) { + assertTrue("GenericServiceException:" + e.toString(), false); + } finally { + point.collect(); + } + + return pof; + } } |