/** * 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.WishlistResource; /** <summary> * Use the Wish Lists resource to manage the shopper wish lists of products associated with a customer account. Although customer accounts are managed at the tenant level, the system stores shopper wish lists at the site level. This enables the same customer to have wish lists for each of a merchant's sites. Use the Wish List Items resource to manage items in a wish list. * </summary> */ public class WishlistFactory { public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistCollection getWishlists(ApiContext apiContext, int expectedCode) throws Exception { return getWishlists(apiContext, null, null, null, null, null, null, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistCollection getWishlists(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String q, Integer qLimit, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.WishlistCollection returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.WishlistCollection(); WishlistResource resource = new WishlistResource(apiContext); try { returnObj = resource.getWishlists( startIndex, pageSize, sortBy, filter, q, qLimit, 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 getWishlist(ApiContext apiContext, String wishlistId, int expectedCode) throws Exception { return getWishlist(apiContext, wishlistId, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist getWishlist(ApiContext apiContext, String wishlistId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.Wishlist returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.Wishlist(); WishlistResource resource = new WishlistResource(apiContext); try { returnObj = resource.getWishlist( 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.Wishlist getWishlistByName(ApiContext apiContext, Integer customerAccountId, String wishlistName, int expectedCode) throws Exception { return getWishlistByName(apiContext, customerAccountId, wishlistName, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist getWishlistByName(ApiContext apiContext, Integer customerAccountId, String wishlistName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.Wishlist returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.Wishlist(); WishlistResource resource = new WishlistResource(apiContext); try { returnObj = resource.getWishlistByName( customerAccountId, wishlistName, 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 createWishlist(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.wishlists.Wishlist wishlist, int expectedCode) throws Exception { return createWishlist(apiContext, wishlist, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist createWishlist(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.wishlists.Wishlist wishlist, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.Wishlist returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.Wishlist(); WishlistResource resource = new WishlistResource(apiContext); try { returnObj = resource.createWishlist( wishlist, 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 updateWishlist(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.wishlists.Wishlist wishlist, String wishlistId, int expectedCode) throws Exception { return updateWishlist(apiContext, wishlist, wishlistId, null, expectedCode); } public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist updateWishlist(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.wishlists.Wishlist wishlist, String wishlistId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.wishlists.Wishlist returnObj = new com.mozu.api.contracts.commerceruntime.wishlists.Wishlist(); WishlistResource resource = new WishlistResource(apiContext); try { returnObj = resource.updateWishlist( wishlist, 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 void deleteWishlist(ApiContext apiContext, String wishlistId, int expectedCode) throws Exception { WishlistResource resource = new WishlistResource(apiContext); try { resource.deleteWishlist( wishlistId); } 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, ""); } }