|
Author: mrisaliti
Date: Sun Jan 9 15:51:29 2011 New Revision: 1056967 URL: http://svn.apache.org/viewvc?rev=1056967&view=rev Log: Remove most of the java compilation warning (generics markup, unused code/import) (OFBIZ-4102) Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java?rev=1056967&r1=1056966&r2=1056967&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java Sun Jan 9 15:51:29 2011 @@ -28,6 +28,7 @@ import java.util.Random; import javolution.util.FastList; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; @@ -49,7 +50,7 @@ public class OrderTestServices { public static final String module = OrderTestServices.class.getName(); - public static Map createTestSalesOrders(DispatchContext dctx, Map context) { + public static Map<String, Object> createTestSalesOrders(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Integer numberOfOrders = (Integer) context.get("numberOfOrders"); @@ -57,7 +58,7 @@ public class OrderTestServices { for (int i = 1; i <= numberOfOrdersInt; i++) { try { ModelService modelService = dctx.getModelService("createTestSalesOrderSingle"); - Map outputMap = dispatcher.runSync("createTestSalesOrderSingle", modelService.makeValid(context, ModelService.IN_PARAM)); + Map<String, Object> outputMap = dispatcher.runSync("createTestSalesOrderSingle", modelService.makeValid(context, ModelService.IN_PARAM)); String orderId = (String)outputMap.get("orderId"); Debug.logInfo("Test sales order with id [" + orderId + "] has been processed.", module); } catch (GenericServiceException e) { @@ -68,7 +69,7 @@ public class OrderTestServices { return ServiceUtil.returnSuccess(); } - public static Map createTestSalesOrderSingle(DispatchContext dctx, Map context) { + public static Map<String, Object> createTestSalesOrderSingle(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); @@ -79,24 +80,23 @@ public class OrderTestServices { String currencyUomId = (String) context.get("currencyUomId"); String partyId = (String) context.get("partyId"); String productId = (String) context.get("productId"); - Integer numberOfOrders = (Integer) context.get("numberOfOrders"); Integer numberOfProductsPerOrder = (Integer) context.get("numberOfProductsPerOrder"); String salesChannel = (String) context.get("salesChannel"); if (UtilValidate.isEmpty(salesChannel)) { salesChannel = "WEB_SALES_CHANNEL"; } - List productsList = FastList.newInstance(); + List<String> productsList = FastList.newInstance(); try { if (UtilValidate.isNotEmpty(productId)) { productsList.add(productId); numberOfProductsPerOrder = Integer.valueOf(1); } else { - Map result = dispatcher.runSync("getProductCategoryMembers", UtilMisc.toMap("categoryId", productCategoryId)); + Map<String, Object> result = dispatcher.runSync("getProductCategoryMembers", UtilMisc.toMap("categoryId", productCategoryId)); if (result.get("categoryMembers") != null) { - List productCategoryMembers = (List)result.get("categoryMembers"); + List<GenericValue> productCategoryMembers = UtilGenerics.checkList(result.get("categoryMembers")); if (productCategoryMembers != null) { - Iterator i = productCategoryMembers.iterator(); + Iterator<GenericValue> i = productCategoryMembers.iterator(); while (i.hasNext()) { GenericValue prodCatMemb = (GenericValue) i.next(); if (prodCatMemb != null) { @@ -143,10 +143,10 @@ public class OrderTestServices { } cart.setDefaultCheckoutOptions(dispatcher); CheckOutHelper checkout = new CheckOutHelper(dispatcher, delegator, cart); - Map orderCreateResult = checkout.createOrder(userLogin); + Map<String, Object> orderCreateResult = checkout.createOrder(userLogin); String orderId = (String) orderCreateResult.get("orderId"); - Map resultMap = ServiceUtil.returnSuccess(); + Map<String, Object> resultMap = ServiceUtil.returnSuccess(); // approve the order if (UtilValidate.isNotEmpty(orderId)) { Debug.logInfo("Created test order with id: " + orderId, module); @@ -157,7 +157,7 @@ public class OrderTestServices { Boolean shipOrder = (Boolean) context.get("shipOrder"); if (shipOrder.booleanValue() && UtilValidate.isNotEmpty(orderId)) { try { - Map outputMap = dispatcher.runSync("quickShipEntireOrder", UtilMisc.toMap("orderId", orderId, "userLogin", userLogin)); + dispatcher.runSync("quickShipEntireOrder", UtilMisc.toMap("orderId", orderId, "userLogin", userLogin)); Debug.logInfo("Test sales order with id [" + orderId + "] has been shipped", module); } catch (Exception exc) { Debug.logWarning("Unable to quick ship test sales order with id [" + orderId + "] with error: " + exc.getMessage(), module); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java?rev=1056967&r1=1056966&r2=1056967&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java Sun Jan 9 15:51:29 2011 @@ -19,10 +19,10 @@ package org.ofbiz.order.test; import java.math.BigDecimal; -import java.util.ArrayList; import java.util.List; import java.util.Map; +import javolution.util.FastList; import javolution.util.FastMap; import org.ofbiz.base.util.UtilMisc; @@ -47,9 +47,9 @@ public class SalesOrderTest extends OFBi } public void testCreateSalesOrder() throws Exception { - Map ctx = UtilMisc.toMap("partyId", "DemoCustomer", "orderTypeId", "SALES_ORDER", "currencyUom", "USD", "productStoreId", "9000"); + Map<String, Object> ctx = UtilMisc.<String, Object>toMap("partyId", "DemoCustomer", "orderTypeId", "SALES_ORDER", "currencyUom", "USD", "productStoreId", "9000"); - List orderPaymentInfo = new ArrayList(); + List<GenericValue> orderPaymentInfo = FastList.newInstance(); GenericValue orderContactMech = delegator.makeValue("OrderContactMech", UtilMisc.toMap("contactMechId", "9015", "contactMechPurposeTypeId", "BILLING_LOCATION")); orderPaymentInfo.add(orderContactMech); @@ -58,7 +58,7 @@ public class SalesOrderTest extends OFBi orderPaymentInfo.add(orderPaymentPreference); ctx.put("orderPaymentInfo", orderPaymentInfo); - List orderItemShipGroupInfo = new ArrayList(); + List<GenericValue> orderItemShipGroupInfo = FastList.newInstance(); orderContactMech.set("contactMechPurposeTypeId", "SHIPPING_LOCATION"); orderItemShipGroupInfo.add(orderContactMech); @@ -102,12 +102,12 @@ public class SalesOrderTest extends OFBi ctx.put("orderItemShipGroupInfo", orderItemShipGroupInfo); - List orderAdjustments = new ArrayList(); + List<GenericValue> orderAdjustments = FastList.newInstance(); orderAdjustment = delegator.makeValue("OrderAdjustment", UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT", "productPromoActionSeqId", "01", "productPromoId", "9011", "productPromoRuleId", "01", "amount", new BigDecimal(-3.84))); orderAdjustments.add(orderAdjustment); ctx.put("orderAdjustments", orderAdjustments); - List orderItems = new ArrayList(); + List<GenericValue> orderItems = FastList.newInstance(); GenericValue orderItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId", "00001", "orderItemTypeId", "PRODUCT_ORDER_ITEM", "prodCatalogId", "DemoCatalog", "productId", "GZ-2644", "quantity", BigDecimal.ONE, "selectedAmount", BigDecimal.ZERO)); orderItem.set("isPromo", "N"); orderItem.set("isModifiedPrice", "N"); @@ -118,13 +118,13 @@ public class SalesOrderTest extends OFBi orderItems.add(orderItem); ctx.put("orderItems", orderItems); - List orderTerms = new ArrayList(); + List<GenericValue> orderTerms = FastList.newInstance(); ctx.put("orderTerms", orderTerms); GenericValue OrderContactMech = delegator.makeValue("OrderContactMech", FastMap.newInstance()); OrderContactMech.set("contactMechPurposeTypeId", "SHIPPING_LOCATION"); OrderContactMech.set("contactMechId", "10000"); - List orderContactMechs = new ArrayList(); + List<GenericValue> orderContactMechs = FastList.newInstance(); orderContactMechs.add(OrderContactMech); ctx.put("placingCustomerPartyId", "DemoCustomer"); @@ -134,7 +134,7 @@ public class SalesOrderTest extends OFBi ctx.put("billFromVendorPartyId", "Company"); ctx.put("userLogin", userLogin); - Map resp = dispatcher.runSync("storeOrder", ctx); + Map<String, Object> resp = dispatcher.runSync("storeOrder", ctx); String orderId = (String) resp.get("orderId"); String statusId = (String) resp.get("statusId"); assertNotNull(orderId); |
| Free forum by Nabble | Edit this page |
