/** * This code was auto-generated by a tool. * * Changes to this file may cause incorrect behavior and will be lost if * the code is regenerated. */ package com.mozu.test.framework.datafactory; import java.util.List; import java.util.HashMap; import java.util.ArrayList; import org.apache.http.HttpStatus; import org.joda.time.DateTime; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; import com.mozu.api.resources.commerce.wishlists.WishlistItemResource; /** <summary> * Use the Wish List Items subresource to manage items in a shopper wish list. The same product can be defined as an item in any number of wish lists for the customer account. Use the Wish Lists resource to manage shopper wish lists. * </summary> */ public class WishlistItemFactory { public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem getWishlistItem(ApiContext apiContext, String wishlistId, String wishlistItemId, int expectedCode) throws Exception { return getWishlistItem(apiContext, wishlistId, wishlistItemId, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem getWishlistItem(ApiContext apiContext, String wishlistId, String wishlistItemId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem(); WishlistItemResource resource = new WishlistItemResource(apiContext); try { returnObj = resource.getWishlistItem( wishlistId, wishlistItemId, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null)) throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemCollection getWishlistItems(ApiContext apiContext, String wishlistId, int expectedCode) throws Exception { return getWishlistItems(apiContext, wishlistId, null, null, null, null, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemCollection getWishlistItems(ApiContext apiContext, String wishlistId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemCollection returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemCollection(); WishlistItemResource resource = new WishlistItemResource(apiContext); try { returnObj = resource.getWishlistItems( wishlistId, startIndex, pageSize, sortBy, filter, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null)) throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemCollection getWishlistItemsByWishlistName(ApiContext apiContext, Integer customerAccountId, String wishlistName, int expectedCode) throws Exception { return getWishlistItemsByWishlistName(apiContext, customerAccountId, wishlistName, null, null, null, null, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemCollection getWishlistItemsByWishlistName(ApiContext apiContext, Integer customerAccountId, String wishlistName, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemCollection returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemCollection(); WishlistItemResource resource = new WishlistItemResource(apiContext); try { returnObj = resource.getWishlistItemsByWishlistName( customerAccountId, wishlistName, startIndex, pageSize, sortBy, filter, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null)) throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem addItemToWishlist(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem wishlistItem, String wishlistId, int expectedCode) throws Exception { return addItemToWishlist(apiContext, wishlistItem, wishlistId, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem addItemToWishlist(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem wishlistItem, String wishlistId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem(); WishlistItemResource resource = new WishlistItemResource(apiContext); try { returnObj = resource.addItemToWishlist( wishlistItem, wishlistId, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null)) throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem updateWishlistItemQuantity(ApiContext apiContext, String wishlistId, String wishlistItemId, Integer quantity, int expectedCode) throws Exception { return updateWishlistItemQuantity(apiContext, wishlistId, wishlistItemId, quantity, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem updateWishlistItemQuantity(ApiContext apiContext, String wishlistId, String wishlistItemId, Integer quantity, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem(); WishlistItemResource resource = new WishlistItemResource(apiContext); try { returnObj = resource.updateWishlistItemQuantity( wishlistId, wishlistItemId, quantity, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null)) throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem updateWishlistItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem wishlistItem, String wishlistId, String wishlistItemId, int expectedCode) throws Exception { return updateWishlistItem(apiContext, wishlistItem, wishlistId, wishlistItemId, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem updateWishlistItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem wishlistItem, String wishlistId, String wishlistItemId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem(); WishlistItemResource resource = new WishlistItemResource(apiContext); try { returnObj = resource.updateWishlistItem( wishlistItem, wishlistId, wishlistItemId, responseFields); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null)) throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); return returnObj; } public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist removeAllWishlistItems(ApiContext apiContext, String wishlistId, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.Wishlist returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.Wishlist(); WishlistItemResource resource = new WishlistItemResource(apiContext); try { returnObj = resource.removeAllWishlistItems( wishlistId); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300) && !(expectedCode == HttpStatus.SC_NOT_FOUND && returnObj == null)) throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); return returnObj; } public static void deleteWishlistItem(ApiContext apiContext, String wishlistId, String wishlistItemId, int expectedCode) throws Exception { WishlistItemResource resource = new WishlistItemResource(apiContext); try { resource.deleteWishlistItem( wishlistId, wishlistItemId); } catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } }