From d52c3bc95a126c9f7cc6ddf9c7d6a9201332e28d Mon Sep 17 00:00:00 2001 From: Eileen Zhuang Date: Wed, 1 Apr 2015 09:18:44 -0500 Subject: [PATCH 1/5] offline order test --- .../mozu/test/framework/helper/Generator.java | 5 + .../test/java/com/mozu/test/OrderTests.java | 183 ++++++++++-------- 2 files changed, 107 insertions(+), 81 deletions(-) diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/helper/Generator.java b/mozu-java-test/src/main/java/com/mozu/test/framework/helper/Generator.java index deeb8f6b..4b7dbe5d 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/helper/Generator.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/helper/Generator.java @@ -30,6 +30,11 @@ public static String randomString(int maxLength, String characterSet) return new String(buffer); } + public static String randomIp() + { + return(randomInt(10, 100).toString() + "." + randomInt(10, 100).toString() + "." + randomInt(10, 100).toString() + "." + randomInt(10, 100).toString()); + } + public static Double randomDecimal(Double min, Double max) { return rand.nextDouble() * (max - min) + min; diff --git a/mozu-java-test/src/test/java/com/mozu/test/OrderTests.java b/mozu-java-test/src/test/java/com/mozu/test/OrderTests.java index 0613a271..f05d3d84 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/OrderTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/OrderTests.java @@ -27,11 +27,13 @@ import com.mozu.api.contracts.commerceruntime.fulfillment.ShippingRate; import com.mozu.api.contracts.commerceruntime.orders.Order; import com.mozu.api.contracts.commerceruntime.orders.OrderAction; +import com.mozu.api.contracts.commerceruntime.orders.OrderItem; import com.mozu.api.contracts.commerceruntime.payments.BillingInfo; import com.mozu.api.contracts.commerceruntime.payments.PaymentAction; import com.mozu.api.contracts.commerceruntime.returns.Return; import com.mozu.api.contracts.commerceruntime.returns.ReturnCollection; import com.mozu.api.contracts.core.Contact; +import com.mozu.api.contracts.customer.CustomerAccount; import com.mozu.api.contracts.customer.CustomerAccountAndAuthInfo; import com.mozu.api.contracts.customer.CustomerAccountCollection; import com.mozu.api.contracts.customer.CustomerAuthTicket; @@ -66,6 +68,7 @@ import com.mozu.test.framework.datafactory.LocationTypeFactory; import com.mozu.test.framework.datafactory.OrderFactory; import com.mozu.test.framework.datafactory.AdminProductFactory; +import com.mozu.test.framework.datafactory.OrderItemFactory; import com.mozu.test.framework.datafactory.OrdersPackageFactory; import com.mozu.test.framework.datafactory.OrdersShipmentFactory; import com.mozu.test.framework.datafactory.PaymentFactory; @@ -120,7 +123,7 @@ public void tearDown() throws Exception { // Log in shopper @Test - public void createOrderTest1() throws Exception { + public void Order_LoginShopper_Test() throws Exception { //get shopper api context ApiContext siteApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); CustomerAccountAndAuthInfo customerAccountAndAuthInfo = CustomerGenerator.generateCustomerAccountAndAuthInfo(); @@ -146,48 +149,7 @@ public void createOrderTest1() throws Exception { //create order Order testOrder = OrderFactory.createOrderFromCart(siteApiContext, testCart.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - //set billing info - Contact billingContact = new Contact(); - billingContact.setFirstName(customerAccountAndAuthInfo.getAccount().getFirstName()); - billingContact.setLastNameOrSurname(customerAccountAndAuthInfo.getAccount().getLastName()); - billingContact.setEmail(customerAccountAndAuthInfo.getAccount().getEmailAddress()); - billingContact.setAddress(customerAccountAndAuthInfo.getAccount().getContacts().get(0).getAddress()); - billingContact.setPhoneNumbers(customerAccountAndAuthInfo.getAccount().getContacts().get(0).getPhoneNumbers()); - - BillingInfo billingInfo = new BillingInfo(); - billingInfo.setPaymentType("Check"); - billingInfo.setIsSameBillingShippingAddress(false); - billingInfo.setBillingContact(billingContact); - - BillingInfoFactory.setBillingInfo(siteApiContext, billingInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - - // set fulfillment info - FulfillmentInfo fulfillmentInfo = new FulfillmentInfo(); - fulfillmentInfo.setIsDestinationCommercial(false); - Contact shippingContact = new Contact(); - shippingContact.setFirstName(Generator.randomString(5, Generator.AlphaChars)); - shippingContact.setLastNameOrSurname(Generator.randomString(5, Generator.AlphaChars)); - shippingContact.setEmail(Generator.randomEmailAddress()); - shippingContact.setAddress(customerAccountAndAuthInfo.getAccount().getContacts().get(0).getAddress()); - shippingContact.setPhoneNumbers(customerAccountAndAuthInfo.getAccount().getContacts().get(0).getPhoneNumbers()); - fulfillmentInfo.setFulfillmentContact(shippingContact); - FulfillmentInfoFactory.setFulFillmentInfo(siteApiContext, fulfillmentInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - - List availableShippingMethods = OrdersShipmentFactory.getAvailableShipmentMethods(siteApiContext, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - fulfillmentInfo.setShippingMethodCode(availableShippingMethods.get(0).getShippingMethodCode()); - fulfillmentInfo.setShippingMethodCode(availableShippingMethods.get(0).getShippingMethodName()); - FulfillmentInfoFactory.setFulFillmentInfo(siteApiContext, fulfillmentInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - - //submit order - OrderAction orderAction = new OrderAction(); - orderAction.setActionName("SubmitOrder"); - testOrder = OrderFactory.getOrder(siteApiContext, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); -// testOrder.getBillingInfo().getBillingContact().setEmail(null); -// testOrder.setEmail(null); -// testOrder.getFulfillmentInfo().getFulfillmentContact().setEmail(null); - OrderFactory.updateOrder(siteApiContext, testOrder, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - OrderFactory.performOrderAction(siteApiContext, orderAction, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - + configureAndSubmitOrder(siteApiContext, customerAccountAndAuthInfo.getAccount(), testOrder); /* ApiContext siteApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); String directShipLocationCode = CommerceLocationFactory.getDirectShipLocation(siteApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK).getCode(); @@ -230,48 +192,107 @@ public void createOrderTest1() throws Exception { assertEquals(order.getItems().get(0).getQuantity(), itemQty); */ } - //Anonymous shopper + // offline order @Test - public void anonymousShopperOrderTest2() throws Exception { - ApiContext siteApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); - ApiContext cataApiContext = new MozuApiContext(tenantId, null, masterCatalogId, catalogId); - //Create product type - ProductType myPT = ProductTypeGenerator.generate(Generator.randomString(5, Generator.AlphaChars)); - ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - productTypes.add(createdPT.getId()); -// ProductTypeCollection pts = ProductTypeFactory.getProductTypes(apiMsgHandler, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); + public void Order_Offline_Test() throws Exception { + //get shopper api context + ApiContext siteApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); + Order testOrder = new Order(); + CustomerAccount testCustomer = CustomerAccountFactory.getAccount(siteApiContext, 1005, HttpStatus.SC_OK, HttpStatus.SC_OK); + testOrder.setType("Offline"); + testOrder.setCustomerAccountId(testCustomer.getId()); + testOrder.setIpAddress(Generator.randomIp()); + testOrder = OrderFactory.createOrder(siteApiContext, testOrder, HttpStatus.SC_OK, HttpStatus.SC_OK); + + OrderItem orderItem = new OrderItem(); + com.mozu.api.contracts.commerceruntime.products.Product testProduct = new com.mozu.api.contracts.commerceruntime.products.Product(); + com.mozu.api.contracts.productruntime.Product testProduct1 = ProductFactory.getProduct(siteApiContext, DataViewMode.Live, Constants.TESTPRODUCTCODE_STANDARD, HttpStatus.SC_OK, HttpStatus.SC_OK); + List cates = new ArrayList(); + for( com.mozu.api.contracts.productruntime.Category cat : testProduct1.getCategories()) + { + com.mozu.api.contracts.commerceruntime.products.Category cate = new com.mozu.api.contracts.commerceruntime.products.Category(); + cate.setId(cat.getCategoryId()); + cates.add(cate); + } + testProduct.setCategories(cates); + testProduct.setDescription(testProduct1.getContent().getProductShortDescription()); + testProduct.setFulfillmentTypesSupported(testProduct1.getFulfillmentTypesSupported()); + testProduct.setGoodsType(testProduct1.getGoodsType()); + testProduct.setIsPackagedStandAlone(testProduct1.getIsPackagedStandAlone()); + testProduct.setIsTaxable(testProduct1.getIsTaxable()); + com.mozu.api.contracts.commerceruntime.commerce.PackageMeasurements measure = new com.mozu.api.contracts.commerceruntime.commerce.PackageMeasurements(); + measure.setHeight(testProduct1.getMeasurements().getPackageHeight()); + measure.setLength(testProduct1.getMeasurements().getPackageLength()); + measure.setWeight(testProduct1.getMeasurements().getPackageWeight()); + measure.setWidth(testProduct1.getMeasurements().getPackageWidth()); + testProduct.setMeasurements(measure); + testProduct.setName(testProduct1.getContent().getProductName()); + com.mozu.api.contracts.commerceruntime.products.ProductPrice price = new com.mozu.api.contracts.commerceruntime.products.ProductPrice(); + price.setPrice(testProduct1.getPrice().getPrice()); + testProduct.setPrice(price); + testProduct.setProductCode(testProduct1.getProductCode()); + testProduct.setProductType(testProduct1.getGoodsType()); + testProduct.setProductUsage(testProduct1.getProductUsage()); + orderItem.setProduct(testProduct); + orderItem.setFulfillmentMethod("ship"); + orderItem.setQuantity(1); + OrderItemFactory.createOrderItem(siteApiContext, orderItem, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + testOrder = OrderFactory.getOrder(siteApiContext, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); -// ProductType createdPT = ProductTypeFactory.getProductType(apiMsgHandler, DataViewMode.Live, pts.getItems().get(2).getId(), null, HttpStatus.SC_OK, HttpStatus.SC_OK); - Product myProduct = ProductGenerator.generate(createdPT); - Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - Product getProduct = AdminProductFactory.getProduct(apiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); -// products.add(createdProduct.getProductCode()); - -// Product createdProduct = AdminProductFactory.getProduct(apiMsgHandler, DataViewMode.Live, "cvrsk", null, HttpStatus.SC_OK, HttpStatus.SC_OK); - //add a category - Category cat = ProductCategoryGenerator.generate(Generator.randomString(4, Generator.AlphaChars), true, null); - Category createdCat = CategoryFactory.addCategory(cataApiContext, cat, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - categories.add(ProductGenerator.generateProductCategory(createdCat.getId())); - List listCat = new ArrayList(); - listCat.add(ProductGenerator.generateProductCategory(createdCat.getId())); - - ProductInCatalogInfo proInfo = ProductGenerator.generateProductInCatalogInfo(catalogId, listCat, - Generator.randomString(6, Generator.AlphaChars), Generator.randomDecimal(20., 1000.), true, true, false,true); - AdminProductFactory.addProductInCatalog(cataApiContext, DataViewMode.Live, proInfo, createdProduct.getProductCode(), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - com.mozu.api.contracts.productruntime.Product product = ProductFactory.getProduct(siteApiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); - - CustomerUserAuthInfo shopperUserAuthInfo = CustomerGenerator.generateUserAuthInfo(null, null); - CustomerAuthenticationProfile shopperAuth = CustomerAuthenticator.authenticate(shopperUserAuthInfo, tenantId, siteId); - siteApiContext.setUserAuthTicket(shopperAuth.getAuthTicket()); - - Cart createdCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - com.mozu.api.contracts.productruntime.Product storeFrontProduct = ProductFactory.getProduct(siteApiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); - Integer itemQty = 2; - CartItemFactory.addItemToCart(siteApiContext, CustomerGenerator.generateCartItem(storeFrontProduct, itemQty), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - Order order = OrderFactory.createOrderFromCart(siteApiContext, createdCart.getId(), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - assertEquals(order.getItems().get(0).getQuantity(), itemQty); + configureAndSubmitOrder(siteApiContext, testCustomer, testOrder); + } + + //Anonymous shopper +// @Test +// public void anonymousShopperOrderTest2() throws Exception { +// } + + void configureAndSubmitOrder(ApiContext siteApiContext, CustomerAccount testAccount, Order testOrder) throws Exception + { + //set billing info + Contact billingContact = new Contact(); + billingContact.setFirstName(testAccount.getFirstName()); + billingContact.setLastNameOrSurname(testAccount.getLastName()); + billingContact.setEmail(testAccount.getEmailAddress()); + billingContact.setAddress(testAccount.getContacts().get(0).getAddress()); + billingContact.setPhoneNumbers(testAccount.getContacts().get(0).getPhoneNumbers()); + + BillingInfo billingInfo = new BillingInfo(); + billingInfo.setPaymentType("Check"); + billingInfo.setIsSameBillingShippingAddress(false); + billingInfo.setBillingContact(billingContact); + + BillingInfoFactory.setBillingInfo(siteApiContext, billingInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + // set fulfillment info + FulfillmentInfo fulfillmentInfo = new FulfillmentInfo(); + fulfillmentInfo.setIsDestinationCommercial(false); + Contact shippingContact = new Contact(); + shippingContact.setFirstName(Generator.randomString(5, Generator.AlphaChars)); + shippingContact.setLastNameOrSurname(Generator.randomString(5, Generator.AlphaChars)); + shippingContact.setEmail(Generator.randomEmailAddress()); + shippingContact.setAddress(testAccount.getContacts().get(0).getAddress()); + shippingContact.setPhoneNumbers(testAccount.getContacts().get(0).getPhoneNumbers()); + fulfillmentInfo.setFulfillmentContact(shippingContact); + FulfillmentInfoFactory.setFulFillmentInfo(siteApiContext, fulfillmentInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + + List availableShippingMethods = OrdersShipmentFactory.getAvailableShipmentMethods(siteApiContext, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + fulfillmentInfo.setShippingMethodCode(availableShippingMethods.get(0).getShippingMethodCode()); + fulfillmentInfo.setShippingMethodCode(availableShippingMethods.get(0).getShippingMethodName()); + FulfillmentInfoFactory.setFulFillmentInfo(siteApiContext, fulfillmentInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + + //submit order + OrderAction orderAction = new OrderAction(); + orderAction.setActionName("SubmitOrder"); + testOrder = OrderFactory.getOrder(siteApiContext, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); +// testOrder.getBillingInfo().getBillingContact().setEmail(null); +// testOrder.setEmail(null); +// testOrder.getFulfillmentInfo().getFulfillmentContact().setEmail(null); + OrderFactory.updateOrder(siteApiContext, testOrder, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + OrderFactory.performOrderAction(siteApiContext, orderAction, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + } + @Test public void smokeOrderTest3() throws Exception { ApiContext siteApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); From bf8c16f7db52b5b72c9664cbd00dbaeb99901ae1 Mon Sep 17 00:00:00 2001 From: Eileen Zhuang Date: Thu, 7 May 2015 13:56:09 -0500 Subject: [PATCH 2/5] snapshot --- mozu-java-test/build.gradle | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mozu-java-test/build.gradle b/mozu-java-test/build.gradle index 5c702e3f..4567762b 100644 --- a/mozu-java-test/build.gradle +++ b/mozu-java-test/build.gradle @@ -24,13 +24,10 @@ task wrapper(type: Wrapper) { repositories { mavenCentral() - mavenLocal() maven { url "https://oss.sonatype.org/content/groups/staging/" } - maven { - url "http://aus02bpnexs001.corp.volusion.com:8080/nexus/content/groups/public" - } + mavenLocal() } configurations.all { From 972d0956e92f5217795e23d8f957bd34169603f0 Mon Sep 17 00:00:00 2001 From: Eileen Zhuang Date: Mon, 18 May 2015 16:27:02 -0500 Subject: [PATCH 3/5] update customer opt-in/out --- .../src/test/java/com/mozu/test/CustomerTests.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mozu-java-test/src/test/java/com/mozu/test/CustomerTests.java b/mozu-java-test/src/test/java/com/mozu/test/CustomerTests.java index efba889b..1dd044aa 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/CustomerTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/CustomerTests.java @@ -58,4 +58,14 @@ public void UpdateCustomerTest1() throws Exception { CustomerAccount updateAccount = CustomerAccountFactory.updateAccount(apiContext, getAccount, ticket.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); assertEquals(updateAccount.getEmailAddress(), getAccount.getEmailAddress()); } -} + + @Test + public void UpdateCustomerTest2() throws Exception { + ApiContext apiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); + //CustomerAccountFactory.getAccounts(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAccount getAccount = CustomerAccountFactory.getAccount(apiContext, 1384, HttpStatus.SC_OK, HttpStatus.SC_OK); + getAccount.setAcceptsMarketing(true); + CustomerAccount updateAccount = CustomerAccountFactory.updateAccount(apiContext, getAccount, 1384, HttpStatus.SC_OK, HttpStatus.SC_OK); + assert(!updateAccount.getAcceptsMarketing()); + } +} \ No newline at end of file From 029a3d967093d762e58d848afaf81fd07afdff38 Mon Sep 17 00:00:00 2001 From: Eileen Zhuang Date: Tue, 19 May 2015 09:06:52 -0500 Subject: [PATCH 4/5] junit version change --- mozu-java-test/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mozu-java-test/build.gradle b/mozu-java-test/build.gradle index 4567762b..e5b2c152 100644 --- a/mozu-java-test/build.gradle +++ b/mozu-java-test/build.gradle @@ -19,7 +19,7 @@ jar { } task wrapper(type: Wrapper) { - gradleVersion = '1.11' + gradleVersion = '1.12' } repositories { @@ -66,7 +66,7 @@ dependencies { compile ('log4j:log4j:1.2.17') - testCompile group: 'junit', name: 'junit', version: '4.+' + testCompile group: 'junit', name: 'junit', version: '4.12' } test { From 23ab6317002b27a5158316b69f6b43efe80dedf1 Mon Sep 17 00:00:00 2001 From: eileen zhuang Date: Tue, 2 Jun 2015 12:34:41 -0500 Subject: [PATCH 5/5] refactored datafactory and fixed 404 error --- .../test/framework/core/MozuApiTestBase.java | 2 +- .../test/framework/core/TestException.java | 14 +- .../framework/core/TestFailException.java | 4 +- .../AddressValidationRequestFactory.java | 13 +- .../datafactory/AdjustmentFactory.java | 49 +- .../datafactory/AdminFacetFactory.java | 57 +- .../AdminLocationInventoryFactory.java | 279 ++--- .../datafactory/AdminProductFactory.java | 591 +++++------ .../datafactory/AdminUserFactory.java | 153 +-- .../datafactory/ApplicationFactory.java | 25 +- .../datafactory/AppliedDiscountFactory.java | 37 +- .../datafactory/AttributeFactory.java | 33 +- .../AttributeLocalizedContentFactory.java | 319 +++--- .../datafactory/AttributeTypeRuleFactory.java | 13 +- .../AttributeVocabularyValueFactory.java | 121 +-- .../AttributedefinitionAttributeFactory.java | 57 +- .../datafactory/AuthTicketFactory.java | 189 ++-- .../datafactory/BillingInfoFactory.java | 25 +- .../framework/datafactory/CardFactory.java | 57 +- .../framework/datafactory/CartFactory.java | 425 ++++---- .../datafactory/CartItemFactory.java | 77 +- .../CartsAppliedDiscountFactory.java | 29 +- .../CartsExtendedPropertyFactory.java | 305 +++--- .../datafactory/CategoryFactory.java | 349 +++---- .../datafactory/ChangeMessageFactory.java | 29 +- .../framework/datafactory/ChannelFactory.java | 57 +- .../datafactory/ChannelGroupFactory.java | 57 +- .../datafactory/CheckoutSettingsFactory.java | 13 +- .../datafactory/CommerceLocationFactory.java | 303 +++--- .../datafactory/CreditAuditEntryFactory.java | 13 +- .../framework/datafactory/CreditFactory.java | 375 +++---- .../datafactory/CreditTransactionFactory.java | 25 +- .../datafactory/CustomerAccountFactory.java | 829 +++++++-------- .../datafactory/CustomerAttributeFactory.java | 57 +- .../CustomerAuthTicketFactory.java | 33 +- .../CustomerCheckoutSettingsFactory.java | 25 +- .../datafactory/CustomerContactFactory.java | 57 +- .../CustomerCustomerSegmentFactory.java | 361 +++---- .../datafactory/CustomerNoteFactory.java | 57 +- .../datafactory/CustomerSegmentFactory.java | 13 +- .../DeveloperAdminUserAuthTicketFactory.java | 189 ++-- .../datafactory/DigitalPackageFactory.java | 53 +- .../datafactory/DiscountFactory.java | 93 +- .../datafactory/DiscountTargetFactory.java | 25 +- .../DocumentDraftSummaryFactory.java | 37 +- .../datafactory/DocumentFactory.java | 81 +- .../datafactory/DocumentListFactory.java | 57 +- .../datafactory/DocumentListTypeFactory.java | 153 +-- .../datafactory/DocumentTreeFactory.java | 37 +- .../datafactory/DocumentTypeFactory.java | 49 +- .../datafactory/EntityContainerFactory.java | 153 +-- .../framework/datafactory/EntityFactory.java | 289 +++--- .../datafactory/EntityListFactory.java | 289 +++--- .../EventDeliverySummaryFactory.java | 153 +-- .../datafactory/EventNotificationFactory.java | 25 +- .../datafactory/ExtendedPropertyFactory.java | 345 +++---- .../framework/datafactory/FacetFactory.java | 9 +- .../datafactory/FulfillmentActionFactory.java | 153 +-- .../datafactory/FulfillmentInfoFactory.java | 25 +- .../datafactory/GeneralSettingsFactory.java | 25 +- ...nStockNotificationSubscriptionFactory.java | 45 +- .../datafactory/ListViewFactory.java | 489 ++++----- .../datafactory/LocationFactory.java | 57 +- .../datafactory/LocationInventoryFactory.java | 279 ++--- .../datafactory/LocationTypeFactory.java | 53 +- .../datafactory/LocationUsageFactory.java | 37 +- .../datafactory/MasterCatalogFactory.java | 37 +- .../datafactory/OrderAttributeFactory.java | 29 +- .../framework/datafactory/OrderFactory.java | 615 +++++------ .../datafactory/OrderItemFactory.java | 553 +++++----- .../datafactory/OrderNoteFactory.java | 53 +- .../OrderValidationResultFactory.java | 21 +- .../datafactory/OrdersPackageFactory.java | 61 +- .../datafactory/OrdersShipmentFactory.java | 41 +- .../framework/datafactory/PackageFactory.java | 53 +- .../framework/datafactory/PaymentFactory.java | 57 +- .../datafactory/PaymentSettingsFactory.java | 9 +- .../framework/datafactory/PickupFactory.java | 53 +- .../PlatformApplicationFactory.java | 389 +++---- .../datafactory/ProductExtraFactory.java | 113 +- .../framework/datafactory/ProductFactory.java | 403 ++++---- .../datafactory/ProductOptionFactory.java | 53 +- .../datafactory/ProductPropertyFactory.java | 113 +- .../ProductReservationFactory.java | 65 +- .../ProductSearchResultFactory.java | 153 +-- .../datafactory/ProductTypeExtraFactory.java | 53 +- .../datafactory/ProductTypeFactory.java | 57 +- .../datafactory/ProductTypeOptionFactory.java | 53 +- .../ProductTypePropertyFactory.java | 53 +- .../ProductTypeVariationFactory.java | 13 +- .../datafactory/ProductVariationFactory.java | 117 +-- .../datafactory/PropertyTypeFactory.java | 57 +- .../datafactory/PublicCardFactory.java | 169 +-- .../datafactory/PublishingScopeFactory.java | 17 +- .../datafactory/ReferenceDataFactory.java | 703 ++++++------- .../framework/datafactory/RefundFactory.java | 139 +-- .../framework/datafactory/ReturnFactory.java | 845 +++++++-------- .../framework/datafactory/SearchFactory.java | 153 +-- .../datafactory/ShipmentFactory.java | 29 +- .../datafactory/ShippingFactory.java | 13 +- .../datafactory/SiteDataFactory.java | 37 +- .../SiteShippingHandlingFeeFactory.java | 37 +- .../SiteShippingSettingsFactory.java | 13 +- .../datafactory/SoftAllocationFactory.java | 349 +++---- .../StorefrontCategoryFactory.java | 37 +- .../datafactory/SubscriptionFactory.java | 103 +- .../datafactory/TaxableTerritoryFactory.java | 29 +- .../TenantAdminUserAuthTicketFactory.java | 33 +- .../datafactory/TenantDataFactory.java | 37 +- .../datafactory/TenantExtensionsFactory.java | 153 +-- .../framework/datafactory/TenantFactory.java | 13 +- .../datafactory/TransactionFactory.java | 29 +- .../datafactory/UserDataFactory.java | 37 +- .../framework/datafactory/ViewFactory.java | 103 +- .../framework/datafactory/VisitFactory.java | 49 +- .../datafactory/WishlistFactory.java | 69 +- .../datafactory/WishlistItemFactory.java | 89 +- .../com/mozu/test/AddressValidateTests.java | 4 +- .../java/com/mozu/test/CustomerTests.java | 16 +- .../com/mozu/test/DocumentResourceTests.java | 14 +- .../test/java/com/mozu/test/EntityTests.java | 16 +- .../test/java/com/mozu/test/GeneralTests.java | 964 +++++++++--------- .../mozu/test/HttpClientConnectionTests.java | 6 +- .../java/com/mozu/test/LocationTests.java | 20 +- .../test/java/com/mozu/test/OrderTests.java | 120 +-- .../com/mozu/test/PopulateCAAttributes.java | 12 +- .../com/mozu/test/ProductAttributeTests.java | 8 +- .../test/java/com/mozu/test/ProductTests.java | 54 +- 128 files changed, 8319 insertions(+), 8201 deletions(-) diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/core/MozuApiTestBase.java b/mozu-java-test/src/main/java/com/mozu/test/framework/core/MozuApiTestBase.java index 17649948..a7e27606 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/core/MozuApiTestBase.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/core/MozuApiTestBase.java @@ -63,7 +63,7 @@ public MozuApiTestBase() ApiContext apiContext = new MozuApiContext(); AppAuthenticator.initialize(appAuthInfo, null); try { - testBaseTenant = TenantFactory.getTenant(apiContext, tenantId, HttpStatus.SC_OK, HttpStatus.SC_OK); + testBaseTenant = TenantFactory.getTenant(apiContext, tenantId, HttpStatus.SC_OK); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/core/TestException.java b/mozu-java-test/src/main/java/com/mozu/test/framework/core/TestException.java index 82884513..9603f139 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/core/TestException.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/core/TestException.java @@ -8,13 +8,12 @@ public class TestException extends Exception { private static final long serialVersionUID = 1L; private Logger logger = LoggerFactory.getLogger(TestException.class); - protected int expectedReturnCode; + protected String expectedReturnCode; protected String message ; protected String clientMethodName; - - public int actualReturnCode; + protected String actualReturnCode; - protected TestException(int actualCode, String methodName, int expectedCode, String msg) { + protected TestException(String actualCode, String methodName, String expectedCode, String msg) { expectedReturnCode = expectedCode; actualReturnCode = actualCode; message = msg; @@ -46,7 +45,12 @@ protected TestException(String methodName, String msg) @Override public String toString() { - return String.format("[%s:expected %s] but the actual return code is %s. %s", clientMethodName, expectedReturnCode, actualReturnCode, message); + return String.format("[%s: expected %s] but the actual return code is %s. %s", clientMethodName, expectedReturnCode, actualReturnCode, message); + } + + public String getActualReturnCode() + { + return actualReturnCode; } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/core/TestFailException.java b/mozu-java-test/src/main/java/com/mozu/test/framework/core/TestFailException.java index 1ff4b713..1c6d752f 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/core/TestFailException.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/core/TestFailException.java @@ -7,7 +7,7 @@ public class TestFailException extends TestException { private static final long serialVersionUID = 1L; private Logger logger = LoggerFactory.getLogger(TestFailException.class); - public TestFailException(int actualCode, String methodName, int expectedCode, String msg) { + public TestFailException(String actualCode, String methodName, String expectedCode, String msg) { super(actualCode, methodName, expectedCode, msg); } @@ -15,7 +15,7 @@ public TestFailException(int actualCode, String methodName, int expectedCode, St public String toString() { String msg = super.toString(); - if(super.actualReturnCode == 403) + if(super.actualReturnCode.equals("403")) { return msg += String.format("\nYou may need to add the proper behavior for %s", super.clientMethodName); } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AddressValidationRequestFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AddressValidationRequestFactory.java index 302c9f8c..cccc6b7a 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AddressValidationRequestFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AddressValidationRequestFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class AddressValidationRequestFactory { - public static com.mozu.api.contracts.customer.AddressValidationResponse validateAddress(ApiContext apiContext, com.mozu.api.contracts.customer.AddressValidationRequest addressValidationRequest, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.AddressValidationResponse validateAddress(ApiContext apiContext, com.mozu.api.contracts.customer.AddressValidationRequest addressValidationRequest, int expectedCode) throws Exception { - return validateAddress(apiContext, addressValidationRequest, null, expectedCode, successCode ); + return validateAddress(apiContext, addressValidationRequest, null, expectedCode); } - public static com.mozu.api.contracts.customer.AddressValidationResponse validateAddress(ApiContext apiContext, com.mozu.api.contracts.customer.AddressValidationRequest addressValidationRequest, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.AddressValidationResponse validateAddress(ApiContext apiContext, com.mozu.api.contracts.customer.AddressValidationRequest addressValidationRequest, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.AddressValidationResponse returnObj = new com.mozu.api.contracts.customer.AddressValidationResponse(); AddressValidationRequestResource resource = new AddressValidationRequestResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.customer.AddressValidationResponse validate catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdjustmentFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdjustmentFactory.java index 73a783bf..72f70e44 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdjustmentFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdjustmentFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class AdjustmentFactory { - public static com.mozu.api.contracts.commerceruntime.orders.Order applyShippingAdjustment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.Adjustment adjustment, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order applyShippingAdjustment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.Adjustment adjustment, String orderId, int expectedCode) throws Exception { - return applyShippingAdjustment(apiContext, adjustment, orderId, null, null, null, expectedCode, successCode ); + return applyShippingAdjustment(apiContext, adjustment, orderId, null, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order applyShippingAdjustment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.Adjustment adjustment, String orderId, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order applyShippingAdjustment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.Adjustment adjustment, String orderId, String updateMode, String version, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); AdjustmentResource resource = new AdjustmentResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order applyShippingA catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.Order applyAdjustment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.Adjustment adjustment, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order applyAdjustment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.Adjustment adjustment, String orderId, int expectedCode) throws Exception { - return applyAdjustment(apiContext, adjustment, orderId, null, null, null, expectedCode, successCode ); + return applyAdjustment(apiContext, adjustment, orderId, null, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order applyAdjustment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.Adjustment adjustment, String orderId, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order applyAdjustment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.Adjustment adjustment, String orderId, String updateMode, String version, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); AdjustmentResource resource = new AdjustmentResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order applyAdjustmen catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.Order removeShippingAdjustment(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order removeShippingAdjustment(ApiContext apiContext, String orderId, int expectedCode) throws Exception { - return removeShippingAdjustment(apiContext, orderId, null, null, expectedCode, successCode ); + return removeShippingAdjustment(apiContext, orderId, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order removeShippingAdjustment(ApiContext apiContext, String orderId, String updateMode, String version, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order removeShippingAdjustment(ApiContext apiContext, String orderId, String updateMode, String version, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); AdjustmentResource resource = new AdjustmentResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order removeShipping catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.Order removeAdjustment(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order removeAdjustment(ApiContext apiContext, String orderId, int expectedCode) throws Exception { - return removeAdjustment(apiContext, orderId, null, null, expectedCode, successCode ); + return removeAdjustment(apiContext, orderId, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order removeAdjustment(ApiContext apiContext, String orderId, String updateMode, String version, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order removeAdjustment(ApiContext apiContext, String orderId, String updateMode, String version, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); AdjustmentResource resource = new AdjustmentResource(apiContext); @@ -111,12 +112,12 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order removeAdjustme catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminFacetFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminFacetFactory.java index 1c5e4a8d..f2a884a1 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminFacetFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminFacetFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class AdminFacetFactory { - public static com.mozu.api.contracts.productadmin.Facet getFacet(ApiContext apiContext, Integer facetId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Facet getFacet(ApiContext apiContext, Integer facetId, int expectedCode) throws Exception { - return getFacet(apiContext, facetId, null, null, expectedCode, successCode ); + return getFacet(apiContext, facetId, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Facet getFacet(ApiContext apiContext, Integer facetId, Boolean validate, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Facet getFacet(ApiContext apiContext, Integer facetId, Boolean validate, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Facet returnObj = new com.mozu.api.contracts.productadmin.Facet(); FacetResource resource = new FacetResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.productadmin.Facet getFacet(ApiContext apiC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.FacetSet getFacetCategoryList(ApiContext apiContext, Integer categoryId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.FacetSet getFacetCategoryList(ApiContext apiContext, Integer categoryId, int expectedCode) throws Exception { - return getFacetCategoryList(apiContext, categoryId, null, null, null, expectedCode, successCode ); + return getFacetCategoryList(apiContext, categoryId, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.FacetSet getFacetCategoryList(ApiContext apiContext, Integer categoryId, Boolean includeAvailable, Boolean validate, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.FacetSet getFacetCategoryList(ApiContext apiContext, Integer categoryId, Boolean includeAvailable, Boolean validate, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.FacetSet returnObj = new com.mozu.api.contracts.productadmin.FacetSet(); FacetResource resource = new FacetResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.productadmin.FacetSet getFacetCategoryList( catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.Facet addFacet(ApiContext apiContext, com.mozu.api.contracts.productadmin.Facet facet, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Facet addFacet(ApiContext apiContext, com.mozu.api.contracts.productadmin.Facet facet, int expectedCode) throws Exception { - return addFacet(apiContext, facet, null, expectedCode, successCode ); + return addFacet(apiContext, facet, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Facet addFacet(ApiContext apiContext, com.mozu.api.contracts.productadmin.Facet facet, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Facet addFacet(ApiContext apiContext, com.mozu.api.contracts.productadmin.Facet facet, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Facet returnObj = new com.mozu.api.contracts.productadmin.Facet(); FacetResource resource = new FacetResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.productadmin.Facet addFacet(ApiContext apiC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.Facet updateFacet(ApiContext apiContext, com.mozu.api.contracts.productadmin.Facet facet, Integer facetId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Facet updateFacet(ApiContext apiContext, com.mozu.api.contracts.productadmin.Facet facet, Integer facetId, int expectedCode) throws Exception { - return updateFacet(apiContext, facet, facetId, null, expectedCode, successCode ); + return updateFacet(apiContext, facet, facetId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Facet updateFacet(ApiContext apiContext, com.mozu.api.contracts.productadmin.Facet facet, Integer facetId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Facet updateFacet(ApiContext apiContext, com.mozu.api.contracts.productadmin.Facet facet, Integer facetId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Facet returnObj = new com.mozu.api.contracts.productadmin.Facet(); FacetResource resource = new FacetResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.productadmin.Facet updateFacet(ApiContext a catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteFacetById(ApiContext apiContext, Integer facetId, int expectedCode, int successCode) throws Exception + public static void deleteFacetById(ApiContext apiContext, Integer facetId, int expectedCode) throws Exception { FacetResource resource = new FacetResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteFacetById(ApiContext apiContext, Integer facetId, int e catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminLocationInventoryFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminLocationInventoryFactory.java index d2b103a9..b8d97180 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminLocationInventoryFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminLocationInventoryFactory.java @@ -1,139 +1,140 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.admin.LocationInventoryResource; - -/** - * Use the Location Inventory resource to manage the level of active product inventory maintained at each defined location, at the location level. - * - */ -public class AdminLocationInventoryFactory -{ - - public static com.mozu.api.contracts.productadmin.LocationInventory getLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, String productCode, int expectedCode, int successCode) throws Exception - { - return getLocationInventory(apiContext, dataViewMode, locationCode, productCode, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.LocationInventory getLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, String productCode, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.LocationInventory returnObj = new com.mozu.api.contracts.productadmin.LocationInventory(); - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - returnObj = resource.getLocationInventory( locationCode, productCode, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.LocationInventoryCollection getLocationInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, int expectedCode, int successCode) throws Exception - { - return getLocationInventories(apiContext, dataViewMode, locationCode, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.LocationInventoryCollection getLocationInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.LocationInventoryCollection returnObj = new com.mozu.api.contracts.productadmin.LocationInventoryCollection(); - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - returnObj = resource.getLocationInventories( locationCode, 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List addLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryList, String locationCode, int expectedCode, int successCode) throws Exception - { - return addLocationInventory(apiContext, dataViewMode, locationInventoryList, locationCode, null, expectedCode, successCode ); - } - - public static List addLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryList, String locationCode, Boolean performUpserts, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - returnObj = resource.addLocationInventory( locationInventoryList, locationCode, performUpserts); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List updateLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryAdjustments, String locationCode, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - returnObj = resource.updateLocationInventory( locationInventoryAdjustments, locationCode); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, String productCode, int expectedCode, int successCode) throws Exception - { - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - resource.deleteLocationInventory( locationCode, productCode); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.admin.LocationInventoryResource; + +/** + * Use the Location Inventory resource to manage the level of active product inventory maintained at each defined location, at the location level. + * + */ +public class AdminLocationInventoryFactory +{ + + public static com.mozu.api.contracts.productadmin.LocationInventory getLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, String productCode, int expectedCode) throws Exception + { + return getLocationInventory(apiContext, dataViewMode, locationCode, productCode, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.LocationInventory getLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, String productCode, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.LocationInventory returnObj = new com.mozu.api.contracts.productadmin.LocationInventory(); + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + returnObj = resource.getLocationInventory( locationCode, productCode, 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.productadmin.LocationInventoryCollection getLocationInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, int expectedCode) throws Exception + { + return getLocationInventories(apiContext, dataViewMode, locationCode, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.LocationInventoryCollection getLocationInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.LocationInventoryCollection returnObj = new com.mozu.api.contracts.productadmin.LocationInventoryCollection(); + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + returnObj = resource.getLocationInventories( locationCode, 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 List addLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryList, String locationCode, int expectedCode) throws Exception + { + return addLocationInventory(apiContext, dataViewMode, locationInventoryList, locationCode, null, expectedCode); + } + + public static List addLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryList, String locationCode, Boolean performUpserts, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + returnObj = resource.addLocationInventory( locationInventoryList, locationCode, performUpserts); + } + 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 List updateLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryAdjustments, String locationCode, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + returnObj = resource.updateLocationInventory( locationInventoryAdjustments, locationCode); + } + 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 deleteLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String locationCode, String productCode, int expectedCode) throws Exception + { + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + resource.deleteLocationInventory( locationCode, productCode); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminProductFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminProductFactory.java index db91df30..333fba4a 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminProductFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminProductFactory.java @@ -1,295 +1,296 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.admin.ProductResource; - -/** - * Use the Product Administration resource to create new product definitions in the master catalog and determine which catalogs will feature products. You can also assign attribute values for defined products, manage product-level location inventory, and configure the variations of a product. - * - */ -public class AdminProductFactory -{ - - public static com.mozu.api.contracts.productadmin.ProductCollection getProducts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode, int successCode) throws Exception - { - return getProducts(apiContext, dataViewMode, null, null, null, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.ProductCollection getProducts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String q, Integer qLimit, Boolean noCount, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.ProductCollection returnObj = new com.mozu.api.contracts.productadmin.ProductCollection(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.getProducts( startIndex, pageSize, sortBy, filter, q, qLimit, noCount, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List getProductInCatalogs(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.getProductInCatalogs( productCode); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo getProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer catalogId, int expectedCode, int successCode) throws Exception - { - return getProductInCatalog(apiContext, dataViewMode, productCode, catalogId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo getProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer catalogId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.ProductInCatalogInfo returnObj = new com.mozu.api.contracts.productadmin.ProductInCatalogInfo(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.getProductInCatalog( productCode, catalogId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.Product getProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception - { - return getProduct(apiContext, dataViewMode, productCode, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.Product getProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.Product returnObj = new com.mozu.api.contracts.productadmin.Product(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.getProduct( productCode, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.Product addProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, int expectedCode, int successCode) throws Exception - { - return addProduct(apiContext, dataViewMode, product, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.Product addProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.Product returnObj = new com.mozu.api.contracts.productadmin.Product(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.addProduct( product, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo addProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductInCatalogInfo productInCatalogInfoIn, String productCode, int expectedCode, int successCode) throws Exception - { - return addProductInCatalog(apiContext, dataViewMode, productInCatalogInfoIn, productCode, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo addProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductInCatalogInfo productInCatalogInfoIn, String productCode, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.ProductInCatalogInfo returnObj = new com.mozu.api.contracts.productadmin.ProductInCatalogInfo(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.addProductInCatalog( productInCatalogInfoIn, productCode, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void renameProductCodes(ApiContext apiContext, List productCodeRenames, int expectedCode, int successCode) throws Exception - { - ProductResource resource = new ProductResource(apiContext); - try - { - resource.renameProductCodes( productCodeRenames); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static List updateProductInCatalogs(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productInCatalogsIn, String productCode, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.updateProductInCatalogs( productInCatalogsIn, productCode); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo updateProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductInCatalogInfo productInCatalogInfoIn, String productCode, Integer catalogId, int expectedCode, int successCode) throws Exception - { - return updateProductInCatalog(apiContext, dataViewMode, productInCatalogInfoIn, productCode, catalogId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo updateProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductInCatalogInfo productInCatalogInfoIn, String productCode, Integer catalogId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.ProductInCatalogInfo returnObj = new com.mozu.api.contracts.productadmin.ProductInCatalogInfo(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.updateProductInCatalog( productInCatalogInfoIn, productCode, catalogId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.Product updateProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, String productCode, int expectedCode, int successCode) throws Exception - { - return updateProduct(apiContext, dataViewMode, product, productCode, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.Product updateProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, String productCode, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.Product returnObj = new com.mozu.api.contracts.productadmin.Product(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.updateProduct( product, productCode, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception - { - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - resource.deleteProduct( productCode); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static void deleteProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer catalogId, int expectedCode, int successCode) throws Exception - { - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - resource.deleteProductInCatalog( productCode, catalogId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.admin.ProductResource; + +/** + * Use the Product Administration resource to create new product definitions in the master catalog and determine which catalogs will feature products. You can also assign attribute values for defined products, manage product-level location inventory, and configure the variations of a product. + * + */ +public class AdminProductFactory +{ + + public static com.mozu.api.contracts.productadmin.ProductCollection getProducts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode) throws Exception + { + return getProducts(apiContext, dataViewMode, null, null, null, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.ProductCollection getProducts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String q, Integer qLimit, Boolean noCount, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.ProductCollection returnObj = new com.mozu.api.contracts.productadmin.ProductCollection(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.getProducts( startIndex, pageSize, sortBy, filter, q, qLimit, noCount, 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 List getProductInCatalogs(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.getProductInCatalogs( productCode); + } + 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.productadmin.ProductInCatalogInfo getProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer catalogId, int expectedCode) throws Exception + { + return getProductInCatalog(apiContext, dataViewMode, productCode, catalogId, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo getProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer catalogId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.ProductInCatalogInfo returnObj = new com.mozu.api.contracts.productadmin.ProductInCatalogInfo(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.getProductInCatalog( productCode, catalogId, 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.productadmin.Product getProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception + { + return getProduct(apiContext, dataViewMode, productCode, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.Product getProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.Product returnObj = new com.mozu.api.contracts.productadmin.Product(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.getProduct( productCode, 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.productadmin.Product addProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, int expectedCode) throws Exception + { + return addProduct(apiContext, dataViewMode, product, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.Product addProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.Product returnObj = new com.mozu.api.contracts.productadmin.Product(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.addProduct( product, 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.productadmin.ProductInCatalogInfo addProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductInCatalogInfo productInCatalogInfoIn, String productCode, int expectedCode) throws Exception + { + return addProductInCatalog(apiContext, dataViewMode, productInCatalogInfoIn, productCode, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo addProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductInCatalogInfo productInCatalogInfoIn, String productCode, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.ProductInCatalogInfo returnObj = new com.mozu.api.contracts.productadmin.ProductInCatalogInfo(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.addProductInCatalog( productInCatalogInfoIn, productCode, 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 renameProductCodes(ApiContext apiContext, List productCodeRenames, int expectedCode) throws Exception + { + ProductResource resource = new ProductResource(apiContext); + try + { + resource.renameProductCodes( productCodeRenames); + } + 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, ""); + } + + public static List updateProductInCatalogs(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productInCatalogsIn, String productCode, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.updateProductInCatalogs( productInCatalogsIn, productCode); + } + 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.productadmin.ProductInCatalogInfo updateProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductInCatalogInfo productInCatalogInfoIn, String productCode, Integer catalogId, int expectedCode) throws Exception + { + return updateProductInCatalog(apiContext, dataViewMode, productInCatalogInfoIn, productCode, catalogId, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.ProductInCatalogInfo updateProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductInCatalogInfo productInCatalogInfoIn, String productCode, Integer catalogId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.ProductInCatalogInfo returnObj = new com.mozu.api.contracts.productadmin.ProductInCatalogInfo(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.updateProductInCatalog( productInCatalogInfoIn, productCode, catalogId, 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.productadmin.Product updateProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, String productCode, int expectedCode) throws Exception + { + return updateProduct(apiContext, dataViewMode, product, productCode, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.Product updateProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, String productCode, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.Product returnObj = new com.mozu.api.contracts.productadmin.Product(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.updateProduct( product, productCode, 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 deleteProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception + { + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + resource.deleteProduct( productCode); + } + 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, ""); + } + + public static void deleteProductInCatalog(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer catalogId, int expectedCode) throws Exception + { + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + resource.deleteProductInCatalog( productCode, catalogId); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminUserFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminUserFactory.java index 1253963a..a894d8e7 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminUserFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AdminUserFactory.java @@ -1,76 +1,77 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.adminuser.AdminUserResource; - -/** - * The Accounts resource displays the user accounts and account details associated with a developer or Mozu tenant administrator. Email addresses uniquely identify admin user accounts. - * - */ -public class AdminUserFactory -{ - - public static com.mozu.api.contracts.tenant.TenantCollection getTenantScopesForUser(ApiContext apiContext, String userId, int expectedCode, int successCode) throws Exception - { - return getTenantScopesForUser(apiContext, userId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.tenant.TenantCollection getTenantScopesForUser(ApiContext apiContext, String userId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.tenant.TenantCollection returnObj = new com.mozu.api.contracts.tenant.TenantCollection(); - AdminUserResource resource = new AdminUserResource(apiContext); - try - { - returnObj = resource.getTenantScopesForUser( userId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.core.User getUser(ApiContext apiContext, String userId, int expectedCode, int successCode) throws Exception - { - return getUser(apiContext, userId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.core.User getUser(ApiContext apiContext, String userId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.core.User returnObj = new com.mozu.api.contracts.core.User(); - AdminUserResource resource = new AdminUserResource(apiContext); - try - { - returnObj = resource.getUser( userId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.adminuser.AdminUserResource; + +/** + * The Accounts resource displays the user accounts and account details associated with a developer or Mozu tenant administrator. Email addresses uniquely identify admin user accounts. + * + */ +public class AdminUserFactory +{ + + public static com.mozu.api.contracts.tenant.TenantCollection getTenantScopesForUser(ApiContext apiContext, String userId, int expectedCode) throws Exception + { + return getTenantScopesForUser(apiContext, userId, null, expectedCode); + } + + public static com.mozu.api.contracts.tenant.TenantCollection getTenantScopesForUser(ApiContext apiContext, String userId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.tenant.TenantCollection returnObj = new com.mozu.api.contracts.tenant.TenantCollection(); + AdminUserResource resource = new AdminUserResource(apiContext); + try + { + returnObj = resource.getTenantScopesForUser( userId, 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.core.User getUser(ApiContext apiContext, String userId, int expectedCode) throws Exception + { + return getUser(apiContext, userId, null, expectedCode); + } + + public static com.mozu.api.contracts.core.User getUser(ApiContext apiContext, String userId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.core.User returnObj = new com.mozu.api.contracts.core.User(); + AdminUserResource resource = new AdminUserResource(apiContext); + try + { + returnObj = resource.getUser( userId, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ApplicationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ApplicationFactory.java index d522ea77..d67964c6 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ApplicationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ApplicationFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ApplicationFactory { - public static com.mozu.api.contracts.sitesettings.application.Application thirdPartyGetApplication(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.application.Application thirdPartyGetApplication(ApiContext apiContext, int expectedCode) throws Exception { - return thirdPartyGetApplication(apiContext, null, expectedCode, successCode ); + return thirdPartyGetApplication(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.application.Application thirdPartyGetApplication(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.application.Application thirdPartyGetApplication(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.application.Application returnObj = new com.mozu.api.contracts.sitesettings.application.Application(); ApplicationResource resource = new ApplicationResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.sitesettings.application.Application thirdP catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.sitesettings.application.Application thirdPartyUpdateApplication(ApiContext apiContext, com.mozu.api.contracts.sitesettings.application.Application application, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.application.Application thirdPartyUpdateApplication(ApiContext apiContext, com.mozu.api.contracts.sitesettings.application.Application application, int expectedCode) throws Exception { - return thirdPartyUpdateApplication(apiContext, application, null, expectedCode, successCode ); + return thirdPartyUpdateApplication(apiContext, application, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.application.Application thirdPartyUpdateApplication(ApiContext apiContext, com.mozu.api.contracts.sitesettings.application.Application application, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.application.Application thirdPartyUpdateApplication(ApiContext apiContext, com.mozu.api.contracts.sitesettings.application.Application application, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.application.Application returnObj = new com.mozu.api.contracts.sitesettings.application.Application(); ApplicationResource resource = new ApplicationResource(apiContext); @@ -61,12 +62,12 @@ public static com.mozu.api.contracts.sitesettings.application.Application thirdP catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AppliedDiscountFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AppliedDiscountFactory.java index 40db0785..45a44e1d 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AppliedDiscountFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AppliedDiscountFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class AppliedDiscountFactory { - public static com.mozu.api.contracts.commerceruntime.orders.Order applyCoupon(ApiContext apiContext, String orderId, String couponCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order applyCoupon(ApiContext apiContext, String orderId, String couponCode, int expectedCode) throws Exception { - return applyCoupon(apiContext, orderId, couponCode, null, null, null, expectedCode, successCode ); + return applyCoupon(apiContext, orderId, couponCode, null, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order applyCoupon(ApiContext apiContext, String orderId, String couponCode, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order applyCoupon(ApiContext apiContext, String orderId, String couponCode, String updateMode, String version, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); AppliedDiscountResource resource = new AppliedDiscountResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order applyCoupon(Ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.Order removeCoupon(ApiContext apiContext, String orderId, String couponCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order removeCoupon(ApiContext apiContext, String orderId, String couponCode, int expectedCode) throws Exception { - return removeCoupon(apiContext, orderId, couponCode, null, null, expectedCode, successCode ); + return removeCoupon(apiContext, orderId, couponCode, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order removeCoupon(ApiContext apiContext, String orderId, String couponCode, String updateMode, String version, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order removeCoupon(ApiContext apiContext, String orderId, String couponCode, String updateMode, String version, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); AppliedDiscountResource resource = new AppliedDiscountResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order removeCoupon(A catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.Order removeCoupons(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order removeCoupons(ApiContext apiContext, String orderId, int expectedCode) throws Exception { - return removeCoupons(apiContext, orderId, null, null, expectedCode, successCode ); + return removeCoupons(apiContext, orderId, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order removeCoupons(ApiContext apiContext, String orderId, String updateMode, String version, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order removeCoupons(ApiContext apiContext, String orderId, String updateMode, String version, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); AppliedDiscountResource resource = new AppliedDiscountResource(apiContext); @@ -86,12 +87,12 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order removeCoupons( catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeFactory.java index fd6e3cf9..06237843 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class AttributeFactory { - public static com.mozu.api.contracts.core.extensible.AttributeCollection getAttributes(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.core.extensible.AttributeCollection getAttributes(ApiContext apiContext, int expectedCode) throws Exception { - return getAttributes(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getAttributes(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.core.extensible.AttributeCollection getAttributes(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.core.extensible.AttributeCollection getAttributes(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.core.extensible.AttributeCollection returnObj = new com.mozu.api.contracts.core.extensible.AttributeCollection(); AttributeResource resource = new AttributeResource(apiContext); @@ -36,16 +37,16 @@ public static com.mozu.api.contracts.core.extensible.AttributeCollection getAttr catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List getAttributeVocabularyValues(ApiContext apiContext, String attributeFQN, int expectedCode, int successCode) throws Exception + public static List getAttributeVocabularyValues(ApiContext apiContext, String attributeFQN, int expectedCode) throws Exception { List returnObj = new ArrayList(); AttributeResource resource = new AttributeResource(apiContext); @@ -56,21 +57,21 @@ public static List= 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.core.extensible.Attribute getAttribute(ApiContext apiContext, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.core.extensible.Attribute getAttribute(ApiContext apiContext, String attributeFQN, int expectedCode) throws Exception { - return getAttribute(apiContext, attributeFQN, null, expectedCode, successCode ); + return getAttribute(apiContext, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.core.extensible.Attribute getAttribute(ApiContext apiContext, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.core.extensible.Attribute getAttribute(ApiContext apiContext, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.core.extensible.Attribute returnObj = new com.mozu.api.contracts.core.extensible.Attribute(); AttributeResource resource = new AttributeResource(apiContext); @@ -81,12 +82,12 @@ public static com.mozu.api.contracts.core.extensible.Attribute getAttribute(ApiC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeLocalizedContentFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeLocalizedContentFactory.java index dbbd0fb3..0ccb0417 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeLocalizedContentFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeLocalizedContentFactory.java @@ -1,159 +1,160 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.admin.attributedefinition.attributes.AttributeLocalizedContentResource; - -/** - * Properties of localized content for attributes, based on a `localeCode` at a site/tenant level. This content supports translated text for product, product options, and additional objects. - * - */ -public class AttributeLocalizedContentFactory -{ - - public static List getAttributeLocalizedContents(ApiContext apiContext, String attributeFQN, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); - try - { - returnObj = resource.getAttributeLocalizedContents( attributeFQN); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent getAttributeLocalizedContent(ApiContext apiContext, String attributeFQN, String localeCode, int expectedCode, int successCode) throws Exception - { - return getAttributeLocalizedContent(apiContext, attributeFQN, localeCode, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent getAttributeLocalizedContent(ApiContext apiContext, String attributeFQN, String localeCode, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.AttributeLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeLocalizedContent(); - AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); - try - { - returnObj = resource.getAttributeLocalizedContent( attributeFQN, localeCode, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent addLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeLocalizedContent localizedContent, String attributeFQN, int expectedCode, int successCode) throws Exception - { - return addLocalizedContent(apiContext, localizedContent, attributeFQN, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent addLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeLocalizedContent localizedContent, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.AttributeLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeLocalizedContent(); - AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); - try - { - returnObj = resource.addLocalizedContent( localizedContent, attributeFQN, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List updateLocalizedContents(ApiContext apiContext, List localizedContent, String attributeFQN, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); - try - { - returnObj = resource.updateLocalizedContents( localizedContent, attributeFQN); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent updateLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeLocalizedContent localizedContent, String attributeFQN, String localeCode, int expectedCode, int successCode) throws Exception - { - return updateLocalizedContent(apiContext, localizedContent, attributeFQN, localeCode, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent updateLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeLocalizedContent localizedContent, String attributeFQN, String localeCode, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.AttributeLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeLocalizedContent(); - AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); - try - { - returnObj = resource.updateLocalizedContent( localizedContent, attributeFQN, localeCode, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteLocalizedContent(ApiContext apiContext, String attributeFQN, String localeCode, int expectedCode, int successCode) throws Exception - { - AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); - try - { - resource.deleteLocalizedContent( attributeFQN, localeCode); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.admin.attributedefinition.attributes.AttributeLocalizedContentResource; + +/** + * Properties of localized content for attributes, based on a `localeCode` at a site/tenant level. This content supports translated text for product, product options, and additional objects. + * + */ +public class AttributeLocalizedContentFactory +{ + + public static List getAttributeLocalizedContents(ApiContext apiContext, String attributeFQN, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); + try + { + returnObj = resource.getAttributeLocalizedContents( attributeFQN); + } + 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.productadmin.AttributeLocalizedContent getAttributeLocalizedContent(ApiContext apiContext, String attributeFQN, String localeCode, int expectedCode) throws Exception + { + return getAttributeLocalizedContent(apiContext, attributeFQN, localeCode, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent getAttributeLocalizedContent(ApiContext apiContext, String attributeFQN, String localeCode, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.AttributeLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeLocalizedContent(); + AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); + try + { + returnObj = resource.getAttributeLocalizedContent( attributeFQN, localeCode, 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.productadmin.AttributeLocalizedContent addLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeLocalizedContent localizedContent, String attributeFQN, int expectedCode) throws Exception + { + return addLocalizedContent(apiContext, localizedContent, attributeFQN, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent addLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeLocalizedContent localizedContent, String attributeFQN, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.AttributeLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeLocalizedContent(); + AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); + try + { + returnObj = resource.addLocalizedContent( localizedContent, attributeFQN, 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 List updateLocalizedContents(ApiContext apiContext, List localizedContent, String attributeFQN, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); + try + { + returnObj = resource.updateLocalizedContents( localizedContent, attributeFQN); + } + 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.productadmin.AttributeLocalizedContent updateLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeLocalizedContent localizedContent, String attributeFQN, String localeCode, int expectedCode) throws Exception + { + return updateLocalizedContent(apiContext, localizedContent, attributeFQN, localeCode, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.AttributeLocalizedContent updateLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeLocalizedContent localizedContent, String attributeFQN, String localeCode, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.AttributeLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeLocalizedContent(); + AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); + try + { + returnObj = resource.updateLocalizedContent( localizedContent, attributeFQN, localeCode, 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 deleteLocalizedContent(ApiContext apiContext, String attributeFQN, String localeCode, int expectedCode) throws Exception + { + AttributeLocalizedContentResource resource = new AttributeLocalizedContentResource(apiContext); + try + { + resource.deleteLocalizedContent( attributeFQN, localeCode); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeTypeRuleFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeTypeRuleFactory.java index 33aa327d..b2f5daff 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeTypeRuleFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeTypeRuleFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class AttributeTypeRuleFactory { - public static com.mozu.api.contracts.productadmin.AttributeTypeRuleCollection getAttributeTypeRules(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeTypeRuleCollection getAttributeTypeRules(ApiContext apiContext, int expectedCode) throws Exception { - return getAttributeTypeRules(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getAttributeTypeRules(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeTypeRuleCollection getAttributeTypeRules(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeTypeRuleCollection getAttributeTypeRules(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeTypeRuleCollection returnObj = new com.mozu.api.contracts.productadmin.AttributeTypeRuleCollection(); AttributeTypeRuleResource resource = new AttributeTypeRuleResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.productadmin.AttributeTypeRuleCollection ge catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeVocabularyValueFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeVocabularyValueFactory.java index d0029fb3..0651f44c 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeVocabularyValueFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributeVocabularyValueFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class AttributeVocabularyValueFactory { - public static List getAttributeVocabularyValues(ApiContext apiContext, String attributeFQN, int expectedCode, int successCode) throws Exception + public static List getAttributeVocabularyValues(ApiContext apiContext, String attributeFQN, int expectedCode) throws Exception { List returnObj = new ArrayList(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -31,16 +32,16 @@ public static List catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List getAttributeVocabularyValueLocalizedContents(ApiContext apiContext, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static List getAttributeVocabularyValueLocalizedContents(ApiContext apiContext, String attributeFQN, String value, int expectedCode) throws Exception { List returnObj = new ArrayList(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -51,21 +52,21 @@ public static List= 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.productadmin.AttributeVocabularyValueLocalizedContent getAttributeVocabularyValueLocalizedContent(ApiContext apiContext, String attributeFQN, String value, String localeCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent getAttributeVocabularyValueLocalizedContent(ApiContext apiContext, String attributeFQN, String value, String localeCode, int expectedCode) throws Exception { - return getAttributeVocabularyValueLocalizedContent(apiContext, attributeFQN, value, localeCode, null, expectedCode, successCode ); + return getAttributeVocabularyValueLocalizedContent(apiContext, attributeFQN, value, localeCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent getAttributeVocabularyValueLocalizedContent(ApiContext apiContext, String attributeFQN, String value, String localeCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent getAttributeVocabularyValueLocalizedContent(ApiContext apiContext, String attributeFQN, String value, String localeCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -76,21 +77,21 @@ public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocali catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeVocabularyValue getAttributeVocabularyValue(ApiContext apiContext, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue getAttributeVocabularyValue(ApiContext apiContext, String attributeFQN, String value, int expectedCode) throws Exception { - return getAttributeVocabularyValue(apiContext, attributeFQN, value, null, expectedCode, successCode ); + return getAttributeVocabularyValue(apiContext, attributeFQN, value, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue getAttributeVocabularyValue(ApiContext apiContext, String attributeFQN, String value, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue getAttributeVocabularyValue(ApiContext apiContext, String attributeFQN, String value, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeVocabularyValue returnObj = new com.mozu.api.contracts.productadmin.AttributeVocabularyValue(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -101,21 +102,21 @@ public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue getAt catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeVocabularyValueLocalizedContent addAttributeVocabularyValueLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent localizedContent, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent addAttributeVocabularyValueLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent localizedContent, String attributeFQN, String value, int expectedCode) throws Exception { - return addAttributeVocabularyValueLocalizedContent(apiContext, localizedContent, attributeFQN, value, null, expectedCode, successCode ); + return addAttributeVocabularyValueLocalizedContent(apiContext, localizedContent, attributeFQN, value, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent addAttributeVocabularyValueLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent localizedContent, String attributeFQN, String value, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent addAttributeVocabularyValueLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent localizedContent, String attributeFQN, String value, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -126,21 +127,21 @@ public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocali catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeVocabularyValue addAttributeVocabularyValue(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValue attributeVocabularyValue, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue addAttributeVocabularyValue(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValue attributeVocabularyValue, String attributeFQN, int expectedCode) throws Exception { - return addAttributeVocabularyValue(apiContext, attributeVocabularyValue, attributeFQN, null, expectedCode, successCode ); + return addAttributeVocabularyValue(apiContext, attributeVocabularyValue, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue addAttributeVocabularyValue(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValue attributeVocabularyValue, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue addAttributeVocabularyValue(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValue attributeVocabularyValue, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeVocabularyValue returnObj = new com.mozu.api.contracts.productadmin.AttributeVocabularyValue(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -151,16 +152,16 @@ public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue addAt catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List updateAttributeVocabularyValues(ApiContext apiContext, List vocabularyValues, String attributeFQN, int expectedCode, int successCode) throws Exception + public static List updateAttributeVocabularyValues(ApiContext apiContext, List vocabularyValues, String attributeFQN, int expectedCode) throws Exception { List returnObj = new ArrayList(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -171,16 +172,16 @@ public static List catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List updateAttributeVocabularyValueLocalizedContents(ApiContext apiContext, List localizedContent, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static List updateAttributeVocabularyValueLocalizedContents(ApiContext apiContext, List localizedContent, String attributeFQN, String value, int expectedCode) throws Exception { List returnObj = new ArrayList(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -191,21 +192,21 @@ public static List= 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.productadmin.AttributeVocabularyValueLocalizedContent updateAttributeVocabularyValueLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent localizedContent, String attributeFQN, String value, String localeCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent updateAttributeVocabularyValueLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent localizedContent, String attributeFQN, String value, String localeCode, int expectedCode) throws Exception { - return updateAttributeVocabularyValueLocalizedContent(apiContext, localizedContent, attributeFQN, value, localeCode, null, expectedCode, successCode ); + return updateAttributeVocabularyValueLocalizedContent(apiContext, localizedContent, attributeFQN, value, localeCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent updateAttributeVocabularyValueLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent localizedContent, String attributeFQN, String value, String localeCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent updateAttributeVocabularyValueLocalizedContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent localizedContent, String attributeFQN, String value, String localeCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocalizedContent(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -216,21 +217,21 @@ public static com.mozu.api.contracts.productadmin.AttributeVocabularyValueLocali catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeVocabularyValue updateAttributeVocabularyValue(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValue attributeVocabularyValue, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue updateAttributeVocabularyValue(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValue attributeVocabularyValue, String attributeFQN, String value, int expectedCode) throws Exception { - return updateAttributeVocabularyValue(apiContext, attributeVocabularyValue, attributeFQN, value, null, expectedCode, successCode ); + return updateAttributeVocabularyValue(apiContext, attributeVocabularyValue, attributeFQN, value, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue updateAttributeVocabularyValue(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValue attributeVocabularyValue, String attributeFQN, String value, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue updateAttributeVocabularyValue(ApiContext apiContext, com.mozu.api.contracts.productadmin.AttributeVocabularyValue attributeVocabularyValue, String attributeFQN, String value, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeVocabularyValue returnObj = new com.mozu.api.contracts.productadmin.AttributeVocabularyValue(); AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); @@ -241,16 +242,16 @@ public static com.mozu.api.contracts.productadmin.AttributeVocabularyValue updat catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteAttributeVocabularyValue(ApiContext apiContext, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static void deleteAttributeVocabularyValue(ApiContext apiContext, String attributeFQN, String value, int expectedCode) throws Exception { AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); try @@ -260,15 +261,15 @@ public static void deleteAttributeVocabularyValue(ApiContext apiContext, String catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deleteAttributeVocabularyValueLocalizedContent(ApiContext apiContext, String attributeFQN, String value, String localeCode, int expectedCode, int successCode) throws Exception + public static void deleteAttributeVocabularyValueLocalizedContent(ApiContext apiContext, String attributeFQN, String value, String localeCode, int expectedCode) throws Exception { AttributeVocabularyValueResource resource = new AttributeVocabularyValueResource(apiContext); try @@ -278,12 +279,12 @@ public static void deleteAttributeVocabularyValueLocalizedContent(ApiContext api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributedefinitionAttributeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributedefinitionAttributeFactory.java index 9d6388ac..e2b66937 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributedefinitionAttributeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AttributedefinitionAttributeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class AttributedefinitionAttributeFactory { - public static com.mozu.api.contracts.productadmin.AttributeCollection getAttributes(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeCollection getAttributes(ApiContext apiContext, int expectedCode) throws Exception { - return getAttributes(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getAttributes(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeCollection getAttributes(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeCollection getAttributes(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeCollection returnObj = new com.mozu.api.contracts.productadmin.AttributeCollection(); AttributeResource resource = new AttributeResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.productadmin.AttributeCollection getAttribu catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.Attribute getAttribute(ApiContext apiContext, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Attribute getAttribute(ApiContext apiContext, String attributeFQN, int expectedCode) throws Exception { - return getAttribute(apiContext, attributeFQN, null, expectedCode, successCode ); + return getAttribute(apiContext, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Attribute getAttribute(ApiContext apiContext, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Attribute getAttribute(ApiContext apiContext, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Attribute returnObj = new com.mozu.api.contracts.productadmin.Attribute(); AttributeResource resource = new AttributeResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.productadmin.Attribute getAttribute(ApiCont catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.Attribute addAttribute(ApiContext apiContext, com.mozu.api.contracts.productadmin.Attribute attribute, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Attribute addAttribute(ApiContext apiContext, com.mozu.api.contracts.productadmin.Attribute attribute, int expectedCode) throws Exception { - return addAttribute(apiContext, attribute, null, expectedCode, successCode ); + return addAttribute(apiContext, attribute, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Attribute addAttribute(ApiContext apiContext, com.mozu.api.contracts.productadmin.Attribute attribute, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Attribute addAttribute(ApiContext apiContext, com.mozu.api.contracts.productadmin.Attribute attribute, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Attribute returnObj = new com.mozu.api.contracts.productadmin.Attribute(); AttributeResource resource = new AttributeResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.productadmin.Attribute addAttribute(ApiCont catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.Attribute updateAttribute(ApiContext apiContext, com.mozu.api.contracts.productadmin.Attribute attribute, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Attribute updateAttribute(ApiContext apiContext, com.mozu.api.contracts.productadmin.Attribute attribute, String attributeFQN, int expectedCode) throws Exception { - return updateAttribute(apiContext, attribute, attributeFQN, null, expectedCode, successCode ); + return updateAttribute(apiContext, attribute, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Attribute updateAttribute(ApiContext apiContext, com.mozu.api.contracts.productadmin.Attribute attribute, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Attribute updateAttribute(ApiContext apiContext, com.mozu.api.contracts.productadmin.Attribute attribute, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Attribute returnObj = new com.mozu.api.contracts.productadmin.Attribute(); AttributeResource resource = new AttributeResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.productadmin.Attribute updateAttribute(ApiC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteAttribute(ApiContext apiContext, String attributeFQN, int expectedCode, int successCode) throws Exception + public static void deleteAttribute(ApiContext apiContext, String attributeFQN, int expectedCode) throws Exception { AttributeResource resource = new AttributeResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteAttribute(ApiContext apiContext, String attributeFQN, i catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AuthTicketFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AuthTicketFactory.java index 8a1dbc3d..bed22f93 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AuthTicketFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/AuthTicketFactory.java @@ -1,94 +1,95 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.applications.AuthTicketResource; - -/** - * Use the Authetickets for applications resource to manage authentication tickets for your apps. - * - */ -public class AuthTicketFactory -{ - - public static com.mozu.api.contracts.appdev.AuthTicket authenticateApp(ApiContext apiContext, com.mozu.api.contracts.appdev.AppAuthInfo appAuthInfo, int expectedCode, int successCode) throws Exception - { - return authenticateApp(apiContext, appAuthInfo, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.appdev.AuthTicket authenticateApp(ApiContext apiContext, com.mozu.api.contracts.appdev.AppAuthInfo appAuthInfo, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.appdev.AuthTicket returnObj = new com.mozu.api.contracts.appdev.AuthTicket(); - AuthTicketResource resource = new AuthTicketResource(apiContext); - try - { - returnObj = resource.authenticateApp( appAuthInfo, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.appdev.AuthTicket refreshAppAuthTicket(ApiContext apiContext, com.mozu.api.contracts.appdev.AuthTicketRequest authTicketRequest, int expectedCode, int successCode) throws Exception - { - return refreshAppAuthTicket(apiContext, authTicketRequest, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.appdev.AuthTicket refreshAppAuthTicket(ApiContext apiContext, com.mozu.api.contracts.appdev.AuthTicketRequest authTicketRequest, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.appdev.AuthTicket returnObj = new com.mozu.api.contracts.appdev.AuthTicket(); - AuthTicketResource resource = new AuthTicketResource(apiContext); - try - { - returnObj = resource.refreshAppAuthTicket( authTicketRequest, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteAppAuthTicket(ApiContext apiContext, String refreshToken, int expectedCode, int successCode) throws Exception - { - AuthTicketResource resource = new AuthTicketResource(apiContext); - try - { - resource.deleteAppAuthTicket( refreshToken); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.applications.AuthTicketResource; + +/** + * Use the Authetickets for applications resource to manage authentication tickets for your apps. + * + */ +public class AuthTicketFactory +{ + + public static com.mozu.api.contracts.appdev.AuthTicket authenticateApp(ApiContext apiContext, com.mozu.api.contracts.appdev.AppAuthInfo appAuthInfo, int expectedCode) throws Exception + { + return authenticateApp(apiContext, appAuthInfo, null, expectedCode); + } + + public static com.mozu.api.contracts.appdev.AuthTicket authenticateApp(ApiContext apiContext, com.mozu.api.contracts.appdev.AppAuthInfo appAuthInfo, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.appdev.AuthTicket returnObj = new com.mozu.api.contracts.appdev.AuthTicket(); + AuthTicketResource resource = new AuthTicketResource(apiContext); + try + { + returnObj = resource.authenticateApp( appAuthInfo, 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.appdev.AuthTicket refreshAppAuthTicket(ApiContext apiContext, com.mozu.api.contracts.appdev.AuthTicketRequest authTicketRequest, int expectedCode) throws Exception + { + return refreshAppAuthTicket(apiContext, authTicketRequest, null, expectedCode); + } + + public static com.mozu.api.contracts.appdev.AuthTicket refreshAppAuthTicket(ApiContext apiContext, com.mozu.api.contracts.appdev.AuthTicketRequest authTicketRequest, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.appdev.AuthTicket returnObj = new com.mozu.api.contracts.appdev.AuthTicket(); + AuthTicketResource resource = new AuthTicketResource(apiContext); + try + { + returnObj = resource.refreshAppAuthTicket( authTicketRequest, 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 deleteAppAuthTicket(ApiContext apiContext, String refreshToken, int expectedCode) throws Exception + { + AuthTicketResource resource = new AuthTicketResource(apiContext); + try + { + resource.deleteAppAuthTicket( refreshToken); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/BillingInfoFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/BillingInfoFactory.java index 73ec7e18..03c0e7df 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/BillingInfoFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/BillingInfoFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class BillingInfoFactory { - public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo getBillingInfo(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo getBillingInfo(ApiContext apiContext, String orderId, int expectedCode) throws Exception { - return getBillingInfo(apiContext, orderId, null, null, expectedCode, successCode ); + return getBillingInfo(apiContext, orderId, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo getBillingInfo(ApiContext apiContext, String orderId, Boolean draft, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo getBillingInfo(ApiContext apiContext, String orderId, Boolean draft, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.payments.BillingInfo returnObj = new com.mozu.api.contracts.commerceruntime.payments.BillingInfo(); BillingInfoResource resource = new BillingInfoResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo getBil catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.payments.BillingInfo setBillingInfo(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.BillingInfo billingInfo, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo setBillingInfo(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.BillingInfo billingInfo, String orderId, int expectedCode) throws Exception { - return setBillingInfo(apiContext, billingInfo, orderId, null, null, null, expectedCode, successCode ); + return setBillingInfo(apiContext, billingInfo, orderId, null, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo setBillingInfo(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.BillingInfo billingInfo, String orderId, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo setBillingInfo(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.BillingInfo billingInfo, String orderId, String updateMode, String version, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.payments.BillingInfo returnObj = new com.mozu.api.contracts.commerceruntime.payments.BillingInfo(); BillingInfoResource resource = new BillingInfoResource(apiContext); @@ -61,12 +62,12 @@ public static com.mozu.api.contracts.commerceruntime.payments.BillingInfo setBil catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CardFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CardFactory.java index dd13b93f..97429403 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CardFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CardFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CardFactory { - public static com.mozu.api.contracts.customer.Card getAccountCard(ApiContext apiContext, Integer accountId, String cardId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Card getAccountCard(ApiContext apiContext, Integer accountId, String cardId, int expectedCode) throws Exception { - return getAccountCard(apiContext, accountId, cardId, null, expectedCode, successCode ); + return getAccountCard(apiContext, accountId, cardId, null, expectedCode); } - public static com.mozu.api.contracts.customer.Card getAccountCard(ApiContext apiContext, Integer accountId, String cardId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Card getAccountCard(ApiContext apiContext, Integer accountId, String cardId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.Card returnObj = new com.mozu.api.contracts.customer.Card(); CardResource resource = new CardResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.customer.Card getAccountCard(ApiContext api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CardCollection getAccountCards(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CardCollection getAccountCards(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception { - return getAccountCards(apiContext, accountId, null, expectedCode, successCode ); + return getAccountCards(apiContext, accountId, null, expectedCode); } - public static com.mozu.api.contracts.customer.CardCollection getAccountCards(ApiContext apiContext, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CardCollection getAccountCards(ApiContext apiContext, Integer accountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CardCollection returnObj = new com.mozu.api.contracts.customer.CardCollection(); CardResource resource = new CardResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.customer.CardCollection getAccountCards(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.Card addAccountCard(ApiContext apiContext, com.mozu.api.contracts.customer.Card card, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Card addAccountCard(ApiContext apiContext, com.mozu.api.contracts.customer.Card card, Integer accountId, int expectedCode) throws Exception { - return addAccountCard(apiContext, card, accountId, null, expectedCode, successCode ); + return addAccountCard(apiContext, card, accountId, null, expectedCode); } - public static com.mozu.api.contracts.customer.Card addAccountCard(ApiContext apiContext, com.mozu.api.contracts.customer.Card card, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Card addAccountCard(ApiContext apiContext, com.mozu.api.contracts.customer.Card card, Integer accountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.Card returnObj = new com.mozu.api.contracts.customer.Card(); CardResource resource = new CardResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.customer.Card addAccountCard(ApiContext api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.Card updateAccountCard(ApiContext apiContext, com.mozu.api.contracts.customer.Card card, Integer accountId, String cardId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Card updateAccountCard(ApiContext apiContext, com.mozu.api.contracts.customer.Card card, Integer accountId, String cardId, int expectedCode) throws Exception { - return updateAccountCard(apiContext, card, accountId, cardId, null, expectedCode, successCode ); + return updateAccountCard(apiContext, card, accountId, cardId, null, expectedCode); } - public static com.mozu.api.contracts.customer.Card updateAccountCard(ApiContext apiContext, com.mozu.api.contracts.customer.Card card, Integer accountId, String cardId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Card updateAccountCard(ApiContext apiContext, com.mozu.api.contracts.customer.Card card, Integer accountId, String cardId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.Card returnObj = new com.mozu.api.contracts.customer.Card(); CardResource resource = new CardResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.customer.Card updateAccountCard(ApiContext catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteAccountCard(ApiContext apiContext, Integer accountId, String cardId, int expectedCode, int successCode) throws Exception + public static void deleteAccountCard(ApiContext apiContext, Integer accountId, String cardId, int expectedCode) throws Exception { CardResource resource = new CardResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteAccountCard(ApiContext apiContext, Integer accountId, S catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartFactory.java index 92c2a54c..8c9ed51a 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartFactory.java @@ -1,212 +1,213 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.CartResource; - -/** - * Use this resource to manage storefront shopping carts as shoppers add and remove items for purchase. Each time a shopper's cart is modified, the Carts resource updates the estimated total with any applicable discounts. - * - */ -public class CartFactory -{ - - public static com.mozu.api.contracts.commerceruntime.carts.Cart getCart(ApiContext apiContext, String cartId, int expectedCode, int successCode) throws Exception - { - return getCart(apiContext, cartId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.carts.Cart getCart(ApiContext apiContext, String cartId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); - CartResource resource = new CartResource(apiContext); - try - { - returnObj = resource.getCart( cartId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.carts.Cart getOrCreateCart(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getOrCreateCart(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.carts.Cart getOrCreateCart(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); - CartResource resource = new CartResource(apiContext); - try - { - returnObj = resource.getOrCreateCart( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.carts.CartSummary getCartSummary(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getCartSummary(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.carts.CartSummary getCartSummary(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.carts.CartSummary returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartSummary(); - CartResource resource = new CartResource(apiContext); - try - { - returnObj = resource.getCartSummary( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.carts.CartSummary getUserCartSummary(ApiContext apiContext, String userId, int expectedCode, int successCode) throws Exception - { - return getUserCartSummary(apiContext, userId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.carts.CartSummary getUserCartSummary(ApiContext apiContext, String userId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.carts.CartSummary returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartSummary(); - CartResource resource = new CartResource(apiContext); - try - { - returnObj = resource.getUserCartSummary( userId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.carts.Cart getUserCart(ApiContext apiContext, String userId, int expectedCode, int successCode) throws Exception - { - return getUserCart(apiContext, userId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.carts.Cart getUserCart(ApiContext apiContext, String userId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); - CartResource resource = new CartResource(apiContext); - try - { - returnObj = resource.getUserCart( userId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.carts.Cart updateCart(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.Cart cart, int expectedCode, int successCode) throws Exception - { - return updateCart(apiContext, cart, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.carts.Cart updateCart(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.Cart cart, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); - CartResource resource = new CartResource(apiContext); - try - { - returnObj = resource.updateCart( cart, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteCart(ApiContext apiContext, String cartId, int expectedCode, int successCode) throws Exception - { - CartResource resource = new CartResource(apiContext); - try - { - resource.deleteCart( cartId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static void deleteCurrentCart(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - CartResource resource = new CartResource(apiContext); - try - { - resource.deleteCurrentCart(); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.CartResource; + +/** + * Use this resource to manage storefront shopping carts as shoppers add and remove items for purchase. Each time a shopper's cart is modified, the Carts resource updates the estimated total with any applicable discounts. + * + */ +public class CartFactory +{ + + public static com.mozu.api.contracts.commerceruntime.carts.Cart getCart(ApiContext apiContext, String cartId, int expectedCode) throws Exception + { + return getCart(apiContext, cartId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.carts.Cart getCart(ApiContext apiContext, String cartId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); + CartResource resource = new CartResource(apiContext); + try + { + returnObj = resource.getCart( cartId, 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.carts.Cart getOrCreateCart(ApiContext apiContext, int expectedCode) throws Exception + { + return getOrCreateCart(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.carts.Cart getOrCreateCart(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); + CartResource resource = new CartResource(apiContext); + try + { + returnObj = resource.getOrCreateCart( 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.carts.CartSummary getCartSummary(ApiContext apiContext, int expectedCode) throws Exception + { + return getCartSummary(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.carts.CartSummary getCartSummary(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.carts.CartSummary returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartSummary(); + CartResource resource = new CartResource(apiContext); + try + { + returnObj = resource.getCartSummary( 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.carts.CartSummary getUserCartSummary(ApiContext apiContext, String userId, int expectedCode) throws Exception + { + return getUserCartSummary(apiContext, userId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.carts.CartSummary getUserCartSummary(ApiContext apiContext, String userId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.carts.CartSummary returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartSummary(); + CartResource resource = new CartResource(apiContext); + try + { + returnObj = resource.getUserCartSummary( userId, 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.carts.Cart getUserCart(ApiContext apiContext, String userId, int expectedCode) throws Exception + { + return getUserCart(apiContext, userId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.carts.Cart getUserCart(ApiContext apiContext, String userId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); + CartResource resource = new CartResource(apiContext); + try + { + returnObj = resource.getUserCart( userId, 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.carts.Cart updateCart(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.Cart cart, int expectedCode) throws Exception + { + return updateCart(apiContext, cart, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.carts.Cart updateCart(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.Cart cart, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); + CartResource resource = new CartResource(apiContext); + try + { + returnObj = resource.updateCart( cart, 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 deleteCart(ApiContext apiContext, String cartId, int expectedCode) throws Exception + { + CartResource resource = new CartResource(apiContext); + try + { + resource.deleteCart( cartId); + } + 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, ""); + } + + public static void deleteCurrentCart(ApiContext apiContext, int expectedCode) throws Exception + { + CartResource resource = new CartResource(apiContext); + try + { + resource.deleteCurrentCart(); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartItemFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartItemFactory.java index 263569ad..06a49fcf 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartItemFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartItemFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CartItemFactory { - public static com.mozu.api.contracts.commerceruntime.carts.CartItem getCartItem(ApiContext apiContext, String cartItemId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItem getCartItem(ApiContext apiContext, String cartItemId, int expectedCode) throws Exception { - return getCartItem(apiContext, cartItemId, null, expectedCode, successCode ); + return getCartItem(apiContext, cartItemId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.carts.CartItem getCartItem(ApiContext apiContext, String cartItemId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItem getCartItem(ApiContext apiContext, String cartItemId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.CartItem returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartItem(); CartItemResource resource = new CartItemResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.carts.CartItem getCartItem( catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.carts.CartItemCollection getCartItems(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItemCollection getCartItems(ApiContext apiContext, int expectedCode) throws Exception { - return getCartItems(apiContext, null, expectedCode, successCode ); + return getCartItems(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.carts.CartItemCollection getCartItems(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItemCollection getCartItems(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.CartItemCollection returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartItemCollection(); CartItemResource resource = new CartItemResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.commerceruntime.carts.CartItemCollection ge catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.carts.CartItem addItemToCart(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.CartItem cartItem, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItem addItemToCart(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.CartItem cartItem, int expectedCode) throws Exception { - return addItemToCart(apiContext, cartItem, null, expectedCode, successCode ); + return addItemToCart(apiContext, cartItem, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.carts.CartItem addItemToCart(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.CartItem cartItem, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItem addItemToCart(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.CartItem cartItem, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.CartItem returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartItem(); CartItemResource resource = new CartItemResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.commerceruntime.carts.CartItem addItemToCar catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.carts.CartItem updateCartItemQuantity(ApiContext apiContext, String cartItemId, Integer quantity, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItem updateCartItemQuantity(ApiContext apiContext, String cartItemId, Integer quantity, int expectedCode) throws Exception { - return updateCartItemQuantity(apiContext, cartItemId, quantity, null, expectedCode, successCode ); + return updateCartItemQuantity(apiContext, cartItemId, quantity, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.carts.CartItem updateCartItemQuantity(ApiContext apiContext, String cartItemId, Integer quantity, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItem updateCartItemQuantity(ApiContext apiContext, String cartItemId, Integer quantity, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.CartItem returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartItem(); CartItemResource resource = new CartItemResource(apiContext); @@ -111,21 +112,21 @@ public static com.mozu.api.contracts.commerceruntime.carts.CartItem updateCartIt catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.carts.CartItem updateCartItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.CartItem cartItem, String cartItemId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItem updateCartItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.CartItem cartItem, String cartItemId, int expectedCode) throws Exception { - return updateCartItem(apiContext, cartItem, cartItemId, null, expectedCode, successCode ); + return updateCartItem(apiContext, cartItem, cartItemId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.carts.CartItem updateCartItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.CartItem cartItem, String cartItemId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartItem updateCartItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.carts.CartItem cartItem, String cartItemId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.CartItem returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartItem(); CartItemResource resource = new CartItemResource(apiContext); @@ -136,16 +137,16 @@ public static com.mozu.api.contracts.commerceruntime.carts.CartItem updateCartIt catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.carts.Cart removeAllCartItems(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.Cart removeAllCartItems(ApiContext apiContext, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); CartItemResource resource = new CartItemResource(apiContext); @@ -156,16 +157,16 @@ public static com.mozu.api.contracts.commerceruntime.carts.Cart removeAllCartIte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteCartItem(ApiContext apiContext, String cartItemId, int expectedCode, int successCode) throws Exception + public static void deleteCartItem(ApiContext apiContext, String cartItemId, int expectedCode) throws Exception { CartItemResource resource = new CartItemResource(apiContext); try @@ -175,12 +176,12 @@ public static void deleteCartItem(ApiContext apiContext, String cartItemId, int catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartsAppliedDiscountFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartsAppliedDiscountFactory.java index 0b4f8397..77dfd434 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartsAppliedDiscountFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartsAppliedDiscountFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CartsAppliedDiscountFactory { - public static com.mozu.api.contracts.commerceruntime.carts.Cart applyCoupon(ApiContext apiContext, String cartId, String couponCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.Cart applyCoupon(ApiContext apiContext, String cartId, String couponCode, int expectedCode) throws Exception { - return applyCoupon(apiContext, cartId, couponCode, null, expectedCode, successCode ); + return applyCoupon(apiContext, cartId, couponCode, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.carts.Cart applyCoupon(ApiContext apiContext, String cartId, String couponCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.Cart applyCoupon(ApiContext apiContext, String cartId, String couponCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); AppliedDiscountResource resource = new AppliedDiscountResource(apiContext); @@ -36,16 +37,16 @@ public static com.mozu.api.contracts.commerceruntime.carts.Cart applyCoupon(ApiC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.carts.Cart removeCoupons(ApiContext apiContext, String cartId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.Cart removeCoupons(ApiContext apiContext, String cartId, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); AppliedDiscountResource resource = new AppliedDiscountResource(apiContext); @@ -56,16 +57,16 @@ public static com.mozu.api.contracts.commerceruntime.carts.Cart removeCoupons(Ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.carts.Cart removeCoupon(ApiContext apiContext, String cartId, String couponCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.Cart removeCoupon(ApiContext apiContext, String cartId, String couponCode, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.Cart returnObj = new com.mozu.api.contracts.commerceruntime.carts.Cart(); AppliedDiscountResource resource = new AppliedDiscountResource(apiContext); @@ -76,12 +77,12 @@ public static com.mozu.api.contracts.commerceruntime.carts.Cart removeCoupon(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartsExtendedPropertyFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartsExtendedPropertyFactory.java index 73d602d0..540e2d52 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartsExtendedPropertyFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CartsExtendedPropertyFactory.java @@ -1,152 +1,153 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.carts.ExtendedPropertyResource; - -/** - * - * - */ -public class CartsExtendedPropertyFactory -{ - - public static List getExtendedProperties(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - returnObj = resource.getExtendedProperties(); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List addExtendedProperties(ApiContext apiContext, List extendedProperties, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - returnObj = resource.addExtendedProperties( extendedProperties); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty updateExtendedProperty(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty extendedProperty, String key, int expectedCode, int successCode) throws Exception - { - return updateExtendedProperty(apiContext, extendedProperty, key, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty updateExtendedProperty(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty extendedProperty, String key, Boolean upsert, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty returnObj = new com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty(); - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - returnObj = resource.updateExtendedProperty( extendedProperty, key, upsert, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List updateExtendedProperties(ApiContext apiContext, List extendedProperties, int expectedCode, int successCode) throws Exception - { - return updateExtendedProperties(apiContext, extendedProperties, null, expectedCode, successCode ); - } - - public static List updateExtendedProperties(ApiContext apiContext, List extendedProperties, Boolean upsert, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - returnObj = resource.updateExtendedProperties( extendedProperties, upsert); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteExtendedProperties(ApiContext apiContext, List keys, int expectedCode, int successCode) throws Exception - { - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - resource.deleteExtendedProperties( keys); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static void deleteExtendedProperty(ApiContext apiContext, String key, int expectedCode, int successCode) throws Exception - { - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - resource.deleteExtendedProperty( key); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.carts.ExtendedPropertyResource; + +/** + * commerce/carts/cartextendedproperties related resources. DOCUMENT_HERE + * + */ +public class CartsExtendedPropertyFactory +{ + + public static List getExtendedProperties(ApiContext apiContext, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + returnObj = resource.getExtendedProperties(); + } + 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 List addExtendedProperties(ApiContext apiContext, List extendedProperties, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + returnObj = resource.addExtendedProperties( extendedProperties); + } + 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.commerce.ExtendedProperty updateExtendedProperty(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty extendedProperty, String key, int expectedCode) throws Exception + { + return updateExtendedProperty(apiContext, extendedProperty, key, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty updateExtendedProperty(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty extendedProperty, String key, Boolean upsert, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty returnObj = new com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty(); + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + returnObj = resource.updateExtendedProperty( extendedProperty, key, upsert, 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 List updateExtendedProperties(ApiContext apiContext, List extendedProperties, int expectedCode) throws Exception + { + return updateExtendedProperties(apiContext, extendedProperties, null, expectedCode); + } + + public static List updateExtendedProperties(ApiContext apiContext, List extendedProperties, Boolean upsert, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + returnObj = resource.updateExtendedProperties( extendedProperties, upsert); + } + 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 deleteExtendedProperties(ApiContext apiContext, List keys, int expectedCode) throws Exception + { + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + resource.deleteExtendedProperties( keys); + } + 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, ""); + } + + public static void deleteExtendedProperty(ApiContext apiContext, String key, int expectedCode) throws Exception + { + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + resource.deleteExtendedProperty( key); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CategoryFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CategoryFactory.java index bcf02207..44813d90 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CategoryFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CategoryFactory.java @@ -1,174 +1,175 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.admin.CategoryResource; - -/** - * Use the Categories resource to organize products and control where they appear on the storefront. Create and maintain a hierarchy of categories and subcategories where the site will store properties. - * - */ -public class CategoryFactory -{ - - public static com.mozu.api.contracts.productadmin.CategoryPagedCollection getCategories(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getCategories(apiContext, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.CategoryPagedCollection getCategories(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.CategoryPagedCollection returnObj = new com.mozu.api.contracts.productadmin.CategoryPagedCollection(); - CategoryResource resource = new CategoryResource(apiContext); - try - { - returnObj = resource.getCategories( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.CategoryCollection getChildCategories(ApiContext apiContext, Integer categoryId, int expectedCode, int successCode) throws Exception - { - return getChildCategories(apiContext, categoryId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.CategoryCollection getChildCategories(ApiContext apiContext, Integer categoryId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.CategoryCollection returnObj = new com.mozu.api.contracts.productadmin.CategoryCollection(); - CategoryResource resource = new CategoryResource(apiContext); - try - { - returnObj = resource.getChildCategories( categoryId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.Category getCategory(ApiContext apiContext, Integer categoryId, int expectedCode, int successCode) throws Exception - { - return getCategory(apiContext, categoryId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.Category getCategory(ApiContext apiContext, Integer categoryId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.Category returnObj = new com.mozu.api.contracts.productadmin.Category(); - CategoryResource resource = new CategoryResource(apiContext); - try - { - returnObj = resource.getCategory( categoryId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.Category addCategory(ApiContext apiContext, com.mozu.api.contracts.productadmin.Category category, int expectedCode, int successCode) throws Exception - { - return addCategory(apiContext, category, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.Category addCategory(ApiContext apiContext, com.mozu.api.contracts.productadmin.Category category, Boolean incrementSequence, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.Category returnObj = new com.mozu.api.contracts.productadmin.Category(); - CategoryResource resource = new CategoryResource(apiContext); - try - { - returnObj = resource.addCategory( category, incrementSequence, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.Category updateCategory(ApiContext apiContext, com.mozu.api.contracts.productadmin.Category category, Integer categoryId, int expectedCode, int successCode) throws Exception - { - return updateCategory(apiContext, category, categoryId, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.Category updateCategory(ApiContext apiContext, com.mozu.api.contracts.productadmin.Category category, Integer categoryId, Boolean cascadeVisibility, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.Category returnObj = new com.mozu.api.contracts.productadmin.Category(); - CategoryResource resource = new CategoryResource(apiContext); - try - { - returnObj = resource.updateCategory( category, categoryId, cascadeVisibility, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteCategoryById(ApiContext apiContext, Integer categoryId, int expectedCode, int successCode) throws Exception - { - deleteCategoryById(apiContext, categoryId, null, null, null, expectedCode, successCode ); - } - - public static void deleteCategoryById(ApiContext apiContext, Integer categoryId, Boolean cascadeDelete, Boolean forceDelete, Boolean reassignToParent, int expectedCode, int successCode) throws Exception - { - CategoryResource resource = new CategoryResource(apiContext); - try - { - resource.deleteCategoryById( categoryId, cascadeDelete, forceDelete, reassignToParent); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.admin.CategoryResource; + +/** + * Use the Categories resource to organize products and control where they appear on the storefront. Create and maintain a hierarchy of categories and subcategories where the site will store properties. + * + */ +public class CategoryFactory +{ + + public static com.mozu.api.contracts.productadmin.CategoryPagedCollection getCategories(ApiContext apiContext, int expectedCode) throws Exception + { + return getCategories(apiContext, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.CategoryPagedCollection getCategories(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.CategoryPagedCollection returnObj = new com.mozu.api.contracts.productadmin.CategoryPagedCollection(); + CategoryResource resource = new CategoryResource(apiContext); + try + { + returnObj = resource.getCategories( 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.productadmin.CategoryCollection getChildCategories(ApiContext apiContext, Integer categoryId, int expectedCode) throws Exception + { + return getChildCategories(apiContext, categoryId, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.CategoryCollection getChildCategories(ApiContext apiContext, Integer categoryId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.CategoryCollection returnObj = new com.mozu.api.contracts.productadmin.CategoryCollection(); + CategoryResource resource = new CategoryResource(apiContext); + try + { + returnObj = resource.getChildCategories( categoryId, 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.productadmin.Category getCategory(ApiContext apiContext, Integer categoryId, int expectedCode) throws Exception + { + return getCategory(apiContext, categoryId, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.Category getCategory(ApiContext apiContext, Integer categoryId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.Category returnObj = new com.mozu.api.contracts.productadmin.Category(); + CategoryResource resource = new CategoryResource(apiContext); + try + { + returnObj = resource.getCategory( categoryId, 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.productadmin.Category addCategory(ApiContext apiContext, com.mozu.api.contracts.productadmin.Category category, int expectedCode) throws Exception + { + return addCategory(apiContext, category, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.Category addCategory(ApiContext apiContext, com.mozu.api.contracts.productadmin.Category category, Boolean incrementSequence, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.Category returnObj = new com.mozu.api.contracts.productadmin.Category(); + CategoryResource resource = new CategoryResource(apiContext); + try + { + returnObj = resource.addCategory( category, incrementSequence, 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.productadmin.Category updateCategory(ApiContext apiContext, com.mozu.api.contracts.productadmin.Category category, Integer categoryId, int expectedCode) throws Exception + { + return updateCategory(apiContext, category, categoryId, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.Category updateCategory(ApiContext apiContext, com.mozu.api.contracts.productadmin.Category category, Integer categoryId, Boolean cascadeVisibility, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.Category returnObj = new com.mozu.api.contracts.productadmin.Category(); + CategoryResource resource = new CategoryResource(apiContext); + try + { + returnObj = resource.updateCategory( category, categoryId, cascadeVisibility, 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 deleteCategoryById(ApiContext apiContext, Integer categoryId, int expectedCode) throws Exception + { + deleteCategoryById(apiContext, categoryId, null, null, null, expectedCode); + } + + public static void deleteCategoryById(ApiContext apiContext, Integer categoryId, Boolean cascadeDelete, Boolean forceDelete, Boolean reassignToParent, int expectedCode) throws Exception + { + CategoryResource resource = new CategoryResource(apiContext); + try + { + resource.deleteCategoryById( categoryId, cascadeDelete, forceDelete, reassignToParent); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChangeMessageFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChangeMessageFactory.java index 23bb7e02..a65ce252 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChangeMessageFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChangeMessageFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ChangeMessageFactory { - public static com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection getMessages(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection getMessages(ApiContext apiContext, int expectedCode) throws Exception { - return getMessages(apiContext, null, expectedCode, successCode ); + return getMessages(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection getMessages(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection getMessages(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection returnObj = new com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageCollection(); ChangeMessageResource resource = new ChangeMessageResource(apiContext); @@ -36,16 +37,16 @@ public static com.mozu.api.contracts.commerceruntime.carts.CartChangeMessageColl catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 removeAllMessages(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static void removeAllMessages(ApiContext apiContext, int expectedCode) throws Exception { ChangeMessageResource resource = new ChangeMessageResource(apiContext); try @@ -55,15 +56,15 @@ public static void removeAllMessages(ApiContext apiContext, int expectedCode, in catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void removeMessage(ApiContext apiContext, String messageId, int expectedCode, int successCode) throws Exception + public static void removeMessage(ApiContext apiContext, String messageId, int expectedCode) throws Exception { ChangeMessageResource resource = new ChangeMessageResource(apiContext); try @@ -73,12 +74,12 @@ public static void removeMessage(ApiContext apiContext, String messageId, int ex catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChannelFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChannelFactory.java index 015a7695..c4f0a10c 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChannelFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChannelFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ChannelFactory { - public static com.mozu.api.contracts.commerceruntime.channels.ChannelCollection getChannels(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelCollection getChannels(ApiContext apiContext, int expectedCode) throws Exception { - return getChannels(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getChannels(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.channels.ChannelCollection getChannels(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelCollection getChannels(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.channels.ChannelCollection returnObj = new com.mozu.api.contracts.commerceruntime.channels.ChannelCollection(); ChannelResource resource = new ChannelResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.channels.ChannelCollection catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.channels.Channel getChannel(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.Channel getChannel(ApiContext apiContext, String code, int expectedCode) throws Exception { - return getChannel(apiContext, code, null, expectedCode, successCode ); + return getChannel(apiContext, code, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.channels.Channel getChannel(ApiContext apiContext, String code, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.Channel getChannel(ApiContext apiContext, String code, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.channels.Channel returnObj = new com.mozu.api.contracts.commerceruntime.channels.Channel(); ChannelResource resource = new ChannelResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.commerceruntime.channels.Channel getChannel catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.channels.Channel createChannel(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.Channel channel, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.Channel createChannel(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.Channel channel, int expectedCode) throws Exception { - return createChannel(apiContext, channel, null, expectedCode, successCode ); + return createChannel(apiContext, channel, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.channels.Channel createChannel(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.Channel channel, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.Channel createChannel(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.Channel channel, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.channels.Channel returnObj = new com.mozu.api.contracts.commerceruntime.channels.Channel(); ChannelResource resource = new ChannelResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.commerceruntime.channels.Channel createChan catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.channels.Channel updateChannel(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.Channel channel, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.Channel updateChannel(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.Channel channel, String code, int expectedCode) throws Exception { - return updateChannel(apiContext, channel, code, null, expectedCode, successCode ); + return updateChannel(apiContext, channel, code, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.channels.Channel updateChannel(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.Channel channel, String code, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.Channel updateChannel(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.Channel channel, String code, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.channels.Channel returnObj = new com.mozu.api.contracts.commerceruntime.channels.Channel(); ChannelResource resource = new ChannelResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.commerceruntime.channels.Channel updateChan catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteChannel(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception + public static void deleteChannel(ApiContext apiContext, String code, int expectedCode) throws Exception { ChannelResource resource = new ChannelResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteChannel(ApiContext apiContext, String code, int expecte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChannelGroupFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChannelGroupFactory.java index 1e7afa2f..eba9b5fb 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChannelGroupFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ChannelGroupFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ChannelGroupFactory { - public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroupCollection getChannelGroups(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroupCollection getChannelGroups(ApiContext apiContext, int expectedCode) throws Exception { - return getChannelGroups(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getChannelGroups(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroupCollection getChannelGroups(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroupCollection getChannelGroups(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.channels.ChannelGroupCollection returnObj = new com.mozu.api.contracts.commerceruntime.channels.ChannelGroupCollection(); ChannelGroupResource resource = new ChannelGroupResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroupCollec catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.channels.ChannelGroup getChannelGroup(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup getChannelGroup(ApiContext apiContext, String code, int expectedCode) throws Exception { - return getChannelGroup(apiContext, code, null, expectedCode, successCode ); + return getChannelGroup(apiContext, code, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup getChannelGroup(ApiContext apiContext, String code, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup getChannelGroup(ApiContext apiContext, String code, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.channels.ChannelGroup returnObj = new com.mozu.api.contracts.commerceruntime.channels.ChannelGroup(); ChannelGroupResource resource = new ChannelGroupResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup getCh catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.channels.ChannelGroup createChannelGroup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup createChannelGroup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, int expectedCode) throws Exception { - return createChannelGroup(apiContext, channelGroup, null, expectedCode, successCode ); + return createChannelGroup(apiContext, channelGroup, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup createChannelGroup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup createChannelGroup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.channels.ChannelGroup returnObj = new com.mozu.api.contracts.commerceruntime.channels.ChannelGroup(); ChannelGroupResource resource = new ChannelGroupResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup creat catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.channels.ChannelGroup updateChannelGroup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup updateChannelGroup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, String code, int expectedCode) throws Exception { - return updateChannelGroup(apiContext, channelGroup, code, null, expectedCode, successCode ); + return updateChannelGroup(apiContext, channelGroup, code, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup updateChannelGroup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, String code, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup updateChannelGroup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.channels.ChannelGroup channelGroup, String code, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.channels.ChannelGroup returnObj = new com.mozu.api.contracts.commerceruntime.channels.ChannelGroup(); ChannelGroupResource resource = new ChannelGroupResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.commerceruntime.channels.ChannelGroup updat catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteChannelGroup(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception + public static void deleteChannelGroup(ApiContext apiContext, String code, int expectedCode) throws Exception { ChannelGroupResource resource = new ChannelGroupResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteChannelGroup(ApiContext apiContext, String code, int ex catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CheckoutSettingsFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CheckoutSettingsFactory.java index a8e26287..899d6a73 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CheckoutSettingsFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CheckoutSettingsFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CheckoutSettingsFactory { - public static com.mozu.api.contracts.sitesettings.order.CheckoutSettings getCheckoutSettings(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.order.CheckoutSettings getCheckoutSettings(ApiContext apiContext, int expectedCode) throws Exception { - return getCheckoutSettings(apiContext, null, expectedCode, successCode ); + return getCheckoutSettings(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.order.CheckoutSettings getCheckoutSettings(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.order.CheckoutSettings getCheckoutSettings(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.order.CheckoutSettings returnObj = new com.mozu.api.contracts.sitesettings.order.CheckoutSettings(); CheckoutSettingsResource resource = new CheckoutSettingsResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.sitesettings.order.CheckoutSettings getChec catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CommerceLocationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CommerceLocationFactory.java index 4cb13a3e..a0a83d87 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CommerceLocationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CommerceLocationFactory.java @@ -1,151 +1,152 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.LocationResource; - -/** - * Use the Location resource to retrieve details about a location from a Mozu hosted storefront. - * - */ -public class CommerceLocationFactory -{ - - public static com.mozu.api.contracts.location.Location getLocation(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception - { - return getLocation(apiContext, code, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.location.Location getLocation(ApiContext apiContext, String code, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); - LocationResource resource = new LocationResource(apiContext); - try - { - returnObj = resource.getLocation( code, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.location.LocationCollection getLocationsInUsageType(ApiContext apiContext, String locationUsageType, int expectedCode, int successCode) throws Exception - { - return getLocationsInUsageType(apiContext, locationUsageType, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.location.LocationCollection getLocationsInUsageType(ApiContext apiContext, String locationUsageType, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.location.LocationCollection returnObj = new com.mozu.api.contracts.location.LocationCollection(); - LocationResource resource = new LocationResource(apiContext); - try - { - returnObj = resource.getLocationsInUsageType( locationUsageType, 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.location.Location getDirectShipLocation(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getDirectShipLocation(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.location.Location getDirectShipLocation(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); - LocationResource resource = new LocationResource(apiContext); - try - { - returnObj = resource.getDirectShipLocation( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.location.Location getInStorePickupLocation(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception - { - return getInStorePickupLocation(apiContext, code, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.location.Location getInStorePickupLocation(ApiContext apiContext, String code, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); - LocationResource resource = new LocationResource(apiContext); - try - { - returnObj = resource.getInStorePickupLocation( code, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.location.LocationCollection getInStorePickupLocations(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getInStorePickupLocations(apiContext, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.location.LocationCollection getInStorePickupLocations(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.location.LocationCollection returnObj = new com.mozu.api.contracts.location.LocationCollection(); - LocationResource resource = new LocationResource(apiContext); - try - { - returnObj = resource.getInStorePickupLocations( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.LocationResource; + +/** + * Use the Location resource to retrieve details about a location from a Mozu hosted storefront. + * + */ +public class CommerceLocationFactory +{ + + public static com.mozu.api.contracts.location.Location getLocation(ApiContext apiContext, String code, int expectedCode) throws Exception + { + return getLocation(apiContext, code, null, expectedCode); + } + + public static com.mozu.api.contracts.location.Location getLocation(ApiContext apiContext, String code, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); + LocationResource resource = new LocationResource(apiContext); + try + { + returnObj = resource.getLocation( code, 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.location.LocationCollection getLocationsInUsageType(ApiContext apiContext, String locationUsageType, int expectedCode) throws Exception + { + return getLocationsInUsageType(apiContext, locationUsageType, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.location.LocationCollection getLocationsInUsageType(ApiContext apiContext, String locationUsageType, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.location.LocationCollection returnObj = new com.mozu.api.contracts.location.LocationCollection(); + LocationResource resource = new LocationResource(apiContext); + try + { + returnObj = resource.getLocationsInUsageType( locationUsageType, 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.location.Location getDirectShipLocation(ApiContext apiContext, int expectedCode) throws Exception + { + return getDirectShipLocation(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.location.Location getDirectShipLocation(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); + LocationResource resource = new LocationResource(apiContext); + try + { + returnObj = resource.getDirectShipLocation( 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.location.Location getInStorePickupLocation(ApiContext apiContext, String code, int expectedCode) throws Exception + { + return getInStorePickupLocation(apiContext, code, null, expectedCode); + } + + public static com.mozu.api.contracts.location.Location getInStorePickupLocation(ApiContext apiContext, String code, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); + LocationResource resource = new LocationResource(apiContext); + try + { + returnObj = resource.getInStorePickupLocation( code, 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.location.LocationCollection getInStorePickupLocations(ApiContext apiContext, int expectedCode) throws Exception + { + return getInStorePickupLocations(apiContext, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.location.LocationCollection getInStorePickupLocations(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.location.LocationCollection returnObj = new com.mozu.api.contracts.location.LocationCollection(); + LocationResource resource = new LocationResource(apiContext); + try + { + returnObj = resource.getInStorePickupLocations( 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditAuditEntryFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditAuditEntryFactory.java index f5f774b7..418d650c 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditAuditEntryFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditAuditEntryFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CreditAuditEntryFactory { - public static com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection getAuditEntries(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection getAuditEntries(ApiContext apiContext, String code, int expectedCode) throws Exception { - return getAuditEntries(apiContext, code, null, null, null, null, null, expectedCode, successCode ); + return getAuditEntries(apiContext, code, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection getAuditEntries(ApiContext apiContext, String code, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection getAuditEntries(ApiContext apiContext, String code, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection returnObj = new com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection(); CreditAuditEntryResource resource = new CreditAuditEntryResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.customer.credit.CreditAuditEntryCollection catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditFactory.java index b6ea4fb6..698b16df 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditFactory.java @@ -1,187 +1,188 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.customer.CreditResource; - -/** - * Use the Customer Credits resource to manage the store credit associated with a customer account. Store credit can represent a static amount the customer can redeem at any of the tenant's sites, or a gift card registered for a customer account. At this time, gift card functionality is reserved for future use. - * - */ -public class CreditFactory -{ - - public static com.mozu.api.contracts.customer.credit.CreditCollection getCredits(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getCredits(apiContext, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.credit.CreditCollection getCredits(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.credit.CreditCollection returnObj = new com.mozu.api.contracts.customer.credit.CreditCollection(); - CreditResource resource = new CreditResource(apiContext); - try - { - returnObj = resource.getCredits( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.credit.Credit getCredit(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception - { - return getCredit(apiContext, code, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.credit.Credit getCredit(ApiContext apiContext, String code, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.credit.Credit returnObj = new com.mozu.api.contracts.customer.credit.Credit(); - CreditResource resource = new CreditResource(apiContext); - try - { - returnObj = resource.getCredit( code, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.credit.Credit addCredit(ApiContext apiContext, com.mozu.api.contracts.customer.credit.Credit credit, int expectedCode, int successCode) throws Exception - { - return addCredit(apiContext, credit, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.credit.Credit addCredit(ApiContext apiContext, com.mozu.api.contracts.customer.credit.Credit credit, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.credit.Credit returnObj = new com.mozu.api.contracts.customer.credit.Credit(); - CreditResource resource = new CreditResource(apiContext); - try - { - returnObj = resource.addCredit( credit, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.credit.Credit associateCreditToShopper(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception - { - return associateCreditToShopper(apiContext, code, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.credit.Credit associateCreditToShopper(ApiContext apiContext, String code, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.credit.Credit returnObj = new com.mozu.api.contracts.customer.credit.Credit(); - CreditResource resource = new CreditResource(apiContext); - try - { - returnObj = resource.associateCreditToShopper( code, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void resendCreditCreatedEmail(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception - { - CreditResource resource = new CreditResource(apiContext); - try - { - resource.resendCreditCreatedEmail( code); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static com.mozu.api.contracts.customer.credit.Credit updateCredit(ApiContext apiContext, com.mozu.api.contracts.customer.credit.Credit credit, String code, int expectedCode, int successCode) throws Exception - { - return updateCredit(apiContext, credit, code, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.credit.Credit updateCredit(ApiContext apiContext, com.mozu.api.contracts.customer.credit.Credit credit, String code, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.credit.Credit returnObj = new com.mozu.api.contracts.customer.credit.Credit(); - CreditResource resource = new CreditResource(apiContext); - try - { - returnObj = resource.updateCredit( credit, code, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteCredit(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception - { - CreditResource resource = new CreditResource(apiContext); - try - { - resource.deleteCredit( code); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.customer.CreditResource; + +/** + * Use the Customer Credits resource to manage the store credit associated with a customer account. Store credit can represent a static amount the customer can redeem at any of the tenant's sites, or a gift card registered for a customer account. At this time, gift card functionality is reserved for future use. + * + */ +public class CreditFactory +{ + + public static com.mozu.api.contracts.customer.credit.CreditCollection getCredits(ApiContext apiContext, int expectedCode) throws Exception + { + return getCredits(apiContext, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.credit.CreditCollection getCredits(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.credit.CreditCollection returnObj = new com.mozu.api.contracts.customer.credit.CreditCollection(); + CreditResource resource = new CreditResource(apiContext); + try + { + returnObj = resource.getCredits( 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.customer.credit.Credit getCredit(ApiContext apiContext, String code, int expectedCode) throws Exception + { + return getCredit(apiContext, code, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.credit.Credit getCredit(ApiContext apiContext, String code, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.credit.Credit returnObj = new com.mozu.api.contracts.customer.credit.Credit(); + CreditResource resource = new CreditResource(apiContext); + try + { + returnObj = resource.getCredit( code, 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.customer.credit.Credit addCredit(ApiContext apiContext, com.mozu.api.contracts.customer.credit.Credit credit, int expectedCode) throws Exception + { + return addCredit(apiContext, credit, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.credit.Credit addCredit(ApiContext apiContext, com.mozu.api.contracts.customer.credit.Credit credit, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.credit.Credit returnObj = new com.mozu.api.contracts.customer.credit.Credit(); + CreditResource resource = new CreditResource(apiContext); + try + { + returnObj = resource.addCredit( credit, 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.customer.credit.Credit associateCreditToShopper(ApiContext apiContext, String code, int expectedCode) throws Exception + { + return associateCreditToShopper(apiContext, code, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.credit.Credit associateCreditToShopper(ApiContext apiContext, String code, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.credit.Credit returnObj = new com.mozu.api.contracts.customer.credit.Credit(); + CreditResource resource = new CreditResource(apiContext); + try + { + returnObj = resource.associateCreditToShopper( code, 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 resendCreditCreatedEmail(ApiContext apiContext, String code, int expectedCode) throws Exception + { + CreditResource resource = new CreditResource(apiContext); + try + { + resource.resendCreditCreatedEmail( code); + } + 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, ""); + } + + public static com.mozu.api.contracts.customer.credit.Credit updateCredit(ApiContext apiContext, com.mozu.api.contracts.customer.credit.Credit credit, String code, int expectedCode) throws Exception + { + return updateCredit(apiContext, credit, code, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.credit.Credit updateCredit(ApiContext apiContext, com.mozu.api.contracts.customer.credit.Credit credit, String code, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.credit.Credit returnObj = new com.mozu.api.contracts.customer.credit.Credit(); + CreditResource resource = new CreditResource(apiContext); + try + { + returnObj = resource.updateCredit( credit, code, 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 deleteCredit(ApiContext apiContext, String code, int expectedCode) throws Exception + { + CreditResource resource = new CreditResource(apiContext); + try + { + resource.deleteCredit( code); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditTransactionFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditTransactionFactory.java index 085d9c0b..8b3747a9 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditTransactionFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CreditTransactionFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CreditTransactionFactory { - public static com.mozu.api.contracts.customer.credit.CreditTransactionCollection getTransactions(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.credit.CreditTransactionCollection getTransactions(ApiContext apiContext, String code, int expectedCode) throws Exception { - return getTransactions(apiContext, code, null, null, null, null, null, expectedCode, successCode ); + return getTransactions(apiContext, code, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.customer.credit.CreditTransactionCollection getTransactions(ApiContext apiContext, String code, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.credit.CreditTransactionCollection getTransactions(ApiContext apiContext, String code, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.credit.CreditTransactionCollection returnObj = new com.mozu.api.contracts.customer.credit.CreditTransactionCollection(); CreditTransactionResource resource = new CreditTransactionResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.customer.credit.CreditTransactionCollection catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.credit.CreditTransaction addTransaction(ApiContext apiContext, com.mozu.api.contracts.customer.credit.CreditTransaction creditTransaction, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.credit.CreditTransaction addTransaction(ApiContext apiContext, com.mozu.api.contracts.customer.credit.CreditTransaction creditTransaction, String code, int expectedCode) throws Exception { - return addTransaction(apiContext, creditTransaction, code, null, expectedCode, successCode ); + return addTransaction(apiContext, creditTransaction, code, null, expectedCode); } - public static com.mozu.api.contracts.customer.credit.CreditTransaction addTransaction(ApiContext apiContext, com.mozu.api.contracts.customer.credit.CreditTransaction creditTransaction, String code, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.credit.CreditTransaction addTransaction(ApiContext apiContext, com.mozu.api.contracts.customer.credit.CreditTransaction creditTransaction, String code, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.credit.CreditTransaction returnObj = new com.mozu.api.contracts.customer.credit.CreditTransaction(); CreditTransactionResource resource = new CreditTransactionResource(apiContext); @@ -61,12 +62,12 @@ public static com.mozu.api.contracts.customer.credit.CreditTransaction addTransa catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAccountFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAccountFactory.java index 8e064d5d..e1554ded 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAccountFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAccountFactory.java @@ -1,414 +1,415 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.customer.CustomerAccountResource; - -/** - * Use the Customer Accounts resource to manage the components of shopper accounts, including attributes, contact information, company notes, and groups associated with the customer account. - * - */ -public class CustomerAccountFactory -{ - - public static com.mozu.api.contracts.customer.CustomerAccountCollection getAccounts(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getAccounts(apiContext, null, null, null, null, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerAccountCollection getAccounts(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String fields, String q, Integer qLimit, Boolean isAnonymous, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerAccountCollection returnObj = new com.mozu.api.contracts.customer.CustomerAccountCollection(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.getAccounts( startIndex, pageSize, sortBy, filter, fields, q, qLimit, isAnonymous, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.LoginState getLoginState(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception - { - return getLoginState(apiContext, accountId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.LoginState getLoginState(ApiContext apiContext, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.LoginState returnObj = new com.mozu.api.contracts.customer.LoginState(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.getLoginState( accountId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.CustomerAccount getAccount(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception - { - return getAccount(apiContext, accountId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerAccount getAccount(ApiContext apiContext, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerAccount returnObj = new com.mozu.api.contracts.customer.CustomerAccount(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.getAccount( accountId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.CustomerAccount addAccount(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccount account, int expectedCode, int successCode) throws Exception - { - return addAccount(apiContext, account, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerAccount addAccount(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccount account, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerAccount returnObj = new com.mozu.api.contracts.customer.CustomerAccount(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.addAccount( account, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void changePassword(ApiContext apiContext, com.mozu.api.contracts.customer.PasswordInfo passwordInfo, Integer accountId, int expectedCode, int successCode) throws Exception - { - changePassword(apiContext, passwordInfo, accountId, null, expectedCode, successCode ); - } - - public static void changePassword(ApiContext apiContext, com.mozu.api.contracts.customer.PasswordInfo passwordInfo, Integer accountId, Boolean unlockAccount, int expectedCode, int successCode) throws Exception - { - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - resource.changePassword( passwordInfo, accountId, unlockAccount); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static com.mozu.api.contracts.customer.CustomerAuthTicket addLoginToExistingCustomer(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerLoginInfo customerAuthInfo, Integer accountId, int expectedCode, int successCode) throws Exception - { - return addLoginToExistingCustomer(apiContext, customerAuthInfo, accountId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerAuthTicket addLoginToExistingCustomer(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerLoginInfo customerAuthInfo, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerAuthTicket returnObj = new com.mozu.api.contracts.customer.CustomerAuthTicket(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.addLoginToExistingCustomer( customerAuthInfo, accountId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void recomputeCustomerLifetimeValue(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception - { - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - resource.recomputeCustomerLifetimeValue( accountId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static void setLoginLocked(ApiContext apiContext, Boolean isLocked, Integer accountId, int expectedCode, int successCode) throws Exception - { - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - resource.setLoginLocked( isLocked, accountId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static void setPasswordChangeRequired(ApiContext apiContext, Boolean isPasswordChangeRequired, Integer accountId, int expectedCode, int successCode) throws Exception - { - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - resource.setPasswordChangeRequired( isPasswordChangeRequired, accountId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static com.mozu.api.contracts.customer.CustomerAuthTicket addAccountAndLogin(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccountAndAuthInfo accountAndAuthInfo, int expectedCode, int successCode) throws Exception - { - return addAccountAndLogin(apiContext, accountAndAuthInfo, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerAuthTicket addAccountAndLogin(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccountAndAuthInfo accountAndAuthInfo, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerAuthTicket returnObj = new com.mozu.api.contracts.customer.CustomerAuthTicket(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.addAccountAndLogin( accountAndAuthInfo, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.CustomerAccountCollection addAccounts(ApiContext apiContext, List customers, int expectedCode, int successCode) throws Exception - { - return addAccounts(apiContext, customers, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerAccountCollection addAccounts(ApiContext apiContext, List customers, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerAccountCollection returnObj = new com.mozu.api.contracts.customer.CustomerAccountCollection(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.addAccounts( customers, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.ChangePasswordResultCollection changePasswords(ApiContext apiContext, com.mozu.api.contracts.customer.AccountPasswordInfoCollection accountPasswordInfos, int expectedCode, int successCode) throws Exception - { - return changePasswords(apiContext, accountPasswordInfos, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.ChangePasswordResultCollection changePasswords(ApiContext apiContext, com.mozu.api.contracts.customer.AccountPasswordInfoCollection accountPasswordInfos, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.ChangePasswordResultCollection returnObj = new com.mozu.api.contracts.customer.ChangePasswordResultCollection(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.changePasswords( accountPasswordInfos, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.LoginState getLoginStateByEmailAddress(ApiContext apiContext, String emailAddress, int expectedCode, int successCode) throws Exception - { - return getLoginStateByEmailAddress(apiContext, emailAddress, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.LoginState getLoginStateByEmailAddress(ApiContext apiContext, String emailAddress, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.LoginState returnObj = new com.mozu.api.contracts.customer.LoginState(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.getLoginStateByEmailAddress( emailAddress, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.LoginState getLoginStateByUserName(ApiContext apiContext, String userName, int expectedCode, int successCode) throws Exception - { - return getLoginStateByUserName(apiContext, userName, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.LoginState getLoginStateByUserName(ApiContext apiContext, String userName, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.LoginState returnObj = new com.mozu.api.contracts.customer.LoginState(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.getLoginStateByUserName( userName, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void resetPassword(ApiContext apiContext, com.mozu.api.contracts.customer.ResetPasswordInfo resetPasswordInfo, int expectedCode, int successCode) throws Exception - { - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - resource.resetPassword( resetPasswordInfo); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static com.mozu.api.contracts.customer.CustomerAccount updateAccount(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccount account, Integer accountId, int expectedCode, int successCode) throws Exception - { - return updateAccount(apiContext, account, accountId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerAccount updateAccount(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccount account, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerAccount returnObj = new com.mozu.api.contracts.customer.CustomerAccount(); - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - returnObj = resource.updateAccount( account, accountId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteAccount(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception - { - CustomerAccountResource resource = new CustomerAccountResource(apiContext); - try - { - resource.deleteAccount( accountId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.customer.CustomerAccountResource; + +/** + * Use the Customer Accounts resource to manage the components of shopper accounts, including attributes, contact information, company notes, and groups associated with the customer account. + * + */ +public class CustomerAccountFactory +{ + + public static com.mozu.api.contracts.customer.CustomerAccountCollection getAccounts(ApiContext apiContext, int expectedCode) throws Exception + { + return getAccounts(apiContext, null, null, null, null, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerAccountCollection getAccounts(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String fields, String q, Integer qLimit, Boolean isAnonymous, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerAccountCollection returnObj = new com.mozu.api.contracts.customer.CustomerAccountCollection(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.getAccounts( startIndex, pageSize, sortBy, filter, fields, q, qLimit, isAnonymous, 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.customer.LoginState getLoginState(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception + { + return getLoginState(apiContext, accountId, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.LoginState getLoginState(ApiContext apiContext, Integer accountId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.LoginState returnObj = new com.mozu.api.contracts.customer.LoginState(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.getLoginState( accountId, 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.customer.CustomerAccount getAccount(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception + { + return getAccount(apiContext, accountId, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerAccount getAccount(ApiContext apiContext, Integer accountId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerAccount returnObj = new com.mozu.api.contracts.customer.CustomerAccount(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.getAccount( accountId, 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.customer.CustomerAccount addAccount(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccount account, int expectedCode) throws Exception + { + return addAccount(apiContext, account, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerAccount addAccount(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccount account, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerAccount returnObj = new com.mozu.api.contracts.customer.CustomerAccount(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.addAccount( account, 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 changePassword(ApiContext apiContext, com.mozu.api.contracts.customer.PasswordInfo passwordInfo, Integer accountId, int expectedCode) throws Exception + { + changePassword(apiContext, passwordInfo, accountId, null, expectedCode); + } + + public static void changePassword(ApiContext apiContext, com.mozu.api.contracts.customer.PasswordInfo passwordInfo, Integer accountId, Boolean unlockAccount, int expectedCode) throws Exception + { + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + resource.changePassword( passwordInfo, accountId, unlockAccount); + } + 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, ""); + } + + public static com.mozu.api.contracts.customer.CustomerAuthTicket addLoginToExistingCustomer(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerLoginInfo customerAuthInfo, Integer accountId, int expectedCode) throws Exception + { + return addLoginToExistingCustomer(apiContext, customerAuthInfo, accountId, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerAuthTicket addLoginToExistingCustomer(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerLoginInfo customerAuthInfo, Integer accountId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerAuthTicket returnObj = new com.mozu.api.contracts.customer.CustomerAuthTicket(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.addLoginToExistingCustomer( customerAuthInfo, accountId, 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 recomputeCustomerLifetimeValue(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception + { + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + resource.recomputeCustomerLifetimeValue( accountId); + } + 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, ""); + } + + public static void setLoginLocked(ApiContext apiContext, Boolean isLocked, Integer accountId, int expectedCode) throws Exception + { + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + resource.setLoginLocked( isLocked, accountId); + } + 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, ""); + } + + public static void setPasswordChangeRequired(ApiContext apiContext, Boolean isPasswordChangeRequired, Integer accountId, int expectedCode) throws Exception + { + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + resource.setPasswordChangeRequired( isPasswordChangeRequired, accountId); + } + 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, ""); + } + + public static com.mozu.api.contracts.customer.CustomerAuthTicket addAccountAndLogin(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccountAndAuthInfo accountAndAuthInfo, int expectedCode) throws Exception + { + return addAccountAndLogin(apiContext, accountAndAuthInfo, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerAuthTicket addAccountAndLogin(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccountAndAuthInfo accountAndAuthInfo, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerAuthTicket returnObj = new com.mozu.api.contracts.customer.CustomerAuthTicket(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.addAccountAndLogin( accountAndAuthInfo, 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.customer.CustomerAccountCollection addAccounts(ApiContext apiContext, List customers, int expectedCode) throws Exception + { + return addAccounts(apiContext, customers, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerAccountCollection addAccounts(ApiContext apiContext, List customers, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerAccountCollection returnObj = new com.mozu.api.contracts.customer.CustomerAccountCollection(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.addAccounts( customers, 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.customer.ChangePasswordResultCollection changePasswords(ApiContext apiContext, com.mozu.api.contracts.customer.AccountPasswordInfoCollection accountPasswordInfos, int expectedCode) throws Exception + { + return changePasswords(apiContext, accountPasswordInfos, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.ChangePasswordResultCollection changePasswords(ApiContext apiContext, com.mozu.api.contracts.customer.AccountPasswordInfoCollection accountPasswordInfos, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.ChangePasswordResultCollection returnObj = new com.mozu.api.contracts.customer.ChangePasswordResultCollection(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.changePasswords( accountPasswordInfos, 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.customer.LoginState getLoginStateByEmailAddress(ApiContext apiContext, String emailAddress, int expectedCode) throws Exception + { + return getLoginStateByEmailAddress(apiContext, emailAddress, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.LoginState getLoginStateByEmailAddress(ApiContext apiContext, String emailAddress, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.LoginState returnObj = new com.mozu.api.contracts.customer.LoginState(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.getLoginStateByEmailAddress( emailAddress, 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.customer.LoginState getLoginStateByUserName(ApiContext apiContext, String userName, int expectedCode) throws Exception + { + return getLoginStateByUserName(apiContext, userName, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.LoginState getLoginStateByUserName(ApiContext apiContext, String userName, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.LoginState returnObj = new com.mozu.api.contracts.customer.LoginState(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.getLoginStateByUserName( userName, 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 resetPassword(ApiContext apiContext, com.mozu.api.contracts.customer.ResetPasswordInfo resetPasswordInfo, int expectedCode) throws Exception + { + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + resource.resetPassword( resetPasswordInfo); + } + 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, ""); + } + + public static com.mozu.api.contracts.customer.CustomerAccount updateAccount(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccount account, Integer accountId, int expectedCode) throws Exception + { + return updateAccount(apiContext, account, accountId, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerAccount updateAccount(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAccount account, Integer accountId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerAccount returnObj = new com.mozu.api.contracts.customer.CustomerAccount(); + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + returnObj = resource.updateAccount( account, accountId, 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 deleteAccount(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception + { + CustomerAccountResource resource = new CustomerAccountResource(apiContext); + try + { + resource.deleteAccount( accountId); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAttributeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAttributeFactory.java index 4b5d0ae4..e7195d4e 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAttributeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAttributeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CustomerAttributeFactory { - public static com.mozu.api.contracts.customer.CustomerAttribute getAccountAttribute(ApiContext apiContext, Integer accountId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAttribute getAccountAttribute(ApiContext apiContext, Integer accountId, String attributeFQN, int expectedCode) throws Exception { - return getAccountAttribute(apiContext, accountId, attributeFQN, null, expectedCode, successCode ); + return getAccountAttribute(apiContext, accountId, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerAttribute getAccountAttribute(ApiContext apiContext, Integer accountId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAttribute getAccountAttribute(ApiContext apiContext, Integer accountId, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerAttribute returnObj = new com.mozu.api.contracts.customer.CustomerAttribute(); CustomerAttributeResource resource = new CustomerAttributeResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.customer.CustomerAttribute getAccountAttrib catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerAttributeCollection getAccountAttributes(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAttributeCollection getAccountAttributes(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception { - return getAccountAttributes(apiContext, accountId, null, null, null, null, null, expectedCode, successCode ); + return getAccountAttributes(apiContext, accountId, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerAttributeCollection getAccountAttributes(ApiContext apiContext, Integer accountId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAttributeCollection getAccountAttributes(ApiContext apiContext, Integer accountId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerAttributeCollection returnObj = new com.mozu.api.contracts.customer.CustomerAttributeCollection(); CustomerAttributeResource resource = new CustomerAttributeResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.customer.CustomerAttributeCollection getAcc catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerAttribute addAccountAttribute(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAttribute attribute, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAttribute addAccountAttribute(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAttribute attribute, Integer accountId, int expectedCode) throws Exception { - return addAccountAttribute(apiContext, attribute, accountId, null, expectedCode, successCode ); + return addAccountAttribute(apiContext, attribute, accountId, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerAttribute addAccountAttribute(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAttribute attribute, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAttribute addAccountAttribute(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAttribute attribute, Integer accountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerAttribute returnObj = new com.mozu.api.contracts.customer.CustomerAttribute(); CustomerAttributeResource resource = new CustomerAttributeResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.customer.CustomerAttribute addAccountAttrib catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerAttribute updateAccountAttribute(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAttribute attribute, Integer accountId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAttribute updateAccountAttribute(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAttribute attribute, Integer accountId, String attributeFQN, int expectedCode) throws Exception { - return updateAccountAttribute(apiContext, attribute, accountId, attributeFQN, null, expectedCode, successCode ); + return updateAccountAttribute(apiContext, attribute, accountId, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerAttribute updateAccountAttribute(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAttribute attribute, Integer accountId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAttribute updateAccountAttribute(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerAttribute attribute, Integer accountId, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerAttribute returnObj = new com.mozu.api.contracts.customer.CustomerAttribute(); CustomerAttributeResource resource = new CustomerAttributeResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.customer.CustomerAttribute updateAccountAtt catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteAccountAttribute(ApiContext apiContext, Integer accountId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static void deleteAccountAttribute(ApiContext apiContext, Integer accountId, String attributeFQN, int expectedCode) throws Exception { CustomerAttributeResource resource = new CustomerAttributeResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteAccountAttribute(ApiContext apiContext, Integer account catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAuthTicketFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAuthTicketFactory.java index ceee0a0f..6c2b78a2 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAuthTicketFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerAuthTicketFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class CustomerAuthTicketFactory { - public static java.io.InputStream createAnonymousShopperAuthTicket(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static java.io.InputStream createAnonymousShopperAuthTicket(ApiContext apiContext, int expectedCode) throws Exception { java.io.InputStream returnObj; CustomerAuthTicketResource resource = new CustomerAuthTicketResource(apiContext); @@ -31,21 +32,21 @@ public static java.io.InputStream createAnonymousShopperAuthTicket(ApiContext ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerAuthTicket createUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerUserAuthInfo userAuthInfo, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAuthTicket createUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerUserAuthInfo userAuthInfo, int expectedCode) throws Exception { - return createUserAuthTicket(apiContext, userAuthInfo, null, expectedCode, successCode ); + return createUserAuthTicket(apiContext, userAuthInfo, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerAuthTicket createUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerUserAuthInfo userAuthInfo, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAuthTicket createUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerUserAuthInfo userAuthInfo, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerAuthTicket returnObj = new com.mozu.api.contracts.customer.CustomerAuthTicket(); CustomerAuthTicketResource resource = new CustomerAuthTicketResource(apiContext); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.customer.CustomerAuthTicket createUserAuthT catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerAuthTicket refreshUserAuthTicket(ApiContext apiContext, String refreshToken, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAuthTicket refreshUserAuthTicket(ApiContext apiContext, String refreshToken, int expectedCode) throws Exception { - return refreshUserAuthTicket(apiContext, refreshToken, null, expectedCode, successCode ); + return refreshUserAuthTicket(apiContext, refreshToken, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerAuthTicket refreshUserAuthTicket(ApiContext apiContext, String refreshToken, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerAuthTicket refreshUserAuthTicket(ApiContext apiContext, String refreshToken, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerAuthTicket returnObj = new com.mozu.api.contracts.customer.CustomerAuthTicket(); CustomerAuthTicketResource resource = new CustomerAuthTicketResource(apiContext); @@ -81,12 +82,12 @@ public static com.mozu.api.contracts.customer.CustomerAuthTicket refreshUserAuth catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerCheckoutSettingsFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerCheckoutSettingsFactory.java index d875695c..6fc73bbb 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerCheckoutSettingsFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerCheckoutSettingsFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CustomerCheckoutSettingsFactory { - public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings getCustomerCheckoutSettings(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings getCustomerCheckoutSettings(ApiContext apiContext, int expectedCode) throws Exception { - return getCustomerCheckoutSettings(apiContext, null, expectedCode, successCode ); + return getCustomerCheckoutSettings(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings getCustomerCheckoutSettings(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings getCustomerCheckoutSettings(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings returnObj = new com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings(); CustomerCheckoutSettingsResource resource = new CustomerCheckoutSettingsResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.sitesettings.order.CustomerCheckoutSettings updateCustomerCheckoutSettings(ApiContext apiContext, com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings customerCheckoutSettings, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings updateCustomerCheckoutSettings(ApiContext apiContext, com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings customerCheckoutSettings, int expectedCode) throws Exception { - return updateCustomerCheckoutSettings(apiContext, customerCheckoutSettings, null, expectedCode, successCode ); + return updateCustomerCheckoutSettings(apiContext, customerCheckoutSettings, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings updateCustomerCheckoutSettings(ApiContext apiContext, com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings customerCheckoutSettings, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings updateCustomerCheckoutSettings(ApiContext apiContext, com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings customerCheckoutSettings, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings returnObj = new com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings(); CustomerCheckoutSettingsResource resource = new CustomerCheckoutSettingsResource(apiContext); @@ -61,12 +62,12 @@ public static com.mozu.api.contracts.sitesettings.order.CustomerCheckoutSettings catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerContactFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerContactFactory.java index 5a289792..506981e2 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerContactFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerContactFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CustomerContactFactory { - public static com.mozu.api.contracts.customer.CustomerContact getAccountContact(ApiContext apiContext, Integer accountId, Integer contactId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerContact getAccountContact(ApiContext apiContext, Integer accountId, Integer contactId, int expectedCode) throws Exception { - return getAccountContact(apiContext, accountId, contactId, null, expectedCode, successCode ); + return getAccountContact(apiContext, accountId, contactId, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerContact getAccountContact(ApiContext apiContext, Integer accountId, Integer contactId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerContact getAccountContact(ApiContext apiContext, Integer accountId, Integer contactId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerContact returnObj = new com.mozu.api.contracts.customer.CustomerContact(); CustomerContactResource resource = new CustomerContactResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.customer.CustomerContact getAccountContact( catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerContactCollection getAccountContacts(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerContactCollection getAccountContacts(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception { - return getAccountContacts(apiContext, accountId, null, null, null, null, null, expectedCode, successCode ); + return getAccountContacts(apiContext, accountId, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerContactCollection getAccountContacts(ApiContext apiContext, Integer accountId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerContactCollection getAccountContacts(ApiContext apiContext, Integer accountId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerContactCollection returnObj = new com.mozu.api.contracts.customer.CustomerContactCollection(); CustomerContactResource resource = new CustomerContactResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.customer.CustomerContactCollection getAccou catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerContact addAccountContact(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerContact addAccountContact(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, int expectedCode) throws Exception { - return addAccountContact(apiContext, contact, accountId, null, expectedCode, successCode ); + return addAccountContact(apiContext, contact, accountId, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerContact addAccountContact(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerContact addAccountContact(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerContact returnObj = new com.mozu.api.contracts.customer.CustomerContact(); CustomerContactResource resource = new CustomerContactResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.customer.CustomerContact addAccountContact( catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerContact updateAccountContact(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, Integer contactId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerContact updateAccountContact(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, Integer contactId, int expectedCode) throws Exception { - return updateAccountContact(apiContext, contact, accountId, contactId, null, expectedCode, successCode ); + return updateAccountContact(apiContext, contact, accountId, contactId, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerContact updateAccountContact(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, Integer contactId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerContact updateAccountContact(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerContact contact, Integer accountId, Integer contactId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerContact returnObj = new com.mozu.api.contracts.customer.CustomerContact(); CustomerContactResource resource = new CustomerContactResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.customer.CustomerContact updateAccountConta catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteAccountContact(ApiContext apiContext, Integer accountId, Integer contactId, int expectedCode, int successCode) throws Exception + public static void deleteAccountContact(ApiContext apiContext, Integer accountId, Integer contactId, int expectedCode) throws Exception { CustomerContactResource resource = new CustomerContactResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteAccountContact(ApiContext apiContext, Integer accountId catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerCustomerSegmentFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerCustomerSegmentFactory.java index beb011a9..9a63d0db 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerCustomerSegmentFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerCustomerSegmentFactory.java @@ -1,180 +1,181 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.customer.CustomerSegmentResource; - -/** - * Use the Customer Segments resource to manage the segments that enable a client to manage groups of customers and target discounts for these segments. After a customer segment is defined, you can associate any number of customer accounts with it. - * - */ -public class CustomerCustomerSegmentFactory -{ - - public static com.mozu.api.contracts.customer.CustomerSegmentCollection getSegments(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getSegments(apiContext, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerSegmentCollection getSegments(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerSegmentCollection returnObj = new com.mozu.api.contracts.customer.CustomerSegmentCollection(); - CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); - try - { - returnObj = resource.getSegments( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.CustomerSegment getSegment(ApiContext apiContext, Integer id, int expectedCode, int successCode) throws Exception - { - return getSegment(apiContext, id, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerSegment getSegment(ApiContext apiContext, Integer id, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerSegment returnObj = new com.mozu.api.contracts.customer.CustomerSegment(); - CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); - try - { - returnObj = resource.getSegment( id, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.customer.CustomerSegment addSegment(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerSegment segment, int expectedCode, int successCode) throws Exception - { - return addSegment(apiContext, segment, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerSegment addSegment(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerSegment segment, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerSegment returnObj = new com.mozu.api.contracts.customer.CustomerSegment(); - CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); - try - { - returnObj = resource.addSegment( segment, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void addSegmentAccounts(ApiContext apiContext, List accountIds, Integer id, int expectedCode, int successCode) throws Exception - { - CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); - try - { - resource.addSegmentAccounts( accountIds, id); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static com.mozu.api.contracts.customer.CustomerSegment updateSegment(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerSegment segment, Integer id, int expectedCode, int successCode) throws Exception - { - return updateSegment(apiContext, segment, id, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.customer.CustomerSegment updateSegment(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerSegment segment, Integer id, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.customer.CustomerSegment returnObj = new com.mozu.api.contracts.customer.CustomerSegment(); - CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); - try - { - returnObj = resource.updateSegment( segment, id, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteSegment(ApiContext apiContext, Integer id, int expectedCode, int successCode) throws Exception - { - CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); - try - { - resource.deleteSegment( id); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static void removeSegmentAccount(ApiContext apiContext, Integer id, Integer accountId, int expectedCode, int successCode) throws Exception - { - CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); - try - { - resource.removeSegmentAccount( id, accountId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.customer.CustomerSegmentResource; + +/** + * Use the Customer Segments resource to manage the segments that enable a client to manage groups of customers and target discounts for these segments. After a customer segment is defined, you can associate any number of customer accounts with it. + * + */ +public class CustomerCustomerSegmentFactory +{ + + public static com.mozu.api.contracts.customer.CustomerSegmentCollection getSegments(ApiContext apiContext, int expectedCode) throws Exception + { + return getSegments(apiContext, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerSegmentCollection getSegments(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerSegmentCollection returnObj = new com.mozu.api.contracts.customer.CustomerSegmentCollection(); + CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); + try + { + returnObj = resource.getSegments( 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.customer.CustomerSegment getSegment(ApiContext apiContext, Integer id, int expectedCode) throws Exception + { + return getSegment(apiContext, id, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerSegment getSegment(ApiContext apiContext, Integer id, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerSegment returnObj = new com.mozu.api.contracts.customer.CustomerSegment(); + CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); + try + { + returnObj = resource.getSegment( id, 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.customer.CustomerSegment addSegment(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerSegment segment, int expectedCode) throws Exception + { + return addSegment(apiContext, segment, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerSegment addSegment(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerSegment segment, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerSegment returnObj = new com.mozu.api.contracts.customer.CustomerSegment(); + CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); + try + { + returnObj = resource.addSegment( segment, 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 addSegmentAccounts(ApiContext apiContext, List accountIds, Integer id, int expectedCode) throws Exception + { + CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); + try + { + resource.addSegmentAccounts( accountIds, id); + } + 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, ""); + } + + public static com.mozu.api.contracts.customer.CustomerSegment updateSegment(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerSegment segment, Integer id, int expectedCode) throws Exception + { + return updateSegment(apiContext, segment, id, null, expectedCode); + } + + public static com.mozu.api.contracts.customer.CustomerSegment updateSegment(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerSegment segment, Integer id, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.customer.CustomerSegment returnObj = new com.mozu.api.contracts.customer.CustomerSegment(); + CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); + try + { + returnObj = resource.updateSegment( segment, id, 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 deleteSegment(ApiContext apiContext, Integer id, int expectedCode) throws Exception + { + CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); + try + { + resource.deleteSegment( id); + } + 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, ""); + } + + public static void removeSegmentAccount(ApiContext apiContext, Integer id, Integer accountId, int expectedCode) throws Exception + { + CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); + try + { + resource.removeSegmentAccount( id, accountId); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerNoteFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerNoteFactory.java index 7deb229d..5eb2f230 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerNoteFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerNoteFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CustomerNoteFactory { - public static com.mozu.api.contracts.customer.CustomerNote getAccountNote(ApiContext apiContext, Integer accountId, Integer noteId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerNote getAccountNote(ApiContext apiContext, Integer accountId, Integer noteId, int expectedCode) throws Exception { - return getAccountNote(apiContext, accountId, noteId, null, expectedCode, successCode ); + return getAccountNote(apiContext, accountId, noteId, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerNote getAccountNote(ApiContext apiContext, Integer accountId, Integer noteId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerNote getAccountNote(ApiContext apiContext, Integer accountId, Integer noteId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerNote returnObj = new com.mozu.api.contracts.customer.CustomerNote(); CustomerNoteResource resource = new CustomerNoteResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.customer.CustomerNote getAccountNote(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerNoteCollection getAccountNotes(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerNoteCollection getAccountNotes(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception { - return getAccountNotes(apiContext, accountId, null, null, null, null, null, expectedCode, successCode ); + return getAccountNotes(apiContext, accountId, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerNoteCollection getAccountNotes(ApiContext apiContext, Integer accountId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerNoteCollection getAccountNotes(ApiContext apiContext, Integer accountId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerNoteCollection returnObj = new com.mozu.api.contracts.customer.CustomerNoteCollection(); CustomerNoteResource resource = new CustomerNoteResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.customer.CustomerNoteCollection getAccountN catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerNote addAccountNote(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerNote note, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerNote addAccountNote(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerNote note, Integer accountId, int expectedCode) throws Exception { - return addAccountNote(apiContext, note, accountId, null, expectedCode, successCode ); + return addAccountNote(apiContext, note, accountId, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerNote addAccountNote(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerNote note, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerNote addAccountNote(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerNote note, Integer accountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerNote returnObj = new com.mozu.api.contracts.customer.CustomerNote(); CustomerNoteResource resource = new CustomerNoteResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.customer.CustomerNote addAccountNote(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.CustomerNote updateAccountNote(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerNote note, Integer accountId, Integer noteId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerNote updateAccountNote(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerNote note, Integer accountId, Integer noteId, int expectedCode) throws Exception { - return updateAccountNote(apiContext, note, accountId, noteId, null, expectedCode, successCode ); + return updateAccountNote(apiContext, note, accountId, noteId, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerNote updateAccountNote(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerNote note, Integer accountId, Integer noteId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerNote updateAccountNote(ApiContext apiContext, com.mozu.api.contracts.customer.CustomerNote note, Integer accountId, Integer noteId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerNote returnObj = new com.mozu.api.contracts.customer.CustomerNote(); CustomerNoteResource resource = new CustomerNoteResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.customer.CustomerNote updateAccountNote(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteAccountNote(ApiContext apiContext, Integer accountId, Integer noteId, int expectedCode, int successCode) throws Exception + public static void deleteAccountNote(ApiContext apiContext, Integer accountId, Integer noteId, int expectedCode) throws Exception { CustomerNoteResource resource = new CustomerNoteResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteAccountNote(ApiContext apiContext, Integer accountId, I catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerSegmentFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerSegmentFactory.java index ab4fc3b2..8cdd006a 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerSegmentFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/CustomerSegmentFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class CustomerSegmentFactory { - public static com.mozu.api.contracts.customer.CustomerSegmentCollection getAccountSegments(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerSegmentCollection getAccountSegments(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception { - return getAccountSegments(apiContext, accountId, null, null, null, null, null, expectedCode, successCode ); + return getAccountSegments(apiContext, accountId, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.customer.CustomerSegmentCollection getAccountSegments(ApiContext apiContext, Integer accountId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.CustomerSegmentCollection getAccountSegments(ApiContext apiContext, Integer accountId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.CustomerSegmentCollection returnObj = new com.mozu.api.contracts.customer.CustomerSegmentCollection(); CustomerSegmentResource resource = new CustomerSegmentResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.customer.CustomerSegmentCollection getAccou catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DeveloperAdminUserAuthTicketFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DeveloperAdminUserAuthTicketFactory.java index 823da353..c00130b5 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DeveloperAdminUserAuthTicketFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DeveloperAdminUserAuthTicketFactory.java @@ -1,94 +1,95 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.developer.DeveloperAdminUserAuthTicketResource; - -/** - * Use the Authtickets resource to manage authentication tickets for your developer account. - * - */ -public class DeveloperAdminUserAuthTicketFactory -{ - - public static com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket createDeveloperUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.core.UserAuthInfo userAuthInfo, int expectedCode, int successCode) throws Exception - { - return createDeveloperUserAuthTicket(apiContext, userAuthInfo, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket createDeveloperUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.core.UserAuthInfo userAuthInfo, Integer developerAccountId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket returnObj = new com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket(); - DeveloperAdminUserAuthTicketResource resource = new DeveloperAdminUserAuthTicketResource(apiContext); - try - { - returnObj = resource.createDeveloperUserAuthTicket( userAuthInfo, developerAccountId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket refreshDeveloperAuthTicket(ApiContext apiContext, com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket existingAuthTicket, int expectedCode, int successCode) throws Exception - { - return refreshDeveloperAuthTicket(apiContext, existingAuthTicket, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket refreshDeveloperAuthTicket(ApiContext apiContext, com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket existingAuthTicket, Integer developerAccountId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket returnObj = new com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket(); - DeveloperAdminUserAuthTicketResource resource = new DeveloperAdminUserAuthTicketResource(apiContext); - try - { - returnObj = resource.refreshDeveloperAuthTicket( existingAuthTicket, developerAccountId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteUserAuthTicket(ApiContext apiContext, String refreshToken, int expectedCode, int successCode) throws Exception - { - DeveloperAdminUserAuthTicketResource resource = new DeveloperAdminUserAuthTicketResource(apiContext); - try - { - resource.deleteUserAuthTicket( refreshToken); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.developer.DeveloperAdminUserAuthTicketResource; + +/** + * Use the Authtickets resource to manage authentication tickets for your developer account. + * + */ +public class DeveloperAdminUserAuthTicketFactory +{ + + public static com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket createDeveloperUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.core.UserAuthInfo userAuthInfo, int expectedCode) throws Exception + { + return createDeveloperUserAuthTicket(apiContext, userAuthInfo, null, null, expectedCode); + } + + public static com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket createDeveloperUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.core.UserAuthInfo userAuthInfo, Integer developerAccountId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket returnObj = new com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket(); + DeveloperAdminUserAuthTicketResource resource = new DeveloperAdminUserAuthTicketResource(apiContext); + try + { + returnObj = resource.createDeveloperUserAuthTicket( userAuthInfo, developerAccountId, 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.adminuser.DeveloperAdminUserAuthTicket refreshDeveloperAuthTicket(ApiContext apiContext, com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket existingAuthTicket, int expectedCode) throws Exception + { + return refreshDeveloperAuthTicket(apiContext, existingAuthTicket, null, null, expectedCode); + } + + public static com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket refreshDeveloperAuthTicket(ApiContext apiContext, com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket existingAuthTicket, Integer developerAccountId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket returnObj = new com.mozu.api.contracts.adminuser.DeveloperAdminUserAuthTicket(); + DeveloperAdminUserAuthTicketResource resource = new DeveloperAdminUserAuthTicketResource(apiContext); + try + { + returnObj = resource.refreshDeveloperAuthTicket( existingAuthTicket, developerAccountId, 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 deleteUserAuthTicket(ApiContext apiContext, String refreshToken, int expectedCode) throws Exception + { + DeveloperAdminUserAuthTicketResource resource = new DeveloperAdminUserAuthTicketResource(apiContext); + try + { + resource.deleteUserAuthTicket( refreshToken); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DigitalPackageFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DigitalPackageFactory.java index 8e45db00..2ad1adb2 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DigitalPackageFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DigitalPackageFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class DigitalPackageFactory { - public static List getAvailableDigitalPackageFulfillmentActions(ApiContext apiContext, String orderId, String digitalPackageId, int expectedCode, int successCode) throws Exception + public static List getAvailableDigitalPackageFulfillmentActions(ApiContext apiContext, String orderId, String digitalPackageId, int expectedCode) throws Exception { List returnObj = new ArrayList(); DigitalPackageResource resource = new DigitalPackageResource(apiContext); @@ -31,21 +32,21 @@ public static List getAvailableDigitalPackageFulfillmentActions(ApiConte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.DigitalPackage getDigitalPackage(ApiContext apiContext, String orderId, String digitalPackageId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage getDigitalPackage(ApiContext apiContext, String orderId, String digitalPackageId, int expectedCode) throws Exception { - return getDigitalPackage(apiContext, orderId, digitalPackageId, null, expectedCode, successCode ); + return getDigitalPackage(apiContext, orderId, digitalPackageId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage getDigitalPackage(ApiContext apiContext, String orderId, String digitalPackageId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage getDigitalPackage(ApiContext apiContext, String orderId, String digitalPackageId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage(); DigitalPackageResource resource = new DigitalPackageResource(apiContext); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.DigitalPackage createDigitalPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage digitalPackage, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage createDigitalPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage digitalPackage, String orderId, int expectedCode) throws Exception { - return createDigitalPackage(apiContext, digitalPackage, orderId, null, expectedCode, successCode ); + return createDigitalPackage(apiContext, digitalPackage, orderId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage createDigitalPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage digitalPackage, String orderId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage createDigitalPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage digitalPackage, String orderId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage(); DigitalPackageResource resource = new DigitalPackageResource(apiContext); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.DigitalPackage updateDigitalPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage digitalPackage, String orderId, String digitalPackageId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage updateDigitalPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage digitalPackage, String orderId, String digitalPackageId, int expectedCode) throws Exception { - return updateDigitalPackage(apiContext, digitalPackage, orderId, digitalPackageId, null, expectedCode, successCode ); + return updateDigitalPackage(apiContext, digitalPackage, orderId, digitalPackageId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage updateDigitalPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage digitalPackage, String orderId, String digitalPackageId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage updateDigitalPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage digitalPackage, String orderId, String digitalPackageId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage(); DigitalPackageResource resource = new DigitalPackageResource(apiContext); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteDigitalPackage(ApiContext apiContext, String orderId, String digitalPackageId, int expectedCode, int successCode) throws Exception + public static void deleteDigitalPackage(ApiContext apiContext, String orderId, String digitalPackageId, int expectedCode) throws Exception { DigitalPackageResource resource = new DigitalPackageResource(apiContext); try @@ -125,12 +126,12 @@ public static void deleteDigitalPackage(ApiContext apiContext, String orderId, S catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DiscountFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DiscountFactory.java index 32b6b8cc..01d3bf9c 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DiscountFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DiscountFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class DiscountFactory { - public static com.mozu.api.contracts.productadmin.DiscountCollection getDiscounts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountCollection getDiscounts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode) throws Exception { - return getDiscounts(apiContext, dataViewMode, null, null, null, null, null, expectedCode, successCode ); + return getDiscounts(apiContext, dataViewMode, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.DiscountCollection getDiscounts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountCollection getDiscounts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.DiscountCollection returnObj = new com.mozu.api.contracts.productadmin.DiscountCollection(); DiscountResource resource = new DiscountResource(apiContext, dataViewMode); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.productadmin.DiscountCollection getDiscount catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.DiscountLocalizedContent getDiscountContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountLocalizedContent getDiscountContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, int expectedCode) throws Exception { - return getDiscountContent(apiContext, dataViewMode, discountId, null, expectedCode, successCode ); + return getDiscountContent(apiContext, dataViewMode, discountId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.DiscountLocalizedContent getDiscountContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountLocalizedContent getDiscountContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.DiscountLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.DiscountLocalizedContent(); DiscountResource resource = new DiscountResource(apiContext, dataViewMode); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.productadmin.DiscountLocalizedContent getDi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.Discount getDiscount(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Discount getDiscount(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, int expectedCode) throws Exception { - return getDiscount(apiContext, dataViewMode, discountId, null, expectedCode, successCode ); + return getDiscount(apiContext, dataViewMode, discountId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Discount getDiscount(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Discount getDiscount(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Discount returnObj = new com.mozu.api.contracts.productadmin.Discount(); DiscountResource resource = new DiscountResource(apiContext, dataViewMode); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.productadmin.Discount getDiscount(ApiContex catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 String generateRandomCoupon(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static String generateRandomCoupon(ApiContext apiContext, int expectedCode) throws Exception { - return generateRandomCoupon(apiContext, null, expectedCode, successCode ); + return generateRandomCoupon(apiContext, null, expectedCode); } - public static String generateRandomCoupon(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static String generateRandomCoupon(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { String returnObj = new String(); DiscountResource resource = new DiscountResource(apiContext); @@ -111,21 +112,21 @@ public static String generateRandomCoupon(ApiContext apiContext, String response catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.Discount createDiscount(ApiContext apiContext, com.mozu.api.contracts.productadmin.Discount discount, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Discount createDiscount(ApiContext apiContext, com.mozu.api.contracts.productadmin.Discount discount, int expectedCode) throws Exception { - return createDiscount(apiContext, discount, null, expectedCode, successCode ); + return createDiscount(apiContext, discount, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Discount createDiscount(ApiContext apiContext, com.mozu.api.contracts.productadmin.Discount discount, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Discount createDiscount(ApiContext apiContext, com.mozu.api.contracts.productadmin.Discount discount, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Discount returnObj = new com.mozu.api.contracts.productadmin.Discount(); DiscountResource resource = new DiscountResource(apiContext); @@ -136,21 +137,21 @@ public static com.mozu.api.contracts.productadmin.Discount createDiscount(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.DiscountLocalizedContent updateDiscountContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.DiscountLocalizedContent content, Integer discountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountLocalizedContent updateDiscountContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.DiscountLocalizedContent content, Integer discountId, int expectedCode) throws Exception { - return updateDiscountContent(apiContext, content, discountId, null, expectedCode, successCode ); + return updateDiscountContent(apiContext, content, discountId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.DiscountLocalizedContent updateDiscountContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.DiscountLocalizedContent content, Integer discountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountLocalizedContent updateDiscountContent(ApiContext apiContext, com.mozu.api.contracts.productadmin.DiscountLocalizedContent content, Integer discountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.DiscountLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.DiscountLocalizedContent(); DiscountResource resource = new DiscountResource(apiContext); @@ -161,21 +162,21 @@ public static com.mozu.api.contracts.productadmin.DiscountLocalizedContent updat catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.Discount updateDiscount(ApiContext apiContext, com.mozu.api.contracts.productadmin.Discount discount, Integer discountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Discount updateDiscount(ApiContext apiContext, com.mozu.api.contracts.productadmin.Discount discount, Integer discountId, int expectedCode) throws Exception { - return updateDiscount(apiContext, discount, discountId, null, expectedCode, successCode ); + return updateDiscount(apiContext, discount, discountId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.Discount updateDiscount(ApiContext apiContext, com.mozu.api.contracts.productadmin.Discount discount, Integer discountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.Discount updateDiscount(ApiContext apiContext, com.mozu.api.contracts.productadmin.Discount discount, Integer discountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.Discount returnObj = new com.mozu.api.contracts.productadmin.Discount(); DiscountResource resource = new DiscountResource(apiContext); @@ -186,16 +187,16 @@ public static com.mozu.api.contracts.productadmin.Discount updateDiscount(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteDiscount(ApiContext apiContext, Integer discountId, int expectedCode, int successCode) throws Exception + public static void deleteDiscount(ApiContext apiContext, Integer discountId, int expectedCode) throws Exception { DiscountResource resource = new DiscountResource(apiContext); try @@ -205,12 +206,12 @@ public static void deleteDiscount(ApiContext apiContext, Integer discountId, int catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DiscountTargetFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DiscountTargetFactory.java index 26aeb322..23954b17 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DiscountTargetFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DiscountTargetFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class DiscountTargetFactory { - public static com.mozu.api.contracts.productadmin.DiscountTarget getDiscountTarget(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountTarget getDiscountTarget(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, int expectedCode) throws Exception { - return getDiscountTarget(apiContext, dataViewMode, discountId, null, expectedCode, successCode ); + return getDiscountTarget(apiContext, dataViewMode, discountId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.DiscountTarget getDiscountTarget(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountTarget getDiscountTarget(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer discountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.DiscountTarget returnObj = new com.mozu.api.contracts.productadmin.DiscountTarget(); DiscountTargetResource resource = new DiscountTargetResource(apiContext, dataViewMode); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.productadmin.DiscountTarget getDiscountTarg catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.DiscountTarget updateDiscountTarget(ApiContext apiContext, com.mozu.api.contracts.productadmin.DiscountTarget discountTarget, Integer discountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountTarget updateDiscountTarget(ApiContext apiContext, com.mozu.api.contracts.productadmin.DiscountTarget discountTarget, Integer discountId, int expectedCode) throws Exception { - return updateDiscountTarget(apiContext, discountTarget, discountId, null, expectedCode, successCode ); + return updateDiscountTarget(apiContext, discountTarget, discountId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.DiscountTarget updateDiscountTarget(ApiContext apiContext, com.mozu.api.contracts.productadmin.DiscountTarget discountTarget, Integer discountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.DiscountTarget updateDiscountTarget(ApiContext apiContext, com.mozu.api.contracts.productadmin.DiscountTarget discountTarget, Integer discountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.DiscountTarget returnObj = new com.mozu.api.contracts.productadmin.DiscountTarget(); DiscountTargetResource resource = new DiscountTargetResource(apiContext); @@ -61,12 +62,12 @@ public static com.mozu.api.contracts.productadmin.DiscountTarget updateDiscountT catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentDraftSummaryFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentDraftSummaryFactory.java index 2feecb01..523de63d 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentDraftSummaryFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentDraftSummaryFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class DocumentDraftSummaryFactory { - public static com.mozu.api.contracts.content.DocumentDraftSummaryPagedCollection listDocumentDraftSummaries(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentDraftSummaryPagedCollection listDocumentDraftSummaries(ApiContext apiContext, int expectedCode) throws Exception { - return listDocumentDraftSummaries(apiContext, null, null, null, null, expectedCode, successCode ); + return listDocumentDraftSummaries(apiContext, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentDraftSummaryPagedCollection listDocumentDraftSummaries(ApiContext apiContext, Integer pageSize, Integer startIndex, String documentLists, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentDraftSummaryPagedCollection listDocumentDraftSummaries(ApiContext apiContext, Integer pageSize, Integer startIndex, String documentLists, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentDraftSummaryPagedCollection returnObj = new com.mozu.api.contracts.content.DocumentDraftSummaryPagedCollection(); DocumentDraftSummaryResource resource = new DocumentDraftSummaryResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.content.DocumentDraftSummaryPagedCollection catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteDocumentDrafts(ApiContext apiContext, List documentIds, int expectedCode, int successCode) throws Exception + public static void deleteDocumentDrafts(ApiContext apiContext, List documentIds, int expectedCode) throws Exception { - deleteDocumentDrafts(apiContext, documentIds, null, expectedCode, successCode ); + deleteDocumentDrafts(apiContext, documentIds, null, expectedCode); } - public static void deleteDocumentDrafts(ApiContext apiContext, List documentIds, String documentLists, int expectedCode, int successCode) throws Exception + public static void deleteDocumentDrafts(ApiContext apiContext, List documentIds, String documentLists, int expectedCode) throws Exception { DocumentDraftSummaryResource resource = new DocumentDraftSummaryResource(apiContext); try @@ -60,20 +61,20 @@ public static void deleteDocumentDrafts(ApiContext apiContext, List docu catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void publishDocuments(ApiContext apiContext, List documentIds, int expectedCode, int successCode) throws Exception + public static void publishDocuments(ApiContext apiContext, List documentIds, int expectedCode) throws Exception { - publishDocuments(apiContext, documentIds, null, expectedCode, successCode ); + publishDocuments(apiContext, documentIds, null, expectedCode); } - public static void publishDocuments(ApiContext apiContext, List documentIds, String documentLists, int expectedCode, int successCode) throws Exception + public static void publishDocuments(ApiContext apiContext, List documentIds, String documentLists, int expectedCode) throws Exception { DocumentDraftSummaryResource resource = new DocumentDraftSummaryResource(apiContext); try @@ -83,12 +84,12 @@ public static void publishDocuments(ApiContext apiContext, List document catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentFactory.java index 7ee43fa9..f676a25b 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class DocumentFactory { - public static java.io.InputStream getDocumentContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentId, int expectedCode, int successCode) throws Exception + public static java.io.InputStream getDocumentContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentId, int expectedCode) throws Exception { java.io.InputStream returnObj; DocumentResource resource = new DocumentResource(apiContext, dataViewMode); @@ -31,21 +32,21 @@ public static java.io.InputStream getDocumentContent(ApiContext apiContext, com. catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.Document getDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.Document getDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentId, int expectedCode) throws Exception { - return getDocument(apiContext, dataViewMode, documentListName, documentId, null, expectedCode, successCode ); + return getDocument(apiContext, dataViewMode, documentListName, documentId, null, expectedCode); } - public static com.mozu.api.contracts.content.Document getDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.Document getDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.Document returnObj = new com.mozu.api.contracts.content.Document(); DocumentResource resource = new DocumentResource(apiContext, dataViewMode); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.content.Document getDocument(ApiContext api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.DocumentCollection getDocuments(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentCollection getDocuments(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, int expectedCode) throws Exception { - return getDocuments(apiContext, dataViewMode, documentListName, null, null, null, null, null, expectedCode, successCode ); + return getDocuments(apiContext, dataViewMode, documentListName, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentCollection getDocuments(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String filter, String sortBy, Integer pageSize, Integer startIndex, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentCollection getDocuments(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String filter, String sortBy, Integer pageSize, Integer startIndex, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentCollection returnObj = new com.mozu.api.contracts.content.DocumentCollection(); DocumentResource resource = new DocumentResource(apiContext, dataViewMode); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.content.DocumentCollection getDocuments(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.Document createDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.Document document, String documentListName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.Document createDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.Document document, String documentListName, int expectedCode) throws Exception { - return createDocument(apiContext, dataViewMode, document, documentListName, null, expectedCode, successCode ); + return createDocument(apiContext, dataViewMode, document, documentListName, null, expectedCode); } - public static com.mozu.api.contracts.content.Document createDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.Document document, String documentListName, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.Document createDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.Document document, String documentListName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.Document returnObj = new com.mozu.api.contracts.content.Document(); DocumentResource resource = new DocumentResource(apiContext, dataViewMode); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.content.Document createDocument(ApiContext catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 updateDocumentContent(ApiContext apiContext, java.io.InputStream stream, String documentListName, String documentId, String contentType, int expectedCode, int successCode) throws Exception + public static void updateDocumentContent(ApiContext apiContext, java.io.InputStream stream, String documentListName, String documentId, String contentType, int expectedCode) throws Exception { DocumentResource resource = new DocumentResource(apiContext); try @@ -125,20 +126,20 @@ public static void updateDocumentContent(ApiContext apiContext, java.io.InputStr catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static com.mozu.api.contracts.content.Document updateDocument(ApiContext apiContext, com.mozu.api.contracts.content.Document document, String documentListName, String documentId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.Document updateDocument(ApiContext apiContext, com.mozu.api.contracts.content.Document document, String documentListName, String documentId, int expectedCode) throws Exception { - return updateDocument(apiContext, document, documentListName, documentId, null, expectedCode, successCode ); + return updateDocument(apiContext, document, documentListName, documentId, null, expectedCode); } - public static com.mozu.api.contracts.content.Document updateDocument(ApiContext apiContext, com.mozu.api.contracts.content.Document document, String documentListName, String documentId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.Document updateDocument(ApiContext apiContext, com.mozu.api.contracts.content.Document document, String documentListName, String documentId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.Document returnObj = new com.mozu.api.contracts.content.Document(); DocumentResource resource = new DocumentResource(apiContext); @@ -149,16 +150,16 @@ public static com.mozu.api.contracts.content.Document updateDocument(ApiContext catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteDocument(ApiContext apiContext, String documentListName, String documentId, int expectedCode, int successCode) throws Exception + public static void deleteDocument(ApiContext apiContext, String documentListName, String documentId, int expectedCode) throws Exception { DocumentResource resource = new DocumentResource(apiContext); try @@ -168,15 +169,15 @@ public static void deleteDocument(ApiContext apiContext, String documentListName catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deleteDocumentContent(ApiContext apiContext, String documentListName, String documentId, int expectedCode, int successCode) throws Exception + public static void deleteDocumentContent(ApiContext apiContext, String documentListName, String documentId, int expectedCode) throws Exception { DocumentResource resource = new DocumentResource(apiContext); try @@ -186,12 +187,12 @@ public static void deleteDocumentContent(ApiContext apiContext, String documentL catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentListFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentListFactory.java index 42d470ce..9ec305a9 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentListFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentListFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class DocumentListFactory { - public static com.mozu.api.contracts.content.DocumentListCollection getDocumentLists(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentListCollection getDocumentLists(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode) throws Exception { - return getDocumentLists(apiContext, dataViewMode, null, null, null, expectedCode, successCode ); + return getDocumentLists(apiContext, dataViewMode, null, null, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentListCollection getDocumentLists(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer pageSize, Integer startIndex, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentListCollection getDocumentLists(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer pageSize, Integer startIndex, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentListCollection returnObj = new com.mozu.api.contracts.content.DocumentListCollection(); DocumentListResource resource = new DocumentListResource(apiContext, dataViewMode); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.content.DocumentListCollection getDocumentL catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.DocumentList getDocumentList(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentList getDocumentList(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, int expectedCode) throws Exception { - return getDocumentList(apiContext, dataViewMode, documentListName, null, expectedCode, successCode ); + return getDocumentList(apiContext, dataViewMode, documentListName, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentList getDocumentList(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentList getDocumentList(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentList returnObj = new com.mozu.api.contracts.content.DocumentList(); DocumentListResource resource = new DocumentListResource(apiContext, dataViewMode); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.content.DocumentList getDocumentList(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.DocumentList createDocumentList(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentList list, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentList createDocumentList(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentList list, int expectedCode) throws Exception { - return createDocumentList(apiContext, dataViewMode, list, null, expectedCode, successCode ); + return createDocumentList(apiContext, dataViewMode, list, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentList createDocumentList(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentList list, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentList createDocumentList(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentList list, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentList returnObj = new com.mozu.api.contracts.content.DocumentList(); DocumentListResource resource = new DocumentListResource(apiContext, dataViewMode); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.content.DocumentList createDocumentList(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.DocumentList updateDocumentList(ApiContext apiContext, com.mozu.api.contracts.content.DocumentList list, String documentListName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentList updateDocumentList(ApiContext apiContext, com.mozu.api.contracts.content.DocumentList list, String documentListName, int expectedCode) throws Exception { - return updateDocumentList(apiContext, list, documentListName, null, expectedCode, successCode ); + return updateDocumentList(apiContext, list, documentListName, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentList updateDocumentList(ApiContext apiContext, com.mozu.api.contracts.content.DocumentList list, String documentListName, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentList updateDocumentList(ApiContext apiContext, com.mozu.api.contracts.content.DocumentList list, String documentListName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentList returnObj = new com.mozu.api.contracts.content.DocumentList(); DocumentListResource resource = new DocumentListResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.content.DocumentList updateDocumentList(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteDocumentList(ApiContext apiContext, String documentListName, int expectedCode, int successCode) throws Exception + public static void deleteDocumentList(ApiContext apiContext, String documentListName, int expectedCode) throws Exception { DocumentListResource resource = new DocumentListResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteDocumentList(ApiContext apiContext, String documentList catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentListTypeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentListTypeFactory.java index 402869df..e337cb3d 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentListTypeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentListTypeFactory.java @@ -1,76 +1,77 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.content.DocumentListTypeResource; - -/** - * Use the Document List Types resource to manage the types of document lists in your site's document hierarchy. The type denotes a content type for that list of folders, sub-folders, and documents such as `web_pages`. - * - */ -public class DocumentListTypeFactory -{ - - public static com.mozu.api.contracts.content.DocumentListType createDocumentListType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentListType list, int expectedCode, int successCode) throws Exception - { - return createDocumentListType(apiContext, dataViewMode, list, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.content.DocumentListType createDocumentListType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentListType list, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.content.DocumentListType returnObj = new com.mozu.api.contracts.content.DocumentListType(); - DocumentListTypeResource resource = new DocumentListTypeResource(apiContext, dataViewMode); - try - { - returnObj = resource.createDocumentListType( list, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.content.DocumentListType updateDocumentListType(ApiContext apiContext, com.mozu.api.contracts.content.DocumentListType list, String documentListTypeFQN, int expectedCode, int successCode) throws Exception - { - return updateDocumentListType(apiContext, list, documentListTypeFQN, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.content.DocumentListType updateDocumentListType(ApiContext apiContext, com.mozu.api.contracts.content.DocumentListType list, String documentListTypeFQN, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.content.DocumentListType returnObj = new com.mozu.api.contracts.content.DocumentListType(); - DocumentListTypeResource resource = new DocumentListTypeResource(apiContext); - try - { - returnObj = resource.updateDocumentListType( list, documentListTypeFQN, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.content.DocumentListTypeResource; + +/** + * Use the Document List Types resource to manage the types of document lists in your site's document hierarchy. The type denotes a content type for that list of folders, sub-folders, and documents such as `web_pages`. + * + */ +public class DocumentListTypeFactory +{ + + public static com.mozu.api.contracts.content.DocumentListType createDocumentListType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentListType list, int expectedCode) throws Exception + { + return createDocumentListType(apiContext, dataViewMode, list, null, expectedCode); + } + + public static com.mozu.api.contracts.content.DocumentListType createDocumentListType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentListType list, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.content.DocumentListType returnObj = new com.mozu.api.contracts.content.DocumentListType(); + DocumentListTypeResource resource = new DocumentListTypeResource(apiContext, dataViewMode); + try + { + returnObj = resource.createDocumentListType( list, 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.content.DocumentListType updateDocumentListType(ApiContext apiContext, com.mozu.api.contracts.content.DocumentListType list, String documentListTypeFQN, int expectedCode) throws Exception + { + return updateDocumentListType(apiContext, list, documentListTypeFQN, null, expectedCode); + } + + public static com.mozu.api.contracts.content.DocumentListType updateDocumentListType(ApiContext apiContext, com.mozu.api.contracts.content.DocumentListType list, String documentListTypeFQN, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.content.DocumentListType returnObj = new com.mozu.api.contracts.content.DocumentListType(); + DocumentListTypeResource resource = new DocumentListTypeResource(apiContext); + try + { + returnObj = resource.updateDocumentListType( list, documentListTypeFQN, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentTreeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentTreeFactory.java index db0d6f1f..d1823645 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentTreeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentTreeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class DocumentTreeFactory { - public static java.io.InputStream getTreeDocumentContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName, int expectedCode, int successCode) throws Exception + public static java.io.InputStream getTreeDocumentContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName, int expectedCode) throws Exception { java.io.InputStream returnObj; DocumentTreeResource resource = new DocumentTreeResource(apiContext, dataViewMode); @@ -31,21 +32,21 @@ public static java.io.InputStream getTreeDocumentContent(ApiContext apiContext, catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.Document getTreeDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.Document getTreeDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName, int expectedCode) throws Exception { - return getTreeDocument(apiContext, dataViewMode, documentListName, documentName, null, expectedCode, successCode ); + return getTreeDocument(apiContext, dataViewMode, documentListName, documentName, null, expectedCode); } - public static com.mozu.api.contracts.content.Document getTreeDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.Document getTreeDocument(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentListName, String documentName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.Document returnObj = new com.mozu.api.contracts.content.Document(); DocumentTreeResource resource = new DocumentTreeResource(apiContext, dataViewMode); @@ -56,16 +57,16 @@ public static com.mozu.api.contracts.content.Document getTreeDocument(ApiContext catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 updateTreeDocumentContent(ApiContext apiContext, java.io.InputStream stream, String documentListName, String documentName, String contentType, int expectedCode, int successCode) throws Exception + public static void updateTreeDocumentContent(ApiContext apiContext, java.io.InputStream stream, String documentListName, String documentName, String contentType, int expectedCode) throws Exception { DocumentTreeResource resource = new DocumentTreeResource(apiContext); try @@ -75,15 +76,15 @@ public static void updateTreeDocumentContent(ApiContext apiContext, java.io.Inpu catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deleteTreeDocumentContent(ApiContext apiContext, java.io.InputStream stream, String documentListName, String documentName, String contentType, int expectedCode, int successCode) throws Exception + public static void deleteTreeDocumentContent(ApiContext apiContext, java.io.InputStream stream, String documentListName, String documentName, String contentType, int expectedCode) throws Exception { DocumentTreeResource resource = new DocumentTreeResource(apiContext); try @@ -93,12 +94,12 @@ public static void deleteTreeDocumentContent(ApiContext apiContext, java.io.Inpu catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentTypeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentTypeFactory.java index e29dcd98..957281da 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentTypeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/DocumentTypeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class DocumentTypeFactory { - public static com.mozu.api.contracts.content.DocumentTypeCollection getDocumentTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentTypeCollection getDocumentTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode) throws Exception { - return getDocumentTypes(apiContext, dataViewMode, null, null, null, expectedCode, successCode ); + return getDocumentTypes(apiContext, dataViewMode, null, null, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentTypeCollection getDocumentTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer pageSize, Integer startIndex, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentTypeCollection getDocumentTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer pageSize, Integer startIndex, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentTypeCollection returnObj = new com.mozu.api.contracts.content.DocumentTypeCollection(); DocumentTypeResource resource = new DocumentTypeResource(apiContext, dataViewMode); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.content.DocumentTypeCollection getDocumentT catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.DocumentType getDocumentType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentTypeName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentType getDocumentType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentTypeName, int expectedCode) throws Exception { - return getDocumentType(apiContext, dataViewMode, documentTypeName, null, expectedCode, successCode ); + return getDocumentType(apiContext, dataViewMode, documentTypeName, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentType getDocumentType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentTypeName, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentType getDocumentType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String documentTypeName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentType returnObj = new com.mozu.api.contracts.content.DocumentType(); DocumentTypeResource resource = new DocumentTypeResource(apiContext, dataViewMode); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.content.DocumentType getDocumentType(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.DocumentType createDocumentType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentType documentType, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentType createDocumentType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentType documentType, int expectedCode) throws Exception { - return createDocumentType(apiContext, dataViewMode, documentType, null, expectedCode, successCode ); + return createDocumentType(apiContext, dataViewMode, documentType, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentType createDocumentType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentType documentType, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentType createDocumentType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.DocumentType documentType, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentType returnObj = new com.mozu.api.contracts.content.DocumentType(); DocumentTypeResource resource = new DocumentTypeResource(apiContext, dataViewMode); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.content.DocumentType createDocumentType(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.DocumentType updateDocumentType(ApiContext apiContext, com.mozu.api.contracts.content.DocumentType documentType, String documentTypeName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentType updateDocumentType(ApiContext apiContext, com.mozu.api.contracts.content.DocumentType documentType, String documentTypeName, int expectedCode) throws Exception { - return updateDocumentType(apiContext, documentType, documentTypeName, null, expectedCode, successCode ); + return updateDocumentType(apiContext, documentType, documentTypeName, null, expectedCode); } - public static com.mozu.api.contracts.content.DocumentType updateDocumentType(ApiContext apiContext, com.mozu.api.contracts.content.DocumentType documentType, String documentTypeName, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.DocumentType updateDocumentType(ApiContext apiContext, com.mozu.api.contracts.content.DocumentType documentType, String documentTypeName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.DocumentType returnObj = new com.mozu.api.contracts.content.DocumentType(); DocumentTypeResource resource = new DocumentTypeResource(apiContext); @@ -111,12 +112,12 @@ public static com.mozu.api.contracts.content.DocumentType updateDocumentType(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityContainerFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityContainerFactory.java index fbb8a5fe..faf73b38 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityContainerFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityContainerFactory.java @@ -1,76 +1,77 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.entitylists.EntityContainerResource; - -/** - * Entity containers provide all properties and data for entities within a site/tenant. This data encapsulates all associated IDs including entity lists, entity views, site, tenant, entities, and more. - * - */ -public class EntityContainerFactory -{ - - public static com.mozu.api.contracts.mzdb.EntityContainer getEntityContainer(ApiContext apiContext, String entityListFullName, String id, int expectedCode, int successCode) throws Exception - { - return getEntityContainer(apiContext, entityListFullName, id, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityContainer getEntityContainer(ApiContext apiContext, String entityListFullName, String id, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityContainer returnObj = new com.mozu.api.contracts.mzdb.EntityContainer(); - EntityContainerResource resource = new EntityContainerResource(apiContext); - try - { - returnObj = resource.getEntityContainer( entityListFullName, id, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.EntityContainerCollection getEntityContainers(ApiContext apiContext, String entityListFullName, int expectedCode, int successCode) throws Exception - { - return getEntityContainers(apiContext, entityListFullName, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityContainerCollection getEntityContainers(ApiContext apiContext, String entityListFullName, Integer pageSize, Integer startIndex, String filter, String sortBy, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityContainerCollection returnObj = new com.mozu.api.contracts.mzdb.EntityContainerCollection(); - EntityContainerResource resource = new EntityContainerResource(apiContext); - try - { - returnObj = resource.getEntityContainers( entityListFullName, pageSize, startIndex, filter, sortBy, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.entitylists.EntityContainerResource; + +/** + * Entity containers provide all properties and data for entities within a site/tenant. This data encapsulates all associated IDs including entity lists, entity views, site, tenant, entities, and more. + * + */ +public class EntityContainerFactory +{ + + public static com.mozu.api.contracts.mzdb.EntityContainer getEntityContainer(ApiContext apiContext, String entityListFullName, String id, int expectedCode) throws Exception + { + return getEntityContainer(apiContext, entityListFullName, id, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityContainer getEntityContainer(ApiContext apiContext, String entityListFullName, String id, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityContainer returnObj = new com.mozu.api.contracts.mzdb.EntityContainer(); + EntityContainerResource resource = new EntityContainerResource(apiContext); + try + { + returnObj = resource.getEntityContainer( entityListFullName, id, 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.mzdb.EntityContainerCollection getEntityContainers(ApiContext apiContext, String entityListFullName, int expectedCode) throws Exception + { + return getEntityContainers(apiContext, entityListFullName, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityContainerCollection getEntityContainers(ApiContext apiContext, String entityListFullName, Integer pageSize, Integer startIndex, String filter, String sortBy, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityContainerCollection returnObj = new com.mozu.api.contracts.mzdb.EntityContainerCollection(); + EntityContainerResource resource = new EntityContainerResource(apiContext); + try + { + returnObj = resource.getEntityContainers( entityListFullName, pageSize, startIndex, filter, sortBy, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityFactory.java index 0fbcb11b..c560a9c8 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityFactory.java @@ -1,144 +1,145 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.entitylists.EntityResource; - -/** - * Entities are JSON entries within the MZDB (Mozu Mongo DB) for handling large data sets to heavily filter (>2,000 items). Each entity is associated to an EntityList with schema, rules, and formatting for storing the content. This content can be accessed via the Mozu API and Mozu Hypr tags. - * - */ -public class EntityFactory -{ - - public static com.fasterxml.jackson.databind.JsonNode getEntity(ApiContext apiContext, String entityListFullName, String id, int expectedCode, int successCode) throws Exception - { - return getEntity(apiContext, entityListFullName, id, null, expectedCode, successCode ); - } - - public static com.fasterxml.jackson.databind.JsonNode getEntity(ApiContext apiContext, String entityListFullName, String id, String responseFields, int expectedCode, int successCode) throws Exception - { - com.fasterxml.jackson.databind.JsonNode returnObj; - EntityResource resource = new EntityResource(apiContext); - try - { - returnObj = resource.getEntity( entityListFullName, id, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.EntityCollection getEntities(ApiContext apiContext, String entityListFullName, int expectedCode, int successCode) throws Exception - { - return getEntities(apiContext, entityListFullName, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityCollection getEntities(ApiContext apiContext, String entityListFullName, Integer pageSize, Integer startIndex, String filter, String sortBy, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityCollection returnObj = new com.mozu.api.contracts.mzdb.EntityCollection(); - EntityResource resource = new EntityResource(apiContext); - try - { - returnObj = resource.getEntities( entityListFullName, pageSize, startIndex, filter, sortBy, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.fasterxml.jackson.databind.JsonNode insertEntity(ApiContext apiContext, com.fasterxml.jackson.databind.JsonNode item, String entityListFullName, int expectedCode, int successCode) throws Exception - { - return insertEntity(apiContext, item, entityListFullName, null, expectedCode, successCode ); - } - - public static com.fasterxml.jackson.databind.JsonNode insertEntity(ApiContext apiContext, com.fasterxml.jackson.databind.JsonNode item, String entityListFullName, String responseFields, int expectedCode, int successCode) throws Exception - { - com.fasterxml.jackson.databind.JsonNode returnObj; - EntityResource resource = new EntityResource(apiContext); - try - { - returnObj = resource.insertEntity( item, entityListFullName, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.fasterxml.jackson.databind.JsonNode updateEntity(ApiContext apiContext, com.fasterxml.jackson.databind.JsonNode item, String entityListFullName, String id, int expectedCode, int successCode) throws Exception - { - return updateEntity(apiContext, item, entityListFullName, id, null, expectedCode, successCode ); - } - - public static com.fasterxml.jackson.databind.JsonNode updateEntity(ApiContext apiContext, com.fasterxml.jackson.databind.JsonNode item, String entityListFullName, String id, String responseFields, int expectedCode, int successCode) throws Exception - { - com.fasterxml.jackson.databind.JsonNode returnObj; - EntityResource resource = new EntityResource(apiContext); - try - { - returnObj = resource.updateEntity( item, entityListFullName, id, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteEntity(ApiContext apiContext, String entityListFullName, String id, int expectedCode, int successCode) throws Exception - { - EntityResource resource = new EntityResource(apiContext); - try - { - resource.deleteEntity( entityListFullName, id); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.entitylists.EntityResource; + +/** + * Entities are JSON entries within the MZDB (Mozu Mongo DB) for handling large data sets to heavily filter (>2,000 items). Each entity is associated to an EntityList with schema, rules, and formatting for storing the content. This content can be accessed via the Mozu API and Mozu Hypr tags. + * + */ +public class EntityFactory +{ + + public static com.fasterxml.jackson.databind.JsonNode getEntity(ApiContext apiContext, String entityListFullName, String id, int expectedCode) throws Exception + { + return getEntity(apiContext, entityListFullName, id, null, expectedCode); + } + + public static com.fasterxml.jackson.databind.JsonNode getEntity(ApiContext apiContext, String entityListFullName, String id, String responseFields, int expectedCode) throws Exception + { + com.fasterxml.jackson.databind.JsonNode returnObj; + EntityResource resource = new EntityResource(apiContext); + try + { + returnObj = resource.getEntity( entityListFullName, id, 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.mzdb.EntityCollection getEntities(ApiContext apiContext, String entityListFullName, int expectedCode) throws Exception + { + return getEntities(apiContext, entityListFullName, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityCollection getEntities(ApiContext apiContext, String entityListFullName, Integer pageSize, Integer startIndex, String filter, String sortBy, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityCollection returnObj = new com.mozu.api.contracts.mzdb.EntityCollection(); + EntityResource resource = new EntityResource(apiContext); + try + { + returnObj = resource.getEntities( entityListFullName, pageSize, startIndex, filter, sortBy, 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.fasterxml.jackson.databind.JsonNode insertEntity(ApiContext apiContext, com.fasterxml.jackson.databind.JsonNode item, String entityListFullName, int expectedCode) throws Exception + { + return insertEntity(apiContext, item, entityListFullName, null, expectedCode); + } + + public static com.fasterxml.jackson.databind.JsonNode insertEntity(ApiContext apiContext, com.fasterxml.jackson.databind.JsonNode item, String entityListFullName, String responseFields, int expectedCode) throws Exception + { + com.fasterxml.jackson.databind.JsonNode returnObj; + EntityResource resource = new EntityResource(apiContext); + try + { + returnObj = resource.insertEntity( item, entityListFullName, 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.fasterxml.jackson.databind.JsonNode updateEntity(ApiContext apiContext, com.fasterxml.jackson.databind.JsonNode item, String entityListFullName, String id, int expectedCode) throws Exception + { + return updateEntity(apiContext, item, entityListFullName, id, null, expectedCode); + } + + public static com.fasterxml.jackson.databind.JsonNode updateEntity(ApiContext apiContext, com.fasterxml.jackson.databind.JsonNode item, String entityListFullName, String id, String responseFields, int expectedCode) throws Exception + { + com.fasterxml.jackson.databind.JsonNode returnObj; + EntityResource resource = new EntityResource(apiContext); + try + { + returnObj = resource.updateEntity( item, entityListFullName, id, 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 deleteEntity(ApiContext apiContext, String entityListFullName, String id, int expectedCode) throws Exception + { + EntityResource resource = new EntityResource(apiContext); + try + { + resource.deleteEntity( entityListFullName, id); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityListFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityListFactory.java index 846488eb..c7926744 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityListFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EntityListFactory.java @@ -1,144 +1,145 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.EntityListResource; - -/** - * The Entity Lists resource manages all dynamic entities in your Mozu document store of the Mozu cloud. The content is JSON and can have up to five indexed properties (integer, decimal, string, date, and boolean) with support for additional customized elements as needed. Every document in the entity list has a validated unique ID. - * - */ -public class EntityListFactory -{ - - public static com.mozu.api.contracts.mzdb.EntityListCollection getEntityLists(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getEntityLists(apiContext, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityListCollection getEntityLists(ApiContext apiContext, Integer pageSize, Integer startIndex, String filter, String sortBy, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityListCollection returnObj = new com.mozu.api.contracts.mzdb.EntityListCollection(); - EntityListResource resource = new EntityListResource(apiContext); - try - { - returnObj = resource.getEntityLists( pageSize, startIndex, filter, sortBy, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.EntityList getEntityList(ApiContext apiContext, String entityListFullName, int expectedCode, int successCode) throws Exception - { - return getEntityList(apiContext, entityListFullName, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityList getEntityList(ApiContext apiContext, String entityListFullName, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityList returnObj = new com.mozu.api.contracts.mzdb.EntityList(); - EntityListResource resource = new EntityListResource(apiContext); - try - { - returnObj = resource.getEntityList( entityListFullName, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.EntityList createEntityList(ApiContext apiContext, com.mozu.api.contracts.mzdb.EntityList entityList, int expectedCode, int successCode) throws Exception - { - return createEntityList(apiContext, entityList, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityList createEntityList(ApiContext apiContext, com.mozu.api.contracts.mzdb.EntityList entityList, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityList returnObj = new com.mozu.api.contracts.mzdb.EntityList(); - EntityListResource resource = new EntityListResource(apiContext); - try - { - returnObj = resource.createEntityList( entityList, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.EntityList updateEntityList(ApiContext apiContext, com.mozu.api.contracts.mzdb.EntityList entityList, String entityListFullName, int expectedCode, int successCode) throws Exception - { - return updateEntityList(apiContext, entityList, entityListFullName, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityList updateEntityList(ApiContext apiContext, com.mozu.api.contracts.mzdb.EntityList entityList, String entityListFullName, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityList returnObj = new com.mozu.api.contracts.mzdb.EntityList(); - EntityListResource resource = new EntityListResource(apiContext); - try - { - returnObj = resource.updateEntityList( entityList, entityListFullName, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteEntityList(ApiContext apiContext, String entityListFullName, int expectedCode, int successCode) throws Exception - { - EntityListResource resource = new EntityListResource(apiContext); - try - { - resource.deleteEntityList( entityListFullName); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.EntityListResource; + +/** + * The Entity Lists resource manages all dynamic entities in your Mozu document store of the Mozu cloud. The content is JSON and can have up to five indexed properties (integer, decimal, string, date, and boolean) with support for additional customized elements as needed. Every document in the entity list has a validated unique ID. + * + */ +public class EntityListFactory +{ + + public static com.mozu.api.contracts.mzdb.EntityListCollection getEntityLists(ApiContext apiContext, int expectedCode) throws Exception + { + return getEntityLists(apiContext, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityListCollection getEntityLists(ApiContext apiContext, Integer pageSize, Integer startIndex, String filter, String sortBy, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityListCollection returnObj = new com.mozu.api.contracts.mzdb.EntityListCollection(); + EntityListResource resource = new EntityListResource(apiContext); + try + { + returnObj = resource.getEntityLists( pageSize, startIndex, filter, sortBy, 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.mzdb.EntityList getEntityList(ApiContext apiContext, String entityListFullName, int expectedCode) throws Exception + { + return getEntityList(apiContext, entityListFullName, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityList getEntityList(ApiContext apiContext, String entityListFullName, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityList returnObj = new com.mozu.api.contracts.mzdb.EntityList(); + EntityListResource resource = new EntityListResource(apiContext); + try + { + returnObj = resource.getEntityList( entityListFullName, 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.mzdb.EntityList createEntityList(ApiContext apiContext, com.mozu.api.contracts.mzdb.EntityList entityList, int expectedCode) throws Exception + { + return createEntityList(apiContext, entityList, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityList createEntityList(ApiContext apiContext, com.mozu.api.contracts.mzdb.EntityList entityList, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityList returnObj = new com.mozu.api.contracts.mzdb.EntityList(); + EntityListResource resource = new EntityListResource(apiContext); + try + { + returnObj = resource.createEntityList( entityList, 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.mzdb.EntityList updateEntityList(ApiContext apiContext, com.mozu.api.contracts.mzdb.EntityList entityList, String entityListFullName, int expectedCode) throws Exception + { + return updateEntityList(apiContext, entityList, entityListFullName, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityList updateEntityList(ApiContext apiContext, com.mozu.api.contracts.mzdb.EntityList entityList, String entityListFullName, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityList returnObj = new com.mozu.api.contracts.mzdb.EntityList(); + EntityListResource resource = new EntityListResource(apiContext); + try + { + returnObj = resource.updateEntityList( entityList, entityListFullName, 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 deleteEntityList(ApiContext apiContext, String entityListFullName, int expectedCode) throws Exception + { + EntityListResource resource = new EntityListResource(apiContext); + try + { + resource.deleteEntityList( entityListFullName); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EventDeliverySummaryFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EventDeliverySummaryFactory.java index 9cbb5d0e..247ed918 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EventDeliverySummaryFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EventDeliverySummaryFactory.java @@ -1,76 +1,77 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.event.push.subscriptions.EventDeliverySummaryResource; - -/** - * Provides details for each attempted delivery of the event to the endpoint. - * - */ -public class EventDeliverySummaryFactory -{ - - public static com.mozu.api.contracts.event.EventDeliverySummary getDeliveryAttemptSummary(ApiContext apiContext, String subscriptionId, int expectedCode, int successCode) throws Exception - { - return getDeliveryAttemptSummary(apiContext, subscriptionId, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.event.EventDeliverySummary getDeliveryAttemptSummary(ApiContext apiContext, String subscriptionId, Integer id, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.event.EventDeliverySummary returnObj = new com.mozu.api.contracts.event.EventDeliverySummary(); - EventDeliverySummaryResource resource = new EventDeliverySummaryResource(apiContext); - try - { - returnObj = resource.getDeliveryAttemptSummary( subscriptionId, id, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.event.EventDeliverySummaryCollection getDeliveryAttemptSummaries(ApiContext apiContext, String subscriptionId, int expectedCode, int successCode) throws Exception - { - return getDeliveryAttemptSummaries(apiContext, subscriptionId, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.event.EventDeliverySummaryCollection getDeliveryAttemptSummaries(ApiContext apiContext, String subscriptionId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.event.EventDeliverySummaryCollection returnObj = new com.mozu.api.contracts.event.EventDeliverySummaryCollection(); - EventDeliverySummaryResource resource = new EventDeliverySummaryResource(apiContext); - try - { - returnObj = resource.getDeliveryAttemptSummaries( subscriptionId, 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.event.push.subscriptions.EventDeliverySummaryResource; + +/** + * Provides details for each attempted delivery of the event to the endpoint. + * + */ +public class EventDeliverySummaryFactory +{ + + public static com.mozu.api.contracts.event.EventDeliverySummary getDeliveryAttemptSummary(ApiContext apiContext, String subscriptionId, int expectedCode) throws Exception + { + return getDeliveryAttemptSummary(apiContext, subscriptionId, null, null, expectedCode); + } + + public static com.mozu.api.contracts.event.EventDeliverySummary getDeliveryAttemptSummary(ApiContext apiContext, String subscriptionId, Integer id, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.event.EventDeliverySummary returnObj = new com.mozu.api.contracts.event.EventDeliverySummary(); + EventDeliverySummaryResource resource = new EventDeliverySummaryResource(apiContext); + try + { + returnObj = resource.getDeliveryAttemptSummary( subscriptionId, id, 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.event.EventDeliverySummaryCollection getDeliveryAttemptSummaries(ApiContext apiContext, String subscriptionId, int expectedCode) throws Exception + { + return getDeliveryAttemptSummaries(apiContext, subscriptionId, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.event.EventDeliverySummaryCollection getDeliveryAttemptSummaries(ApiContext apiContext, String subscriptionId, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.event.EventDeliverySummaryCollection returnObj = new com.mozu.api.contracts.event.EventDeliverySummaryCollection(); + EventDeliverySummaryResource resource = new EventDeliverySummaryResource(apiContext); + try + { + returnObj = resource.getDeliveryAttemptSummaries( subscriptionId, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EventNotificationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EventNotificationFactory.java index 7c26b505..7fd965d5 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EventNotificationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/EventNotificationFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class EventNotificationFactory { - public static com.mozu.api.contracts.event.EventCollection getEvents(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.event.EventCollection getEvents(ApiContext apiContext, int expectedCode) throws Exception { - return getEvents(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getEvents(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.event.EventCollection getEvents(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.event.EventCollection getEvents(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.event.EventCollection returnObj = new com.mozu.api.contracts.event.EventCollection(); EventNotificationResource resource = new EventNotificationResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.event.EventCollection getEvents(ApiContext catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.event.Event getEvent(ApiContext apiContext, String eventId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.event.Event getEvent(ApiContext apiContext, String eventId, int expectedCode) throws Exception { - return getEvent(apiContext, eventId, null, expectedCode, successCode ); + return getEvent(apiContext, eventId, null, expectedCode); } - public static com.mozu.api.contracts.event.Event getEvent(ApiContext apiContext, String eventId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.event.Event getEvent(ApiContext apiContext, String eventId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.event.Event returnObj = new com.mozu.api.contracts.event.Event(); EventNotificationResource resource = new EventNotificationResource(apiContext); @@ -61,12 +62,12 @@ public static com.mozu.api.contracts.event.Event getEvent(ApiContext apiContext, catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ExtendedPropertyFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ExtendedPropertyFactory.java index e94acd98..dec88bb1 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ExtendedPropertyFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ExtendedPropertyFactory.java @@ -1,172 +1,173 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.orders.ExtendedPropertyResource; - -/** - * - * - */ -public class ExtendedPropertyFactory -{ - - public static List getExtendedProperties(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception - { - return getExtendedProperties(apiContext, orderId, null, expectedCode, successCode ); - } - - public static List getExtendedProperties(ApiContext apiContext, String orderId, Boolean draft, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - returnObj = resource.getExtendedProperties( orderId, draft); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List addExtendedProperties(ApiContext apiContext, List extendedProperties, String orderId, int expectedCode, int successCode) throws Exception - { - return addExtendedProperties(apiContext, extendedProperties, orderId, null, null, expectedCode, successCode ); - } - - public static List addExtendedProperties(ApiContext apiContext, List extendedProperties, String orderId, String updateMode, String version, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - returnObj = resource.addExtendedProperties( extendedProperties, orderId, updateMode, version); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty updateExtendedProperty(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty extendedProperty, String orderId, String key, int expectedCode, int successCode) throws Exception - { - return updateExtendedProperty(apiContext, extendedProperty, orderId, key, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty updateExtendedProperty(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty extendedProperty, String orderId, String key, String updateMode, String version, Boolean upsert, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty returnObj = new com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty(); - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - returnObj = resource.updateExtendedProperty( extendedProperty, orderId, key, updateMode, version, upsert, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List updateExtendedProperties(ApiContext apiContext, List extendedProperties, String orderId, int expectedCode, int successCode) throws Exception - { - return updateExtendedProperties(apiContext, extendedProperties, orderId, null, null, null, expectedCode, successCode ); - } - - public static List updateExtendedProperties(ApiContext apiContext, List extendedProperties, String orderId, String updateMode, String version, Boolean upsert, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - returnObj = resource.updateExtendedProperties( extendedProperties, orderId, updateMode, version, upsert); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteExtendedProperty(ApiContext apiContext, String orderId, String key, int expectedCode, int successCode) throws Exception - { - deleteExtendedProperty(apiContext, orderId, key, null, null, expectedCode, successCode ); - } - - public static void deleteExtendedProperty(ApiContext apiContext, String orderId, String key, String updateMode, String version, int expectedCode, int successCode) throws Exception - { - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - resource.deleteExtendedProperty( orderId, key, updateMode, version); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static void deleteExtendedProperties(ApiContext apiContext, List keys, String orderId, int expectedCode, int successCode) throws Exception - { - deleteExtendedProperties(apiContext, keys, orderId, null, null, expectedCode, successCode ); - } - - public static void deleteExtendedProperties(ApiContext apiContext, List keys, String orderId, String updateMode, String version, int expectedCode, int successCode) throws Exception - { - ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); - try - { - resource.deleteExtendedProperties( keys, orderId, updateMode, version); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.orders.ExtendedPropertyResource; + +/** + * commerce/orders/extendedproperties related resources. DOCUMENT_HERE + * + */ +public class ExtendedPropertyFactory +{ + + public static List getExtendedProperties(ApiContext apiContext, String orderId, int expectedCode) throws Exception + { + return getExtendedProperties(apiContext, orderId, null, expectedCode); + } + + public static List getExtendedProperties(ApiContext apiContext, String orderId, Boolean draft, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + returnObj = resource.getExtendedProperties( orderId, draft); + } + 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 List addExtendedProperties(ApiContext apiContext, List extendedProperties, String orderId, int expectedCode) throws Exception + { + return addExtendedProperties(apiContext, extendedProperties, orderId, null, null, expectedCode); + } + + public static List addExtendedProperties(ApiContext apiContext, List extendedProperties, String orderId, String updateMode, String version, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + returnObj = resource.addExtendedProperties( extendedProperties, orderId, updateMode, version); + } + 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.commerce.ExtendedProperty updateExtendedProperty(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty extendedProperty, String orderId, String key, int expectedCode) throws Exception + { + return updateExtendedProperty(apiContext, extendedProperty, orderId, key, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty updateExtendedProperty(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty extendedProperty, String orderId, String key, String updateMode, String version, Boolean upsert, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty returnObj = new com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty(); + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + returnObj = resource.updateExtendedProperty( extendedProperty, orderId, key, updateMode, version, upsert, 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 List updateExtendedProperties(ApiContext apiContext, List extendedProperties, String orderId, int expectedCode) throws Exception + { + return updateExtendedProperties(apiContext, extendedProperties, orderId, null, null, null, expectedCode); + } + + public static List updateExtendedProperties(ApiContext apiContext, List extendedProperties, String orderId, String updateMode, String version, Boolean upsert, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + returnObj = resource.updateExtendedProperties( extendedProperties, orderId, updateMode, version, upsert); + } + 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 deleteExtendedProperty(ApiContext apiContext, String orderId, String key, int expectedCode) throws Exception + { + deleteExtendedProperty(apiContext, orderId, key, null, null, expectedCode); + } + + public static void deleteExtendedProperty(ApiContext apiContext, String orderId, String key, String updateMode, String version, int expectedCode) throws Exception + { + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + resource.deleteExtendedProperty( orderId, key, updateMode, version); + } + 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, ""); + } + + public static void deleteExtendedProperties(ApiContext apiContext, List keys, String orderId, int expectedCode) throws Exception + { + deleteExtendedProperties(apiContext, keys, orderId, null, null, expectedCode); + } + + public static void deleteExtendedProperties(ApiContext apiContext, List keys, String orderId, String updateMode, String version, int expectedCode) throws Exception + { + ExtendedPropertyResource resource = new ExtendedPropertyResource(apiContext); + try + { + resource.deleteExtendedProperties( keys, orderId, updateMode, version); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FacetFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FacetFactory.java index 2dc8a93a..6f82b3f6 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FacetFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FacetFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class FacetFactory { - public static List getFacets(ApiContext apiContext, String documentListName, String propertyName, int expectedCode, int successCode) throws Exception + public static List getFacets(ApiContext apiContext, String documentListName, String propertyName, int expectedCode) throws Exception { List returnObj = new ArrayList(); FacetResource resource = new FacetResource(apiContext); @@ -31,12 +32,12 @@ public static List getFacets(ApiContext ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FulfillmentActionFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FulfillmentActionFactory.java index eda7607d..5535d735 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FulfillmentActionFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FulfillmentActionFactory.java @@ -1,76 +1,77 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.orders.FulfillmentActionResource; - -/** - * Use the Fulfillment resource to manage shipments or pickups of collections of packages for an order. - * - */ -public class FulfillmentActionFactory -{ - - public static com.mozu.api.contracts.commerceruntime.orders.Order performFulfillmentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentAction action, String orderId, int expectedCode, int successCode) throws Exception - { - return performFulfillmentAction(apiContext, action, orderId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order performFulfillmentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentAction action, String orderId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - FulfillmentActionResource resource = new FulfillmentActionResource(apiContext); - try - { - returnObj = resource.performFulfillmentAction( action, orderId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order resendPackageFulfillmentEmail(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentAction action, String orderId, int expectedCode, int successCode) throws Exception - { - return resendPackageFulfillmentEmail(apiContext, action, orderId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order resendPackageFulfillmentEmail(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentAction action, String orderId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - FulfillmentActionResource resource = new FulfillmentActionResource(apiContext); - try - { - returnObj = resource.resendPackageFulfillmentEmail( action, orderId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.orders.FulfillmentActionResource; + +/** + * Use the Fulfillment resource to manage shipments or pickups of collections of packages for an order. + * + */ +public class FulfillmentActionFactory +{ + + public static com.mozu.api.contracts.commerceruntime.orders.Order performFulfillmentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentAction action, String orderId, int expectedCode) throws Exception + { + return performFulfillmentAction(apiContext, action, orderId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order performFulfillmentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentAction action, String orderId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + FulfillmentActionResource resource = new FulfillmentActionResource(apiContext); + try + { + returnObj = resource.performFulfillmentAction( action, orderId, 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.orders.Order resendPackageFulfillmentEmail(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentAction action, String orderId, int expectedCode) throws Exception + { + return resendPackageFulfillmentEmail(apiContext, action, orderId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order resendPackageFulfillmentEmail(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentAction action, String orderId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + FulfillmentActionResource resource = new FulfillmentActionResource(apiContext); + try + { + returnObj = resource.resendPackageFulfillmentEmail( action, orderId, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FulfillmentInfoFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FulfillmentInfoFactory.java index 16a0e130..4a43c97f 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FulfillmentInfoFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/FulfillmentInfoFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class FulfillmentInfoFactory { - public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo getFulfillmentInfo(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo getFulfillmentInfo(ApiContext apiContext, String orderId, int expectedCode) throws Exception { - return getFulfillmentInfo(apiContext, orderId, null, null, expectedCode, successCode ); + return getFulfillmentInfo(apiContext, orderId, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo getFulfillmentInfo(ApiContext apiContext, String orderId, Boolean draft, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo getFulfillmentInfo(ApiContext apiContext, String orderId, Boolean draft, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo(); FulfillmentInfoResource resource = new FulfillmentInfoResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.FulfillmentInfo setFulFillmentInfo(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo fulfillmentInfo, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo setFulFillmentInfo(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo fulfillmentInfo, String orderId, int expectedCode) throws Exception { - return setFulFillmentInfo(apiContext, fulfillmentInfo, orderId, null, null, null, expectedCode, successCode ); + return setFulFillmentInfo(apiContext, fulfillmentInfo, orderId, null, null, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo setFulFillmentInfo(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo fulfillmentInfo, String orderId, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo setFulFillmentInfo(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo fulfillmentInfo, String orderId, String updateMode, String version, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo(); FulfillmentInfoResource resource = new FulfillmentInfoResource(apiContext); @@ -61,12 +62,12 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.FulfillmentInfo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/GeneralSettingsFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/GeneralSettingsFactory.java index b40ed767..430a3516 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/GeneralSettingsFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/GeneralSettingsFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class GeneralSettingsFactory { - public static com.mozu.api.contracts.sitesettings.general.GeneralSettings getGeneralSettings(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.general.GeneralSettings getGeneralSettings(ApiContext apiContext, int expectedCode) throws Exception { - return getGeneralSettings(apiContext, null, expectedCode, successCode ); + return getGeneralSettings(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.general.GeneralSettings getGeneralSettings(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.general.GeneralSettings getGeneralSettings(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.general.GeneralSettings returnObj = new com.mozu.api.contracts.sitesettings.general.GeneralSettings(); GeneralSettingsResource resource = new GeneralSettingsResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.sitesettings.general.GeneralSettings getGen catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.sitesettings.general.GeneralSettings updateGeneralSettings(ApiContext apiContext, com.mozu.api.contracts.sitesettings.general.GeneralSettings generalSettings, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.general.GeneralSettings updateGeneralSettings(ApiContext apiContext, com.mozu.api.contracts.sitesettings.general.GeneralSettings generalSettings, int expectedCode) throws Exception { - return updateGeneralSettings(apiContext, generalSettings, null, expectedCode, successCode ); + return updateGeneralSettings(apiContext, generalSettings, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.general.GeneralSettings updateGeneralSettings(ApiContext apiContext, com.mozu.api.contracts.sitesettings.general.GeneralSettings generalSettings, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.general.GeneralSettings updateGeneralSettings(ApiContext apiContext, com.mozu.api.contracts.sitesettings.general.GeneralSettings generalSettings, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.general.GeneralSettings returnObj = new com.mozu.api.contracts.sitesettings.general.GeneralSettings(); GeneralSettingsResource resource = new GeneralSettingsResource(apiContext); @@ -61,12 +62,12 @@ public static com.mozu.api.contracts.sitesettings.general.GeneralSettings update catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/InStockNotificationSubscriptionFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/InStockNotificationSubscriptionFactory.java index 77619bde..73a903ce 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/InStockNotificationSubscriptionFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/InStockNotificationSubscriptionFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class InStockNotificationSubscriptionFactory { - public static com.mozu.api.contracts.customer.InStockNotificationSubscriptionCollection getInStockNotificationSubscriptions(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.InStockNotificationSubscriptionCollection getInStockNotificationSubscriptions(ApiContext apiContext, int expectedCode) throws Exception { - return getInStockNotificationSubscriptions(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getInStockNotificationSubscriptions(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.customer.InStockNotificationSubscriptionCollection getInStockNotificationSubscriptions(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.InStockNotificationSubscriptionCollection getInStockNotificationSubscriptions(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.InStockNotificationSubscriptionCollection returnObj = new com.mozu.api.contracts.customer.InStockNotificationSubscriptionCollection(); InStockNotificationSubscriptionResource resource = new InStockNotificationSubscriptionResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.customer.InStockNotificationSubscriptionCol catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.InStockNotificationSubscription getInStockNotificationSubscription(ApiContext apiContext, Integer id, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.InStockNotificationSubscription getInStockNotificationSubscription(ApiContext apiContext, Integer id, int expectedCode) throws Exception { - return getInStockNotificationSubscription(apiContext, id, null, expectedCode, successCode ); + return getInStockNotificationSubscription(apiContext, id, null, expectedCode); } - public static com.mozu.api.contracts.customer.InStockNotificationSubscription getInStockNotificationSubscription(ApiContext apiContext, Integer id, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.InStockNotificationSubscription getInStockNotificationSubscription(ApiContext apiContext, Integer id, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.InStockNotificationSubscription returnObj = new com.mozu.api.contracts.customer.InStockNotificationSubscription(); InStockNotificationSubscriptionResource resource = new InStockNotificationSubscriptionResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.customer.InStockNotificationSubscription ge catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.InStockNotificationSubscription addInStockNotificationSubscription(ApiContext apiContext, com.mozu.api.contracts.customer.InStockNotificationSubscription inStockNotificationSubscription, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.InStockNotificationSubscription addInStockNotificationSubscription(ApiContext apiContext, com.mozu.api.contracts.customer.InStockNotificationSubscription inStockNotificationSubscription, int expectedCode) throws Exception { - return addInStockNotificationSubscription(apiContext, inStockNotificationSubscription, null, expectedCode, successCode ); + return addInStockNotificationSubscription(apiContext, inStockNotificationSubscription, null, expectedCode); } - public static com.mozu.api.contracts.customer.InStockNotificationSubscription addInStockNotificationSubscription(ApiContext apiContext, com.mozu.api.contracts.customer.InStockNotificationSubscription inStockNotificationSubscription, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.InStockNotificationSubscription addInStockNotificationSubscription(ApiContext apiContext, com.mozu.api.contracts.customer.InStockNotificationSubscription inStockNotificationSubscription, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.InStockNotificationSubscription returnObj = new com.mozu.api.contracts.customer.InStockNotificationSubscription(); InStockNotificationSubscriptionResource resource = new InStockNotificationSubscriptionResource(apiContext); @@ -86,16 +87,16 @@ public static com.mozu.api.contracts.customer.InStockNotificationSubscription ad catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteInStockNotificationSubscription(ApiContext apiContext, Integer id, int expectedCode, int successCode) throws Exception + public static void deleteInStockNotificationSubscription(ApiContext apiContext, Integer id, int expectedCode) throws Exception { InStockNotificationSubscriptionResource resource = new InStockNotificationSubscriptionResource(apiContext); try @@ -105,12 +106,12 @@ public static void deleteInStockNotificationSubscription(ApiContext apiContext, catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ListViewFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ListViewFactory.java index c25fc753..170ca554 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ListViewFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ListViewFactory.java @@ -1,244 +1,245 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.entitylists.ListViewResource; - -/** - * Provides settings and options for displaying associated content within a context level of site, tenant, catalog, or master catalog. ListViews can be associated with entity lists and entities. - * - */ -public class ListViewFactory -{ - - public static com.fasterxml.jackson.databind.JsonNode getViewEntity(ApiContext apiContext, String entityListFullName, String viewName, String entityId, int expectedCode, int successCode) throws Exception - { - return getViewEntity(apiContext, entityListFullName, viewName, entityId, null, expectedCode, successCode ); - } - - public static com.fasterxml.jackson.databind.JsonNode getViewEntity(ApiContext apiContext, String entityListFullName, String viewName, String entityId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.fasterxml.jackson.databind.JsonNode returnObj; - ListViewResource resource = new ListViewResource(apiContext); - try - { - returnObj = resource.getViewEntity( entityListFullName, viewName, entityId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.EntityCollection getViewEntities(ApiContext apiContext, String entityListFullName, String viewName, int expectedCode, int successCode) throws Exception - { - return getViewEntities(apiContext, entityListFullName, viewName, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityCollection getViewEntities(ApiContext apiContext, String entityListFullName, String viewName, Integer pageSize, Integer startIndex, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityCollection returnObj = new com.mozu.api.contracts.mzdb.EntityCollection(); - ListViewResource resource = new ListViewResource(apiContext); - try - { - returnObj = resource.getViewEntities( entityListFullName, viewName, pageSize, startIndex, 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.EntityContainer getViewEntityContainer(ApiContext apiContext, String entityListFullName, String viewName, String entityId, int expectedCode, int successCode) throws Exception - { - return getViewEntityContainer(apiContext, entityListFullName, viewName, entityId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityContainer getViewEntityContainer(ApiContext apiContext, String entityListFullName, String viewName, String entityId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityContainer returnObj = new com.mozu.api.contracts.mzdb.EntityContainer(); - ListViewResource resource = new ListViewResource(apiContext); - try - { - returnObj = resource.getViewEntityContainer( entityListFullName, viewName, entityId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.EntityContainerCollection getViewEntityContainers(ApiContext apiContext, String entityListFullName, String viewName, int expectedCode, int successCode) throws Exception - { - return getViewEntityContainers(apiContext, entityListFullName, viewName, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.EntityContainerCollection getViewEntityContainers(ApiContext apiContext, String entityListFullName, String viewName, Integer pageSize, Integer startIndex, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.EntityContainerCollection returnObj = new com.mozu.api.contracts.mzdb.EntityContainerCollection(); - ListViewResource resource = new ListViewResource(apiContext); - try - { - returnObj = resource.getViewEntityContainers( entityListFullName, viewName, pageSize, startIndex, 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.ListView getEntityListView(ApiContext apiContext, String entityListFullName, String viewName, int expectedCode, int successCode) throws Exception - { - return getEntityListView(apiContext, entityListFullName, viewName, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.ListView getEntityListView(ApiContext apiContext, String entityListFullName, String viewName, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.ListView returnObj = new com.mozu.api.contracts.mzdb.ListView(); - ListViewResource resource = new ListViewResource(apiContext); - try - { - returnObj = resource.getEntityListView( entityListFullName, viewName, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.ListViewCollection getEntityListViews(ApiContext apiContext, String entityListFullName, int expectedCode, int successCode) throws Exception - { - return getEntityListViews(apiContext, entityListFullName, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.ListViewCollection getEntityListViews(ApiContext apiContext, String entityListFullName, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.ListViewCollection returnObj = new com.mozu.api.contracts.mzdb.ListViewCollection(); - ListViewResource resource = new ListViewResource(apiContext); - try - { - returnObj = resource.getEntityListViews( entityListFullName, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.ListView createEntityListView(ApiContext apiContext, com.mozu.api.contracts.mzdb.ListView listView, String entityListFullName, int expectedCode, int successCode) throws Exception - { - return createEntityListView(apiContext, listView, entityListFullName, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.ListView createEntityListView(ApiContext apiContext, com.mozu.api.contracts.mzdb.ListView listView, String entityListFullName, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.ListView returnObj = new com.mozu.api.contracts.mzdb.ListView(); - ListViewResource resource = new ListViewResource(apiContext); - try - { - returnObj = resource.createEntityListView( listView, entityListFullName, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.mzdb.ListView updateEntityListView(ApiContext apiContext, com.mozu.api.contracts.mzdb.ListView listView, String entityListFullName, String viewName, int expectedCode, int successCode) throws Exception - { - return updateEntityListView(apiContext, listView, entityListFullName, viewName, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.mzdb.ListView updateEntityListView(ApiContext apiContext, com.mozu.api.contracts.mzdb.ListView listView, String entityListFullName, String viewName, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.mzdb.ListView returnObj = new com.mozu.api.contracts.mzdb.ListView(); - ListViewResource resource = new ListViewResource(apiContext); - try - { - returnObj = resource.updateEntityListView( listView, entityListFullName, viewName, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteEntityListView(ApiContext apiContext, String entityListFullName, String viewName, int expectedCode, int successCode) throws Exception - { - ListViewResource resource = new ListViewResource(apiContext); - try - { - resource.deleteEntityListView( entityListFullName, viewName); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.entitylists.ListViewResource; + +/** + * Provides settings and options for displaying associated content within a context level of site, tenant, catalog, or master catalog. ListViews can be associated with entity lists and entities. + * + */ +public class ListViewFactory +{ + + public static com.fasterxml.jackson.databind.JsonNode getViewEntity(ApiContext apiContext, String entityListFullName, String viewName, String entityId, int expectedCode) throws Exception + { + return getViewEntity(apiContext, entityListFullName, viewName, entityId, null, expectedCode); + } + + public static com.fasterxml.jackson.databind.JsonNode getViewEntity(ApiContext apiContext, String entityListFullName, String viewName, String entityId, String responseFields, int expectedCode) throws Exception + { + com.fasterxml.jackson.databind.JsonNode returnObj; + ListViewResource resource = new ListViewResource(apiContext); + try + { + returnObj = resource.getViewEntity( entityListFullName, viewName, entityId, 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.mzdb.EntityCollection getViewEntities(ApiContext apiContext, String entityListFullName, String viewName, int expectedCode) throws Exception + { + return getViewEntities(apiContext, entityListFullName, viewName, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityCollection getViewEntities(ApiContext apiContext, String entityListFullName, String viewName, Integer pageSize, Integer startIndex, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityCollection returnObj = new com.mozu.api.contracts.mzdb.EntityCollection(); + ListViewResource resource = new ListViewResource(apiContext); + try + { + returnObj = resource.getViewEntities( entityListFullName, viewName, pageSize, startIndex, 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.mzdb.EntityContainer getViewEntityContainer(ApiContext apiContext, String entityListFullName, String viewName, String entityId, int expectedCode) throws Exception + { + return getViewEntityContainer(apiContext, entityListFullName, viewName, entityId, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityContainer getViewEntityContainer(ApiContext apiContext, String entityListFullName, String viewName, String entityId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityContainer returnObj = new com.mozu.api.contracts.mzdb.EntityContainer(); + ListViewResource resource = new ListViewResource(apiContext); + try + { + returnObj = resource.getViewEntityContainer( entityListFullName, viewName, entityId, 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.mzdb.EntityContainerCollection getViewEntityContainers(ApiContext apiContext, String entityListFullName, String viewName, int expectedCode) throws Exception + { + return getViewEntityContainers(apiContext, entityListFullName, viewName, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.EntityContainerCollection getViewEntityContainers(ApiContext apiContext, String entityListFullName, String viewName, Integer pageSize, Integer startIndex, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.EntityContainerCollection returnObj = new com.mozu.api.contracts.mzdb.EntityContainerCollection(); + ListViewResource resource = new ListViewResource(apiContext); + try + { + returnObj = resource.getViewEntityContainers( entityListFullName, viewName, pageSize, startIndex, 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.mzdb.ListView getEntityListView(ApiContext apiContext, String entityListFullName, String viewName, int expectedCode) throws Exception + { + return getEntityListView(apiContext, entityListFullName, viewName, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.ListView getEntityListView(ApiContext apiContext, String entityListFullName, String viewName, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.ListView returnObj = new com.mozu.api.contracts.mzdb.ListView(); + ListViewResource resource = new ListViewResource(apiContext); + try + { + returnObj = resource.getEntityListView( entityListFullName, viewName, 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.mzdb.ListViewCollection getEntityListViews(ApiContext apiContext, String entityListFullName, int expectedCode) throws Exception + { + return getEntityListViews(apiContext, entityListFullName, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.ListViewCollection getEntityListViews(ApiContext apiContext, String entityListFullName, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.ListViewCollection returnObj = new com.mozu.api.contracts.mzdb.ListViewCollection(); + ListViewResource resource = new ListViewResource(apiContext); + try + { + returnObj = resource.getEntityListViews( entityListFullName, 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.mzdb.ListView createEntityListView(ApiContext apiContext, com.mozu.api.contracts.mzdb.ListView listView, String entityListFullName, int expectedCode) throws Exception + { + return createEntityListView(apiContext, listView, entityListFullName, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.ListView createEntityListView(ApiContext apiContext, com.mozu.api.contracts.mzdb.ListView listView, String entityListFullName, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.ListView returnObj = new com.mozu.api.contracts.mzdb.ListView(); + ListViewResource resource = new ListViewResource(apiContext); + try + { + returnObj = resource.createEntityListView( listView, entityListFullName, 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.mzdb.ListView updateEntityListView(ApiContext apiContext, com.mozu.api.contracts.mzdb.ListView listView, String entityListFullName, String viewName, int expectedCode) throws Exception + { + return updateEntityListView(apiContext, listView, entityListFullName, viewName, null, expectedCode); + } + + public static com.mozu.api.contracts.mzdb.ListView updateEntityListView(ApiContext apiContext, com.mozu.api.contracts.mzdb.ListView listView, String entityListFullName, String viewName, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.mzdb.ListView returnObj = new com.mozu.api.contracts.mzdb.ListView(); + ListViewResource resource = new ListViewResource(apiContext); + try + { + returnObj = resource.updateEntityListView( listView, entityListFullName, viewName, 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 deleteEntityListView(ApiContext apiContext, String entityListFullName, String viewName, int expectedCode) throws Exception + { + ListViewResource resource = new ListViewResource(apiContext); + try + { + resource.deleteEntityListView( entityListFullName, viewName); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationFactory.java index ef6bd053..56b3cef0 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class LocationFactory { - public static com.mozu.api.contracts.location.LocationCollection getLocations(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationCollection getLocations(ApiContext apiContext, int expectedCode) throws Exception { - return getLocations(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getLocations(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.location.LocationCollection getLocations(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationCollection getLocations(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.LocationCollection returnObj = new com.mozu.api.contracts.location.LocationCollection(); LocationResource resource = new LocationResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.location.LocationCollection getLocations(Ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.location.Location getLocation(ApiContext apiContext, String locationCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.Location getLocation(ApiContext apiContext, String locationCode, int expectedCode) throws Exception { - return getLocation(apiContext, locationCode, null, expectedCode, successCode ); + return getLocation(apiContext, locationCode, null, expectedCode); } - public static com.mozu.api.contracts.location.Location getLocation(ApiContext apiContext, String locationCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.Location getLocation(ApiContext apiContext, String locationCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); LocationResource resource = new LocationResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.location.Location getLocation(ApiContext ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.location.Location addLocation(ApiContext apiContext, com.mozu.api.contracts.location.Location location, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.Location addLocation(ApiContext apiContext, com.mozu.api.contracts.location.Location location, int expectedCode) throws Exception { - return addLocation(apiContext, location, null, expectedCode, successCode ); + return addLocation(apiContext, location, null, expectedCode); } - public static com.mozu.api.contracts.location.Location addLocation(ApiContext apiContext, com.mozu.api.contracts.location.Location location, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.Location addLocation(ApiContext apiContext, com.mozu.api.contracts.location.Location location, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); LocationResource resource = new LocationResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.location.Location addLocation(ApiContext ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.location.Location updateLocation(ApiContext apiContext, com.mozu.api.contracts.location.Location location, String locationCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.Location updateLocation(ApiContext apiContext, com.mozu.api.contracts.location.Location location, String locationCode, int expectedCode) throws Exception { - return updateLocation(apiContext, location, locationCode, null, expectedCode, successCode ); + return updateLocation(apiContext, location, locationCode, null, expectedCode); } - public static com.mozu.api.contracts.location.Location updateLocation(ApiContext apiContext, com.mozu.api.contracts.location.Location location, String locationCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.Location updateLocation(ApiContext apiContext, com.mozu.api.contracts.location.Location location, String locationCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.Location returnObj = new com.mozu.api.contracts.location.Location(); LocationResource resource = new LocationResource(apiContext); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.location.Location updateLocation(ApiContext catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteLocation(ApiContext apiContext, String locationCode, int expectedCode, int successCode) throws Exception + public static void deleteLocation(ApiContext apiContext, String locationCode, int expectedCode) throws Exception { LocationResource resource = new LocationResource(apiContext); try @@ -130,12 +131,12 @@ public static void deleteLocation(ApiContext apiContext, String locationCode, in catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationInventoryFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationInventoryFactory.java index 42e8432d..5339e80b 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationInventoryFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationInventoryFactory.java @@ -1,139 +1,140 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.admin.products.LocationInventoryResource; - -/** - * Use the Product Location Inventory resource to manage the levels of active product inventory to maintain across defined locations at the product level. - * - */ -public class LocationInventoryFactory -{ - - public static com.mozu.api.contracts.productadmin.LocationInventoryCollection getLocationInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception - { - return getLocationInventories(apiContext, dataViewMode, productCode, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.LocationInventoryCollection getLocationInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.LocationInventoryCollection returnObj = new com.mozu.api.contracts.productadmin.LocationInventoryCollection(); - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - returnObj = resource.getLocationInventories( productCode, 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.LocationInventory getLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String locationCode, int expectedCode, int successCode) throws Exception - { - return getLocationInventory(apiContext, dataViewMode, productCode, locationCode, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.LocationInventory getLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String locationCode, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.LocationInventory returnObj = new com.mozu.api.contracts.productadmin.LocationInventory(); - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - returnObj = resource.getLocationInventory( productCode, locationCode, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List addLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryList, String productCode, int expectedCode, int successCode) throws Exception - { - return addLocationInventory(apiContext, dataViewMode, locationInventoryList, productCode, null, expectedCode, successCode ); - } - - public static List addLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryList, String productCode, Boolean performUpserts, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - returnObj = resource.addLocationInventory( locationInventoryList, productCode, performUpserts); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List updateLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryAdjustments, String productCode, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - returnObj = resource.updateLocationInventory( locationInventoryAdjustments, productCode); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String locationCode, int expectedCode, int successCode) throws Exception - { - LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); - try - { - resource.deleteLocationInventory( productCode, locationCode); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.admin.products.LocationInventoryResource; + +/** + * Use the Product Location Inventory resource to manage the levels of active product inventory to maintain across defined locations at the product level. + * + */ +public class LocationInventoryFactory +{ + + public static com.mozu.api.contracts.productadmin.LocationInventoryCollection getLocationInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception + { + return getLocationInventories(apiContext, dataViewMode, productCode, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.LocationInventoryCollection getLocationInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.LocationInventoryCollection returnObj = new com.mozu.api.contracts.productadmin.LocationInventoryCollection(); + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + returnObj = resource.getLocationInventories( productCode, 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.productadmin.LocationInventory getLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String locationCode, int expectedCode) throws Exception + { + return getLocationInventory(apiContext, dataViewMode, productCode, locationCode, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.LocationInventory getLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String locationCode, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.LocationInventory returnObj = new com.mozu.api.contracts.productadmin.LocationInventory(); + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + returnObj = resource.getLocationInventory( productCode, locationCode, 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 List addLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryList, String productCode, int expectedCode) throws Exception + { + return addLocationInventory(apiContext, dataViewMode, locationInventoryList, productCode, null, expectedCode); + } + + public static List addLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryList, String productCode, Boolean performUpserts, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + returnObj = resource.addLocationInventory( locationInventoryList, productCode, performUpserts); + } + 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 List updateLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List locationInventoryAdjustments, String productCode, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + returnObj = resource.updateLocationInventory( locationInventoryAdjustments, productCode); + } + 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 deleteLocationInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String locationCode, int expectedCode) throws Exception + { + LocationInventoryResource resource = new LocationInventoryResource(apiContext, dataViewMode); + try + { + resource.deleteLocationInventory( productCode, locationCode); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationTypeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationTypeFactory.java index acbc782f..19897417 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationTypeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationTypeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class LocationTypeFactory { - public static List getLocationTypes(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static List getLocationTypes(ApiContext apiContext, int expectedCode) throws Exception { List returnObj = new ArrayList(); LocationTypeResource resource = new LocationTypeResource(apiContext); @@ -31,21 +32,21 @@ public static List getLocationType catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.location.LocationType getLocationType(ApiContext apiContext, String locationTypeCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationType getLocationType(ApiContext apiContext, String locationTypeCode, int expectedCode) throws Exception { - return getLocationType(apiContext, locationTypeCode, null, expectedCode, successCode ); + return getLocationType(apiContext, locationTypeCode, null, expectedCode); } - public static com.mozu.api.contracts.location.LocationType getLocationType(ApiContext apiContext, String locationTypeCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationType getLocationType(ApiContext apiContext, String locationTypeCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.LocationType returnObj = new com.mozu.api.contracts.location.LocationType(); LocationTypeResource resource = new LocationTypeResource(apiContext); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.location.LocationType getLocationType(ApiCo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.location.LocationType addLocationType(ApiContext apiContext, com.mozu.api.contracts.location.LocationType locationType, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationType addLocationType(ApiContext apiContext, com.mozu.api.contracts.location.LocationType locationType, int expectedCode) throws Exception { - return addLocationType(apiContext, locationType, null, expectedCode, successCode ); + return addLocationType(apiContext, locationType, null, expectedCode); } - public static com.mozu.api.contracts.location.LocationType addLocationType(ApiContext apiContext, com.mozu.api.contracts.location.LocationType locationType, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationType addLocationType(ApiContext apiContext, com.mozu.api.contracts.location.LocationType locationType, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.LocationType returnObj = new com.mozu.api.contracts.location.LocationType(); LocationTypeResource resource = new LocationTypeResource(apiContext); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.location.LocationType addLocationType(ApiCo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.location.LocationType updateLocationType(ApiContext apiContext, com.mozu.api.contracts.location.LocationType locationType, String locationTypeCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationType updateLocationType(ApiContext apiContext, com.mozu.api.contracts.location.LocationType locationType, String locationTypeCode, int expectedCode) throws Exception { - return updateLocationType(apiContext, locationType, locationTypeCode, null, expectedCode, successCode ); + return updateLocationType(apiContext, locationType, locationTypeCode, null, expectedCode); } - public static com.mozu.api.contracts.location.LocationType updateLocationType(ApiContext apiContext, com.mozu.api.contracts.location.LocationType locationType, String locationTypeCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationType updateLocationType(ApiContext apiContext, com.mozu.api.contracts.location.LocationType locationType, String locationTypeCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.LocationType returnObj = new com.mozu.api.contracts.location.LocationType(); LocationTypeResource resource = new LocationTypeResource(apiContext); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.location.LocationType updateLocationType(Ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteLocationType(ApiContext apiContext, String locationTypeCode, int expectedCode, int successCode) throws Exception + public static void deleteLocationType(ApiContext apiContext, String locationTypeCode, int expectedCode) throws Exception { LocationTypeResource resource = new LocationTypeResource(apiContext); try @@ -125,12 +126,12 @@ public static void deleteLocationType(ApiContext apiContext, String locationType catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationUsageFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationUsageFactory.java index 398e58d7..b35a4881 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationUsageFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/LocationUsageFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class LocationUsageFactory { - public static com.mozu.api.contracts.location.LocationUsageCollection getLocationUsages(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationUsageCollection getLocationUsages(ApiContext apiContext, int expectedCode) throws Exception { - return getLocationUsages(apiContext, null, expectedCode, successCode ); + return getLocationUsages(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.location.LocationUsageCollection getLocationUsages(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationUsageCollection getLocationUsages(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.LocationUsageCollection returnObj = new com.mozu.api.contracts.location.LocationUsageCollection(); LocationUsageResource resource = new LocationUsageResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.location.LocationUsageCollection getLocatio catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.location.LocationUsage getLocationUsage(ApiContext apiContext, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationUsage getLocationUsage(ApiContext apiContext, String code, int expectedCode) throws Exception { - return getLocationUsage(apiContext, code, null, expectedCode, successCode ); + return getLocationUsage(apiContext, code, null, expectedCode); } - public static com.mozu.api.contracts.location.LocationUsage getLocationUsage(ApiContext apiContext, String code, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationUsage getLocationUsage(ApiContext apiContext, String code, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.LocationUsage returnObj = new com.mozu.api.contracts.location.LocationUsage(); LocationUsageResource resource = new LocationUsageResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.location.LocationUsage getLocationUsage(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.location.LocationUsage updateLocationUsage(ApiContext apiContext, com.mozu.api.contracts.location.LocationUsage usage, String code, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationUsage updateLocationUsage(ApiContext apiContext, com.mozu.api.contracts.location.LocationUsage usage, String code, int expectedCode) throws Exception { - return updateLocationUsage(apiContext, usage, code, null, expectedCode, successCode ); + return updateLocationUsage(apiContext, usage, code, null, expectedCode); } - public static com.mozu.api.contracts.location.LocationUsage updateLocationUsage(ApiContext apiContext, com.mozu.api.contracts.location.LocationUsage usage, String code, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.location.LocationUsage updateLocationUsage(ApiContext apiContext, com.mozu.api.contracts.location.LocationUsage usage, String code, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.location.LocationUsage returnObj = new com.mozu.api.contracts.location.LocationUsage(); LocationUsageResource resource = new LocationUsageResource(apiContext); @@ -86,12 +87,12 @@ public static com.mozu.api.contracts.location.LocationUsage updateLocationUsage( catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/MasterCatalogFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/MasterCatalogFactory.java index f0f610ba..fecbb713 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/MasterCatalogFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/MasterCatalogFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class MasterCatalogFactory { - public static com.mozu.api.contracts.productadmin.MasterCatalogCollection getMasterCatalogs(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.MasterCatalogCollection getMasterCatalogs(ApiContext apiContext, int expectedCode) throws Exception { - return getMasterCatalogs(apiContext, null, expectedCode, successCode ); + return getMasterCatalogs(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.MasterCatalogCollection getMasterCatalogs(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.MasterCatalogCollection getMasterCatalogs(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.MasterCatalogCollection returnObj = new com.mozu.api.contracts.productadmin.MasterCatalogCollection(); MasterCatalogResource resource = new MasterCatalogResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.productadmin.MasterCatalogCollection getMas catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.MasterCatalog getMasterCatalog(ApiContext apiContext, Integer masterCatalogId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.MasterCatalog getMasterCatalog(ApiContext apiContext, Integer masterCatalogId, int expectedCode) throws Exception { - return getMasterCatalog(apiContext, masterCatalogId, null, expectedCode, successCode ); + return getMasterCatalog(apiContext, masterCatalogId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.MasterCatalog getMasterCatalog(ApiContext apiContext, Integer masterCatalogId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.MasterCatalog getMasterCatalog(ApiContext apiContext, Integer masterCatalogId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.MasterCatalog returnObj = new com.mozu.api.contracts.productadmin.MasterCatalog(); MasterCatalogResource resource = new MasterCatalogResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.productadmin.MasterCatalog getMasterCatalog catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.MasterCatalog updateMasterCatalog(ApiContext apiContext, com.mozu.api.contracts.productadmin.MasterCatalog masterCatalog, Integer masterCatalogId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.MasterCatalog updateMasterCatalog(ApiContext apiContext, com.mozu.api.contracts.productadmin.MasterCatalog masterCatalog, Integer masterCatalogId, int expectedCode) throws Exception { - return updateMasterCatalog(apiContext, masterCatalog, masterCatalogId, null, expectedCode, successCode ); + return updateMasterCatalog(apiContext, masterCatalog, masterCatalogId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.MasterCatalog updateMasterCatalog(ApiContext apiContext, com.mozu.api.contracts.productadmin.MasterCatalog masterCatalog, Integer masterCatalogId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.MasterCatalog updateMasterCatalog(ApiContext apiContext, com.mozu.api.contracts.productadmin.MasterCatalog masterCatalog, Integer masterCatalogId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.MasterCatalog returnObj = new com.mozu.api.contracts.productadmin.MasterCatalog(); MasterCatalogResource resource = new MasterCatalogResource(apiContext); @@ -86,12 +87,12 @@ public static com.mozu.api.contracts.productadmin.MasterCatalog updateMasterCata catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderAttributeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderAttributeFactory.java index 5e561177..a540eab7 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderAttributeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderAttributeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class OrderAttributeFactory { - public static List getOrderAttributes(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static List getOrderAttributes(ApiContext apiContext, String orderId, int expectedCode) throws Exception { List returnObj = new ArrayList(); OrderAttributeResource resource = new OrderAttributeResource(apiContext); @@ -31,16 +32,16 @@ public static List catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List createOrderAttributes(ApiContext apiContext, List orderAttributes, String orderId, int expectedCode, int successCode) throws Exception + public static List createOrderAttributes(ApiContext apiContext, List orderAttributes, String orderId, int expectedCode) throws Exception { List returnObj = new ArrayList(); OrderAttributeResource resource = new OrderAttributeResource(apiContext); @@ -51,21 +52,21 @@ public static List catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List updateOrderAttributes(ApiContext apiContext, List orderAttributes, String orderId, int expectedCode, int successCode) throws Exception + public static List updateOrderAttributes(ApiContext apiContext, List orderAttributes, String orderId, int expectedCode) throws Exception { - return updateOrderAttributes(apiContext, orderAttributes, orderId, null, expectedCode, successCode ); + return updateOrderAttributes(apiContext, orderAttributes, orderId, null, expectedCode); } - public static List updateOrderAttributes(ApiContext apiContext, List orderAttributes, String orderId, Boolean removeMissing, int expectedCode, int successCode) throws Exception + public static List updateOrderAttributes(ApiContext apiContext, List orderAttributes, String orderId, Boolean removeMissing, int expectedCode) throws Exception { List returnObj = new ArrayList(); OrderAttributeResource resource = new OrderAttributeResource(apiContext); @@ -76,12 +77,12 @@ public static List catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderFactory.java index 5e7fc80a..10843b52 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderFactory.java @@ -1,307 +1,308 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.OrderResource; - -/** - * Use the Orders resource to manage all components of order processing, payment, and fulfillment. - * - */ -public class OrderFactory -{ - - public static com.mozu.api.contracts.commerceruntime.orders.OrderCollection getOrders(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getOrders(apiContext, null, null, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.OrderCollection getOrders(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String q, Integer qLimit, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.OrderCollection returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderCollection(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.getOrders( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List getAvailableActions(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.getAvailableActions( orderId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List getTaxableOrders(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.getTaxableOrders( orderId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order getOrder(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception - { - return getOrder(apiContext, orderId, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order getOrder(ApiContext apiContext, String orderId, Boolean draft, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.getOrder( orderId, draft, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order createOrderFromCart(ApiContext apiContext, String cartId, int expectedCode, int successCode) throws Exception - { - return createOrderFromCart(apiContext, cartId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order createOrderFromCart(ApiContext apiContext, String cartId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.createOrderFromCart( cartId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order createOrder(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.Order order, int expectedCode, int successCode) throws Exception - { - return createOrder(apiContext, order, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order createOrder(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.Order order, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.createOrder( order, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order performOrderAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderAction action, String orderId, int expectedCode, int successCode) throws Exception - { - return performOrderAction(apiContext, action, orderId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order performOrderAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderAction action, String orderId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.performOrderAction( action, orderId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrderDiscount(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, Integer discountId, int expectedCode, int successCode) throws Exception - { - return updateOrderDiscount(apiContext, discount, orderId, discountId, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrderDiscount(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, Integer discountId, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.updateOrderDiscount( discount, orderId, discountId, updateMode, version, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteOrderDraft(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception - { - deleteOrderDraft(apiContext, orderId, null, expectedCode, successCode ); - } - - public static void deleteOrderDraft(ApiContext apiContext, String orderId, String version, int expectedCode, int successCode) throws Exception - { - OrderResource resource = new OrderResource(apiContext); - try - { - resource.deleteOrderDraft( orderId, version); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static void resendOrderConfirmationEmail(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderAction action, String orderId, int expectedCode, int successCode) throws Exception - { - OrderResource resource = new OrderResource(apiContext); - try - { - resource.resendOrderConfirmationEmail( action, orderId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order changeOrderUserId(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception - { - return changeOrderUserId(apiContext, orderId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order changeOrderUserId(ApiContext apiContext, String orderId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.changeOrderUserId( orderId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrder(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.Order order, String orderId, int expectedCode, int successCode) throws Exception - { - return updateOrder(apiContext, order, orderId, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrder(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.Order order, String orderId, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderResource resource = new OrderResource(apiContext); - try - { - returnObj = resource.updateOrder( order, orderId, updateMode, version, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.OrderResource; + +/** + * Use the Orders resource to manage all components of order processing, payment, and fulfillment. + * + */ +public class OrderFactory +{ + + public static com.mozu.api.contracts.commerceruntime.orders.OrderCollection getOrders(ApiContext apiContext, int expectedCode) throws Exception + { + return getOrders(apiContext, null, null, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.OrderCollection getOrders(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.orders.OrderCollection returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderCollection(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.getOrders( 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 List getAvailableActions(ApiContext apiContext, String orderId, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.getAvailableActions( orderId); + } + 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 List getTaxableOrders(ApiContext apiContext, String orderId, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.getTaxableOrders( orderId); + } + 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.orders.Order getOrder(ApiContext apiContext, String orderId, int expectedCode) throws Exception + { + return getOrder(apiContext, orderId, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order getOrder(ApiContext apiContext, String orderId, Boolean draft, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.getOrder( orderId, draft, 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.orders.Order createOrderFromCart(ApiContext apiContext, String cartId, int expectedCode) throws Exception + { + return createOrderFromCart(apiContext, cartId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order createOrderFromCart(ApiContext apiContext, String cartId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.createOrderFromCart( cartId, 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.orders.Order createOrder(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.Order order, int expectedCode) throws Exception + { + return createOrder(apiContext, order, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order createOrder(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.Order order, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.createOrder( order, 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.orders.Order performOrderAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderAction action, String orderId, int expectedCode) throws Exception + { + return performOrderAction(apiContext, action, orderId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order performOrderAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderAction action, String orderId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.performOrderAction( action, orderId, 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.orders.Order updateOrderDiscount(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, Integer discountId, int expectedCode) throws Exception + { + return updateOrderDiscount(apiContext, discount, orderId, discountId, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrderDiscount(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, Integer discountId, String updateMode, String version, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.updateOrderDiscount( discount, orderId, discountId, updateMode, version, 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 deleteOrderDraft(ApiContext apiContext, String orderId, int expectedCode) throws Exception + { + deleteOrderDraft(apiContext, orderId, null, expectedCode); + } + + public static void deleteOrderDraft(ApiContext apiContext, String orderId, String version, int expectedCode) throws Exception + { + OrderResource resource = new OrderResource(apiContext); + try + { + resource.deleteOrderDraft( orderId, version); + } + 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, ""); + } + + public static void resendOrderConfirmationEmail(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderAction action, String orderId, int expectedCode) throws Exception + { + OrderResource resource = new OrderResource(apiContext); + try + { + resource.resendOrderConfirmationEmail( action, orderId); + } + 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, ""); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order changeOrderUserId(ApiContext apiContext, String orderId, int expectedCode) throws Exception + { + return changeOrderUserId(apiContext, orderId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order changeOrderUserId(ApiContext apiContext, String orderId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.changeOrderUserId( orderId, 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.orders.Order updateOrder(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.Order order, String orderId, int expectedCode) throws Exception + { + return updateOrder(apiContext, order, orderId, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrder(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.Order order, String orderId, String updateMode, String version, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderResource resource = new OrderResource(apiContext); + try + { + returnObj = resource.updateOrder( order, orderId, updateMode, version, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderItemFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderItemFactory.java index f57760c2..c4081aaa 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderItemFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderItemFactory.java @@ -1,276 +1,277 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.orders.OrderItemResource; - -/** - * Use this subresource to retrieve details about items in an active order. - * - */ -public class OrderItemFactory -{ - - public static com.mozu.api.contracts.commerceruntime.orders.OrderItem getOrderItemViaLineId(ApiContext apiContext, String orderId, Integer lineId, int expectedCode, int successCode) throws Exception - { - return getOrderItemViaLineId(apiContext, orderId, lineId, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.OrderItem getOrderItemViaLineId(ApiContext apiContext, String orderId, Integer lineId, Boolean draft, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.OrderItem returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderItem(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.getOrderItemViaLineId( orderId, lineId, draft, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.OrderItem getOrderItem(ApiContext apiContext, String orderId, String orderItemId, int expectedCode, int successCode) throws Exception - { - return getOrderItem(apiContext, orderId, orderItemId, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.OrderItem getOrderItem(ApiContext apiContext, String orderId, String orderItemId, Boolean draft, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.OrderItem returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderItem(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.getOrderItem( orderId, orderItemId, draft, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.OrderItemCollection getOrderItems(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception - { - return getOrderItems(apiContext, orderId, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.OrderItemCollection getOrderItems(ApiContext apiContext, String orderId, Boolean draft, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.OrderItemCollection returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderItemCollection(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.getOrderItems( orderId, draft, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order createOrderItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderItem orderItem, String orderId, int expectedCode, int successCode) throws Exception - { - return createOrderItem(apiContext, orderItem, orderId, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order createOrderItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderItem orderItem, String orderId, String updateMode, String version, Boolean skipInventoryCheck, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.createOrderItem( orderItem, orderId, updateMode, version, skipInventoryCheck, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrderItemDiscount(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, String orderItemId, Integer discountId, int expectedCode, int successCode) throws Exception - { - return updateOrderItemDiscount(apiContext, discount, orderId, orderItemId, discountId, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrderItemDiscount(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, String orderItemId, Integer discountId, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.updateOrderItemDiscount( discount, orderId, orderItemId, discountId, updateMode, version, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemDuty(ApiContext apiContext, String orderId, String orderItemId, Double dutyAmount, int expectedCode, int successCode) throws Exception - { - return updateItemDuty(apiContext, orderId, orderItemId, dutyAmount, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemDuty(ApiContext apiContext, String orderId, String orderItemId, Double dutyAmount, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.updateItemDuty( orderId, orderItemId, dutyAmount, updateMode, version, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemFulfillment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderItem orderItem, String orderId, String orderItemId, int expectedCode, int successCode) throws Exception - { - return updateItemFulfillment(apiContext, orderItem, orderId, orderItemId, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemFulfillment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderItem orderItem, String orderId, String orderItemId, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.updateItemFulfillment( orderItem, orderId, orderItemId, updateMode, version, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemProductPrice(ApiContext apiContext, String orderId, String orderItemId, Double price, int expectedCode, int successCode) throws Exception - { - return updateItemProductPrice(apiContext, orderId, orderItemId, price, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemProductPrice(ApiContext apiContext, String orderId, String orderItemId, Double price, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.updateItemProductPrice( orderId, orderItemId, price, updateMode, version, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemQuantity(ApiContext apiContext, String orderId, String orderItemId, Integer quantity, int expectedCode, int successCode) throws Exception - { - return updateItemQuantity(apiContext, orderId, orderItemId, quantity, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemQuantity(ApiContext apiContext, String orderId, String orderItemId, Integer quantity, String updateMode, String version, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.updateItemQuantity( orderId, orderItemId, quantity, updateMode, version, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order deleteOrderItem(ApiContext apiContext, String orderId, String orderItemId, int expectedCode, int successCode) throws Exception - { - return deleteOrderItem(apiContext, orderId, orderItemId, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.orders.Order deleteOrderItem(ApiContext apiContext, String orderId, String orderItemId, String updateMode, String version, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); - OrderItemResource resource = new OrderItemResource(apiContext); - try - { - returnObj = resource.deleteOrderItem( orderId, orderItemId, updateMode, version); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.orders.OrderItemResource; + +/** + * Use this subresource to retrieve details about items in an active order. + * + */ +public class OrderItemFactory +{ + + public static com.mozu.api.contracts.commerceruntime.orders.OrderItem getOrderItemViaLineId(ApiContext apiContext, String orderId, Integer lineId, int expectedCode) throws Exception + { + return getOrderItemViaLineId(apiContext, orderId, lineId, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.OrderItem getOrderItemViaLineId(ApiContext apiContext, String orderId, Integer lineId, Boolean draft, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.OrderItem returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderItem(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.getOrderItemViaLineId( orderId, lineId, draft, 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.orders.OrderItem getOrderItem(ApiContext apiContext, String orderId, String orderItemId, int expectedCode) throws Exception + { + return getOrderItem(apiContext, orderId, orderItemId, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.OrderItem getOrderItem(ApiContext apiContext, String orderId, String orderItemId, Boolean draft, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.OrderItem returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderItem(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.getOrderItem( orderId, orderItemId, draft, 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.orders.OrderItemCollection getOrderItems(ApiContext apiContext, String orderId, int expectedCode) throws Exception + { + return getOrderItems(apiContext, orderId, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.OrderItemCollection getOrderItems(ApiContext apiContext, String orderId, Boolean draft, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.OrderItemCollection returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderItemCollection(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.getOrderItems( orderId, draft, 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.orders.Order createOrderItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderItem orderItem, String orderId, int expectedCode) throws Exception + { + return createOrderItem(apiContext, orderItem, orderId, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order createOrderItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderItem orderItem, String orderId, String updateMode, String version, Boolean skipInventoryCheck, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.createOrderItem( orderItem, orderId, updateMode, version, skipInventoryCheck, 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.orders.Order updateOrderItemDiscount(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, String orderItemId, Integer discountId, int expectedCode) throws Exception + { + return updateOrderItemDiscount(apiContext, discount, orderId, orderItemId, discountId, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order updateOrderItemDiscount(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.discounts.AppliedDiscount discount, String orderId, String orderItemId, Integer discountId, String updateMode, String version, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.updateOrderItemDiscount( discount, orderId, orderItemId, discountId, updateMode, version, 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.orders.Order updateItemDuty(ApiContext apiContext, String orderId, String orderItemId, Double dutyAmount, int expectedCode) throws Exception + { + return updateItemDuty(apiContext, orderId, orderItemId, dutyAmount, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemDuty(ApiContext apiContext, String orderId, String orderItemId, Double dutyAmount, String updateMode, String version, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.updateItemDuty( orderId, orderItemId, dutyAmount, updateMode, version, 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.orders.Order updateItemFulfillment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderItem orderItem, String orderId, String orderItemId, int expectedCode) throws Exception + { + return updateItemFulfillment(apiContext, orderItem, orderId, orderItemId, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemFulfillment(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderItem orderItem, String orderId, String orderItemId, String updateMode, String version, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.updateItemFulfillment( orderItem, orderId, orderItemId, updateMode, version, 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.orders.Order updateItemProductPrice(ApiContext apiContext, String orderId, String orderItemId, Double price, int expectedCode) throws Exception + { + return updateItemProductPrice(apiContext, orderId, orderItemId, price, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemProductPrice(ApiContext apiContext, String orderId, String orderItemId, Double price, String updateMode, String version, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.updateItemProductPrice( orderId, orderItemId, price, updateMode, version, 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.orders.Order updateItemQuantity(ApiContext apiContext, String orderId, String orderItemId, Integer quantity, int expectedCode) throws Exception + { + return updateItemQuantity(apiContext, orderId, orderItemId, quantity, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order updateItemQuantity(ApiContext apiContext, String orderId, String orderItemId, Integer quantity, String updateMode, String version, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.updateItemQuantity( orderId, orderItemId, quantity, updateMode, version, 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.orders.Order deleteOrderItem(ApiContext apiContext, String orderId, String orderItemId, int expectedCode) throws Exception + { + return deleteOrderItem(apiContext, orderId, orderItemId, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.orders.Order deleteOrderItem(ApiContext apiContext, String orderId, String orderItemId, String updateMode, String version, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); + OrderItemResource resource = new OrderItemResource(apiContext); + try + { + returnObj = resource.deleteOrderItem( orderId, orderItemId, updateMode, version); + } + 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderNoteFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderNoteFactory.java index 4728783b..8e80d163 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderNoteFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderNoteFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class OrderNoteFactory { - public static List getOrderNotes(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static List getOrderNotes(ApiContext apiContext, String orderId, int expectedCode) throws Exception { List returnObj = new ArrayList(); OrderNoteResource resource = new OrderNoteResource(apiContext); @@ -31,21 +32,21 @@ public static List getO catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.OrderNote getOrderNote(ApiContext apiContext, String orderId, String noteId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.OrderNote getOrderNote(ApiContext apiContext, String orderId, String noteId, int expectedCode) throws Exception { - return getOrderNote(apiContext, orderId, noteId, null, expectedCode, successCode ); + return getOrderNote(apiContext, orderId, noteId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.OrderNote getOrderNote(ApiContext apiContext, String orderId, String noteId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.OrderNote getOrderNote(ApiContext apiContext, String orderId, String noteId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.OrderNote returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderNote(); OrderNoteResource resource = new OrderNoteResource(apiContext); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.commerceruntime.orders.OrderNote getOrderNo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.OrderNote createOrderNote(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderNote orderNote, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.OrderNote createOrderNote(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderNote orderNote, String orderId, int expectedCode) throws Exception { - return createOrderNote(apiContext, orderNote, orderId, null, expectedCode, successCode ); + return createOrderNote(apiContext, orderNote, orderId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.OrderNote createOrderNote(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderNote orderNote, String orderId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.OrderNote createOrderNote(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderNote orderNote, String orderId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.OrderNote returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderNote(); OrderNoteResource resource = new OrderNoteResource(apiContext); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.commerceruntime.orders.OrderNote createOrde catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.OrderNote updateOrderNote(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderNote orderNote, String orderId, String noteId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.OrderNote updateOrderNote(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderNote orderNote, String orderId, String noteId, int expectedCode) throws Exception { - return updateOrderNote(apiContext, orderNote, orderId, noteId, null, expectedCode, successCode ); + return updateOrderNote(apiContext, orderNote, orderId, noteId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.OrderNote updateOrderNote(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderNote orderNote, String orderId, String noteId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.OrderNote updateOrderNote(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderNote orderNote, String orderId, String noteId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.OrderNote returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderNote(); OrderNoteResource resource = new OrderNoteResource(apiContext); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.commerceruntime.orders.OrderNote updateOrde catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteOrderNote(ApiContext apiContext, String orderId, String noteId, int expectedCode, int successCode) throws Exception + public static void deleteOrderNote(ApiContext apiContext, String orderId, String noteId, int expectedCode) throws Exception { OrderNoteResource resource = new OrderNoteResource(apiContext); try @@ -125,12 +126,12 @@ public static void deleteOrderNote(ApiContext apiContext, String orderId, String catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderValidationResultFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderValidationResultFactory.java index 7d7b7112..b934db56 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderValidationResultFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrderValidationResultFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class OrderValidationResultFactory { - public static List getValidationResults(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static List getValidationResults(ApiContext apiContext, String orderId, int expectedCode) throws Exception { List returnObj = new ArrayList(); OrderValidationResultResource resource = new OrderValidationResultResource(apiContext); @@ -31,21 +32,21 @@ public static List= 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.orders.OrderValidationResult addValidationResult(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult validationResult, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult addValidationResult(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult validationResult, String orderId, int expectedCode) throws Exception { - return addValidationResult(apiContext, validationResult, orderId, null, expectedCode, successCode ); + return addValidationResult(apiContext, validationResult, orderId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult addValidationResult(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult validationResult, String orderId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult addValidationResult(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult validationResult, String orderId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult returnObj = new com.mozu.api.contracts.commerceruntime.orders.OrderValidationResult(); OrderValidationResultResource resource = new OrderValidationResultResource(apiContext); @@ -56,12 +57,12 @@ public static com.mozu.api.contracts.commerceruntime.orders.OrderValidationResul catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrdersPackageFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrdersPackageFactory.java index d55cd1f8..d69d3682 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrdersPackageFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrdersPackageFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class OrdersPackageFactory { - public static List getAvailablePackageFulfillmentActions(ApiContext apiContext, String orderId, String packageId, int expectedCode, int successCode) throws Exception + public static List getAvailablePackageFulfillmentActions(ApiContext apiContext, String orderId, String packageId, int expectedCode) throws Exception { List returnObj = new ArrayList(); PackageResource resource = new PackageResource(apiContext); @@ -31,16 +32,16 @@ public static List getAvailablePackageFulfillmentActions(ApiContext apiC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 java.io.InputStream getPackageLabel(ApiContext apiContext, String orderId, String packageId, int expectedCode, int successCode) throws Exception + public static java.io.InputStream getPackageLabel(ApiContext apiContext, String orderId, String packageId, int expectedCode) throws Exception { java.io.InputStream returnObj; PackageResource resource = new PackageResource(apiContext); @@ -51,21 +52,21 @@ public static java.io.InputStream getPackageLabel(ApiContext apiContext, String catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Package getPackage(ApiContext apiContext, String orderId, String packageId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package getPackage(ApiContext apiContext, String orderId, String packageId, int expectedCode) throws Exception { - return getPackage(apiContext, orderId, packageId, null, expectedCode, successCode ); + return getPackage(apiContext, orderId, packageId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Package getPackage(ApiContext apiContext, String orderId, String packageId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package getPackage(ApiContext apiContext, String orderId, String packageId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Package returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Package(); PackageResource resource = new PackageResource(apiContext); @@ -76,21 +77,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Package getPack catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Package createPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package createPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String orderId, int expectedCode) throws Exception { - return createPackage(apiContext, pkg, orderId, null, expectedCode, successCode ); + return createPackage(apiContext, pkg, orderId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Package createPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String orderId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package createPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String orderId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Package returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Package(); PackageResource resource = new PackageResource(apiContext); @@ -101,21 +102,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Package createP catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Package updatePackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String orderId, String packageId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package updatePackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String orderId, String packageId, int expectedCode) throws Exception { - return updatePackage(apiContext, pkg, orderId, packageId, null, expectedCode, successCode ); + return updatePackage(apiContext, pkg, orderId, packageId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Package updatePackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String orderId, String packageId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package updatePackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String orderId, String packageId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Package returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Package(); PackageResource resource = new PackageResource(apiContext); @@ -126,16 +127,16 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Package updateP catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deletePackage(ApiContext apiContext, String orderId, String packageId, int expectedCode, int successCode) throws Exception + public static void deletePackage(ApiContext apiContext, String orderId, String packageId, int expectedCode) throws Exception { PackageResource resource = new PackageResource(apiContext); try @@ -145,12 +146,12 @@ public static void deletePackage(ApiContext apiContext, String orderId, String p catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrdersShipmentFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrdersShipmentFactory.java index f6e8335f..020421e8 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrdersShipmentFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/OrdersShipmentFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class OrdersShipmentFactory { - public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShipment(ApiContext apiContext, String orderId, String shipmentId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShipment(ApiContext apiContext, String orderId, String shipmentId, int expectedCode) throws Exception { - return getShipment(apiContext, orderId, shipmentId, null, expectedCode, successCode ); + return getShipment(apiContext, orderId, shipmentId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShipment(ApiContext apiContext, String orderId, String shipmentId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShipment(ApiContext apiContext, String orderId, String shipmentId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Shipment returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Shipment(); ShipmentResource resource = new ShipmentResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List getAvailableShipmentMethods(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static List getAvailableShipmentMethods(ApiContext apiContext, String orderId, int expectedCode) throws Exception { - return getAvailableShipmentMethods(apiContext, orderId, null, expectedCode, successCode ); + return getAvailableShipmentMethods(apiContext, orderId, null, expectedCode); } - public static List getAvailableShipmentMethods(ApiContext apiContext, String orderId, Boolean draft, int expectedCode, int successCode) throws Exception + public static List getAvailableShipmentMethods(ApiContext apiContext, String orderId, Boolean draft, int expectedCode) throws Exception { List returnObj = new ArrayList(); ShipmentResource resource = new ShipmentResource(apiContext); @@ -61,16 +62,16 @@ public static List= 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 List createPackageShipments(ApiContext apiContext, List packageIds, String orderId, int expectedCode, int successCode) throws Exception + public static List createPackageShipments(ApiContext apiContext, List packageIds, String orderId, int expectedCode) throws Exception { List returnObj = new ArrayList(); ShipmentResource resource = new ShipmentResource(apiContext); @@ -81,16 +82,16 @@ public static List c catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteShipment(ApiContext apiContext, String orderId, String shipmentId, int expectedCode, int successCode) throws Exception + public static void deleteShipment(ApiContext apiContext, String orderId, String shipmentId, int expectedCode) throws Exception { ShipmentResource resource = new ShipmentResource(apiContext); try @@ -100,12 +101,12 @@ public static void deleteShipment(ApiContext apiContext, String orderId, String catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PackageFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PackageFactory.java index 2d468a95..7c586ffc 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PackageFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PackageFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class PackageFactory { - public static java.io.InputStream getPackageLabel(ApiContext apiContext, String returnId, String packageId, int expectedCode, int successCode) throws Exception + public static java.io.InputStream getPackageLabel(ApiContext apiContext, String returnId, String packageId, int expectedCode) throws Exception { java.io.InputStream returnObj; PackageResource resource = new PackageResource(apiContext); @@ -31,21 +32,21 @@ public static java.io.InputStream getPackageLabel(ApiContext apiContext, String catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Package getPackage(ApiContext apiContext, String returnId, String packageId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package getPackage(ApiContext apiContext, String returnId, String packageId, int expectedCode) throws Exception { - return getPackage(apiContext, returnId, packageId, null, expectedCode, successCode ); + return getPackage(apiContext, returnId, packageId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Package getPackage(ApiContext apiContext, String returnId, String packageId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package getPackage(ApiContext apiContext, String returnId, String packageId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Package returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Package(); PackageResource resource = new PackageResource(apiContext); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Package getPack catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Package createPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String returnId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package createPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String returnId, int expectedCode) throws Exception { - return createPackage(apiContext, pkg, returnId, null, expectedCode, successCode ); + return createPackage(apiContext, pkg, returnId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Package createPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String returnId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package createPackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String returnId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Package returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Package(); PackageResource resource = new PackageResource(apiContext); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Package createP catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Package updatePackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String returnId, String packageId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package updatePackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String returnId, String packageId, int expectedCode) throws Exception { - return updatePackage(apiContext, pkg, returnId, packageId, null, expectedCode, successCode ); + return updatePackage(apiContext, pkg, returnId, packageId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Package updatePackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String returnId, String packageId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Package updatePackage(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg, String returnId, String packageId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Package returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Package(); PackageResource resource = new PackageResource(apiContext); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Package updateP catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deletePackage(ApiContext apiContext, String returnId, String packageId, int expectedCode, int successCode) throws Exception + public static void deletePackage(ApiContext apiContext, String returnId, String packageId, int expectedCode) throws Exception { PackageResource resource = new PackageResource(apiContext); try @@ -125,12 +126,12 @@ public static void deletePackage(ApiContext apiContext, String returnId, String catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PaymentFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PaymentFactory.java index 7dc678ed..617a7091 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PaymentFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PaymentFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class PaymentFactory { - public static com.mozu.api.contracts.commerceruntime.payments.PaymentCollection getPayments(ApiContext apiContext, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.payments.PaymentCollection getPayments(ApiContext apiContext, String orderId, int expectedCode) throws Exception { - return getPayments(apiContext, orderId, null, expectedCode, successCode ); + return getPayments(apiContext, orderId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.payments.PaymentCollection getPayments(ApiContext apiContext, String orderId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.payments.PaymentCollection getPayments(ApiContext apiContext, String orderId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.payments.PaymentCollection returnObj = new com.mozu.api.contracts.commerceruntime.payments.PaymentCollection(); PaymentResource resource = new PaymentResource(apiContext); @@ -36,16 +37,16 @@ public static com.mozu.api.contracts.commerceruntime.payments.PaymentCollection catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List getAvailablePaymentActions(ApiContext apiContext, String orderId, String paymentId, int expectedCode, int successCode) throws Exception + public static List getAvailablePaymentActions(ApiContext apiContext, String orderId, String paymentId, int expectedCode) throws Exception { List returnObj = new ArrayList(); PaymentResource resource = new PaymentResource(apiContext); @@ -56,21 +57,21 @@ public static List getAvailablePaymentActions(ApiContext apiContext, Str catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.payments.Payment getPayment(ApiContext apiContext, String orderId, String paymentId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.payments.Payment getPayment(ApiContext apiContext, String orderId, String paymentId, int expectedCode) throws Exception { - return getPayment(apiContext, orderId, paymentId, null, expectedCode, successCode ); + return getPayment(apiContext, orderId, paymentId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.payments.Payment getPayment(ApiContext apiContext, String orderId, String paymentId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.payments.Payment getPayment(ApiContext apiContext, String orderId, String paymentId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.payments.Payment returnObj = new com.mozu.api.contracts.commerceruntime.payments.Payment(); PaymentResource resource = new PaymentResource(apiContext); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.commerceruntime.payments.Payment getPayment catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.Order performPaymentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String orderId, String paymentId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order performPaymentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String orderId, String paymentId, int expectedCode) throws Exception { - return performPaymentAction(apiContext, action, orderId, paymentId, null, expectedCode, successCode ); + return performPaymentAction(apiContext, action, orderId, paymentId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order performPaymentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String orderId, String paymentId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order performPaymentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String orderId, String paymentId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); PaymentResource resource = new PaymentResource(apiContext); @@ -106,21 +107,21 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order performPayment catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.orders.Order createPaymentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order createPaymentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String orderId, int expectedCode) throws Exception { - return createPaymentAction(apiContext, action, orderId, null, expectedCode, successCode ); + return createPaymentAction(apiContext, action, orderId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.orders.Order createPaymentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String orderId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.orders.Order createPaymentAction(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String orderId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.orders.Order returnObj = new com.mozu.api.contracts.commerceruntime.orders.Order(); PaymentResource resource = new PaymentResource(apiContext); @@ -131,12 +132,12 @@ public static com.mozu.api.contracts.commerceruntime.orders.Order createPaymentA catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PaymentSettingsFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PaymentSettingsFactory.java index efee74aa..14904708 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PaymentSettingsFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PaymentSettingsFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class PaymentSettingsFactory { - public static List getThirdPartyPaymentWorkflows(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static List getThirdPartyPaymentWorkflows(ApiContext apiContext, int expectedCode) throws Exception { List returnObj = new ArrayList(); PaymentSettingsResource resource = new PaymentSettingsResource(apiContext); @@ -31,12 +32,12 @@ public static List= 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PickupFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PickupFactory.java index 749bcb87..c8c91420 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PickupFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PickupFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class PickupFactory { - public static List getAvailablePickupFulfillmentActions(ApiContext apiContext, String orderId, String pickupId, int expectedCode, int successCode) throws Exception + public static List getAvailablePickupFulfillmentActions(ApiContext apiContext, String orderId, String pickupId, int expectedCode) throws Exception { List returnObj = new ArrayList(); PickupResource resource = new PickupResource(apiContext); @@ -31,21 +32,21 @@ public static List getAvailablePickupFulfillmentActions(ApiContext apiCo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Pickup getPickup(ApiContext apiContext, String orderId, String pickupId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup getPickup(ApiContext apiContext, String orderId, String pickupId, int expectedCode) throws Exception { - return getPickup(apiContext, orderId, pickupId, null, expectedCode, successCode ); + return getPickup(apiContext, orderId, pickupId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup getPickup(ApiContext apiContext, String orderId, String pickupId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup getPickup(ApiContext apiContext, String orderId, String pickupId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Pickup returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Pickup(); PickupResource resource = new PickupResource(apiContext); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup getPicku catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Pickup createPickup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup createPickup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, int expectedCode) throws Exception { - return createPickup(apiContext, pickup, orderId, null, expectedCode, successCode ); + return createPickup(apiContext, pickup, orderId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup createPickup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup createPickup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Pickup returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Pickup(); PickupResource resource = new PickupResource(apiContext); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup createPi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.fulfillment.Pickup updatePickup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, String pickupId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup updatePickup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, String pickupId, int expectedCode) throws Exception { - return updatePickup(apiContext, pickup, orderId, pickupId, null, expectedCode, successCode ); + return updatePickup(apiContext, pickup, orderId, pickupId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup updatePickup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, String pickupId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup updatePickup(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.fulfillment.Pickup pickup, String orderId, String pickupId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Pickup returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Pickup(); PickupResource resource = new PickupResource(apiContext); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Pickup updatePi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deletePickup(ApiContext apiContext, String orderId, String pickupId, int expectedCode, int successCode) throws Exception + public static void deletePickup(ApiContext apiContext, String orderId, String pickupId, int expectedCode) throws Exception { PickupResource resource = new PickupResource(apiContext); try @@ -125,12 +126,12 @@ public static void deletePickup(ApiContext apiContext, String orderId, String pi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PlatformApplicationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PlatformApplicationFactory.java index f8a299f6..331c2019 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PlatformApplicationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PlatformApplicationFactory.java @@ -1,194 +1,195 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.ApplicationResource; - -/** - * - * - */ -public class PlatformApplicationFactory -{ - - public static com.mozu.api.contracts.appdev.PackageNamesCollection getAppPackageNames(ApiContext apiContext, String applicationKey, int expectedCode, int successCode) throws Exception - { - return getAppPackageNames(apiContext, applicationKey, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.appdev.PackageNamesCollection getAppPackageNames(ApiContext apiContext, String applicationKey, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.appdev.PackageNamesCollection returnObj = new com.mozu.api.contracts.appdev.PackageNamesCollection(); - ApplicationResource resource = new ApplicationResource(apiContext); - try - { - returnObj = resource.getAppPackageNames( applicationKey, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.appdev.ApplicationVersionsCollection getAppVersions(ApiContext apiContext, String nsAndAppId, int expectedCode, int successCode) throws Exception - { - return getAppVersions(apiContext, nsAndAppId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.appdev.ApplicationVersionsCollection getAppVersions(ApiContext apiContext, String nsAndAppId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.appdev.ApplicationVersionsCollection returnObj = new com.mozu.api.contracts.appdev.ApplicationVersionsCollection(); - ApplicationResource resource = new ApplicationResource(apiContext); - try - { - returnObj = resource.getAppVersions( nsAndAppId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.appdev.FileMetadata getPackageFileMetadata(ApiContext apiContext, String applicationKey, String filepath, int expectedCode, int successCode) throws Exception - { - return getPackageFileMetadata(apiContext, applicationKey, filepath, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.appdev.FileMetadata getPackageFileMetadata(ApiContext apiContext, String applicationKey, String filepath, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.appdev.FileMetadata returnObj = new com.mozu.api.contracts.appdev.FileMetadata(); - ApplicationResource resource = new ApplicationResource(apiContext); - try - { - returnObj = resource.getPackageFileMetadata( applicationKey, filepath, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.appdev.FolderMetadata getPackageMetadata(ApiContext apiContext, String applicationKey, int expectedCode, int successCode) throws Exception - { - return getPackageMetadata(apiContext, applicationKey, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.appdev.FolderMetadata getPackageMetadata(ApiContext apiContext, String applicationKey, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.appdev.FolderMetadata returnObj = new com.mozu.api.contracts.appdev.FolderMetadata(); - ApplicationResource resource = new ApplicationResource(apiContext); - try - { - returnObj = resource.getPackageMetadata( applicationKey, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.appdev.FileMetadata upsertPackageFile(ApiContext apiContext, java.io.InputStream stream, String applicationKey, String filepath, String contentType, int expectedCode, int successCode) throws Exception - { - return upsertPackageFile(apiContext, stream, applicationKey, filepath, null, null, contentType, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.appdev.FileMetadata upsertPackageFile(ApiContext apiContext, java.io.InputStream stream, String applicationKey, String filepath, String lastModifiedTime, String responseFields, String contentType, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.appdev.FileMetadata returnObj = new com.mozu.api.contracts.appdev.FileMetadata(); - ApplicationResource resource = new ApplicationResource(apiContext); - try - { - returnObj = resource.upsertPackageFile( stream, applicationKey, filepath, lastModifiedTime, responseFields, contentType); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.appdev.FileMetadata renamePackageFile(ApiContext apiContext, com.mozu.api.contracts.appdev.RenameInfo renameInfo, String applicationKey, int expectedCode, int successCode) throws Exception - { - return renamePackageFile(apiContext, renameInfo, applicationKey, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.appdev.FileMetadata renamePackageFile(ApiContext apiContext, com.mozu.api.contracts.appdev.RenameInfo renameInfo, String applicationKey, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.appdev.FileMetadata returnObj = new com.mozu.api.contracts.appdev.FileMetadata(); - ApplicationResource resource = new ApplicationResource(apiContext); - try - { - returnObj = resource.renamePackageFile( renameInfo, applicationKey, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deletePackageFile(ApiContext apiContext, String applicationKey, String filepath, int expectedCode, int successCode) throws Exception - { - ApplicationResource resource = new ApplicationResource(apiContext); - try - { - resource.deletePackageFile( applicationKey, filepath); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.ApplicationResource; + +/** + * platform/developer related resources. DOCUMENT_HERE + * + */ +public class PlatformApplicationFactory +{ + + public static com.mozu.api.contracts.appdev.PackageNamesCollection getAppPackageNames(ApiContext apiContext, String applicationKey, int expectedCode) throws Exception + { + return getAppPackageNames(apiContext, applicationKey, null, expectedCode); + } + + public static com.mozu.api.contracts.appdev.PackageNamesCollection getAppPackageNames(ApiContext apiContext, String applicationKey, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.appdev.PackageNamesCollection returnObj = new com.mozu.api.contracts.appdev.PackageNamesCollection(); + ApplicationResource resource = new ApplicationResource(apiContext); + try + { + returnObj = resource.getAppPackageNames( applicationKey, 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.appdev.ApplicationVersionsCollection getAppVersions(ApiContext apiContext, String nsAndAppId, int expectedCode) throws Exception + { + return getAppVersions(apiContext, nsAndAppId, null, expectedCode); + } + + public static com.mozu.api.contracts.appdev.ApplicationVersionsCollection getAppVersions(ApiContext apiContext, String nsAndAppId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.appdev.ApplicationVersionsCollection returnObj = new com.mozu.api.contracts.appdev.ApplicationVersionsCollection(); + ApplicationResource resource = new ApplicationResource(apiContext); + try + { + returnObj = resource.getAppVersions( nsAndAppId, 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.appdev.FileMetadata getPackageFileMetadata(ApiContext apiContext, String applicationKey, String filepath, int expectedCode) throws Exception + { + return getPackageFileMetadata(apiContext, applicationKey, filepath, null, expectedCode); + } + + public static com.mozu.api.contracts.appdev.FileMetadata getPackageFileMetadata(ApiContext apiContext, String applicationKey, String filepath, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.appdev.FileMetadata returnObj = new com.mozu.api.contracts.appdev.FileMetadata(); + ApplicationResource resource = new ApplicationResource(apiContext); + try + { + returnObj = resource.getPackageFileMetadata( applicationKey, filepath, 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.appdev.FolderMetadata getPackageMetadata(ApiContext apiContext, String applicationKey, int expectedCode) throws Exception + { + return getPackageMetadata(apiContext, applicationKey, null, expectedCode); + } + + public static com.mozu.api.contracts.appdev.FolderMetadata getPackageMetadata(ApiContext apiContext, String applicationKey, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.appdev.FolderMetadata returnObj = new com.mozu.api.contracts.appdev.FolderMetadata(); + ApplicationResource resource = new ApplicationResource(apiContext); + try + { + returnObj = resource.getPackageMetadata( applicationKey, 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.appdev.FileMetadata upsertPackageFile(ApiContext apiContext, java.io.InputStream stream, String applicationKey, String filepath, String contentType, int expectedCode) throws Exception + { + return upsertPackageFile(apiContext, stream, applicationKey, filepath, null, null, contentType, expectedCode); + } + + public static com.mozu.api.contracts.appdev.FileMetadata upsertPackageFile(ApiContext apiContext, java.io.InputStream stream, String applicationKey, String filepath, String lastModifiedTime, String responseFields, String contentType, int expectedCode) throws Exception + { + com.mozu.api.contracts.appdev.FileMetadata returnObj = new com.mozu.api.contracts.appdev.FileMetadata(); + ApplicationResource resource = new ApplicationResource(apiContext); + try + { + returnObj = resource.upsertPackageFile( stream, applicationKey, filepath, lastModifiedTime, responseFields, contentType); + } + 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.appdev.FileMetadata renamePackageFile(ApiContext apiContext, com.mozu.api.contracts.appdev.RenameInfo renameInfo, String applicationKey, int expectedCode) throws Exception + { + return renamePackageFile(apiContext, renameInfo, applicationKey, null, expectedCode); + } + + public static com.mozu.api.contracts.appdev.FileMetadata renamePackageFile(ApiContext apiContext, com.mozu.api.contracts.appdev.RenameInfo renameInfo, String applicationKey, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.appdev.FileMetadata returnObj = new com.mozu.api.contracts.appdev.FileMetadata(); + ApplicationResource resource = new ApplicationResource(apiContext); + try + { + returnObj = resource.renamePackageFile( renameInfo, applicationKey, 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 deletePackageFile(ApiContext apiContext, String applicationKey, String filepath, int expectedCode) throws Exception + { + ApplicationResource resource = new ApplicationResource(apiContext); + try + { + resource.deletePackageFile( applicationKey, filepath); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductExtraFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductExtraFactory.java index 24de1e61..152528ff 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductExtraFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductExtraFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class ProductExtraFactory { - public static List getExtras(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception + public static List getExtras(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -31,16 +32,16 @@ public static List getExtras(A catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List getExtraValueLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static List getExtraValueLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -51,21 +52,21 @@ public static List= 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.productadmin.ProductExtraValueDeltaPrice getExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String currencyCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice getExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String currencyCode, int expectedCode) throws Exception { - return getExtraValueLocalizedDeltaPrice(apiContext, dataViewMode, productCode, attributeFQN, value, currencyCode, null, expectedCode, successCode ); + return getExtraValueLocalizedDeltaPrice(apiContext, dataViewMode, productCode, attributeFQN, value, currencyCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice getExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String currencyCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice getExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String currencyCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -76,21 +77,21 @@ public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice ge catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductExtra getExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtra getExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode) throws Exception { - return getExtra(apiContext, dataViewMode, productCode, attributeFQN, null, expectedCode, successCode ); + return getExtra(apiContext, dataViewMode, productCode, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductExtra getExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtra getExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductExtra returnObj = new com.mozu.api.contracts.productadmin.ProductExtra(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -101,21 +102,21 @@ public static com.mozu.api.contracts.productadmin.ProductExtra getExtra(ApiConte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductExtraValueDeltaPrice addExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice localizedDeltaPrice, String productCode, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice addExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice localizedDeltaPrice, String productCode, String attributeFQN, String value, int expectedCode) throws Exception { - return addExtraValueLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, attributeFQN, value, null, expectedCode, successCode ); + return addExtraValueLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, attributeFQN, value, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice addExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice localizedDeltaPrice, String productCode, String attributeFQN, String value, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice addExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice localizedDeltaPrice, String productCode, String attributeFQN, String value, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -126,21 +127,21 @@ public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice ad catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductExtra addExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtra addExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, int expectedCode) throws Exception { - return addExtra(apiContext, dataViewMode, productExtra, productCode, null, expectedCode, successCode ); + return addExtra(apiContext, dataViewMode, productExtra, productCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductExtra addExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtra addExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductExtra returnObj = new com.mozu.api.contracts.productadmin.ProductExtra(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -151,16 +152,16 @@ public static com.mozu.api.contracts.productadmin.ProductExtra addExtra(ApiConte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List updateExtraValueLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List localizedDeltaPrice, String productCode, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static List updateExtraValueLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List localizedDeltaPrice, String productCode, String attributeFQN, String value, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -171,21 +172,21 @@ public static List= 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.productadmin.ProductExtraValueDeltaPrice updateExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice localizedDeltaPrice, String productCode, String attributeFQN, String value, String currencyCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice updateExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice localizedDeltaPrice, String productCode, String attributeFQN, String value, String currencyCode, int expectedCode) throws Exception { - return updateExtraValueLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, attributeFQN, value, currencyCode, null, expectedCode, successCode ); + return updateExtraValueLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, attributeFQN, value, currencyCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice updateExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice localizedDeltaPrice, String productCode, String attributeFQN, String value, String currencyCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice updateExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice localizedDeltaPrice, String productCode, String attributeFQN, String value, String currencyCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -196,21 +197,21 @@ public static com.mozu.api.contracts.productadmin.ProductExtraValueDeltaPrice up catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductExtra updateExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtra updateExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, String attributeFQN, int expectedCode) throws Exception { - return updateExtra(apiContext, dataViewMode, productExtra, productCode, attributeFQN, null, expectedCode, successCode ); + return updateExtra(apiContext, dataViewMode, productExtra, productCode, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductExtra updateExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductExtra updateExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductExtra productExtra, String productCode, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductExtra returnObj = new com.mozu.api.contracts.productadmin.ProductExtra(); ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); @@ -221,16 +222,16 @@ public static com.mozu.api.contracts.productadmin.ProductExtra updateExtra(ApiCo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static void deleteExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode) throws Exception { ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); try @@ -240,15 +241,15 @@ public static void deleteExtra(ApiContext apiContext, com.mozu.api.DataViewMode catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deleteExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String currencyCode, int expectedCode, int successCode) throws Exception + public static void deleteExtraValueLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String currencyCode, int expectedCode) throws Exception { ProductExtraResource resource = new ProductExtraResource(apiContext, dataViewMode); try @@ -258,12 +259,12 @@ public static void deleteExtraValueLocalizedDeltaPrice(ApiContext apiContext, co catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductFactory.java index 741b6f47..a3d951c3 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductFactory.java @@ -1,201 +1,202 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.storefront.ProductResource; - -/** - * Use the Storefront Products resource to manage the shopper product selection process during a visit to the web storefront. You can update product options as shoppers pick and choose their product choices. A shopper cannot add a product to a cart until all of its required options have been selected. - * - */ -public class ProductFactory -{ - - public static com.mozu.api.contracts.productruntime.ProductCollection getProducts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode, int successCode) throws Exception - { - return getProducts(apiContext, dataViewMode, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.ProductCollection getProducts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String filter, Integer startIndex, Integer pageSize, String sortBy, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.ProductCollection returnObj = new com.mozu.api.contracts.productruntime.ProductCollection(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.getProducts( filter, startIndex, pageSize, sortBy, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productruntime.LocationInventoryCollection getProductInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception - { - return getProductInventory(apiContext, dataViewMode, productCode, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.LocationInventoryCollection getProductInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String locationCodes, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.LocationInventoryCollection returnObj = new com.mozu.api.contracts.productruntime.LocationInventoryCollection(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.getProductInventory( productCode, locationCodes, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productruntime.Product getProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception - { - return getProduct(apiContext, dataViewMode, productCode, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.Product getProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationProductCode, Boolean allowInactive, Boolean skipInventoryCheck, Boolean supressOutOfStock404, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.Product returnObj = new com.mozu.api.contracts.productruntime.Product(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.getProduct( productCode, variationProductCode, allowInactive, skipInventoryCheck, supressOutOfStock404, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productruntime.ConfiguredProduct configuredProduct(ApiContext apiContext, com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, int expectedCode, int successCode) throws Exception - { - return configuredProduct(apiContext, productOptionSelections, productCode, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.ConfiguredProduct configuredProduct(ApiContext apiContext, com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, Boolean includeOptionDetails, Boolean skipInventoryCheck, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.ConfiguredProduct returnObj = new com.mozu.api.contracts.productruntime.ConfiguredProduct(); - ProductResource resource = new ProductResource(apiContext); - try - { - returnObj = resource.configuredProduct( productOptionSelections, productCode, includeOptionDetails, skipInventoryCheck, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productruntime.ProductValidationSummary validateProduct(ApiContext apiContext, com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, int expectedCode, int successCode) throws Exception - { - return validateProduct(apiContext, productOptionSelections, productCode, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.ProductValidationSummary validateProduct(ApiContext apiContext, com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, Boolean skipInventoryCheck, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.ProductValidationSummary returnObj = new com.mozu.api.contracts.productruntime.ProductValidationSummary(); - ProductResource resource = new ProductResource(apiContext); - try - { - returnObj = resource.validateProduct( productOptionSelections, productCode, skipInventoryCheck, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productruntime.DiscountValidationSummary validateDiscounts(ApiContext apiContext, com.mozu.api.contracts.productruntime.DiscountSelections discountSelections, String productCode, int expectedCode, int successCode) throws Exception - { - return validateDiscounts(apiContext, discountSelections, productCode, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.DiscountValidationSummary validateDiscounts(ApiContext apiContext, com.mozu.api.contracts.productruntime.DiscountSelections discountSelections, String productCode, String variationProductCode, Integer customerAccountId, Boolean allowInactive, Boolean skipInventoryCheck, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.DiscountValidationSummary returnObj = new com.mozu.api.contracts.productruntime.DiscountValidationSummary(); - ProductResource resource = new ProductResource(apiContext); - try - { - returnObj = resource.validateDiscounts( discountSelections, productCode, variationProductCode, customerAccountId, allowInactive, skipInventoryCheck, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productruntime.LocationInventoryCollection getProductInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productruntime.LocationInventoryQuery query, int expectedCode, int successCode) throws Exception - { - return getProductInventories(apiContext, dataViewMode, query, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.LocationInventoryCollection getProductInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productruntime.LocationInventoryQuery query, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.LocationInventoryCollection returnObj = new com.mozu.api.contracts.productruntime.LocationInventoryCollection(); - ProductResource resource = new ProductResource(apiContext, dataViewMode); - try - { - returnObj = resource.getProductInventories( query, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.storefront.ProductResource; + +/** + * Use the Storefront Products resource to manage the shopper product selection process during a visit to the web storefront. You can update product options as shoppers pick and choose their product choices. A shopper cannot add a product to a cart until all of its required options have been selected. + * + */ +public class ProductFactory +{ + + public static com.mozu.api.contracts.productruntime.ProductCollection getProducts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode) throws Exception + { + return getProducts(apiContext, dataViewMode, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.ProductCollection getProducts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String filter, Integer startIndex, Integer pageSize, String sortBy, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.ProductCollection returnObj = new com.mozu.api.contracts.productruntime.ProductCollection(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.getProducts( filter, startIndex, pageSize, sortBy, 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.productruntime.LocationInventoryCollection getProductInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception + { + return getProductInventory(apiContext, dataViewMode, productCode, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.LocationInventoryCollection getProductInventory(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String locationCodes, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.LocationInventoryCollection returnObj = new com.mozu.api.contracts.productruntime.LocationInventoryCollection(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.getProductInventory( productCode, locationCodes, 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.productruntime.Product getProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception + { + return getProduct(apiContext, dataViewMode, productCode, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.Product getProduct(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationProductCode, Boolean allowInactive, Boolean skipInventoryCheck, Boolean supressOutOfStock404, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.Product returnObj = new com.mozu.api.contracts.productruntime.Product(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.getProduct( productCode, variationProductCode, allowInactive, skipInventoryCheck, supressOutOfStock404, 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.productruntime.ConfiguredProduct configuredProduct(ApiContext apiContext, com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, int expectedCode) throws Exception + { + return configuredProduct(apiContext, productOptionSelections, productCode, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.ConfiguredProduct configuredProduct(ApiContext apiContext, com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, Boolean includeOptionDetails, Boolean skipInventoryCheck, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.ConfiguredProduct returnObj = new com.mozu.api.contracts.productruntime.ConfiguredProduct(); + ProductResource resource = new ProductResource(apiContext); + try + { + returnObj = resource.configuredProduct( productOptionSelections, productCode, includeOptionDetails, skipInventoryCheck, 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.productruntime.ProductValidationSummary validateProduct(ApiContext apiContext, com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, int expectedCode) throws Exception + { + return validateProduct(apiContext, productOptionSelections, productCode, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.ProductValidationSummary validateProduct(ApiContext apiContext, com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, Boolean skipInventoryCheck, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.ProductValidationSummary returnObj = new com.mozu.api.contracts.productruntime.ProductValidationSummary(); + ProductResource resource = new ProductResource(apiContext); + try + { + returnObj = resource.validateProduct( productOptionSelections, productCode, skipInventoryCheck, 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.productruntime.DiscountValidationSummary validateDiscounts(ApiContext apiContext, com.mozu.api.contracts.productruntime.DiscountSelections discountSelections, String productCode, int expectedCode) throws Exception + { + return validateDiscounts(apiContext, discountSelections, productCode, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.DiscountValidationSummary validateDiscounts(ApiContext apiContext, com.mozu.api.contracts.productruntime.DiscountSelections discountSelections, String productCode, String variationProductCode, Integer customerAccountId, Boolean allowInactive, Boolean skipInventoryCheck, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.DiscountValidationSummary returnObj = new com.mozu.api.contracts.productruntime.DiscountValidationSummary(); + ProductResource resource = new ProductResource(apiContext); + try + { + returnObj = resource.validateDiscounts( discountSelections, productCode, variationProductCode, customerAccountId, allowInactive, skipInventoryCheck, 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.productruntime.LocationInventoryCollection getProductInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productruntime.LocationInventoryQuery query, int expectedCode) throws Exception + { + return getProductInventories(apiContext, dataViewMode, query, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.LocationInventoryCollection getProductInventories(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productruntime.LocationInventoryQuery query, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.LocationInventoryCollection returnObj = new com.mozu.api.contracts.productruntime.LocationInventoryCollection(); + ProductResource resource = new ProductResource(apiContext, dataViewMode); + try + { + returnObj = resource.getProductInventories( query, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductOptionFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductOptionFactory.java index 606b3629..a140a147 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductOptionFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductOptionFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class ProductOptionFactory { - public static List getOptions(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception + public static List getOptions(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductOptionResource resource = new ProductOptionResource(apiContext, dataViewMode); @@ -31,21 +32,21 @@ public static List getOptions catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductOption getOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductOption getOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode) throws Exception { - return getOption(apiContext, dataViewMode, productCode, attributeFQN, null, expectedCode, successCode ); + return getOption(apiContext, dataViewMode, productCode, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductOption getOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductOption getOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductOption returnObj = new com.mozu.api.contracts.productadmin.ProductOption(); ProductOptionResource resource = new ProductOptionResource(apiContext, dataViewMode); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.productadmin.ProductOption getOption(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductOption addOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductOption productOption, String productCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductOption addOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductOption productOption, String productCode, int expectedCode) throws Exception { - return addOption(apiContext, dataViewMode, productOption, productCode, null, expectedCode, successCode ); + return addOption(apiContext, dataViewMode, productOption, productCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductOption addOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductOption productOption, String productCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductOption addOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductOption productOption, String productCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductOption returnObj = new com.mozu.api.contracts.productadmin.ProductOption(); ProductOptionResource resource = new ProductOptionResource(apiContext, dataViewMode); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.productadmin.ProductOption addOption(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductOption updateOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductOption productOption, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductOption updateOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductOption productOption, String productCode, String attributeFQN, int expectedCode) throws Exception { - return updateOption(apiContext, dataViewMode, productOption, productCode, attributeFQN, null, expectedCode, successCode ); + return updateOption(apiContext, dataViewMode, productOption, productCode, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductOption updateOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductOption productOption, String productCode, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductOption updateOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductOption productOption, String productCode, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductOption returnObj = new com.mozu.api.contracts.productadmin.ProductOption(); ProductOptionResource resource = new ProductOptionResource(apiContext, dataViewMode); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.productadmin.ProductOption updateOption(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static void deleteOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode) throws Exception { ProductOptionResource resource = new ProductOptionResource(apiContext, dataViewMode); try @@ -125,12 +126,12 @@ public static void deleteOption(ApiContext apiContext, com.mozu.api.DataViewMode catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductPropertyFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductPropertyFactory.java index 1017f6c0..8cd9b9aa 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductPropertyFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductPropertyFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class ProductPropertyFactory { - public static List getProperties(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception + public static List getProperties(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -31,16 +32,16 @@ public static List getPrope catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List getPropertyValueLocalizedContents(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static List getPropertyValueLocalizedContents(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -51,21 +52,21 @@ public static List= 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.productadmin.ProductPropertyValueLocalizedContent getPropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String localeCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent getPropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String localeCode, int expectedCode) throws Exception { - return getPropertyValueLocalizedContent(apiContext, dataViewMode, productCode, attributeFQN, value, localeCode, null, expectedCode, successCode ); + return getPropertyValueLocalizedContent(apiContext, dataViewMode, productCode, attributeFQN, value, localeCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent getPropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String localeCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent getPropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String localeCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -76,21 +77,21 @@ public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductProperty getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductProperty getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode) throws Exception { - return getProperty(apiContext, dataViewMode, productCode, attributeFQN, null, expectedCode, successCode ); + return getProperty(apiContext, dataViewMode, productCode, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductProperty getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductProperty getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductProperty returnObj = new com.mozu.api.contracts.productadmin.ProductProperty(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -101,21 +102,21 @@ public static com.mozu.api.contracts.productadmin.ProductProperty getProperty(Ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductPropertyValueLocalizedContent addPropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent addPropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, int expectedCode) throws Exception { - return addPropertyValueLocalizedContent(apiContext, dataViewMode, localizedContent, productCode, attributeFQN, value, null, expectedCode, successCode ); + return addPropertyValueLocalizedContent(apiContext, dataViewMode, localizedContent, productCode, attributeFQN, value, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent addPropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent addPropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -126,21 +127,21 @@ public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductProperty addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductProperty addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, int expectedCode) throws Exception { - return addProperty(apiContext, dataViewMode, productProperty, productCode, null, expectedCode, successCode ); + return addProperty(apiContext, dataViewMode, productProperty, productCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductProperty addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductProperty addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductProperty returnObj = new com.mozu.api.contracts.productadmin.ProductProperty(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -151,16 +152,16 @@ public static com.mozu.api.contracts.productadmin.ProductProperty addProperty(Ap catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List updatePropertyValueLocalizedContents(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List localizedContent, String productCode, String attributeFQN, String value, int expectedCode, int successCode) throws Exception + public static List updatePropertyValueLocalizedContents(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List localizedContent, String productCode, String attributeFQN, String value, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -171,21 +172,21 @@ public static List= 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.productadmin.ProductPropertyValueLocalizedContent updatePropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String localeCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent updatePropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String localeCode, int expectedCode) throws Exception { - return updatePropertyValueLocalizedContent(apiContext, dataViewMode, localizedContent, productCode, attributeFQN, value, localeCode, null, expectedCode, successCode ); + return updatePropertyValueLocalizedContent(apiContext, dataViewMode, localizedContent, productCode, attributeFQN, value, localeCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent updatePropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String localeCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent updatePropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String localeCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent returnObj = new com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -196,21 +197,21 @@ public static com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductProperty updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductProperty updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String attributeFQN, int expectedCode) throws Exception { - return updateProperty(apiContext, dataViewMode, productProperty, productCode, attributeFQN, null, expectedCode, successCode ); + return updateProperty(apiContext, dataViewMode, productProperty, productCode, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductProperty updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductProperty updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductProperty returnObj = new com.mozu.api.contracts.productadmin.ProductProperty(); ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); @@ -221,16 +222,16 @@ public static com.mozu.api.contracts.productadmin.ProductProperty updateProperty catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode, int successCode) throws Exception + public static void deleteProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, int expectedCode) throws Exception { ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); try @@ -240,15 +241,15 @@ public static void deleteProperty(ApiContext apiContext, com.mozu.api.DataViewMo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deletePropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String localeCode, int expectedCode, int successCode) throws Exception + public static void deletePropertyValueLocalizedContent(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String attributeFQN, String value, String localeCode, int expectedCode) throws Exception { ProductPropertyResource resource = new ProductPropertyResource(apiContext, dataViewMode); try @@ -258,12 +259,12 @@ public static void deletePropertyValueLocalizedContent(ApiContext apiContext, co catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductReservationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductReservationFactory.java index fb43dbac..51257eb4 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductReservationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductReservationFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ProductReservationFactory { - public static com.mozu.api.contracts.productadmin.ProductReservationCollection getProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductReservationCollection getProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode) throws Exception { - return getProductReservations(apiContext, dataViewMode, null, null, null, null, null, expectedCode, successCode ); + return getProductReservations(apiContext, dataViewMode, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductReservationCollection getProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductReservationCollection getProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductReservationCollection returnObj = new com.mozu.api.contracts.productadmin.ProductReservationCollection(); ProductReservationResource resource = new ProductReservationResource(apiContext, dataViewMode); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.productadmin.ProductReservationCollection g catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductReservation getProductReservation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productReservationId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductReservation getProductReservation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productReservationId, int expectedCode) throws Exception { - return getProductReservation(apiContext, dataViewMode, productReservationId, null, expectedCode, successCode ); + return getProductReservation(apiContext, dataViewMode, productReservationId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductReservation getProductReservation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productReservationId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductReservation getProductReservation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productReservationId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductReservation returnObj = new com.mozu.api.contracts.productadmin.ProductReservation(); ProductReservationResource resource = new ProductReservationResource(apiContext, dataViewMode); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.productadmin.ProductReservation getProductR catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List addProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, int expectedCode, int successCode) throws Exception + public static List addProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, int expectedCode) throws Exception { - return addProductReservations(apiContext, dataViewMode, productReservations, null, expectedCode, successCode ); + return addProductReservations(apiContext, dataViewMode, productReservations, null, expectedCode); } - public static List addProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, Boolean skipInventoryCheck, int expectedCode, int successCode) throws Exception + public static List addProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, Boolean skipInventoryCheck, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductReservationResource resource = new ProductReservationResource(apiContext, dataViewMode); @@ -86,16 +87,16 @@ public static List addPr catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 commitReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, int expectedCode, int successCode) throws Exception + public static void commitReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, int expectedCode) throws Exception { ProductReservationResource resource = new ProductReservationResource(apiContext, dataViewMode); try @@ -105,20 +106,20 @@ public static void commitReservations(ApiContext apiContext, com.mozu.api.DataVi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static List updateProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, int expectedCode, int successCode) throws Exception + public static List updateProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, int expectedCode) throws Exception { - return updateProductReservations(apiContext, dataViewMode, productReservations, null, expectedCode, successCode ); + return updateProductReservations(apiContext, dataViewMode, productReservations, null, expectedCode); } - public static List updateProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, Boolean skipInventoryCheck, int expectedCode, int successCode) throws Exception + public static List updateProductReservations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List productReservations, Boolean skipInventoryCheck, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductReservationResource resource = new ProductReservationResource(apiContext, dataViewMode); @@ -129,16 +130,16 @@ public static List updat catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteProductReservation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productReservationId, int expectedCode, int successCode) throws Exception + public static void deleteProductReservation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productReservationId, int expectedCode) throws Exception { ProductReservationResource resource = new ProductReservationResource(apiContext, dataViewMode); try @@ -148,12 +149,12 @@ public static void deleteProductReservation(ApiContext apiContext, com.mozu.api. catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductSearchResultFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductSearchResultFactory.java index 91b88f56..507aa683 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductSearchResultFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductSearchResultFactory.java @@ -1,76 +1,77 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.storefront.ProductSearchResultResource; - -/** - * Use the Product Search resource to provide dynamic search results to shoppers as they browse and search for products on the web storefront, and to suggest possible search terms as the shopper enters text. - * - */ -public class ProductSearchResultFactory -{ - - public static com.mozu.api.contracts.productruntime.ProductSearchResult search(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return search(apiContext, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.ProductSearchResult search(ApiContext apiContext, String query, String filter, String facetTemplate, String facetTemplateSubset, String facet, String facetFieldRangeQuery, String facetHierPrefix, String facetHierValue, String facetHierDepth, String facetStartIndex, String facetPageSize, String facetSettings, String facetValueFilter, String sortBy, Integer pageSize, Integer startIndex, String searchSettings, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.ProductSearchResult returnObj = new com.mozu.api.contracts.productruntime.ProductSearchResult(); - ProductSearchResultResource resource = new ProductSearchResultResource(apiContext); - try - { - returnObj = resource.search( query, filter, facetTemplate, facetTemplateSubset, facet, facetFieldRangeQuery, facetHierPrefix, facetHierValue, facetHierDepth, facetStartIndex, facetPageSize, facetSettings, facetValueFilter, sortBy, pageSize, startIndex, searchSettings, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productruntime.SearchSuggestionResult suggest(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return suggest(apiContext, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productruntime.SearchSuggestionResult suggest(ApiContext apiContext, String query, String groups, Integer pageSize, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productruntime.SearchSuggestionResult returnObj = new com.mozu.api.contracts.productruntime.SearchSuggestionResult(); - ProductSearchResultResource resource = new ProductSearchResultResource(apiContext); - try - { - returnObj = resource.suggest( query, groups, pageSize, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.storefront.ProductSearchResultResource; + +/** + * Use the Product Search resource to provide dynamic search results to shoppers as they browse and search for products on the web storefront, and to suggest possible search terms as the shopper enters text. + * + */ +public class ProductSearchResultFactory +{ + + public static com.mozu.api.contracts.productruntime.ProductSearchResult search(ApiContext apiContext, int expectedCode) throws Exception + { + return search(apiContext, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.ProductSearchResult search(ApiContext apiContext, String query, String filter, String facetTemplate, String facetTemplateSubset, String facet, String facetFieldRangeQuery, String facetHierPrefix, String facetHierValue, String facetHierDepth, String facetStartIndex, String facetPageSize, String facetSettings, String facetValueFilter, String sortBy, Integer pageSize, Integer startIndex, String searchSettings, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.ProductSearchResult returnObj = new com.mozu.api.contracts.productruntime.ProductSearchResult(); + ProductSearchResultResource resource = new ProductSearchResultResource(apiContext); + try + { + returnObj = resource.search( query, filter, facetTemplate, facetTemplateSubset, facet, facetFieldRangeQuery, facetHierPrefix, facetHierValue, facetHierDepth, facetStartIndex, facetPageSize, facetSettings, facetValueFilter, sortBy, pageSize, startIndex, searchSettings, 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.productruntime.SearchSuggestionResult suggest(ApiContext apiContext, int expectedCode) throws Exception + { + return suggest(apiContext, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productruntime.SearchSuggestionResult suggest(ApiContext apiContext, String query, String groups, Integer pageSize, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productruntime.SearchSuggestionResult returnObj = new com.mozu.api.contracts.productruntime.SearchSuggestionResult(); + ProductSearchResultResource resource = new ProductSearchResultResource(apiContext); + try + { + returnObj = resource.suggest( query, groups, pageSize, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeExtraFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeExtraFactory.java index d7afc948..71e0eafc 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeExtraFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeExtraFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class ProductTypeExtraFactory { - public static List getExtras(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static List getExtras(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductTypeExtraResource resource = new ProductTypeExtraResource(apiContext, dataViewMode); @@ -31,21 +32,21 @@ public static List g catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType getExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType getExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { - return getExtra(apiContext, dataViewMode, productTypeId, attributeFQN, null, expectedCode, successCode ); + return getExtra(apiContext, dataViewMode, productTypeId, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType getExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType getExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypeExtraResource resource = new ProductTypeExtraResource(apiContext, dataViewMode); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType getExtr catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType addExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType addExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, int expectedCode) throws Exception { - return addExtra(apiContext, dataViewMode, attributeInProductType, productTypeId, null, expectedCode, successCode ); + return addExtra(apiContext, dataViewMode, attributeInProductType, productTypeId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType addExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType addExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypeExtraResource resource = new ProductTypeExtraResource(apiContext, dataViewMode); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType addExtr catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType updateExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType updateExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { - return updateExtra(apiContext, dataViewMode, attributeInProductType, productTypeId, attributeFQN, null, expectedCode, successCode ); + return updateExtra(apiContext, dataViewMode, attributeInProductType, productTypeId, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType updateExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType updateExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypeExtraResource resource = new ProductTypeExtraResource(apiContext, dataViewMode); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType updateE catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static void deleteExtra(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { ProductTypeExtraResource resource = new ProductTypeExtraResource(apiContext, dataViewMode); try @@ -125,12 +126,12 @@ public static void deleteExtra(ApiContext apiContext, com.mozu.api.DataViewMode catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeFactory.java index f31914c6..ec9562fe 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ProductTypeFactory { - public static com.mozu.api.contracts.productadmin.ProductTypeCollection getProductTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductTypeCollection getProductTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode) throws Exception { - return getProductTypes(apiContext, dataViewMode, null, null, null, null, null, expectedCode, successCode ); + return getProductTypes(apiContext, dataViewMode, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductTypeCollection getProductTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductTypeCollection getProductTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductTypeCollection returnObj = new com.mozu.api.contracts.productadmin.ProductTypeCollection(); ProductTypeResource resource = new ProductTypeResource(apiContext, dataViewMode); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.productadmin.ProductTypeCollection getProdu catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductType getProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductType getProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode) throws Exception { - return getProductType(apiContext, dataViewMode, productTypeId, null, expectedCode, successCode ); + return getProductType(apiContext, dataViewMode, productTypeId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductType getProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductType getProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductType returnObj = new com.mozu.api.contracts.productadmin.ProductType(); ProductTypeResource resource = new ProductTypeResource(apiContext, dataViewMode); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.productadmin.ProductType getProductType(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductType addProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductType productType, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductType addProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductType productType, int expectedCode) throws Exception { - return addProductType(apiContext, dataViewMode, productType, null, expectedCode, successCode ); + return addProductType(apiContext, dataViewMode, productType, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductType addProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductType productType, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductType addProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductType productType, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductType returnObj = new com.mozu.api.contracts.productadmin.ProductType(); ProductTypeResource resource = new ProductTypeResource(apiContext, dataViewMode); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.productadmin.ProductType addProductType(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductType updateProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductType productType, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductType updateProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductType productType, Integer productTypeId, int expectedCode) throws Exception { - return updateProductType(apiContext, dataViewMode, productType, productTypeId, null, expectedCode, successCode ); + return updateProductType(apiContext, dataViewMode, productType, productTypeId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductType updateProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductType productType, Integer productTypeId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductType updateProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductType productType, Integer productTypeId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductType returnObj = new com.mozu.api.contracts.productadmin.ProductType(); ProductTypeResource resource = new ProductTypeResource(apiContext, dataViewMode); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.productadmin.ProductType updateProductType( catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static void deleteProductType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode) throws Exception { ProductTypeResource resource = new ProductTypeResource(apiContext, dataViewMode); try @@ -130,12 +131,12 @@ public static void deleteProductType(ApiContext apiContext, com.mozu.api.DataVie catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeOptionFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeOptionFactory.java index 1038aa4b..e811b19d 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeOptionFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeOptionFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class ProductTypeOptionFactory { - public static List getOptions(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static List getOptions(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductTypeOptionResource resource = new ProductTypeOptionResource(apiContext, dataViewMode); @@ -31,21 +32,21 @@ public static List g catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType getOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType getOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { - return getOption(apiContext, dataViewMode, productTypeId, attributeFQN, null, expectedCode, successCode ); + return getOption(apiContext, dataViewMode, productTypeId, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType getOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType getOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypeOptionResource resource = new ProductTypeOptionResource(apiContext, dataViewMode); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType getOpti catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType addOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType addOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, int expectedCode) throws Exception { - return addOption(apiContext, dataViewMode, attributeInProductType, productTypeId, null, expectedCode, successCode ); + return addOption(apiContext, dataViewMode, attributeInProductType, productTypeId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType addOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType addOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypeOptionResource resource = new ProductTypeOptionResource(apiContext, dataViewMode); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType addOpti catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType updateOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType updateOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { - return updateOption(apiContext, dataViewMode, attributeInProductType, productTypeId, attributeFQN, null, expectedCode, successCode ); + return updateOption(apiContext, dataViewMode, attributeInProductType, productTypeId, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType updateOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType updateOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypeOptionResource resource = new ProductTypeOptionResource(apiContext, dataViewMode); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType updateO catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static void deleteOption(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { ProductTypeOptionResource resource = new ProductTypeOptionResource(apiContext, dataViewMode); try @@ -125,12 +126,12 @@ public static void deleteOption(ApiContext apiContext, com.mozu.api.DataViewMode catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypePropertyFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypePropertyFactory.java index 92691cc6..fa33d556 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypePropertyFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypePropertyFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class ProductTypePropertyFactory { - public static List getProperties(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static List getProperties(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); @@ -31,21 +32,21 @@ public static List g catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { - return getProperty(apiContext, dataViewMode, productTypeId, attributeFQN, null, expectedCode, successCode ); + return getProperty(apiContext, dataViewMode, productTypeId, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType getProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType getProp catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, int expectedCode) throws Exception { - return addProperty(apiContext, dataViewMode, attributeInProductType, productTypeId, null, expectedCode, successCode ); + return addProperty(apiContext, dataViewMode, attributeInProductType, productTypeId, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType addProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType addProp catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.AttributeInProductType updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { - return updateProperty(apiContext, dataViewMode, attributeInProductType, productTypeId, attributeFQN, null, expectedCode, successCode ); + return updateProperty(apiContext, dataViewMode, attributeInProductType, productTypeId, attributeFQN, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.AttributeInProductType updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.AttributeInProductType updateProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, String attributeFQN, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.AttributeInProductType returnObj = new com.mozu.api.contracts.productadmin.AttributeInProductType(); ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); @@ -106,16 +107,16 @@ public static com.mozu.api.contracts.productadmin.AttributeInProductType updateP catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode, int successCode) throws Exception + public static void deleteProperty(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, String attributeFQN, int expectedCode) throws Exception { ProductTypePropertyResource resource = new ProductTypePropertyResource(apiContext, dataViewMode); try @@ -125,12 +126,12 @@ public static void deleteProperty(ApiContext apiContext, com.mozu.api.DataViewMo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeVariationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeVariationFactory.java index 2a9a4275..aa37a400 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeVariationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductTypeVariationFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ProductTypeVariationFactory { - public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection generateProductVariations(ApiContext apiContext, List productOptionsIn, Integer productTypeId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection generateProductVariations(ApiContext apiContext, List productOptionsIn, Integer productTypeId, int expectedCode) throws Exception { - return generateProductVariations(apiContext, productOptionsIn, productTypeId, null, null, null, null, null, null, expectedCode, successCode ); + return generateProductVariations(apiContext, productOptionsIn, productTypeId, null, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection generateProductVariations(ApiContext apiContext, List productOptionsIn, Integer productTypeId, String productCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection generateProductVariations(ApiContext apiContext, List productOptionsIn, Integer productTypeId, String productCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductVariationPagedCollection returnObj = new com.mozu.api.contracts.productadmin.ProductVariationPagedCollection(); ProductTypeVariationResource resource = new ProductTypeVariationResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollectio catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductVariationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductVariationFactory.java index 523f5c0f..2310a394 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductVariationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ProductVariationFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class ProductVariationFactory { - public static List getProductVariationLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode, int successCode) throws Exception + public static List getProductVariationLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -31,21 +32,21 @@ public static List= 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.productadmin.ProductVariationDeltaPrice getProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice getProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception { - return getProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, productCode, variationKey, currencyCode, null, expectedCode, successCode ); + return getProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, productCode, variationKey, currencyCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice getProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice getProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -56,21 +57,21 @@ public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice get catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductVariation getProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariation getProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode) throws Exception { - return getProductVariation(apiContext, dataViewMode, productCode, variationKey, null, expectedCode, successCode ); + return getProductVariation(apiContext, dataViewMode, productCode, variationKey, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductVariation getProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariation getProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductVariation returnObj = new com.mozu.api.contracts.productadmin.ProductVariation(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -81,21 +82,21 @@ public static com.mozu.api.contracts.productadmin.ProductVariation getProductVar catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductVariationPagedCollection getProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection getProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, int expectedCode) throws Exception { - return getProductVariations(apiContext, dataViewMode, productCode, null, null, null, null, null, expectedCode, successCode ); + return getProductVariations(apiContext, dataViewMode, productCode, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection getProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollection getProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductVariationPagedCollection returnObj = new com.mozu.api.contracts.productadmin.ProductVariationPagedCollection(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -106,21 +107,21 @@ public static com.mozu.api.contracts.productadmin.ProductVariationPagedCollectio catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductVariationDeltaPrice addProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice addProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, int expectedCode) throws Exception { - return addProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, variationKey, null, expectedCode, successCode ); + return addProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, variationKey, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice addProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice addProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -131,16 +132,16 @@ public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice add catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List updateProductVariationLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List localizedDeltaPrice, String productCode, String variationKey, int expectedCode, int successCode) throws Exception + public static List updateProductVariationLocalizedDeltaPrices(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, List localizedDeltaPrice, String productCode, String variationKey, int expectedCode) throws Exception { List returnObj = new ArrayList(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -151,21 +152,21 @@ public static List= 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.productadmin.ProductVariationDeltaPrice updateProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String currencyCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice updateProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception { - return updateProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, variationKey, currencyCode, null, expectedCode, successCode ); + return updateProductVariationLocalizedDeltaPrice(apiContext, dataViewMode, localizedDeltaPrice, productCode, variationKey, currencyCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice updateProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String currencyCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice updateProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice localizedDeltaPrice, String productCode, String variationKey, String currencyCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice returnObj = new com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -176,21 +177,21 @@ public static com.mozu.api.contracts.productadmin.ProductVariationDeltaPrice upd catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductVariation updateProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariation productVariation, String productCode, String variationKey, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariation updateProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariation productVariation, String productCode, String variationKey, int expectedCode) throws Exception { - return updateProductVariation(apiContext, dataViewMode, productVariation, productCode, variationKey, null, expectedCode, successCode ); + return updateProductVariation(apiContext, dataViewMode, productVariation, productCode, variationKey, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductVariation updateProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariation productVariation, String productCode, String variationKey, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariation updateProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariation productVariation, String productCode, String variationKey, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductVariation returnObj = new com.mozu.api.contracts.productadmin.ProductVariation(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -201,21 +202,21 @@ public static com.mozu.api.contracts.productadmin.ProductVariation updateProduct catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productadmin.ProductVariationCollection updateProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationCollection productVariations, String productCode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationCollection updateProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationCollection productVariations, String productCode, int expectedCode) throws Exception { - return updateProductVariations(apiContext, dataViewMode, productVariations, productCode, null, expectedCode, successCode ); + return updateProductVariations(apiContext, dataViewMode, productVariations, productCode, null, expectedCode); } - public static com.mozu.api.contracts.productadmin.ProductVariationCollection updateProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationCollection productVariations, String productCode, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productadmin.ProductVariationCollection updateProductVariations(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.ProductVariationCollection productVariations, String productCode, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productadmin.ProductVariationCollection returnObj = new com.mozu.api.contracts.productadmin.ProductVariationCollection(); ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); @@ -226,16 +227,16 @@ public static com.mozu.api.contracts.productadmin.ProductVariationCollection upd catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode, int successCode) throws Exception + public static void deleteProductVariation(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, int expectedCode) throws Exception { ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); try @@ -245,15 +246,15 @@ public static void deleteProductVariation(ApiContext apiContext, com.mozu.api.Da catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deleteProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, int expectedCode, int successCode) throws Exception + public static void deleteProductVariationLocalizedDeltaPrice(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String productCode, String variationKey, String currencyCode, int expectedCode) throws Exception { ProductVariationResource resource = new ProductVariationResource(apiContext, dataViewMode); try @@ -263,12 +264,12 @@ public static void deleteProductVariationLocalizedDeltaPrice(ApiContext apiConte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PropertyTypeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PropertyTypeFactory.java index e6ee9186..43578fb7 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PropertyTypeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PropertyTypeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class PropertyTypeFactory { - public static com.mozu.api.contracts.content.PropertyTypeCollection getPropertyTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.PropertyTypeCollection getPropertyTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, int expectedCode) throws Exception { - return getPropertyTypes(apiContext, dataViewMode, null, null, null, expectedCode, successCode ); + return getPropertyTypes(apiContext, dataViewMode, null, null, null, expectedCode); } - public static com.mozu.api.contracts.content.PropertyTypeCollection getPropertyTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer pageSize, Integer startIndex, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.PropertyTypeCollection getPropertyTypes(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, Integer pageSize, Integer startIndex, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.PropertyTypeCollection returnObj = new com.mozu.api.contracts.content.PropertyTypeCollection(); PropertyTypeResource resource = new PropertyTypeResource(apiContext, dataViewMode); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.content.PropertyTypeCollection getPropertyT catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.PropertyType getPropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String propertyTypeName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.PropertyType getPropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String propertyTypeName, int expectedCode) throws Exception { - return getPropertyType(apiContext, dataViewMode, propertyTypeName, null, expectedCode, successCode ); + return getPropertyType(apiContext, dataViewMode, propertyTypeName, null, expectedCode); } - public static com.mozu.api.contracts.content.PropertyType getPropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String propertyTypeName, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.PropertyType getPropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String propertyTypeName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.PropertyType returnObj = new com.mozu.api.contracts.content.PropertyType(); PropertyTypeResource resource = new PropertyTypeResource(apiContext, dataViewMode); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.content.PropertyType getPropertyType(ApiCon catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.PropertyType createPropertyType(ApiContext apiContext, com.mozu.api.contracts.content.PropertyType propertyType, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.PropertyType createPropertyType(ApiContext apiContext, com.mozu.api.contracts.content.PropertyType propertyType, int expectedCode) throws Exception { - return createPropertyType(apiContext, propertyType, null, expectedCode, successCode ); + return createPropertyType(apiContext, propertyType, null, expectedCode); } - public static com.mozu.api.contracts.content.PropertyType createPropertyType(ApiContext apiContext, com.mozu.api.contracts.content.PropertyType propertyType, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.PropertyType createPropertyType(ApiContext apiContext, com.mozu.api.contracts.content.PropertyType propertyType, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.PropertyType returnObj = new com.mozu.api.contracts.content.PropertyType(); PropertyTypeResource resource = new PropertyTypeResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.content.PropertyType createPropertyType(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.content.PropertyType updatePropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.PropertyType propertyType, String propertyTypeName, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.PropertyType updatePropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.PropertyType propertyType, String propertyTypeName, int expectedCode) throws Exception { - return updatePropertyType(apiContext, dataViewMode, propertyType, propertyTypeName, null, expectedCode, successCode ); + return updatePropertyType(apiContext, dataViewMode, propertyType, propertyTypeName, null, expectedCode); } - public static com.mozu.api.contracts.content.PropertyType updatePropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.PropertyType propertyType, String propertyTypeName, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.content.PropertyType updatePropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.content.PropertyType propertyType, String propertyTypeName, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.content.PropertyType returnObj = new com.mozu.api.contracts.content.PropertyType(); PropertyTypeResource resource = new PropertyTypeResource(apiContext, dataViewMode); @@ -111,16 +112,16 @@ public static com.mozu.api.contracts.content.PropertyType updatePropertyType(Api catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deletePropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String propertyTypeName, int expectedCode, int successCode) throws Exception + public static void deletePropertyType(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, String propertyTypeName, int expectedCode) throws Exception { PropertyTypeResource resource = new PropertyTypeResource(apiContext, dataViewMode); try @@ -130,12 +131,12 @@ public static void deletePropertyType(ApiContext apiContext, com.mozu.api.DataVi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PublicCardFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PublicCardFactory.java index 128ad864..2e51ba52 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PublicCardFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PublicCardFactory.java @@ -1,84 +1,85 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.payments.PublicCardResource; - -/** - * - * - */ -public class PublicCardFactory -{ - - public static com.mozu.api.contracts.paymentservice.response.SyncResponse create(ApiContext apiContext, com.mozu.api.contracts.paymentservice.PublicCard request, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.paymentservice.response.SyncResponse returnObj = new com.mozu.api.contracts.paymentservice.response.SyncResponse(); - PublicCardResource resource = new PublicCardResource(apiContext); - try - { - returnObj = resource.create( request); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.paymentservice.response.SyncResponse update(ApiContext apiContext, com.mozu.api.contracts.paymentservice.PublicCard request, String cardId, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.paymentservice.response.SyncResponse returnObj = new com.mozu.api.contracts.paymentservice.response.SyncResponse(); - PublicCardResource resource = new PublicCardResource(apiContext); - try - { - returnObj = resource.update( request, cardId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void delete(ApiContext apiContext, String cardId, int expectedCode, int successCode) throws Exception - { - PublicCardResource resource = new PublicCardResource(apiContext); - try - { - resource.delete( cardId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.payments.PublicCardResource; + +/** + * commerce/payments/cards related resources. DOCUMENT_HERE + * + */ +public class PublicCardFactory +{ + + public static com.mozu.api.contracts.paymentservice.response.SyncResponse create(ApiContext apiContext, com.mozu.api.contracts.paymentservice.PublicCard request, int expectedCode) throws Exception + { + com.mozu.api.contracts.paymentservice.response.SyncResponse returnObj = new com.mozu.api.contracts.paymentservice.response.SyncResponse(); + PublicCardResource resource = new PublicCardResource(apiContext); + try + { + returnObj = resource.create( request); + } + 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.paymentservice.response.SyncResponse update(ApiContext apiContext, com.mozu.api.contracts.paymentservice.PublicCard request, String cardId, int expectedCode) throws Exception + { + com.mozu.api.contracts.paymentservice.response.SyncResponse returnObj = new com.mozu.api.contracts.paymentservice.response.SyncResponse(); + PublicCardResource resource = new PublicCardResource(apiContext); + try + { + returnObj = resource.update( request, cardId); + } + 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 delete(ApiContext apiContext, String cardId, int expectedCode) throws Exception + { + PublicCardResource resource = new PublicCardResource(apiContext); + try + { + resource.delete( cardId); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PublishingScopeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PublishingScopeFactory.java index d7a2380e..98077ed0 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PublishingScopeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/PublishingScopeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class PublishingScopeFactory { - public static void discardDrafts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.PublishingScope publishScope, int expectedCode, int successCode) throws Exception + public static void discardDrafts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.PublishingScope publishScope, int expectedCode) throws Exception { PublishingScopeResource resource = new PublishingScopeResource(apiContext, dataViewMode); try @@ -30,15 +31,15 @@ public static void discardDrafts(ApiContext apiContext, com.mozu.api.DataViewMod catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void publishDrafts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.PublishingScope publishScope, int expectedCode, int successCode) throws Exception + public static void publishDrafts(ApiContext apiContext, com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.PublishingScope publishScope, int expectedCode) throws Exception { PublishingScopeResource resource = new PublishingScopeResource(apiContext, dataViewMode); try @@ -48,12 +49,12 @@ public static void publishDrafts(ApiContext apiContext, com.mozu.api.DataViewMod catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ReferenceDataFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ReferenceDataFactory.java index f62e8741..a6553696 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ReferenceDataFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ReferenceDataFactory.java @@ -1,351 +1,352 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.ReferenceDataResource; - -/** - * The Reference resource retrieves collections of standards the Mozu system currently supports. This includes content locales, top-level domains, units of measure, countries, currencies, time zones, and shipping or billing address schemas. - * - */ -public class ReferenceDataFactory -{ - - public static com.mozu.api.contracts.reference.AddressSchema getAddressSchema(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getAddressSchema(apiContext, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.AddressSchema getAddressSchema(ApiContext apiContext, String countryCode, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.AddressSchema returnObj = new com.mozu.api.contracts.reference.AddressSchema(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getAddressSchema( countryCode, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.reference.AddressSchemaCollection getAddressSchemas(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getAddressSchemas(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.AddressSchemaCollection getAddressSchemas(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.AddressSchemaCollection returnObj = new com.mozu.api.contracts.reference.AddressSchemaCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getAddressSchemas( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.core.Behavior getBehavior(ApiContext apiContext, Integer behaviorId, int expectedCode, int successCode) throws Exception - { - return getBehavior(apiContext, behaviorId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.core.Behavior getBehavior(ApiContext apiContext, Integer behaviorId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.core.Behavior returnObj = new com.mozu.api.contracts.core.Behavior(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getBehavior( behaviorId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.core.BehaviorCategory getBehaviorCategory(ApiContext apiContext, Integer categoryId, int expectedCode, int successCode) throws Exception - { - return getBehaviorCategory(apiContext, categoryId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.core.BehaviorCategory getBehaviorCategory(ApiContext apiContext, Integer categoryId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.core.BehaviorCategory returnObj = new com.mozu.api.contracts.core.BehaviorCategory(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getBehaviorCategory( categoryId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.core.BehaviorCategoryCollection getBehaviorCategories(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getBehaviorCategories(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.core.BehaviorCategoryCollection getBehaviorCategories(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.core.BehaviorCategoryCollection returnObj = new com.mozu.api.contracts.core.BehaviorCategoryCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getBehaviorCategories( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.core.BehaviorCollection getBehaviors(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getBehaviors(apiContext, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.core.BehaviorCollection getBehaviors(ApiContext apiContext, String userType, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.core.BehaviorCollection returnObj = new com.mozu.api.contracts.core.BehaviorCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getBehaviors( userType, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.reference.ContentLocaleCollection getContentLocales(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getContentLocales(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.ContentLocaleCollection getContentLocales(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.ContentLocaleCollection returnObj = new com.mozu.api.contracts.reference.ContentLocaleCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getContentLocales( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.reference.CountryCollection getCountries(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getCountries(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.CountryCollection getCountries(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.CountryCollection returnObj = new com.mozu.api.contracts.reference.CountryCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getCountries( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.reference.CountryWithStatesCollection getCountriesWithStates(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getCountriesWithStates(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.CountryWithStatesCollection getCountriesWithStates(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.CountryWithStatesCollection returnObj = new com.mozu.api.contracts.reference.CountryWithStatesCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getCountriesWithStates( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.reference.CurrencyCollection getCurrencies(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getCurrencies(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.CurrencyCollection getCurrencies(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.CurrencyCollection returnObj = new com.mozu.api.contracts.reference.CurrencyCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getCurrencies( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.reference.TimeZoneCollection getTimeZones(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getTimeZones(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.TimeZoneCollection getTimeZones(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.TimeZoneCollection returnObj = new com.mozu.api.contracts.reference.TimeZoneCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getTimeZones( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.reference.TopLevelDomainCollection getTopLevelDomains(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getTopLevelDomains(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.TopLevelDomainCollection getTopLevelDomains(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.TopLevelDomainCollection returnObj = new com.mozu.api.contracts.reference.TopLevelDomainCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getTopLevelDomains( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.reference.UnitOfMeasureCollection getUnitsOfMeasure(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getUnitsOfMeasure(apiContext, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.reference.UnitOfMeasureCollection getUnitsOfMeasure(ApiContext apiContext, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.reference.UnitOfMeasureCollection returnObj = new com.mozu.api.contracts.reference.UnitOfMeasureCollection(); - ReferenceDataResource resource = new ReferenceDataResource(apiContext); - try - { - returnObj = resource.getUnitsOfMeasure( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.ReferenceDataResource; + +/** + * The Reference resource retrieves collections of standards the Mozu system currently supports. This includes content locales, top-level domains, units of measure, countries, currencies, time zones, and shipping or billing address schemas. + * + */ +public class ReferenceDataFactory +{ + + public static com.mozu.api.contracts.reference.AddressSchema getAddressSchema(ApiContext apiContext, int expectedCode) throws Exception + { + return getAddressSchema(apiContext, null, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.AddressSchema getAddressSchema(ApiContext apiContext, String countryCode, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.AddressSchema returnObj = new com.mozu.api.contracts.reference.AddressSchema(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getAddressSchema( countryCode, 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.reference.AddressSchemaCollection getAddressSchemas(ApiContext apiContext, int expectedCode) throws Exception + { + return getAddressSchemas(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.AddressSchemaCollection getAddressSchemas(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.AddressSchemaCollection returnObj = new com.mozu.api.contracts.reference.AddressSchemaCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getAddressSchemas( 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.core.Behavior getBehavior(ApiContext apiContext, Integer behaviorId, int expectedCode) throws Exception + { + return getBehavior(apiContext, behaviorId, null, expectedCode); + } + + public static com.mozu.api.contracts.core.Behavior getBehavior(ApiContext apiContext, Integer behaviorId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.core.Behavior returnObj = new com.mozu.api.contracts.core.Behavior(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getBehavior( behaviorId, 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.core.BehaviorCategory getBehaviorCategory(ApiContext apiContext, Integer categoryId, int expectedCode) throws Exception + { + return getBehaviorCategory(apiContext, categoryId, null, expectedCode); + } + + public static com.mozu.api.contracts.core.BehaviorCategory getBehaviorCategory(ApiContext apiContext, Integer categoryId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.core.BehaviorCategory returnObj = new com.mozu.api.contracts.core.BehaviorCategory(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getBehaviorCategory( categoryId, 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.core.BehaviorCategoryCollection getBehaviorCategories(ApiContext apiContext, int expectedCode) throws Exception + { + return getBehaviorCategories(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.core.BehaviorCategoryCollection getBehaviorCategories(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.core.BehaviorCategoryCollection returnObj = new com.mozu.api.contracts.core.BehaviorCategoryCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getBehaviorCategories( 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.core.BehaviorCollection getBehaviors(ApiContext apiContext, int expectedCode) throws Exception + { + return getBehaviors(apiContext, null, null, expectedCode); + } + + public static com.mozu.api.contracts.core.BehaviorCollection getBehaviors(ApiContext apiContext, String userType, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.core.BehaviorCollection returnObj = new com.mozu.api.contracts.core.BehaviorCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getBehaviors( userType, 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.reference.ContentLocaleCollection getContentLocales(ApiContext apiContext, int expectedCode) throws Exception + { + return getContentLocales(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.ContentLocaleCollection getContentLocales(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.ContentLocaleCollection returnObj = new com.mozu.api.contracts.reference.ContentLocaleCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getContentLocales( 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.reference.CountryCollection getCountries(ApiContext apiContext, int expectedCode) throws Exception + { + return getCountries(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.CountryCollection getCountries(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.CountryCollection returnObj = new com.mozu.api.contracts.reference.CountryCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getCountries( 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.reference.CountryWithStatesCollection getCountriesWithStates(ApiContext apiContext, int expectedCode) throws Exception + { + return getCountriesWithStates(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.CountryWithStatesCollection getCountriesWithStates(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.CountryWithStatesCollection returnObj = new com.mozu.api.contracts.reference.CountryWithStatesCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getCountriesWithStates( 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.reference.CurrencyCollection getCurrencies(ApiContext apiContext, int expectedCode) throws Exception + { + return getCurrencies(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.CurrencyCollection getCurrencies(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.CurrencyCollection returnObj = new com.mozu.api.contracts.reference.CurrencyCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getCurrencies( 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.reference.TimeZoneCollection getTimeZones(ApiContext apiContext, int expectedCode) throws Exception + { + return getTimeZones(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.TimeZoneCollection getTimeZones(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.TimeZoneCollection returnObj = new com.mozu.api.contracts.reference.TimeZoneCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getTimeZones( 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.reference.TopLevelDomainCollection getTopLevelDomains(ApiContext apiContext, int expectedCode) throws Exception + { + return getTopLevelDomains(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.TopLevelDomainCollection getTopLevelDomains(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.TopLevelDomainCollection returnObj = new com.mozu.api.contracts.reference.TopLevelDomainCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getTopLevelDomains( 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.reference.UnitOfMeasureCollection getUnitsOfMeasure(ApiContext apiContext, int expectedCode) throws Exception + { + return getUnitsOfMeasure(apiContext, null, null, expectedCode); + } + + public static com.mozu.api.contracts.reference.UnitOfMeasureCollection getUnitsOfMeasure(ApiContext apiContext, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.reference.UnitOfMeasureCollection returnObj = new com.mozu.api.contracts.reference.UnitOfMeasureCollection(); + ReferenceDataResource resource = new ReferenceDataResource(apiContext); + try + { + returnObj = resource.getUnitsOfMeasure( 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/RefundFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/RefundFactory.java index c9662377..fc88ea99 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/RefundFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/RefundFactory.java @@ -1,69 +1,70 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.orders.RefundResource; - -/** - * commerce/orders/orderrefunds related resources. DOCUMENT_HERE - * - */ -public class RefundFactory -{ - - public static com.mozu.api.contracts.commerceruntime.refunds.Refund createRefund(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.refunds.Refund refund, String orderId, int expectedCode, int successCode) throws Exception - { - return createRefund(apiContext, refund, orderId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.refunds.Refund createRefund(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.refunds.Refund refund, String orderId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.refunds.Refund returnObj = new com.mozu.api.contracts.commerceruntime.refunds.Refund(); - RefundResource resource = new RefundResource(apiContext); - try - { - returnObj = resource.createRefund( refund, orderId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void resendRefundEmail(ApiContext apiContext, String orderId, String refundId, int expectedCode, int successCode) throws Exception - { - RefundResource resource = new RefundResource(apiContext); - try - { - resource.resendRefundEmail( orderId, refundId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.orders.RefundResource; + +/** + * commerce/orders/orderrefunds related resources. DOCUMENT_HERE + * + */ +public class RefundFactory +{ + + public static com.mozu.api.contracts.commerceruntime.refunds.Refund createRefund(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.refunds.Refund refund, String orderId, int expectedCode) throws Exception + { + return createRefund(apiContext, refund, orderId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.refunds.Refund createRefund(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.refunds.Refund refund, String orderId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.refunds.Refund returnObj = new com.mozu.api.contracts.commerceruntime.refunds.Refund(); + RefundResource resource = new RefundResource(apiContext); + try + { + returnObj = resource.createRefund( refund, orderId, 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 resendRefundEmail(ApiContext apiContext, String orderId, String refundId, int expectedCode) throws Exception + { + RefundResource resource = new RefundResource(apiContext); + try + { + resource.resendRefundEmail( orderId, refundId); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ReturnFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ReturnFactory.java index d274b8bf..ea31298d 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ReturnFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ReturnFactory.java @@ -1,422 +1,423 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.ReturnResource; - -/** - * Use the Returns resource to manage returned items that were previously fufilled. Returns can include any number of items associated with an original Mozu order. Each return must either be associated with an original order or a product definition to represent each returned item. - * - */ -public class ReturnFactory -{ - - public static com.mozu.api.contracts.commerceruntime.returns.ReturnCollection getReturns(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getReturns(apiContext, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.ReturnCollection getReturns(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.ReturnCollection returnObj = new com.mozu.api.contracts.commerceruntime.returns.ReturnCollection(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.getReturns( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List getAvailableReturnActions(ApiContext apiContext, String returnId, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.getAvailableReturnActions( returnId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.ReturnItem getReturnItem(ApiContext apiContext, String returnId, String returnItemId, int expectedCode, int successCode) throws Exception - { - return getReturnItem(apiContext, returnId, returnItemId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.ReturnItem getReturnItem(ApiContext apiContext, String returnId, String returnItemId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.ReturnItem returnObj = new com.mozu.api.contracts.commerceruntime.returns.ReturnItem(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.getReturnItem( returnId, returnItemId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.ReturnItemCollection getReturnItems(ApiContext apiContext, String returnId, int expectedCode, int successCode) throws Exception - { - return getReturnItems(apiContext, returnId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.ReturnItemCollection getReturnItems(ApiContext apiContext, String returnId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.ReturnItemCollection returnObj = new com.mozu.api.contracts.commerceruntime.returns.ReturnItemCollection(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.getReturnItems( returnId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List getAvailablePaymentActionsForReturn(ApiContext apiContext, String returnId, String paymentId, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.getAvailablePaymentActionsForReturn( returnId, paymentId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.payments.Payment getPayment(ApiContext apiContext, String returnId, String paymentId, int expectedCode, int successCode) throws Exception - { - return getPayment(apiContext, returnId, paymentId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.payments.Payment getPayment(ApiContext apiContext, String returnId, String paymentId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.payments.Payment returnObj = new com.mozu.api.contracts.commerceruntime.payments.Payment(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.getPayment( returnId, paymentId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.payments.PaymentCollection getPayments(ApiContext apiContext, String returnId, int expectedCode, int successCode) throws Exception - { - return getPayments(apiContext, returnId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.payments.PaymentCollection getPayments(ApiContext apiContext, String returnId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.payments.PaymentCollection returnObj = new com.mozu.api.contracts.commerceruntime.payments.PaymentCollection(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.getPayments( returnId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return getReturn(ApiContext apiContext, String returnId, int expectedCode, int successCode) throws Exception - { - return getReturn(apiContext, returnId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return getReturn(ApiContext apiContext, String returnId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.getReturn( returnId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return createReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.Return ret, int expectedCode, int successCode) throws Exception - { - return createReturn(apiContext, ret, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return createReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.Return ret, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.createReturn( ret, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return createReturnItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnItem returnItem, String returnId, int expectedCode, int successCode) throws Exception - { - return createReturnItem(apiContext, returnItem, returnId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return createReturnItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnItem returnItem, String returnId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.createReturnItem( returnItem, returnId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return performPaymentActionForReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String returnId, String paymentId, int expectedCode, int successCode) throws Exception - { - return performPaymentActionForReturn(apiContext, action, returnId, paymentId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return performPaymentActionForReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String returnId, String paymentId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.performPaymentActionForReturn( action, returnId, paymentId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return createPaymentActionForReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String returnId, int expectedCode, int successCode) throws Exception - { - return createPaymentActionForReturn(apiContext, action, returnId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return createPaymentActionForReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String returnId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.createPaymentActionForReturn( action, returnId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.ReturnCollection performReturnActions(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnAction action, int expectedCode, int successCode) throws Exception - { - return performReturnActions(apiContext, action, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.ReturnCollection performReturnActions(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnAction action, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.ReturnCollection returnObj = new com.mozu.api.contracts.commerceruntime.returns.ReturnCollection(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.performReturnActions( action, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return updateReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.Return ret, String returnId, int expectedCode, int successCode) throws Exception - { - return updateReturn(apiContext, ret, returnId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return updateReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.Return ret, String returnId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.updateReturn( ret, returnId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void resendReturnEmail(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnAction action, int expectedCode, int successCode) throws Exception - { - ReturnResource resource = new ReturnResource(apiContext); - try - { - resource.resendReturnEmail( action); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - - public static com.mozu.api.contracts.commerceruntime.returns.Return deleteOrderItem(ApiContext apiContext, String returnId, String returnItemId, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); - ReturnResource resource = new ReturnResource(apiContext); - try - { - returnObj = resource.deleteOrderItem( returnId, returnItemId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteReturn(ApiContext apiContext, String returnId, int expectedCode, int successCode) throws Exception - { - ReturnResource resource = new ReturnResource(apiContext); - try - { - resource.deleteReturn( returnId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.ReturnResource; + +/** + * Use the Returns resource to manage returned items that were previously fufilled. Returns can include any number of items associated with an original Mozu order. Each return must either be associated with an original order or a product definition to represent each returned item. + * + */ +public class ReturnFactory +{ + + public static com.mozu.api.contracts.commerceruntime.returns.ReturnCollection getReturns(ApiContext apiContext, int expectedCode) throws Exception + { + return getReturns(apiContext, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.ReturnCollection getReturns(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.ReturnCollection returnObj = new com.mozu.api.contracts.commerceruntime.returns.ReturnCollection(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.getReturns( 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 List getAvailableReturnActions(ApiContext apiContext, String returnId, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.getAvailableReturnActions( returnId); + } + 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.returns.ReturnItem getReturnItem(ApiContext apiContext, String returnId, String returnItemId, int expectedCode) throws Exception + { + return getReturnItem(apiContext, returnId, returnItemId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.ReturnItem getReturnItem(ApiContext apiContext, String returnId, String returnItemId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.ReturnItem returnObj = new com.mozu.api.contracts.commerceruntime.returns.ReturnItem(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.getReturnItem( returnId, returnItemId, 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.returns.ReturnItemCollection getReturnItems(ApiContext apiContext, String returnId, int expectedCode) throws Exception + { + return getReturnItems(apiContext, returnId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.ReturnItemCollection getReturnItems(ApiContext apiContext, String returnId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.ReturnItemCollection returnObj = new com.mozu.api.contracts.commerceruntime.returns.ReturnItemCollection(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.getReturnItems( returnId, 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 List getAvailablePaymentActionsForReturn(ApiContext apiContext, String returnId, String paymentId, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.getAvailablePaymentActionsForReturn( returnId, paymentId); + } + 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.payments.Payment getPayment(ApiContext apiContext, String returnId, String paymentId, int expectedCode) throws Exception + { + return getPayment(apiContext, returnId, paymentId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.payments.Payment getPayment(ApiContext apiContext, String returnId, String paymentId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.payments.Payment returnObj = new com.mozu.api.contracts.commerceruntime.payments.Payment(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.getPayment( returnId, paymentId, 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.payments.PaymentCollection getPayments(ApiContext apiContext, String returnId, int expectedCode) throws Exception + { + return getPayments(apiContext, returnId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.payments.PaymentCollection getPayments(ApiContext apiContext, String returnId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.payments.PaymentCollection returnObj = new com.mozu.api.contracts.commerceruntime.payments.PaymentCollection(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.getPayments( returnId, 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.returns.Return getReturn(ApiContext apiContext, String returnId, int expectedCode) throws Exception + { + return getReturn(apiContext, returnId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.Return getReturn(ApiContext apiContext, String returnId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.getReturn( returnId, 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.returns.Return createReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.Return ret, int expectedCode) throws Exception + { + return createReturn(apiContext, ret, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.Return createReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.Return ret, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.createReturn( ret, 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.returns.Return createReturnItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnItem returnItem, String returnId, int expectedCode) throws Exception + { + return createReturnItem(apiContext, returnItem, returnId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.Return createReturnItem(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnItem returnItem, String returnId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.createReturnItem( returnItem, returnId, 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.returns.Return performPaymentActionForReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String returnId, String paymentId, int expectedCode) throws Exception + { + return performPaymentActionForReturn(apiContext, action, returnId, paymentId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.Return performPaymentActionForReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String returnId, String paymentId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.performPaymentActionForReturn( action, returnId, paymentId, 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.returns.Return createPaymentActionForReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String returnId, int expectedCode) throws Exception + { + return createPaymentActionForReturn(apiContext, action, returnId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.Return createPaymentActionForReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.payments.PaymentAction action, String returnId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.createPaymentActionForReturn( action, returnId, 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.returns.ReturnCollection performReturnActions(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnAction action, int expectedCode) throws Exception + { + return performReturnActions(apiContext, action, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.ReturnCollection performReturnActions(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnAction action, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.ReturnCollection returnObj = new com.mozu.api.contracts.commerceruntime.returns.ReturnCollection(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.performReturnActions( action, 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.returns.Return updateReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.Return ret, String returnId, int expectedCode) throws Exception + { + return updateReturn(apiContext, ret, returnId, null, expectedCode); + } + + public static com.mozu.api.contracts.commerceruntime.returns.Return updateReturn(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.Return ret, String returnId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.updateReturn( ret, returnId, 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 resendReturnEmail(ApiContext apiContext, com.mozu.api.contracts.commerceruntime.returns.ReturnAction action, int expectedCode) throws Exception + { + ReturnResource resource = new ReturnResource(apiContext); + try + { + resource.resendReturnEmail( action); + } + 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, ""); + } + + public static com.mozu.api.contracts.commerceruntime.returns.Return deleteOrderItem(ApiContext apiContext, String returnId, String returnItemId, int expectedCode) throws Exception + { + com.mozu.api.contracts.commerceruntime.returns.Return returnObj = new com.mozu.api.contracts.commerceruntime.returns.Return(); + ReturnResource resource = new ReturnResource(apiContext); + try + { + returnObj = resource.deleteOrderItem( returnId, returnItemId); + } + 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 deleteReturn(ApiContext apiContext, String returnId, int expectedCode) throws Exception + { + ReturnResource resource = new ReturnResource(apiContext); + try + { + resource.deleteReturn( returnId); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SearchFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SearchFactory.java index 0914fbcf..6b56b5fd 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SearchFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SearchFactory.java @@ -1,76 +1,77 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.admin.SearchResource; - -/** - * The Search resource manages all settings and options for providing product search on your site. - * - */ -public class SearchFactory -{ - - public static com.mozu.api.contracts.productadmin.SearchSettings getSettings(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getSettings(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.SearchSettings getSettings(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.SearchSettings returnObj = new com.mozu.api.contracts.productadmin.SearchSettings(); - SearchResource resource = new SearchResource(apiContext); - try - { - returnObj = resource.getSettings( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.SearchSettings updateSettings(ApiContext apiContext, com.mozu.api.contracts.productadmin.SearchSettings settings, int expectedCode, int successCode) throws Exception - { - return updateSettings(apiContext, settings, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.SearchSettings updateSettings(ApiContext apiContext, com.mozu.api.contracts.productadmin.SearchSettings settings, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.SearchSettings returnObj = new com.mozu.api.contracts.productadmin.SearchSettings(); - SearchResource resource = new SearchResource(apiContext); - try - { - returnObj = resource.updateSettings( settings, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.admin.SearchResource; + +/** + * The Search resource manages all settings and options for providing product search on your site. + * + */ +public class SearchFactory +{ + + public static com.mozu.api.contracts.productadmin.SearchSettings getSettings(ApiContext apiContext, int expectedCode) throws Exception + { + return getSettings(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.SearchSettings getSettings(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.SearchSettings returnObj = new com.mozu.api.contracts.productadmin.SearchSettings(); + SearchResource resource = new SearchResource(apiContext); + try + { + returnObj = resource.getSettings( 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.productadmin.SearchSettings updateSettings(ApiContext apiContext, com.mozu.api.contracts.productadmin.SearchSettings settings, int expectedCode) throws Exception + { + return updateSettings(apiContext, settings, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.SearchSettings updateSettings(ApiContext apiContext, com.mozu.api.contracts.productadmin.SearchSettings settings, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.SearchSettings returnObj = new com.mozu.api.contracts.productadmin.SearchSettings(); + SearchResource resource = new SearchResource(apiContext); + try + { + returnObj = resource.updateSettings( settings, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ShipmentFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ShipmentFactory.java index fd50be31..e070a628 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ShipmentFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ShipmentFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ShipmentFactory { - public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShipment(ApiContext apiContext, String returnId, String shipmentId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShipment(ApiContext apiContext, String returnId, String shipmentId, int expectedCode) throws Exception { - return getShipment(apiContext, returnId, shipmentId, null, expectedCode, successCode ); + return getShipment(apiContext, returnId, shipmentId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShipment(ApiContext apiContext, String returnId, String shipmentId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShipment(ApiContext apiContext, String returnId, String shipmentId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.commerceruntime.fulfillment.Shipment returnObj = new com.mozu.api.contracts.commerceruntime.fulfillment.Shipment(); ShipmentResource resource = new ShipmentResource(apiContext); @@ -36,16 +37,16 @@ public static com.mozu.api.contracts.commerceruntime.fulfillment.Shipment getShi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List createPackageShipments(ApiContext apiContext, List packageIds, String returnId, int expectedCode, int successCode) throws Exception + public static List createPackageShipments(ApiContext apiContext, List packageIds, String returnId, int expectedCode) throws Exception { List returnObj = new ArrayList(); ShipmentResource resource = new ShipmentResource(apiContext); @@ -56,16 +57,16 @@ public static List c catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteShipment(ApiContext apiContext, String returnId, String shipmentId, int expectedCode, int successCode) throws Exception + public static void deleteShipment(ApiContext apiContext, String returnId, String shipmentId, int expectedCode) throws Exception { ShipmentResource resource = new ShipmentResource(apiContext); try @@ -75,12 +76,12 @@ public static void deleteShipment(ApiContext apiContext, String returnId, String catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ShippingFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ShippingFactory.java index fdeb76cb..2fd171f9 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ShippingFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ShippingFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class ShippingFactory { - public static com.mozu.api.contracts.shippingruntime.RatesResponse getRates(ApiContext apiContext, com.mozu.api.contracts.shippingruntime.RateRequest rateRequest, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.shippingruntime.RatesResponse getRates(ApiContext apiContext, com.mozu.api.contracts.shippingruntime.RateRequest rateRequest, int expectedCode) throws Exception { - return getRates(apiContext, rateRequest, null, expectedCode, successCode ); + return getRates(apiContext, rateRequest, null, expectedCode); } - public static com.mozu.api.contracts.shippingruntime.RatesResponse getRates(ApiContext apiContext, com.mozu.api.contracts.shippingruntime.RateRequest rateRequest, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.shippingruntime.RatesResponse getRates(ApiContext apiContext, com.mozu.api.contracts.shippingruntime.RateRequest rateRequest, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.shippingruntime.RatesResponse returnObj = new com.mozu.api.contracts.shippingruntime.RatesResponse(); ShippingResource resource = new ShippingResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.shippingruntime.RatesResponse getRates(ApiC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteDataFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteDataFactory.java index 2582bcd9..c756f09e 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteDataFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteDataFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class SiteDataFactory { - public static String getDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static String getDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode) throws Exception { - return getDBValue(apiContext, dbEntryQuery, null, expectedCode, successCode ); + return getDBValue(apiContext, dbEntryQuery, null, expectedCode); } - public static String getDBValue(ApiContext apiContext, String dbEntryQuery, String responseFields, int expectedCode, int successCode) throws Exception + public static String getDBValue(ApiContext apiContext, String dbEntryQuery, String responseFields, int expectedCode) throws Exception { String returnObj = new String(); SiteDataResource resource = new SiteDataResource(apiContext); @@ -36,16 +37,16 @@ public static String getDBValue(ApiContext apiContext, String dbEntryQuery, Stri catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 createDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void createDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode) throws Exception { SiteDataResource resource = new SiteDataResource(apiContext); try @@ -55,15 +56,15 @@ public static void createDBValue(ApiContext apiContext, String value, String dbE catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void updateDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void updateDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode) throws Exception { SiteDataResource resource = new SiteDataResource(apiContext); try @@ -73,15 +74,15 @@ public static void updateDBValue(ApiContext apiContext, String value, String dbE catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode) throws Exception { SiteDataResource resource = new SiteDataResource(apiContext); try @@ -91,12 +92,12 @@ public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteShippingHandlingFeeFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteShippingHandlingFeeFactory.java index 1d7a14c6..263d2bb1 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteShippingHandlingFeeFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteShippingHandlingFeeFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class SiteShippingHandlingFeeFactory { - public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee getOrderHandlingFee(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee getOrderHandlingFee(ApiContext apiContext, int expectedCode) throws Exception { - return getOrderHandlingFee(apiContext, null, expectedCode, successCode ); + return getOrderHandlingFee(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee getOrderHandlingFee(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee getOrderHandlingFee(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee returnObj = new com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee(); SiteShippingHandlingFeeResource resource = new SiteShippingHandlingFeeResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingF catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.sitesettings.shipping.SiteShippingHandlingFee createOrderHandlingFee(ApiContext apiContext, com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee createOrderHandlingFee(ApiContext apiContext, com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, int expectedCode) throws Exception { - return createOrderHandlingFee(apiContext, orderHandlingFee, null, expectedCode, successCode ); + return createOrderHandlingFee(apiContext, orderHandlingFee, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee createOrderHandlingFee(ApiContext apiContext, com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee createOrderHandlingFee(ApiContext apiContext, com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee returnObj = new com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee(); SiteShippingHandlingFeeResource resource = new SiteShippingHandlingFeeResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingF catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.sitesettings.shipping.SiteShippingHandlingFee updateOrderHandlingFee(ApiContext apiContext, com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee updateOrderHandlingFee(ApiContext apiContext, com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, int expectedCode) throws Exception { - return updateOrderHandlingFee(apiContext, orderHandlingFee, null, expectedCode, successCode ); + return updateOrderHandlingFee(apiContext, orderHandlingFee, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee updateOrderHandlingFee(ApiContext apiContext, com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee updateOrderHandlingFee(ApiContext apiContext, com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee orderHandlingFee, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee returnObj = new com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingFee(); SiteShippingHandlingFeeResource resource = new SiteShippingHandlingFeeResource(apiContext); @@ -86,12 +87,12 @@ public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingHandlingF catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteShippingSettingsFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteShippingSettingsFactory.java index db3a4091..31221e9a 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteShippingSettingsFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SiteShippingSettingsFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class SiteShippingSettingsFactory { - public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingSettings getSiteShippingSettings(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingSettings getSiteShippingSettings(ApiContext apiContext, int expectedCode) throws Exception { - return getSiteShippingSettings(apiContext, null, expectedCode, successCode ); + return getSiteShippingSettings(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingSettings getSiteShippingSettings(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingSettings getSiteShippingSettings(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.shipping.SiteShippingSettings returnObj = new com.mozu.api.contracts.sitesettings.shipping.SiteShippingSettings(); SiteShippingSettingsResource resource = new SiteShippingSettingsResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.sitesettings.shipping.SiteShippingSettings catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SoftAllocationFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SoftAllocationFactory.java index 37f85da4..0ddf70b0 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SoftAllocationFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SoftAllocationFactory.java @@ -1,174 +1,175 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.commerce.catalog.admin.SoftAllocationResource; - -/** - * - * - */ -public class SoftAllocationFactory -{ - - public static com.mozu.api.contracts.productadmin.SoftAllocationCollection getSoftAllocations(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getSoftAllocations(apiContext, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.SoftAllocationCollection getSoftAllocations(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.SoftAllocationCollection returnObj = new com.mozu.api.contracts.productadmin.SoftAllocationCollection(); - SoftAllocationResource resource = new SoftAllocationResource(apiContext); - try - { - returnObj = resource.getSoftAllocations( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.productadmin.SoftAllocation getSoftAllocation(ApiContext apiContext, Integer softAllocationId, int expectedCode, int successCode) throws Exception - { - return getSoftAllocation(apiContext, softAllocationId, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.productadmin.SoftAllocation getSoftAllocation(ApiContext apiContext, Integer softAllocationId, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.productadmin.SoftAllocation returnObj = new com.mozu.api.contracts.productadmin.SoftAllocation(); - SoftAllocationResource resource = new SoftAllocationResource(apiContext); - try - { - returnObj = resource.getSoftAllocation( softAllocationId, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List addSoftAllocations(ApiContext apiContext, List softAllocationsIn, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - SoftAllocationResource resource = new SoftAllocationResource(apiContext); - try - { - returnObj = resource.addSoftAllocations( softAllocationsIn); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List convertToProductReservation(ApiContext apiContext, List softAllocations, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - SoftAllocationResource resource = new SoftAllocationResource(apiContext); - try - { - returnObj = resource.convertToProductReservation( softAllocations); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List renewSoftAllocations(ApiContext apiContext, com.mozu.api.contracts.productadmin.SoftAllocationRenew softAllocationRenew, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - SoftAllocationResource resource = new SoftAllocationResource(apiContext); - try - { - returnObj = resource.renewSoftAllocations( softAllocationRenew); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static List updateSoftAllocations(ApiContext apiContext, List softAllocations, int expectedCode, int successCode) throws Exception - { - List returnObj = new ArrayList(); - SoftAllocationResource resource = new SoftAllocationResource(apiContext); - try - { - returnObj = resource.updateSoftAllocations( softAllocations); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static void deleteSoftAllocation(ApiContext apiContext, Integer softAllocationId, int expectedCode, int successCode) throws Exception - { - SoftAllocationResource resource = new SoftAllocationResource(apiContext); - try - { - resource.deleteSoftAllocation( softAllocationId); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.commerce.catalog.admin.SoftAllocationResource; + +/** + * Allows you to temporarily hold a product from inventory while a shopper is filling out payment information. You create a product reservation when a shopper proceeds to check out and then release the reservation when the order process is complete. + * + */ +public class SoftAllocationFactory +{ + + public static com.mozu.api.contracts.productadmin.SoftAllocationCollection getSoftAllocations(ApiContext apiContext, int expectedCode) throws Exception + { + return getSoftAllocations(apiContext, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.SoftAllocationCollection getSoftAllocations(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.SoftAllocationCollection returnObj = new com.mozu.api.contracts.productadmin.SoftAllocationCollection(); + SoftAllocationResource resource = new SoftAllocationResource(apiContext); + try + { + returnObj = resource.getSoftAllocations( 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.productadmin.SoftAllocation getSoftAllocation(ApiContext apiContext, Integer softAllocationId, int expectedCode) throws Exception + { + return getSoftAllocation(apiContext, softAllocationId, null, expectedCode); + } + + public static com.mozu.api.contracts.productadmin.SoftAllocation getSoftAllocation(ApiContext apiContext, Integer softAllocationId, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.productadmin.SoftAllocation returnObj = new com.mozu.api.contracts.productadmin.SoftAllocation(); + SoftAllocationResource resource = new SoftAllocationResource(apiContext); + try + { + returnObj = resource.getSoftAllocation( softAllocationId, 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 List addSoftAllocations(ApiContext apiContext, List softAllocationsIn, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + SoftAllocationResource resource = new SoftAllocationResource(apiContext); + try + { + returnObj = resource.addSoftAllocations( softAllocationsIn); + } + 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 List convertToProductReservation(ApiContext apiContext, List softAllocations, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + SoftAllocationResource resource = new SoftAllocationResource(apiContext); + try + { + returnObj = resource.convertToProductReservation( softAllocations); + } + 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 List renewSoftAllocations(ApiContext apiContext, com.mozu.api.contracts.productadmin.SoftAllocationRenew softAllocationRenew, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + SoftAllocationResource resource = new SoftAllocationResource(apiContext); + try + { + returnObj = resource.renewSoftAllocations( softAllocationRenew); + } + 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 List updateSoftAllocations(ApiContext apiContext, List softAllocations, int expectedCode) throws Exception + { + List returnObj = new ArrayList(); + SoftAllocationResource resource = new SoftAllocationResource(apiContext); + try + { + returnObj = resource.updateSoftAllocations( softAllocations); + } + 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 deleteSoftAllocation(ApiContext apiContext, Integer softAllocationId, int expectedCode) throws Exception + { + SoftAllocationResource resource = new SoftAllocationResource(apiContext); + try + { + resource.deleteSoftAllocation( softAllocationId); + } + 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, ""); + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/StorefrontCategoryFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/StorefrontCategoryFactory.java index 380d35b9..2e1a46cb 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/StorefrontCategoryFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/StorefrontCategoryFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class StorefrontCategoryFactory { - public static com.mozu.api.contracts.productruntime.CategoryPagedCollection getCategories(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productruntime.CategoryPagedCollection getCategories(ApiContext apiContext, int expectedCode) throws Exception { - return getCategories(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getCategories(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.productruntime.CategoryPagedCollection getCategories(ApiContext apiContext, String filter, Integer startIndex, Integer pageSize, String sortBy, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productruntime.CategoryPagedCollection getCategories(ApiContext apiContext, String filter, Integer startIndex, Integer pageSize, String sortBy, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productruntime.CategoryPagedCollection returnObj = new com.mozu.api.contracts.productruntime.CategoryPagedCollection(); CategoryResource resource = new CategoryResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.productruntime.CategoryPagedCollection getC catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productruntime.Category getCategory(ApiContext apiContext, Integer categoryId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productruntime.Category getCategory(ApiContext apiContext, Integer categoryId, int expectedCode) throws Exception { - return getCategory(apiContext, categoryId, null, null, expectedCode, successCode ); + return getCategory(apiContext, categoryId, null, null, expectedCode); } - public static com.mozu.api.contracts.productruntime.Category getCategory(ApiContext apiContext, Integer categoryId, Boolean allowInactive, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productruntime.Category getCategory(ApiContext apiContext, Integer categoryId, Boolean allowInactive, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productruntime.Category returnObj = new com.mozu.api.contracts.productruntime.Category(); CategoryResource resource = new CategoryResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.productruntime.Category getCategory(ApiCont catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.productruntime.CategoryCollection getCategoryTree(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productruntime.CategoryCollection getCategoryTree(ApiContext apiContext, int expectedCode) throws Exception { - return getCategoryTree(apiContext, null, expectedCode, successCode ); + return getCategoryTree(apiContext, null, expectedCode); } - public static com.mozu.api.contracts.productruntime.CategoryCollection getCategoryTree(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.productruntime.CategoryCollection getCategoryTree(ApiContext apiContext, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.productruntime.CategoryCollection returnObj = new com.mozu.api.contracts.productruntime.CategoryCollection(); CategoryResource resource = new CategoryResource(apiContext); @@ -86,12 +87,12 @@ public static com.mozu.api.contracts.productruntime.CategoryCollection getCatego catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SubscriptionFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SubscriptionFactory.java index 3ca9e8ae..307e533e 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SubscriptionFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/SubscriptionFactory.java @@ -1,51 +1,52 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.event.push.SubscriptionResource; - -/** - * The Subscriptions resource triggers a push service to sent immediate notifications to the subscribed tenants and applications when triggers. The resource sends messages regarding a subscription event tha occurs in the tenant or site. - * - */ -public class SubscriptionFactory -{ - - public static com.mozu.api.contracts.event.SubscriptionCollection getSubscriptions(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getSubscriptions(apiContext, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.event.SubscriptionCollection getSubscriptions(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.event.SubscriptionCollection returnObj = new com.mozu.api.contracts.event.SubscriptionCollection(); - SubscriptionResource resource = new SubscriptionResource(apiContext); - try - { - returnObj = resource.getSubscriptions( 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 != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.event.push.SubscriptionResource; + +/** + * The Subscriptions resource triggers a push service to sent immediate notifications to the subscribed tenants and applications when triggers. The resource sends messages regarding a subscription event tha occurs in the tenant or site. + * + */ +public class SubscriptionFactory +{ + + public static com.mozu.api.contracts.event.SubscriptionCollection getSubscriptions(ApiContext apiContext, int expectedCode) throws Exception + { + return getSubscriptions(apiContext, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.event.SubscriptionCollection getSubscriptions(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.event.SubscriptionCollection returnObj = new com.mozu.api.contracts.event.SubscriptionCollection(); + SubscriptionResource resource = new SubscriptionResource(apiContext); + try + { + returnObj = resource.getSubscriptions( 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TaxableTerritoryFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TaxableTerritoryFactory.java index dd6d7a2b..d98199e8 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TaxableTerritoryFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TaxableTerritoryFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class TaxableTerritoryFactory { - public static List getTaxableTerritories(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static List getTaxableTerritories(ApiContext apiContext, int expectedCode) throws Exception { List returnObj = new ArrayList(); TaxableTerritoryResource resource = new TaxableTerritoryResource(apiContext); @@ -31,21 +32,21 @@ public static List catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.sitesettings.general.TaxableTerritory addTaxableTerritory(ApiContext apiContext, com.mozu.api.contracts.sitesettings.general.TaxableTerritory taxableTerritory, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.general.TaxableTerritory addTaxableTerritory(ApiContext apiContext, com.mozu.api.contracts.sitesettings.general.TaxableTerritory taxableTerritory, int expectedCode) throws Exception { - return addTaxableTerritory(apiContext, taxableTerritory, null, expectedCode, successCode ); + return addTaxableTerritory(apiContext, taxableTerritory, null, expectedCode); } - public static com.mozu.api.contracts.sitesettings.general.TaxableTerritory addTaxableTerritory(ApiContext apiContext, com.mozu.api.contracts.sitesettings.general.TaxableTerritory taxableTerritory, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.sitesettings.general.TaxableTerritory addTaxableTerritory(ApiContext apiContext, com.mozu.api.contracts.sitesettings.general.TaxableTerritory taxableTerritory, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.sitesettings.general.TaxableTerritory returnObj = new com.mozu.api.contracts.sitesettings.general.TaxableTerritory(); TaxableTerritoryResource resource = new TaxableTerritoryResource(apiContext); @@ -56,16 +57,16 @@ public static com.mozu.api.contracts.sitesettings.general.TaxableTerritory addTa catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 List updateTaxableTerritories(ApiContext apiContext, List taxableterritories, int expectedCode, int successCode) throws Exception + public static List updateTaxableTerritories(ApiContext apiContext, List taxableterritories, int expectedCode) throws Exception { List returnObj = new ArrayList(); TaxableTerritoryResource resource = new TaxableTerritoryResource(apiContext); @@ -76,12 +77,12 @@ public static List catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantAdminUserAuthTicketFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantAdminUserAuthTicketFactory.java index 7e18a21d..527ebde7 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantAdminUserAuthTicketFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantAdminUserAuthTicketFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class TenantAdminUserAuthTicketFactory { - public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket createUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.core.UserAuthInfo userAuthInfo, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket createUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.core.UserAuthInfo userAuthInfo, int expectedCode) throws Exception { - return createUserAuthTicket(apiContext, userAuthInfo, null, null, expectedCode, successCode ); + return createUserAuthTicket(apiContext, userAuthInfo, null, null, expectedCode); } - public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket createUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.core.UserAuthInfo userAuthInfo, Integer tenantId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket createUserAuthTicket(ApiContext apiContext, com.mozu.api.contracts.core.UserAuthInfo userAuthInfo, Integer tenantId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket returnObj = new com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket(); TenantAdminUserAuthTicketResource resource = new TenantAdminUserAuthTicketResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket createU catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.adminuser.TenantAdminUserAuthTicket refreshAuthTicket(ApiContext apiContext, com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket existingAuthTicket, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket refreshAuthTicket(ApiContext apiContext, com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket existingAuthTicket, int expectedCode) throws Exception { - return refreshAuthTicket(apiContext, existingAuthTicket, null, null, expectedCode, successCode ); + return refreshAuthTicket(apiContext, existingAuthTicket, null, null, expectedCode); } - public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket refreshAuthTicket(ApiContext apiContext, com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket existingAuthTicket, Integer tenantId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket refreshAuthTicket(ApiContext apiContext, com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket existingAuthTicket, Integer tenantId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket returnObj = new com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket(); TenantAdminUserAuthTicketResource resource = new TenantAdminUserAuthTicketResource(apiContext); @@ -61,16 +62,16 @@ public static com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket refresh catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 deleteUserAuthTicket(ApiContext apiContext, String refreshToken, int expectedCode, int successCode) throws Exception + public static void deleteUserAuthTicket(ApiContext apiContext, String refreshToken, int expectedCode) throws Exception { TenantAdminUserAuthTicketResource resource = new TenantAdminUserAuthTicketResource(apiContext); try @@ -80,12 +81,12 @@ public static void deleteUserAuthTicket(ApiContext apiContext, String refreshTok catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantDataFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantDataFactory.java index 9fc222fc..37ca3c65 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantDataFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantDataFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class TenantDataFactory { - public static String getDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static String getDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode) throws Exception { - return getDBValue(apiContext, dbEntryQuery, null, expectedCode, successCode ); + return getDBValue(apiContext, dbEntryQuery, null, expectedCode); } - public static String getDBValue(ApiContext apiContext, String dbEntryQuery, String responseFields, int expectedCode, int successCode) throws Exception + public static String getDBValue(ApiContext apiContext, String dbEntryQuery, String responseFields, int expectedCode) throws Exception { String returnObj = new String(); TenantDataResource resource = new TenantDataResource(apiContext); @@ -36,16 +37,16 @@ public static String getDBValue(ApiContext apiContext, String dbEntryQuery, Stri catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 createDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void createDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode) throws Exception { TenantDataResource resource = new TenantDataResource(apiContext); try @@ -55,15 +56,15 @@ public static void createDBValue(ApiContext apiContext, String value, String dbE catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void updateDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void updateDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode) throws Exception { TenantDataResource resource = new TenantDataResource(apiContext); try @@ -73,15 +74,15 @@ public static void updateDBValue(ApiContext apiContext, String value, String dbE catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode) throws Exception { TenantDataResource resource = new TenantDataResource(apiContext); try @@ -91,12 +92,12 @@ public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantExtensionsFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantExtensionsFactory.java index a9d0543b..53956ff1 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantExtensionsFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantExtensionsFactory.java @@ -1,76 +1,77 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.platform.TenantExtensionsResource; - -/** - * - * - */ -public class TenantExtensionsFactory -{ - - public static com.mozu.api.contracts.installedapplications.TenantExtensions getExtensions(ApiContext apiContext, int expectedCode, int successCode) throws Exception - { - return getExtensions(apiContext, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.installedapplications.TenantExtensions getExtensions(ApiContext apiContext, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.installedapplications.TenantExtensions returnObj = new com.mozu.api.contracts.installedapplications.TenantExtensions(); - TenantExtensionsResource resource = new TenantExtensionsResource(apiContext); - try - { - returnObj = resource.getExtensions( responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - - public static com.mozu.api.contracts.installedapplications.TenantExtensions updateExtensions(ApiContext apiContext, com.mozu.api.contracts.installedapplications.TenantExtensions extensions, int expectedCode, int successCode) throws Exception - { - return updateExtensions(apiContext, extensions, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.installedapplications.TenantExtensions updateExtensions(ApiContext apiContext, com.mozu.api.contracts.installedapplications.TenantExtensions extensions, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.installedapplications.TenantExtensions returnObj = new com.mozu.api.contracts.installedapplications.TenantExtensions(); - TenantExtensionsResource resource = new TenantExtensionsResource(apiContext); - try - { - returnObj = resource.updateExtensions( extensions, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.platform.TenantExtensionsResource; + +/** + * platform/extensions related resources. DOCUMENT_HERE + * + */ +public class TenantExtensionsFactory +{ + + public static com.mozu.api.contracts.installedapplications.TenantExtensions getExtensions(ApiContext apiContext, int expectedCode) throws Exception + { + return getExtensions(apiContext, null, expectedCode); + } + + public static com.mozu.api.contracts.installedapplications.TenantExtensions getExtensions(ApiContext apiContext, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.installedapplications.TenantExtensions returnObj = new com.mozu.api.contracts.installedapplications.TenantExtensions(); + TenantExtensionsResource resource = new TenantExtensionsResource(apiContext); + try + { + returnObj = resource.getExtensions( 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.installedapplications.TenantExtensions updateExtensions(ApiContext apiContext, com.mozu.api.contracts.installedapplications.TenantExtensions extensions, int expectedCode) throws Exception + { + return updateExtensions(apiContext, extensions, null, expectedCode); + } + + public static com.mozu.api.contracts.installedapplications.TenantExtensions updateExtensions(ApiContext apiContext, com.mozu.api.contracts.installedapplications.TenantExtensions extensions, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.installedapplications.TenantExtensions returnObj = new com.mozu.api.contracts.installedapplications.TenantExtensions(); + TenantExtensionsResource resource = new TenantExtensionsResource(apiContext); + try + { + returnObj = resource.updateExtensions( extensions, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantFactory.java index 88a2f88f..cba62246 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TenantFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class TenantFactory { - public static com.mozu.api.contracts.tenant.Tenant getTenant(ApiContext apiContext, Integer tenantId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.tenant.Tenant getTenant(ApiContext apiContext, Integer tenantId, int expectedCode) throws Exception { - return getTenant(apiContext, tenantId, null, expectedCode, successCode ); + return getTenant(apiContext, tenantId, null, expectedCode); } - public static com.mozu.api.contracts.tenant.Tenant getTenant(ApiContext apiContext, Integer tenantId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.tenant.Tenant getTenant(ApiContext apiContext, Integer tenantId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.tenant.Tenant returnObj = new com.mozu.api.contracts.tenant.Tenant(); TenantResource resource = new TenantResource(apiContext); @@ -36,12 +37,12 @@ public static com.mozu.api.contracts.tenant.Tenant getTenant(ApiContext apiConte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TransactionFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TransactionFactory.java index 67324aaf..5aef4b4b 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TransactionFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/TransactionFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,7 +21,7 @@ public class TransactionFactory { - public static List getTransactions(ApiContext apiContext, Integer accountId, int expectedCode, int successCode) throws Exception + public static List getTransactions(ApiContext apiContext, Integer accountId, int expectedCode) throws Exception { List returnObj = new ArrayList(); TransactionResource resource = new TransactionResource(apiContext); @@ -31,21 +32,21 @@ public static List getTransactions( catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.Transaction addTransaction(ApiContext apiContext, com.mozu.api.contracts.customer.Transaction transaction, Integer accountId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Transaction addTransaction(ApiContext apiContext, com.mozu.api.contracts.customer.Transaction transaction, Integer accountId, int expectedCode) throws Exception { - return addTransaction(apiContext, transaction, accountId, null, expectedCode, successCode ); + return addTransaction(apiContext, transaction, accountId, null, expectedCode); } - public static com.mozu.api.contracts.customer.Transaction addTransaction(ApiContext apiContext, com.mozu.api.contracts.customer.Transaction transaction, Integer accountId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Transaction addTransaction(ApiContext apiContext, com.mozu.api.contracts.customer.Transaction transaction, Integer accountId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.Transaction returnObj = new com.mozu.api.contracts.customer.Transaction(); TransactionResource resource = new TransactionResource(apiContext); @@ -56,16 +57,16 @@ public static com.mozu.api.contracts.customer.Transaction addTransaction(ApiCont catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 removeTransaction(ApiContext apiContext, Integer accountId, String transactionId, int expectedCode, int successCode) throws Exception + public static void removeTransaction(ApiContext apiContext, Integer accountId, String transactionId, int expectedCode) throws Exception { TransactionResource resource = new TransactionResource(apiContext); try @@ -75,12 +76,12 @@ public static void removeTransaction(ApiContext apiContext, Integer accountId, S catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/UserDataFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/UserDataFactory.java index ff91f8fb..a20fc064 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/UserDataFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/UserDataFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class UserDataFactory { - public static String getDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static String getDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode) throws Exception { - return getDBValue(apiContext, dbEntryQuery, null, expectedCode, successCode ); + return getDBValue(apiContext, dbEntryQuery, null, expectedCode); } - public static String getDBValue(ApiContext apiContext, String dbEntryQuery, String responseFields, int expectedCode, int successCode) throws Exception + public static String getDBValue(ApiContext apiContext, String dbEntryQuery, String responseFields, int expectedCode) throws Exception { String returnObj = new String(); UserDataResource resource = new UserDataResource(apiContext); @@ -36,16 +37,16 @@ public static String getDBValue(ApiContext apiContext, String dbEntryQuery, Stri catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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 createDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void createDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode) throws Exception { UserDataResource resource = new UserDataResource(apiContext); try @@ -55,15 +56,15 @@ public static void createDBValue(ApiContext apiContext, String value, String dbE catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void updateDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void updateDBValue(ApiContext apiContext, String value, String dbEntryQuery, int expectedCode) throws Exception { UserDataResource resource = new UserDataResource(apiContext); try @@ -73,15 +74,15 @@ public static void updateDBValue(ApiContext apiContext, String value, String dbE catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } - public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode, int successCode) throws Exception + public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int expectedCode) throws Exception { UserDataResource resource = new UserDataResource(apiContext); try @@ -91,12 +92,12 @@ public static void deleteDBValue(ApiContext apiContext, String dbEntryQuery, int catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ViewFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ViewFactory.java index 00b32dce..ad9fd9c7 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ViewFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/ViewFactory.java @@ -1,51 +1,52 @@ -/** - * 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.ArrayList; -import com.mozu.api.ApiException; -import com.mozu.api.ApiContext; -import com.mozu.test.framework.core.TestFailException; -import com.mozu.api.resources.content.documentlists.ViewResource; - -/** - * Properties and content for views within a site/tenant. Views provide the schema, formatting, and associated content and entities for displaying content within a site/tenant. - * - */ -public class ViewFactory -{ - - public static com.mozu.api.contracts.content.DocumentCollection getViewDocuments(ApiContext apiContext, String documentListName, String viewName, int expectedCode, int successCode) throws Exception - { - return getViewDocuments(apiContext, documentListName, viewName, null, null, null, null, null, expectedCode, successCode ); - } - - public static com.mozu.api.contracts.content.DocumentCollection getViewDocuments(ApiContext apiContext, String documentListName, String viewName, String filter, String sortBy, Integer pageSize, Integer startIndex, String responseFields, int expectedCode, int successCode) throws Exception - { - com.mozu.api.contracts.content.DocumentCollection returnObj = new com.mozu.api.contracts.content.DocumentCollection(); - ViewResource resource = new ViewResource(apiContext); - try - { - returnObj = resource.getViewDocuments( documentListName, viewName, filter, sortBy, pageSize, startIndex, responseFields); - } - catch (ApiException e) - { - if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - else - return null; - } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); - return returnObj; - } - -} - - - +/** + * 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.ArrayList; +import org.apache.http.HttpStatus; +import com.mozu.api.ApiException; +import com.mozu.api.ApiContext; +import com.mozu.test.framework.core.TestFailException; +import com.mozu.api.resources.content.documentlists.ViewResource; + +/** + * Properties and content for views within a site/tenant. Views provide the schema, formatting, and associated content and entities for displaying content within a site/tenant. + * + */ +public class ViewFactory +{ + + public static com.mozu.api.contracts.content.DocumentCollection getViewDocuments(ApiContext apiContext, String documentListName, String viewName, int expectedCode) throws Exception + { + return getViewDocuments(apiContext, documentListName, viewName, null, null, null, null, null, expectedCode); + } + + public static com.mozu.api.contracts.content.DocumentCollection getViewDocuments(ApiContext apiContext, String documentListName, String viewName, String filter, String sortBy, Integer pageSize, Integer startIndex, String responseFields, int expectedCode) throws Exception + { + com.mozu.api.contracts.content.DocumentCollection returnObj = new com.mozu.api.contracts.content.DocumentCollection(); + ViewResource resource = new ViewResource(apiContext); + try + { + returnObj = resource.getViewDocuments( documentListName, viewName, filter, sortBy, pageSize, startIndex, 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; + } + +} + + + diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/VisitFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/VisitFactory.java index e335b80c..d52cf243 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/VisitFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/VisitFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class VisitFactory { - public static com.mozu.api.contracts.customer.VisitCollection getVisits(ApiContext apiContext, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.VisitCollection getVisits(ApiContext apiContext, int expectedCode) throws Exception { - return getVisits(apiContext, null, null, null, null, null, expectedCode, successCode ); + return getVisits(apiContext, null, null, null, null, null, expectedCode); } - public static com.mozu.api.contracts.customer.VisitCollection getVisits(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.VisitCollection getVisits(ApiContext apiContext, Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.VisitCollection returnObj = new com.mozu.api.contracts.customer.VisitCollection(); VisitResource resource = new VisitResource(apiContext); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.customer.VisitCollection getVisits(ApiConte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.Visit getVisit(ApiContext apiContext, String visitId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Visit getVisit(ApiContext apiContext, String visitId, int expectedCode) throws Exception { - return getVisit(apiContext, visitId, null, expectedCode, successCode ); + return getVisit(apiContext, visitId, null, expectedCode); } - public static com.mozu.api.contracts.customer.Visit getVisit(ApiContext apiContext, String visitId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Visit getVisit(ApiContext apiContext, String visitId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.Visit returnObj = new com.mozu.api.contracts.customer.Visit(); VisitResource resource = new VisitResource(apiContext); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.customer.Visit getVisit(ApiContext apiConte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.Visit addVisit(ApiContext apiContext, com.mozu.api.contracts.customer.Visit visit, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Visit addVisit(ApiContext apiContext, com.mozu.api.contracts.customer.Visit visit, int expectedCode) throws Exception { - return addVisit(apiContext, visit, null, expectedCode, successCode ); + return addVisit(apiContext, visit, null, expectedCode); } - public static com.mozu.api.contracts.customer.Visit addVisit(ApiContext apiContext, com.mozu.api.contracts.customer.Visit visit, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Visit addVisit(ApiContext apiContext, com.mozu.api.contracts.customer.Visit visit, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.Visit returnObj = new com.mozu.api.contracts.customer.Visit(); VisitResource resource = new VisitResource(apiContext); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.customer.Visit addVisit(ApiContext apiConte catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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.customer.Visit updateVisit(ApiContext apiContext, com.mozu.api.contracts.customer.Visit visit, String visitId, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Visit updateVisit(ApiContext apiContext, com.mozu.api.contracts.customer.Visit visit, String visitId, int expectedCode) throws Exception { - return updateVisit(apiContext, visit, visitId, null, expectedCode, successCode ); + return updateVisit(apiContext, visit, visitId, null, expectedCode); } - public static com.mozu.api.contracts.customer.Visit updateVisit(ApiContext apiContext, com.mozu.api.contracts.customer.Visit visit, String visitId, String responseFields, int expectedCode, int successCode) throws Exception + public static com.mozu.api.contracts.customer.Visit updateVisit(ApiContext apiContext, com.mozu.api.contracts.customer.Visit visit, String visitId, String responseFields, int expectedCode) throws Exception { com.mozu.api.contracts.customer.Visit returnObj = new com.mozu.api.contracts.customer.Visit(); VisitResource resource = new VisitResource(apiContext); @@ -111,12 +112,12 @@ public static com.mozu.api.contracts.customer.Visit updateVisit(ApiContext apiCo catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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; } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/WishlistFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/WishlistFactory.java index 47959228..71595aa7 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/WishlistFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/WishlistFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class WishlistFactory { - public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistCollection getWishlists(ApiContext apiContext, int expectedCode, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistCollectio catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist getWishlist(ApiContext apiContext, String wishlistId, int expectedCode) throws Exception { - return getWishlist(apiContext, wishlistId, null, expectedCode, successCode ); + return getWishlist(apiContext, wishlistId, null, expectedCode); } - public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist getWishlist(ApiContext apiContext, String wishlistId, String responseFields, int expectedCode, int successCode) throws Exception + 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); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist getWishl catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist getWishl catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -111,21 +112,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist createWi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -136,16 +137,16 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist updateWi catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + public static void deleteWishlist(ApiContext apiContext, String wishlistId, int expectedCode) throws Exception { WishlistResource resource = new WishlistResource(apiContext); try @@ -155,12 +156,12 @@ public static void deleteWishlist(ApiContext apiContext, String wishlistId, int catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/WishlistItemFactory.java b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/WishlistItemFactory.java index 4f59ffc9..b9ac4ab3 100644 --- a/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/WishlistItemFactory.java +++ b/mozu-java-test/src/main/java/com/mozu/test/framework/datafactory/WishlistItemFactory.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.ArrayList; +import org.apache.http.HttpStatus; import com.mozu.api.ApiException; import com.mozu.api.ApiContext; import com.mozu.test.framework.core.TestFailException; @@ -20,12 +21,12 @@ public class WishlistItemFactory { - public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem getWishlistItem(ApiContext apiContext, String wishlistId, String wishlistItemId, int expectedCode, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -36,21 +37,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem getW catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -61,21 +62,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemColle catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -86,21 +87,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItemColle catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -111,21 +112,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem addI catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -136,21 +137,21 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem upda catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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, successCode ); + 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, int successCode) throws Exception + 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); @@ -161,16 +162,16 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.WishlistItem upda catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + 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); @@ -181,16 +182,16 @@ public static com.mozu.api.contracts.commerceruntime.wishlists.Wishlist removeAl catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return null; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + 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, int successCode) throws Exception + public static void deleteWishlistItem(ApiContext apiContext, String wishlistId, String wishlistItemId, int expectedCode) throws Exception { WishlistItemResource resource = new WishlistItemResource(apiContext); try @@ -200,12 +201,12 @@ public static void deleteWishlistItem(ApiContext apiContext, String wishlistId, catch (ApiException e) { if(e.getHttpStatusCode() != expectedCode) - throw new TestFailException(e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + throw new TestFailException("" + e.getHttpStatusCode(), Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); else return; } - if(expectedCode != successCode) - throw new TestFailException(successCode, Thread.currentThread().getStackTrace()[2].getMethodName(), expectedCode, ""); + if(expectedCode != 304 && !(expectedCode >= 200 && expectedCode <= 300)) + throw new TestFailException("304 or between 200 and 300", Thread.currentThread().getStackTrace()[2].getMethodName(), "" + expectedCode, ""); } } diff --git a/mozu-java-test/src/test/java/com/mozu/test/AddressValidateTests.java b/mozu-java-test/src/test/java/com/mozu/test/AddressValidateTests.java index 9f786885..b23711ec 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/AddressValidateTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/AddressValidateTests.java @@ -39,8 +39,8 @@ public void AddressValidationRequestsTests() throws Exception { ApiContext apiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); AddressValidationRequest request = new AddressValidationRequest(); request.setAddress(CustomerGenerator.generateAddress("ca")); - AddressValidationRequestFactory.validateAddress(apiContext, request, HttpStatus.SC_OK, HttpStatus.SC_OK); + AddressValidationRequestFactory.validateAddress(apiContext, request, HttpStatus.SC_OK); request.setAddress(CustomerGenerator.generateInvalidAddress()); - AddressValidationRequestFactory.validateAddress(apiContext, request, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + AddressValidationRequestFactory.validateAddress(apiContext, request, HttpStatus.SC_CONFLICT); } } diff --git a/mozu-java-test/src/test/java/com/mozu/test/CustomerTests.java b/mozu-java-test/src/test/java/com/mozu/test/CustomerTests.java index 1dd044aa..e4087dba 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/CustomerTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/CustomerTests.java @@ -43,8 +43,8 @@ public void tearDown() throws Exception { public void CreateCustomerTest1() throws Exception { ApiContext apiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); CustomerAccountAndAuthInfo customerAccountAndAuthInfo = CustomerGenerator.generateCustomerAccountAndAuthInfo(); - CustomerAuthTicket ticket = CustomerAccountFactory.addAccountAndLogin(apiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - CustomerAccount getAccount = CustomerAccountFactory.getAccount(apiContext, ticket.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAuthTicket ticket = CustomerAccountFactory.addAccountAndLogin(apiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED); + CustomerAccount getAccount = CustomerAccountFactory.getAccount(apiContext, ticket.getCustomerAccount().getId(), HttpStatus.SC_OK); assertEquals(getAccount.getEmailAddress(), customerAccountAndAuthInfo.getAccount().getEmailAddress()); } @@ -52,10 +52,10 @@ public void CreateCustomerTest1() throws Exception { public void UpdateCustomerTest1() throws Exception { ApiContext apiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); CustomerAccountAndAuthInfo customerAccountAndAuthInfo = CustomerGenerator.generateCustomerAccountAndAuthInfo(); - CustomerAuthTicket ticket = CustomerAccountFactory.addAccountAndLogin(apiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - CustomerAccount getAccount = CustomerAccountFactory.getAccount(apiContext, ticket.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAuthTicket ticket = CustomerAccountFactory.addAccountAndLogin(apiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED); + CustomerAccount getAccount = CustomerAccountFactory.getAccount(apiContext, ticket.getCustomerAccount().getId(), HttpStatus.SC_OK); getAccount.setEmailAddress(Generator.randomEmailAddress()); - CustomerAccount updateAccount = CustomerAccountFactory.updateAccount(apiContext, getAccount, ticket.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAccount updateAccount = CustomerAccountFactory.updateAccount(apiContext, getAccount, ticket.getCustomerAccount().getId(), HttpStatus.SC_OK); assertEquals(updateAccount.getEmailAddress(), getAccount.getEmailAddress()); } @@ -63,9 +63,9 @@ public void UpdateCustomerTest1() throws Exception { public void UpdateCustomerTest2() throws Exception { ApiContext apiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); //CustomerAccountFactory.getAccounts(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CustomerAccount getAccount = CustomerAccountFactory.getAccount(apiContext, 1384, HttpStatus.SC_OK, HttpStatus.SC_OK); - getAccount.setAcceptsMarketing(true); - CustomerAccount updateAccount = CustomerAccountFactory.updateAccount(apiContext, getAccount, 1384, HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAccount getAccount = CustomerAccountFactory.getAccount(apiContext, 1004, HttpStatus.SC_OK); + getAccount.setAcceptsMarketing(false); + CustomerAccount updateAccount = CustomerAccountFactory.updateAccount(apiContext, getAccount, 1004, HttpStatus.SC_OK); assert(!updateAccount.getAcceptsMarketing()); } } \ No newline at end of file diff --git a/mozu-java-test/src/test/java/com/mozu/test/DocumentResourceTests.java b/mozu-java-test/src/test/java/com/mozu/test/DocumentResourceTests.java index 35b187be..a5843896 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/DocumentResourceTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/DocumentResourceTests.java @@ -60,24 +60,24 @@ public void UpdateDocumentContentTest1() throws Exception { DocumentList list = com.mozu.test.framework.helper.DocumentGenerator.generateDocumentList(mozuNamespace, "QA"); DocumentList existing = null; try{ - existing = DocumentListFactory.getDocumentList(apiContext, DataViewMode.Live, list.getName()+"@"+list.getNamespace(), HttpStatus.SC_OK, HttpStatus.SC_OK); + existing = DocumentListFactory.getDocumentList(apiContext, DataViewMode.Live, list.getName()+"@"+list.getNamespace(), HttpStatus.SC_OK); } catch(Exception ae) { } if (existing == null) - list = DocumentListFactory.createDocumentList(apiContext, DataViewMode.Live, list, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + list = DocumentListFactory.createDocumentList(apiContext, DataViewMode.Live, list, HttpStatus.SC_CREATED); else list = existing; DocumentType type = com.mozu.test.framework.helper.DocumentGenerator.generateDocumentType(mozuNamespace, "QAText"); DocumentType existingType = null; try{ - existingType = DocumentTypeFactory.getDocumentType(apiContext, DataViewMode.Live, type.getName()+"@"+type.getNamespace(), HttpStatus.SC_OK, HttpStatus.SC_OK); + existingType = DocumentTypeFactory.getDocumentType(apiContext, DataViewMode.Live, type.getName()+"@"+type.getNamespace(), HttpStatus.SC_OK); } catch(Exception ae) { } if (existingType == null) - type = DocumentTypeFactory.createDocumentType(apiContext, DataViewMode.Live, type, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + type = DocumentTypeFactory.createDocumentType(apiContext, DataViewMode.Live, type, HttpStatus.SC_CREATED); else type = existingType; @@ -97,13 +97,13 @@ public void UpdateDocumentContentTest1() throws Exception { doc.setName(fileName); doc.setDocumentTypeFQN(type.getDocumentTypeFQN()); - Document newDoc = DocumentFactory.createDocument(apiContext, DataViewMode.Live, doc, list.getListFQN(), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Document newDoc = DocumentFactory.createDocument(apiContext, DataViewMode.Live, doc, list.getListFQN(), HttpStatus.SC_CREATED); FileInputStream inputStream = new FileInputStream(file); DocumentFactory.updateDocumentContent(apiContext, inputStream, list.getListFQN(), newDoc.getId(), - CONTENTTYPE, HttpStatus.SC_OK, HttpStatus.SC_OK); + CONTENTTYPE, HttpStatus.SC_OK); - Document docResponse = DocumentFactory.getDocument(apiContext, DataViewMode.Live, list.getListFQN(), newDoc.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Document docResponse = DocumentFactory.getDocument(apiContext, DataViewMode.Live, list.getListFQN(), newDoc.getId(), HttpStatus.SC_OK); assertEquals(CONTENTLENGTH, docResponse.getContentLength().intValue()); file.delete(); } diff --git a/mozu-java-test/src/test/java/com/mozu/test/EntityTests.java b/mozu-java-test/src/test/java/com/mozu/test/EntityTests.java index 246a3958..a5386a31 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/EntityTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/EntityTests.java @@ -71,14 +71,14 @@ public void EntityTest1() throws Exception { EntityList existing = null; String entityListName = list.getName(); try{ - existing = EntityListFactory.getEntityList(apiContext, entityListName, HttpStatus.SC_OK, HttpStatus.SC_OK); + existing = EntityListFactory.getEntityList(apiContext, entityListName, HttpStatus.SC_OK); } catch(Exception ae) { } if (existing==null) - EntityListFactory.createEntityList(apiContext, list, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + EntityListFactory.createEntityList(apiContext, list, HttpStatus.SC_CREATED); else - EntityListFactory.updateEntityList(apiContext, list, entityListName, HttpStatus.SC_OK, HttpStatus.SC_OK); + EntityListFactory.updateEntityList(apiContext, list, entityListName, HttpStatus.SC_OK); com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper(); MyClass sampleObject = new MyClass(); @@ -86,7 +86,7 @@ public void EntityTest1() throws Exception { sampleObject.setItem2(DateTime.now()); JsonNode json= mapper.valueToTree(sampleObject); String idMapName = entityListName + "@" + mozuNamespace; - EntityFactory.insertEntity(apiContext, json, idMapName, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + EntityFactory.insertEntity(apiContext, json, idMapName, HttpStatus.SC_BAD_REQUEST); } @Test @@ -97,14 +97,14 @@ public void EntityTest2() throws Exception { EntityList existing = null; String entityListName = list.getName(); try{ - existing = EntityListFactory.getEntityList(apiContext, entityListName, HttpStatus.SC_OK, HttpStatus.SC_OK); + existing = EntityListFactory.getEntityList(apiContext, entityListName, HttpStatus.SC_OK); } catch(Exception ae) { } if (existing==null) - EntityListFactory.createEntityList(apiContext, list, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + EntityListFactory.createEntityList(apiContext, list, HttpStatus.SC_CREATED); else - EntityListFactory.updateEntityList(apiContext, list, entityListName, HttpStatus.SC_OK, HttpStatus.SC_OK); + EntityListFactory.updateEntityList(apiContext, list, entityListName, HttpStatus.SC_OK); com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper(); mapper.registerModule(new JodaModule()); @@ -115,7 +115,7 @@ public void EntityTest2() throws Exception { sampleObject.setItem2(DateTime.now()); JsonNode json= mapper.valueToTree(sampleObject); String idMapName = entityListName + "@" + mozuNamespace; - EntityFactory.insertEntity(apiContext, json, idMapName, HttpStatus.SC_OK, HttpStatus.SC_OK); + EntityFactory.insertEntity(apiContext, json, idMapName, HttpStatus.SC_OK); } } \ No newline at end of file diff --git a/mozu-java-test/src/test/java/com/mozu/test/GeneralTests.java b/mozu-java-test/src/test/java/com/mozu/test/GeneralTests.java index 3d352de5..bbb02523 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/GeneralTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/GeneralTests.java @@ -128,18 +128,18 @@ public void setUp() throws Exception { apiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); shopperApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); CustomerAccountAndAuthInfo customerAccountAndAuthInfo = CustomerGenerator.generateCustomerAccountAndAuthInfo(true, "98-02565-0000"); - CustomerAccountFactory.addAccountAndLogin(apiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + CustomerAccountFactory.addAccountAndLogin(apiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED); CustomerUserAuthInfo shopperUserAuthInfo = CustomerGenerator.generateUserAuthInfo(customerAccountAndAuthInfo.getAccount().getUserName(), customerAccountAndAuthInfo.getPassword()); shopperAuth = CustomerAuthenticator.authenticate(shopperUserAuthInfo, tenantId, siteId); shopperApiContext.setUserAuthTicket(shopperAuth.getAuthTicket()); ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - MasterCatalog mc = MasterCatalogFactory.getMasterCatalog(localApiContext, masterCatalogId, HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalog mc = MasterCatalogFactory.getMasterCatalog(localApiContext, masterCatalogId, HttpStatus.SC_OK); if(mc.getProductPublishingMode().equalsIgnoreCase("pending")) { PublishingScope scope = ProductGenerator.generatePublishingScope(true, null); - PublishingScopeFactory.publishDrafts(localApiContext, DataViewMode.Pending, scope, HttpStatus.SC_OK, HttpStatus.SC_OK); + PublishingScopeFactory.publishDrafts(localApiContext, DataViewMode.Pending, scope, HttpStatus.SC_OK); mc.setProductPublishingMode("Live"); - MasterCatalogFactory.updateMasterCatalog(localApiContext, mc, masterCatalogId, HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalogFactory.updateMasterCatalog(localApiContext, mc, masterCatalogId, HttpStatus.SC_OK); } } @@ -149,132 +149,132 @@ public void tearDown() throws Exception { @Test public void AdjustmentTests() throws Exception { - AdjustmentFactory.applyAdjustment(apiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(10, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AdjustmentFactory.applyShippingAdjustment(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AdjustmentFactory.removeAdjustment(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AdjustmentFactory.removeShippingAdjustment(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + AdjustmentFactory.applyAdjustment(apiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(10, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), null, HttpStatus.SC_BAD_REQUEST); + AdjustmentFactory.applyShippingAdjustment(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + AdjustmentFactory.removeAdjustment(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + AdjustmentFactory.removeShippingAdjustment(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void AddressValidationRequestTests() throws Exception { AddressValidationRequest request = new AddressValidationRequest(); request.setAddress(CustomerGenerator.generateAddress("tx")); - AddressValidationRequestFactory.validateAddress(apiContext, request, HttpStatus.SC_OK, HttpStatus.SC_OK); + AddressValidationRequestFactory.validateAddress(apiContext, request, HttpStatus.SC_OK); } @Test public void AdminFacetTests() throws Exception { - AdminFacetFactory.getFacet(apiContext, Generator.randomInt(500, 600), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + AdminFacetFactory.getFacet(apiContext, Generator.randomInt(500, 600), HttpStatus.SC_NOT_FOUND); Facet facet = new Facet(); - AdminFacetFactory.deleteFacetById(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); - AdminFacetFactory.getFacetCategoryList(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_OK, HttpStatus.SC_OK); -/*bug 27015*/ AdminFacetFactory.addFacet(apiContext, facet, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AdminFacetFactory.updateFacet(apiContext, facet, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + AdminFacetFactory.deleteFacetById(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); + AdminFacetFactory.getFacetCategoryList(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_OK); +/*bug 27015*/ AdminFacetFactory.addFacet(apiContext, facet, HttpStatus.SC_CONFLICT); + AdminFacetFactory.updateFacet(apiContext, facet, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); } @Test public void AdminLocationInventoryTests() throws Exception { List list = new ArrayList(); list.add(new LocationInventory()); -/*bug 35021*/ AdminLocationInventoryFactory.addLocationInventory(apiContext, DataViewMode.Live, list, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AdminLocationInventoryFactory.deleteLocationInventory(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AdminLocationInventoryFactory.getLocationInventory(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AdminLocationInventoryFactory.getLocationInventories(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK, HttpStatus.SC_OK); +/*bug 35021*/ AdminLocationInventoryFactory.addLocationInventory(apiContext, DataViewMode.Live, list, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + AdminLocationInventoryFactory.deleteLocationInventory(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AdminLocationInventoryFactory.getLocationInventory(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AdminLocationInventoryFactory.getLocationInventories(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK); List list1 = new ArrayList(); LocationInventoryAdjustment adjust = new LocationInventoryAdjustment(); adjust.setProductCode(Generator.randomString(5, Generator.AlphaChars)); list1.add(adjust); - AdminLocationInventoryFactory.updateLocationInventory(apiContext, DataViewMode.Live, list1, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + AdminLocationInventoryFactory.updateLocationInventory(apiContext, DataViewMode.Live, list1, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void AdminProductTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - AdminProductFactory.getProduct(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AdminProductFactory.getProductInCatalog(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AdminProductFactory.getProductInCatalogs(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AdminProductFactory.getProduct(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AdminProductFactory.updateProduct(localApiContext, DataViewMode.Live, new Product(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AdminProductFactory.updateProductInCatalogs(localApiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AdminProductFactory.updateProductInCatalog(localApiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AdminProductFactory.deleteProductInCatalog(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AdminProductFactory.getProducts(localApiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); - AdminProductFactory.renameProductCodes(localApiContext, new ArrayList(), HttpStatus.SC_OK, HttpStatus.SC_OK); + AdminProductFactory.getProduct(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AdminProductFactory.getProductInCatalog(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_NOT_FOUND); + AdminProductFactory.getProductInCatalogs(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AdminProductFactory.getProduct(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AdminProductFactory.updateProduct(localApiContext, DataViewMode.Live, new Product(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AdminProductFactory.updateProductInCatalogs(localApiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + AdminProductFactory.updateProductInCatalog(localApiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_CONFLICT); + AdminProductFactory.deleteProductInCatalog(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_NOT_FOUND); + AdminProductFactory.getProducts(localApiContext, DataViewMode.Live, HttpStatus.SC_OK); + AdminProductFactory.renameProductCodes(localApiContext, new ArrayList(), HttpStatus.SC_OK); } @Test public void AdminUserTests() throws Exception { - TenantCollection tenants = AdminUserFactory.getTenantScopesForUser(apiContext, Generator.randomString(20, Generator.AlphaNumericChars), HttpStatus.SC_OK, HttpStatus.SC_OK); + TenantCollection tenants = AdminUserFactory.getTenantScopesForUser(apiContext, Generator.randomString(20, Generator.AlphaNumericChars), HttpStatus.SC_OK); assertEquals(tenants.getTotalCount(), new Integer(0)); - AdminUserFactory.getUser(apiContext, Generator.randomString(20, Generator.AlphaNumericChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + AdminUserFactory.getUser(apiContext, Generator.randomString(20, Generator.AlphaNumericChars), HttpStatus.SC_NOT_FOUND); } @Test public void ApplicationTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, null, null); - Application app = ApplicationFactory.thirdPartyGetApplication(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ApplicationFactory.thirdPartyUpdateApplication(localApiContext, app, HttpStatus.SC_OK, HttpStatus.SC_OK); + Application app = ApplicationFactory.thirdPartyGetApplication(localApiContext, HttpStatus.SC_OK); + ApplicationFactory.thirdPartyUpdateApplication(localApiContext, app, HttpStatus.SC_OK); } @Test public void AppliedDiscountTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, null, null); - AppliedDiscountFactory.removeCoupon(localApiContext, Generator.randomString(10, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_NO_CONTENT); - AppliedDiscountFactory.applyCoupon(localApiContext, Generator.randomString(10, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AppliedDiscountFactory.removeCoupons(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + AppliedDiscountFactory.removeCoupon(localApiContext, Generator.randomString(10, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + AppliedDiscountFactory.applyCoupon(localApiContext, Generator.randomString(10, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + AppliedDiscountFactory.removeCoupons(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void AttributeTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, null, null); - AttributeFactory.getAttribute(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AttributeFactory.getAttributes(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - AttributeFactory.getAttributeVocabularyValues(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + AttributeFactory.getAttribute(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributeFactory.getAttributes(localApiContext, HttpStatus.SC_OK); + AttributeFactory.getAttributeVocabularyValues(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void AttributedefinitionAttributeTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - AttributedefinitionAttributeFactory.addAttribute(localApiContext, new com.mozu.api.contracts.productadmin.Attribute(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AttributedefinitionAttributeFactory.deleteAttribute(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); - AttributedefinitionAttributeFactory.getAttribute(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AttributedefinitionAttributeFactory.getAttributes(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - AttributedefinitionAttributeFactory.updateAttribute(localApiContext, new com.mozu.api.contracts.productadmin.Attribute(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + AttributedefinitionAttributeFactory.addAttribute(localApiContext, new com.mozu.api.contracts.productadmin.Attribute(), HttpStatus.SC_CONFLICT); + AttributedefinitionAttributeFactory.deleteAttribute(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributedefinitionAttributeFactory.getAttribute(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributedefinitionAttributeFactory.getAttributes(localApiContext, HttpStatus.SC_OK); + AttributedefinitionAttributeFactory.updateAttribute(localApiContext, new com.mozu.api.contracts.productadmin.Attribute(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void AttributeLocalizedContentTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, null, null); - AttributeLocalizedContentFactory.addLocalizedContent(localApiContext, new AttributeLocalizedContent(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AttributeLocalizedContentFactory.deleteLocalizedContent(localApiContext, Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.LocaleCode, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AttributeLocalizedContentFactory.getAttributeLocalizedContent(localApiContext, Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.LocaleCode, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AttributeLocalizedContentFactory.getAttributeLocalizedContents(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AttributeLocalizedContentFactory.updateLocalizedContent(localApiContext, new AttributeLocalizedContent(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.LocaleCode, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - AttributeLocalizedContentFactory.updateLocalizedContents(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + AttributeLocalizedContentFactory.addLocalizedContent(localApiContext, new AttributeLocalizedContent(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + AttributeLocalizedContentFactory.deleteLocalizedContent(localApiContext, Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.LocaleCode, HttpStatus.SC_BAD_REQUEST); + AttributeLocalizedContentFactory.getAttributeLocalizedContent(localApiContext, Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.LocaleCode, HttpStatus.SC_BAD_REQUEST); + AttributeLocalizedContentFactory.getAttributeLocalizedContents(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + AttributeLocalizedContentFactory.updateLocalizedContent(localApiContext, new AttributeLocalizedContent(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.LocaleCode, HttpStatus.SC_BAD_REQUEST); + AttributeLocalizedContentFactory.updateLocalizedContents(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void AttributeTypeRuleTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - AttributeTypeRuleFactory.getAttributeTypeRules(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + AttributeTypeRuleFactory.getAttributeTypeRules(localApiContext, HttpStatus.SC_OK); } @Test public void AttributeVocabularyValueTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - AttributeVocabularyValueFactory.getAttributeVocabularyValues(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.addAttributeVocabularyValue(localApiContext, new AttributeVocabularyValue(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.deleteAttributeVocabularyValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); - AttributeVocabularyValueFactory.updateAttributeVocabularyValue(localApiContext, new AttributeVocabularyValue(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.getAttributeVocabularyValueLocalizedContent(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.LocaleCode, HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.getAttributeVocabularyValueLocalizedContents(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.updateAttributeVocabularyValues(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.updateAttributeVocabularyValueLocalizedContent(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.updateAttributeVocabularyValueLocalizedContents(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.deleteAttributeVocabularyValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.addAttributeVocabularyValue(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.deleteAttributeVocabularyValueLocalizedContent(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - AttributeVocabularyValueFactory.addAttributeVocabularyValueLocalizedContent(localApiContext, new AttributeVocabularyValueLocalizedContent(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + AttributeVocabularyValueFactory.getAttributeVocabularyValues(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributeVocabularyValueFactory.addAttributeVocabularyValue(localApiContext, new AttributeVocabularyValue(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + AttributeVocabularyValueFactory.deleteAttributeVocabularyValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributeVocabularyValueFactory.updateAttributeVocabularyValue(localApiContext, new AttributeVocabularyValue(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributeVocabularyValueFactory.getAttributeVocabularyValueLocalizedContent(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.LocaleCode, HttpStatus.SC_NOT_FOUND); + AttributeVocabularyValueFactory.getAttributeVocabularyValueLocalizedContents(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributeVocabularyValueFactory.updateAttributeVocabularyValues(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + AttributeVocabularyValueFactory.updateAttributeVocabularyValueLocalizedContent(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + AttributeVocabularyValueFactory.updateAttributeVocabularyValueLocalizedContents(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + AttributeVocabularyValueFactory.deleteAttributeVocabularyValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributeVocabularyValueFactory.addAttributeVocabularyValue(localApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + AttributeVocabularyValueFactory.deleteAttributeVocabularyValueLocalizedContent(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + AttributeVocabularyValueFactory.addAttributeVocabularyValueLocalizedContent(localApiContext, new AttributeVocabularyValueLocalizedContent(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test @@ -283,262 +283,262 @@ public void AuthTicketTests() throws Exception { AppAuthInfo info = new AppAuthInfo(); info.setApplicationId(Generator.randomString(10, Generator.AlphaChars)); info.setSharedSecret(Generator.randomString(10, Generator.AlphaChars)); - AuthTicketFactory.authenticateApp(localApiContext, info, HttpStatus.SC_UNAUTHORIZED, HttpStatus.SC_OK); - AuthTicketFactory.refreshAppAuthTicket(localApiContext, new AuthTicketRequest(), HttpStatus.SC_UNAUTHORIZED, HttpStatus.SC_OK); -/*bug 36445*/ AuthTicketFactory.deleteAppAuthTicket(localApiContext, Generator.randomString(10, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + AuthTicketFactory.authenticateApp(localApiContext, info, HttpStatus.SC_UNAUTHORIZED); + AuthTicketFactory.refreshAppAuthTicket(localApiContext, new AuthTicketRequest(), HttpStatus.SC_UNAUTHORIZED); +/*bug 36445*/ AuthTicketFactory.deleteAppAuthTicket(localApiContext, Generator.randomString(10, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void BillingInfoTests() throws Exception { - BillingInfoFactory.getBillingInfo(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - BillingInfoFactory.setBillingInfo(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + BillingInfoFactory.getBillingInfo(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + BillingInfoFactory.setBillingInfo(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void CardTests() throws Exception { - CardFactory.getAccountCards(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - CardFactory.addAccountCard(apiContext, null, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CardFactory.deleteAccountCard(apiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - CardFactory.updateAccountCard(apiContext, null, shopperAuth.getCustomerAccount().getId(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + CardFactory.getAccountCards(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK); + CardFactory.addAccountCard(apiContext, null, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST); + CardFactory.deleteAccountCard(apiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + CardFactory.updateAccountCard(apiContext, null, shopperAuth.getCustomerAccount().getId(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void CartItemTests() throws Exception { - CartItemFactory.getCartItems(shopperApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CartItemFactory.addItemToCart(shopperApiContext, new CartItem(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - CartItemFactory.removeAllCartItems(shopperApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CartItemFactory.updateCartItem(shopperApiContext, new CartItem(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CartItemFactory.updateCartItemQuantity(shopperApiContext, Generator.randomString(6, Generator.AlphaChars), 2, HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CartItemFactory.deleteCartItem(shopperApiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + CartItemFactory.getCartItems(shopperApiContext, HttpStatus.SC_OK); + CartItemFactory.addItemToCart(shopperApiContext, new CartItem(), HttpStatus.SC_CONFLICT); + CartItemFactory.removeAllCartItems(shopperApiContext, HttpStatus.SC_OK); + CartItemFactory.updateCartItem(shopperApiContext, new CartItem(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + CartItemFactory.updateCartItemQuantity(shopperApiContext, Generator.randomString(6, Generator.AlphaChars), 2, HttpStatus.SC_NOT_FOUND); + CartItemFactory.deleteCartItem(shopperApiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void CartTests() throws Exception { - Cart cart = CartFactory.getOrCreateCart(shopperApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CartFactory.deleteCart(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CartFactory.getOrCreateCart(shopperApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CartFactory.getCartSummary(shopperApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CartFactory.getUserCart(apiContext, shopperAuth.getCustomerAccount().getUserId(), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CartFactory.getUserCartSummary(apiContext, shopperAuth.getCustomerAccount().getUserId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - CartFactory.updateCart(shopperApiContext, new Cart(), HttpStatus.SC_OK, HttpStatus.SC_OK); - CartFactory.deleteCurrentCart(shopperApiContext, HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); + Cart cart = CartFactory.getOrCreateCart(shopperApiContext, HttpStatus.SC_OK); + CartFactory.deleteCart(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + CartFactory.getOrCreateCart(shopperApiContext, HttpStatus.SC_OK); + CartFactory.getCartSummary(shopperApiContext, HttpStatus.SC_OK); + CartFactory.getUserCart(apiContext, shopperAuth.getCustomerAccount().getUserId(), HttpStatus.SC_NOT_FOUND); + CartFactory.getUserCartSummary(apiContext, shopperAuth.getCustomerAccount().getUserId(), HttpStatus.SC_OK); + CartFactory.updateCart(shopperApiContext, new Cart(), HttpStatus.SC_OK); + CartFactory.deleteCurrentCart(shopperApiContext, HttpStatus.SC_NO_CONTENT); } @Test public void CartAppliedDiscountTests() throws Exception { - CartsAppliedDiscountFactory.applyCoupon(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CartsAppliedDiscountFactory.removeCoupon(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CartsAppliedDiscountFactory.removeCoupons(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + CartsAppliedDiscountFactory.applyCoupon(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + CartsAppliedDiscountFactory.removeCoupon(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + CartsAppliedDiscountFactory.removeCoupons(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void CategoryTests() throws Exception { -/*bug 36448*/ // CategoryFactory.getChildCategories(apiContext, Generator.randomInt(500, 600), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CategoryFactory.updateCategory(apiContext, new Category(), Generator.randomInt(50, 100), HttpStatus.SC_INTERNAL_SERVER_ERROR, HttpStatus.SC_OK); - CategoryFactory.deleteCategoryById(apiContext, Generator.randomInt(50, 100), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); +/*bug 36448*/ CategoryFactory.getChildCategories(apiContext, Generator.randomInt(500, 600), HttpStatus.SC_BAD_REQUEST); + CategoryFactory.updateCategory(apiContext, new Category(), Generator.randomInt(50, 100), HttpStatus.SC_INTERNAL_SERVER_ERROR); + CategoryFactory.deleteCategoryById(apiContext, Generator.randomInt(50, 100), HttpStatus.SC_CONFLICT); } @Test public void ChangeMessageTests() throws Exception { - ChangeMessageFactory.getMessages(shopperApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ChangeMessageFactory.removeMessage(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); - ChangeMessageFactory.removeAllMessages(shopperApiContext, HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); + ChangeMessageFactory.getMessages(shopperApiContext, HttpStatus.SC_OK); + ChangeMessageFactory.removeMessage(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ChangeMessageFactory.removeAllMessages(shopperApiContext, HttpStatus.SC_NO_CONTENT); } @Test public void ChannelTests() throws Exception { Channel ch = new Channel(); ch.setTenantId(tenantId); - ChannelFactory.getChannels(apiContext, null, null, null, null, null, HttpStatus.SC_OK, HttpStatus.SC_OK); - ChannelFactory.createChannel(apiContext, ch, HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - ChannelFactory.deleteChannel(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); - ChannelFactory.getChannel(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ChannelFactory.updateChannel(apiContext, ch, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ChannelFactory.getChannels(apiContext, null, null, null, null, null, HttpStatus.SC_OK); + ChannelFactory.createChannel(apiContext, ch, HttpStatus.SC_CONFLICT); + ChannelFactory.deleteChannel(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ChannelFactory.getChannel(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ChannelFactory.updateChannel(apiContext, ch, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void ChannelGroupTests() throws Exception { - ChannelGroupFactory.getChannelGroups(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ChannelGroupFactory.createChannelGroup(apiContext, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ChannelGroupFactory.deleteChannelGroup(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); - ChannelGroupFactory.getChannelGroups(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ChannelGroupFactory.updateChannelGroup(apiContext, new ChannelGroup(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + ChannelGroupFactory.getChannelGroups(apiContext, HttpStatus.SC_OK); + ChannelGroupFactory.createChannelGroup(apiContext, null, HttpStatus.SC_CONFLICT); + ChannelGroupFactory.deleteChannelGroup(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ChannelGroupFactory.getChannelGroups(apiContext, HttpStatus.SC_OK); + ChannelGroupFactory.updateChannelGroup(apiContext, new ChannelGroup(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void CheckoutSettingsTests() throws Exception { - CheckoutSettingsFactory.getCheckoutSettings(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + CheckoutSettingsFactory.getCheckoutSettings(apiContext, HttpStatus.SC_OK); } @Test public void CreditAuditEntryTests() throws Exception { - CreditAuditEntryFactory.getAuditEntries(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_OK, HttpStatus.SC_OK); + CreditAuditEntryFactory.getAuditEntries(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_OK); } @Test public void CreditTests() throws Exception { - /*bug 35020*/CreditFactory.addCredit(apiContext, new Credit(), HttpStatus.SC_INTERNAL_SERVER_ERROR, HttpStatus.SC_OK); - CreditFactory.getCredits(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CreditFactory.associateCreditToShopper(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CreditFactory.getCredit(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CreditFactory.updateCredit(apiContext, null, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - CreditFactory.deleteCredit(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); + /*bug 35020*/CreditFactory.addCredit(apiContext, new Credit(), HttpStatus.SC_INTERNAL_SERVER_ERROR); + CreditFactory.getCredits(apiContext, HttpStatus.SC_OK); + CreditFactory.associateCreditToShopper(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_BAD_REQUEST); + CreditFactory.getCredit(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_NOT_FOUND); + CreditFactory.updateCredit(apiContext, null, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_CONFLICT); + CreditFactory.deleteCredit(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_NOT_FOUND); } @Test public void CreditTransactionTests() throws Exception { - CreditTransactionFactory.getTransactions(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK, HttpStatus.SC_OK); - CreditTransactionFactory.addTransaction(apiContext, new CreditTransaction(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_CREATED); + CreditTransactionFactory.getTransactions(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK); + CreditTransactionFactory.addTransaction(apiContext, new CreditTransaction(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void CommerceLocationTests() throws Exception { - CommerceLocationFactory.getDirectShipLocation(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CommerceLocationFactory.getLocation(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - /*bug 36454*/ CommerceLocationFactory.getLocationsInUsageType(apiContext, "direct ship", HttpStatus.SC_OK, HttpStatus.SC_OK); - CommerceLocationFactory.getLocationsInUsageType(apiContext, "direct ship", HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); -/*bug 36455*/ CommerceLocationFactory.getInStorePickupLocation(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CommerceLocationFactory.getInStorePickupLocations(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + CommerceLocationFactory.getDirectShipLocation(apiContext, HttpStatus.SC_OK); + CommerceLocationFactory.getLocation(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + /*bug 36454*/ CommerceLocationFactory.getLocationsInUsageType(apiContext, "direct ship", HttpStatus.SC_OK); + CommerceLocationFactory.getLocationsInUsageType(apiContext, "direct ship", HttpStatus.SC_NOT_FOUND); +/*bug 36455*/ CommerceLocationFactory.getInStorePickupLocation(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + CommerceLocationFactory.getInStorePickupLocations(apiContext, HttpStatus.SC_OK); } @Test public void CustomerAccountTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, null, null); - CustomerAccountFactory.getAccounts(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CustomerAccountFactory.getLoginState(localApiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - CustomerAccountFactory.getAccount(localApiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAccountFactory.getAccounts(localApiContext, HttpStatus.SC_OK); + CustomerAccountFactory.getLoginState(localApiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK); + CustomerAccountFactory.getAccount(localApiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK); PasswordInfo pinfo = new PasswordInfo(); pinfo.setOldPassword(Generator.randomString(5, Generator.AlphaChars)); pinfo.setNewPassword(Generator.randomString(5, Generator.AlphaChars)); - CustomerAccountFactory.changePassword(localApiContext, pinfo, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CustomerAccountFactory.addLoginToExistingCustomer(localApiContext, new CustomerLoginInfo(), shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CustomerAccountFactory.recomputeCustomerLifetimeValue(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); - CustomerAccountFactory.setLoginLocked(localApiContext, true, Generator.randomInt(10000, 20000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CustomerAccountFactory.setPasswordChangeRequired(localApiContext, true, Generator.randomInt(10000, 20000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CustomerAccountFactory.addAccounts(localApiContext, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CustomerAccountFactory.resetPassword(localApiContext, new ResetPasswordInfo(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CustomerAccountFactory.updateAccount(localApiContext, new CustomerAccount(), Generator.randomInt(10000, 20000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CustomerAccountFactory.deleteAccount(localApiContext, Generator.randomInt(10000, 20000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CustomerAccountFactory.getLoginStateByUserName(localApiContext, shopperAuth.getCustomerAccount().getUserName(), HttpStatus.SC_OK, HttpStatus.SC_OK); -/*bug 36464*/ CustomerAccountFactory.getLoginStateByEmailAddress(localApiContext, email, HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAccountFactory.changePassword(localApiContext, pinfo, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST); + CustomerAccountFactory.addLoginToExistingCustomer(localApiContext, new CustomerLoginInfo(), shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST); + CustomerAccountFactory.recomputeCustomerLifetimeValue(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_NO_CONTENT); + CustomerAccountFactory.setLoginLocked(localApiContext, true, Generator.randomInt(10000, 20000), HttpStatus.SC_NOT_FOUND); + CustomerAccountFactory.setPasswordChangeRequired(localApiContext, true, Generator.randomInt(10000, 20000), HttpStatus.SC_NOT_FOUND); + CustomerAccountFactory.addAccounts(localApiContext, null, HttpStatus.SC_BAD_REQUEST); + CustomerAccountFactory.resetPassword(localApiContext, new ResetPasswordInfo(), HttpStatus.SC_BAD_REQUEST); + CustomerAccountFactory.updateAccount(localApiContext, new CustomerAccount(), Generator.randomInt(10000, 20000), HttpStatus.SC_NOT_FOUND); + CustomerAccountFactory.deleteAccount(localApiContext, Generator.randomInt(10000, 20000), HttpStatus.SC_NOT_FOUND); + CustomerAccountFactory.getLoginStateByUserName(localApiContext, shopperAuth.getCustomerAccount().getUserName(), HttpStatus.SC_OK); +/*bug 36464*/ CustomerAccountFactory.getLoginStateByEmailAddress(localApiContext, email, HttpStatus.SC_OK); } @Test public void CustomerAttributeTests() throws Exception { - CustomerAttributeFactory.getAccountAttributes(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAttributeFactory.getAccountAttributes(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK); CustomerAttribute attr = new CustomerAttribute(); - CustomerAttributeFactory.addAccountAttribute(apiContext, new CustomerAttribute(), shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - CustomerAttributeFactory.updateAccountAttribute(apiContext, new CustomerAttribute(), shopperAuth.getCustomerAccount().getId(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - CustomerAttributeFactory.deleteAccountAttribute(apiContext, Generator.randomInt(10000, 20000), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + CustomerAttributeFactory.addAccountAttribute(apiContext, new CustomerAttribute(), shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_CONFLICT); + CustomerAttributeFactory.updateAccountAttribute(apiContext, new CustomerAttribute(), shopperAuth.getCustomerAccount().getId(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + CustomerAttributeFactory.deleteAccountAttribute(apiContext, Generator.randomInt(10000, 20000), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void CustomerAuthTicketTests() throws Exception { - CustomerAuthTicketFactory.createAnonymousShopperAuthTicket(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CustomerAuthTicketFactory.createUserAuthTicket(apiContext, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CustomerAuthTicketFactory.refreshUserAuthTicket(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + CustomerAuthTicketFactory.createAnonymousShopperAuthTicket(apiContext, HttpStatus.SC_OK); + CustomerAuthTicketFactory.createUserAuthTicket(apiContext, null, HttpStatus.SC_BAD_REQUEST); + CustomerAuthTicketFactory.refreshUserAuthTicket(apiContext, Generator.randomString(10, Generator.AlphaNumericChars), HttpStatus.SC_NOT_FOUND); } @Test public void CustomerCheckoutSettingsTests() throws Exception { - CustomerCheckoutSettingsFactory.getCustomerCheckoutSettings(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CustomerCheckoutSettingsFactory.updateCustomerCheckoutSettings(apiContext, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + CustomerCheckoutSettingsFactory.getCustomerCheckoutSettings(apiContext, HttpStatus.SC_OK); + CustomerCheckoutSettingsFactory.updateCustomerCheckoutSettings(apiContext, null, HttpStatus.SC_BAD_REQUEST); } @Test public void CustomerContactTests() throws Exception { - CustomerContactFactory.getAccountContacts(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - CustomerContactFactory.addAccountContact(apiContext, new CustomerContact(), shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CustomerContactFactory.updateAccountContact(apiContext, new CustomerContact(), shopperAuth.getCustomerAccount().getId(), Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CustomerContactFactory.deleteAccountContact(apiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); + CustomerContactFactory.getAccountContacts(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK); + CustomerContactFactory.addAccountContact(apiContext, new CustomerContact(), shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST); + CustomerContactFactory.updateAccountContact(apiContext, new CustomerContact(), shopperAuth.getCustomerAccount().getId(), Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST); + CustomerContactFactory.deleteAccountContact(apiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND); } @Test public void CustomerNoteTests() throws Exception { - CustomerNoteFactory.getAccountNotes(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - CustomerNoteFactory.addAccountNote(apiContext, null, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - CustomerNoteFactory.updateAccountNote(apiContext, null, shopperAuth.getCustomerAccount().getId(), Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - /*bug 34991*/ CustomerNoteFactory.deleteAccountNote(apiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); + CustomerNoteFactory.getAccountNotes(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK); + CustomerNoteFactory.addAccountNote(apiContext, null, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST); + CustomerNoteFactory.updateAccountNote(apiContext, null, shopperAuth.getCustomerAccount().getId(), Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST); + /*bug 34991*/ CustomerNoteFactory.deleteAccountNote(apiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); } @Test public void CustomerCustomerSegmentTests() throws Exception { - CustomerCustomerSegmentFactory.addSegment(apiContext, new CustomerSegment(), HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - CustomerCustomerSegmentFactory.getSegment(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CustomerCustomerSegmentFactory.getSegments(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - CustomerCustomerSegmentFactory.updateSegment(apiContext, new CustomerSegment(), Generator.randomInt(100, 200), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - CustomerCustomerSegmentFactory.deleteSegment(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - CustomerCustomerSegmentFactory.removeSegmentAccount(apiContext, Generator.randomInt(100, 200), Generator.randomInt(100, 200), HttpStatus.SC_CONFLICT, HttpStatus.SC_NO_CONTENT); - CustomerCustomerSegmentFactory.addSegmentAccounts(apiContext, new ArrayList(), Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_CREATED); + CustomerCustomerSegmentFactory.addSegment(apiContext, new CustomerSegment(), HttpStatus.SC_CONFLICT); + CustomerCustomerSegmentFactory.getSegment(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); + CustomerCustomerSegmentFactory.getSegments(apiContext, HttpStatus.SC_OK); + CustomerCustomerSegmentFactory.updateSegment(apiContext, new CustomerSegment(), Generator.randomInt(100, 200), HttpStatus.SC_CONFLICT); + CustomerCustomerSegmentFactory.deleteSegment(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); + CustomerCustomerSegmentFactory.removeSegmentAccount(apiContext, Generator.randomInt(100, 200), Generator.randomInt(100, 200), HttpStatus.SC_CONFLICT); + CustomerCustomerSegmentFactory.addSegmentAccounts(apiContext, new ArrayList(), Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST); } @Test public void CustomerSegmentTests() throws Exception { - CustomerSegmentFactory.getAccountSegments(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerSegmentFactory.getAccountSegments(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_OK); } @Test public void DeveloperAdminUserAuthTicketTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, null, null); - DeveloperAdminUserAuthTicketFactory.createDeveloperUserAuthTicket(localApiContext, new UserAuthInfo(), HttpStatus.SC_UNAUTHORIZED, HttpStatus.SC_OK); - DeveloperAdminUserAuthTicketFactory.refreshDeveloperAuthTicket(localApiContext, new DeveloperAdminUserAuthTicket(), HttpStatus.SC_UNAUTHORIZED, HttpStatus.SC_OK); - DeveloperAdminUserAuthTicketFactory.deleteUserAuthTicket(localApiContext, Generator.randomString(10, Generator.AlphaChars), HttpStatus.SC_UNAUTHORIZED, HttpStatus.SC_OK); + DeveloperAdminUserAuthTicketFactory.createDeveloperUserAuthTicket(localApiContext, new UserAuthInfo(), HttpStatus.SC_UNAUTHORIZED); + DeveloperAdminUserAuthTicketFactory.refreshDeveloperAuthTicket(localApiContext, new DeveloperAdminUserAuthTicket(), HttpStatus.SC_UNAUTHORIZED); + DeveloperAdminUserAuthTicketFactory.deleteUserAuthTicket(localApiContext, Generator.randomString(10, Generator.AlphaChars), HttpStatus.SC_UNAUTHORIZED); } @Test public void DigitalPackageTests() throws Exception { - DigitalPackageFactory.deleteDigitalPackage(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_NO_CONTENT); - DigitalPackageFactory.getAvailableDigitalPackageFulfillmentActions(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - DigitalPackageFactory.updateDigitalPackage(apiContext, new DigitalPackage(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - DigitalPackageFactory.createDigitalPackage(apiContext, new DigitalPackage(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - DigitalPackageFactory.getDigitalPackage(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + DigitalPackageFactory.deleteDigitalPackage(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + DigitalPackageFactory.getAvailableDigitalPackageFulfillmentActions(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + DigitalPackageFactory.updateDigitalPackage(apiContext, new DigitalPackage(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + DigitalPackageFactory.createDigitalPackage(apiContext, new DigitalPackage(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + DigitalPackageFactory.getDigitalPackage(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void DiscountTests() throws Exception { - DiscountFactory.getDiscounts(apiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); - DiscountFactory.createDiscount(apiContext, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_CREATED); - DiscountFactory.deleteDiscount(apiContext, Generator.randomInt(2000, 3000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_NO_CONTENT); - DiscountFactory.generateRandomCoupon(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - DiscountFactory.getDiscount(apiContext, DataViewMode.Live, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - DiscountFactory.updateDiscount(apiContext, null, Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - DiscountFactory.updateDiscountContent(apiContext, null, Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - DiscountFactory.getDiscountContent(apiContext, DataViewMode.Live, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + DiscountFactory.getDiscounts(apiContext, DataViewMode.Live, HttpStatus.SC_OK); + DiscountFactory.createDiscount(apiContext, null, HttpStatus.SC_BAD_REQUEST); + DiscountFactory.deleteDiscount(apiContext, Generator.randomInt(2000, 3000), HttpStatus.SC_NOT_FOUND); + DiscountFactory.generateRandomCoupon(apiContext, HttpStatus.SC_OK); + DiscountFactory.getDiscount(apiContext, DataViewMode.Live, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND); + DiscountFactory.updateDiscount(apiContext, null, Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST); + DiscountFactory.updateDiscountContent(apiContext, null, Generator.randomInt(100, 200), HttpStatus.SC_BAD_REQUEST); + DiscountFactory.getDiscountContent(apiContext, DataViewMode.Live, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND); } @Test public void DiscountTargetTests() throws Exception { - DiscountTargetFactory.getDiscountTarget(apiContext, DataViewMode.Live, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - DiscountTargetFactory.updateDiscountTarget(apiContext, new DiscountTarget(), Generator.randomInt(1000, 2000), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + DiscountTargetFactory.getDiscountTarget(apiContext, DataViewMode.Live, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND); + DiscountTargetFactory.updateDiscountTarget(apiContext, new DiscountTarget(), Generator.randomInt(1000, 2000), HttpStatus.SC_BAD_REQUEST); } @Test public void DocumentDraftSummaryTests() throws Exception { - DocumentDraftSummaryFactory.listDocumentDraftSummaries(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - DocumentDraftSummaryFactory.deleteDocumentDrafts(apiContext, null, HttpStatus.SC_OK, HttpStatus.SC_OK); - DocumentDraftSummaryFactory.publishDocuments(apiContext, null, HttpStatus.SC_OK, HttpStatus.SC_OK); + DocumentDraftSummaryFactory.listDocumentDraftSummaries(apiContext, HttpStatus.SC_OK); + DocumentDraftSummaryFactory.deleteDocumentDrafts(apiContext, null, HttpStatus.SC_OK); + DocumentDraftSummaryFactory.publishDocuments(apiContext, null, HttpStatus.SC_OK); } @Test public void DocumentTests() throws Exception { - DocumentFactory.getDocuments(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - DocumentFactory.createDocument(apiContext, DataViewMode.Live, new Document(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - DocumentFactory.deleteDocument(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_NO_CONTENT); - DocumentFactory.deleteDocumentContent(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_NO_CONTENT); - DocumentFactory.getDocument(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - DocumentFactory.getDocumentContent(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_NO_CONTENT); - /*bug 35041*/ DocumentFactory.updateDocument(apiContext, new Document(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_NO_CONTENT); - DocumentFactory.updateDocumentContent(apiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_NO_CONTENT); + DocumentFactory.getDocuments(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + DocumentFactory.createDocument(apiContext, DataViewMode.Live, new Document(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + DocumentFactory.deleteDocument(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + DocumentFactory.deleteDocumentContent(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + DocumentFactory.getDocument(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + DocumentFactory.getDocumentContent(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + /*bug 35041*/ DocumentFactory.updateDocument(apiContext, new Document(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + DocumentFactory.updateDocumentContent(apiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), null, HttpStatus.SC_BAD_REQUEST); } @Test public void DocumentListTests() throws Exception { - DocumentListFactory.createDocumentList(apiContext, DataViewMode.Live, new DocumentList(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - DocumentListFactory.getDocumentLists(apiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); - DocumentListFactory.getDocumentList(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - DocumentListFactory.updateDocumentList(apiContext, new DocumentList(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); -/*bug 36472*/ DocumentListFactory.deleteDocumentList(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK, HttpStatus.SC_OK); + DocumentListFactory.createDocumentList(apiContext, DataViewMode.Live, new DocumentList(), HttpStatus.SC_CONFLICT); + DocumentListFactory.getDocumentLists(apiContext, DataViewMode.Live, HttpStatus.SC_OK); + DocumentListFactory.getDocumentList(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + DocumentListFactory.updateDocumentList(apiContext, new DocumentList(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); +/*bug 36472*/ DocumentListFactory.deleteDocumentList(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK); } @Test @@ -547,527 +547,527 @@ public void DocumentListTypeTests() throws Exception { String mozuNamespace = appId.substring(0, appId.indexOf('.')); DocumentListType type = new DocumentListType(); type.setNamespace(mozuNamespace); -/*bug 35164*/ DocumentListTypeFactory.createDocumentListType(apiContext, DataViewMode.Live, type, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); -/*bug 47694*/ DocumentListTypeFactory.updateDocumentListType(apiContext, new DocumentListType(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); +/*bug 35164*/ DocumentListTypeFactory.createDocumentListType(apiContext, DataViewMode.Live, type, HttpStatus.SC_BAD_REQUEST); +/*bug 47694*/ DocumentListTypeFactory.updateDocumentListType(apiContext, new DocumentListType(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void DocumentTypeTests() throws Exception { DocumentType type = DocumentGenerator.generateDocumentType(Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars)); - DocumentTypeFactory.createDocumentType(apiContext, DataViewMode.Live, type, HttpStatus.SC_FORBIDDEN, HttpStatus.SC_OK); - DocumentTypeFactory.getDocumentTypes(apiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); - DocumentTypeFactory.getDocumentType(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - DocumentTypeFactory.updateDocumentType(apiContext, new DocumentType(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + DocumentTypeFactory.createDocumentType(apiContext, DataViewMode.Live, type, HttpStatus.SC_FORBIDDEN); + DocumentTypeFactory.getDocumentTypes(apiContext, DataViewMode.Live, HttpStatus.SC_OK); + DocumentTypeFactory.getDocumentType(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + DocumentTypeFactory.updateDocumentType(apiContext, new DocumentType(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void DocumentTreeTests() throws Exception { - DocumentTreeFactory.getTreeDocumentContent(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - DocumentTreeFactory.updateTreeDocumentContent(apiContext, new FileInputStream("C:\\tmp\\NWCRq.txt"), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - DocumentTreeFactory.deleteTreeDocumentContent(apiContext, new ByteArrayInputStream( Generator.randomString(15, Generator.AlphaChars).getBytes( Charset.defaultCharset() )), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - /*bug 47696*/ DocumentTreeFactory.getTreeDocument(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + DocumentTreeFactory.getTreeDocumentContent(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + DocumentTreeFactory.updateTreeDocumentContent(apiContext, new FileInputStream("C:\\tmp\\NWCRq.txt"), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + DocumentTreeFactory.deleteTreeDocumentContent(apiContext, new ByteArrayInputStream( Generator.randomString(15, Generator.AlphaChars).getBytes( Charset.defaultCharset() )), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + /*bug 47696*/ DocumentTreeFactory.getTreeDocument(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void EntityContainerTests() throws Exception { - EntityContainerFactory.getEntityContainer(apiContext, Generator.randomString(15, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - EntityContainerFactory.getEntityContainers(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + EntityContainerFactory.getEntityContainer(apiContext, Generator.randomString(15, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + EntityContainerFactory.getEntityContainers(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void EntityFactoryTests() throws Exception { - EntityFactory.deleteEntity(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - EntityFactory.getEntity(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - EntityFactory.insertEntity(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - EntityFactory.updateEntity(apiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - EntityFactory.getEntities(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + EntityFactory.deleteEntity(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + EntityFactory.getEntity(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + EntityFactory.insertEntity(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + EntityFactory.updateEntity(apiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + EntityFactory.getEntities(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void EntityListTests() throws Exception { - EntityListFactory.createEntityList(apiContext, new EntityList(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - EntityListFactory.deleteEntityList(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK, HttpStatus.SC_OK); - EntityListFactory.getEntityList(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK, HttpStatus.SC_OK); - EntityListFactory.getEntityLists(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - EntityListFactory.updateEntityList(apiContext, new EntityList(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK, HttpStatus.SC_OK); + EntityListFactory.createEntityList(apiContext, new EntityList(), HttpStatus.SC_BAD_REQUEST); + EntityListFactory.deleteEntityList(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK); + EntityListFactory.getEntityList(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK); + EntityListFactory.getEntityLists(apiContext, HttpStatus.SC_OK); + EntityListFactory.updateEntityList(apiContext, new EntityList(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK); } @Test public void EventDeliverySummaryTests() throws Exception { - EventDeliverySummaryFactory.getDeliveryAttemptSummaries(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - EventDeliverySummaryFactory.getDeliveryAttemptSummary(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + EventDeliverySummaryFactory.getDeliveryAttemptSummaries(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + EventDeliverySummaryFactory.getDeliveryAttemptSummary(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void EventNotificationTests() throws Exception { - EventNotificationFactory.getEvents(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - EventNotificationFactory.getEvent(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + EventNotificationFactory.getEvents(apiContext, HttpStatus.SC_OK); + EventNotificationFactory.getEvent(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void FacetTests() throws Exception { - FacetFactory.getFacets(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + FacetFactory.getFacets(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void FulfillmentInfoTests() throws Exception { - FulfillmentInfoFactory.getFulfillmentInfo(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - FulfillmentInfoFactory.setFulFillmentInfo(apiContext, new FulfillmentInfo(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + FulfillmentInfoFactory.getFulfillmentInfo(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + FulfillmentInfoFactory.setFulFillmentInfo(apiContext, new FulfillmentInfo(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void FulfillmentActionTests() throws Exception { FulfillmentAction action = new FulfillmentAction(); action.setActionName("SP"); - FulfillmentActionFactory.performFulfillmentAction(apiContext, action, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + FulfillmentActionFactory.performFulfillmentAction(apiContext, action, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void GeneralSettingsTests() throws Exception { - GeneralSettingsFactory.getGeneralSettings(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - GeneralSettingsFactory.updateGeneralSettings(apiContext, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + GeneralSettingsFactory.getGeneralSettings(apiContext, HttpStatus.SC_OK); + GeneralSettingsFactory.updateGeneralSettings(apiContext, null, HttpStatus.SC_CONFLICT); } @Test public void InStockNotificationSubscriptionTests() throws Exception { - InStockNotificationSubscriptionFactory.getInStockNotificationSubscriptions(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - InStockNotificationSubscriptionFactory.addInStockNotificationSubscription(apiContext, new InStockNotificationSubscription(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - InStockNotificationSubscriptionFactory.getInStockNotificationSubscription(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - InStockNotificationSubscriptionFactory.deleteInStockNotificationSubscription(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + InStockNotificationSubscriptionFactory.getInStockNotificationSubscriptions(apiContext, HttpStatus.SC_OK); + InStockNotificationSubscriptionFactory.addInStockNotificationSubscription(apiContext, new InStockNotificationSubscription(), HttpStatus.SC_CONFLICT); + InStockNotificationSubscriptionFactory.getInStockNotificationSubscription(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); + InStockNotificationSubscriptionFactory.deleteInStockNotificationSubscription(apiContext, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); } @Test public void ListViewTests() throws Exception { - ListViewFactory.createEntityListView(apiContext, new ListView(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ListViewFactory.getEntityListView(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ListViewFactory.getViewEntities(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ListViewFactory.getViewEntity(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ListViewFactory.getViewEntityContainer(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ListViewFactory.getViewEntityContainers(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ListViewFactory.updateEntityListView(apiContext, new ListView(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ListViewFactory.getEntityListViews(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ListViewFactory.deleteEntityListView(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ListViewFactory.createEntityListView(apiContext, new ListView(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ListViewFactory.getEntityListView(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ListViewFactory.getViewEntities(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ListViewFactory.getViewEntity(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ListViewFactory.getViewEntityContainer(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ListViewFactory.getViewEntityContainers(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ListViewFactory.updateEntityListView(apiContext, new ListView(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ListViewFactory.getEntityListViews(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ListViewFactory.deleteEntityListView(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void LocationTests() throws Exception { - LocationFactory.getLocation(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - LocationFactory.getLocations(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - LocationFactory.addLocation(apiContext, new Location(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - LocationFactory.updateLocation(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_CREATED); -/*bug 36475 */ LocationFactory.deleteLocation(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + LocationFactory.getLocation(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + LocationFactory.getLocations(apiContext, HttpStatus.SC_OK); + LocationFactory.addLocation(apiContext, new Location(), HttpStatus.SC_BAD_REQUEST); + LocationFactory.updateLocation(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); +/*bug 36475 */ LocationFactory.deleteLocation(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void LocationInventoryTests() throws Exception { - LocationInventoryFactory.getLocationInventories(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK, HttpStatus.SC_OK); + LocationInventoryFactory.getLocationInventories(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_OK); List list = new ArrayList(); list.add(new LocationInventory()); - /*bug 35021*/LocationInventoryFactory.addLocationInventory(apiContext, DataViewMode.Live, list, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_INTERNAL_SERVER_ERROR, HttpStatus.SC_OK); - LocationInventoryFactory.deleteLocationInventory(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - LocationInventoryFactory.getLocationInventory(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - LocationInventoryFactory.updateLocationInventory(apiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + /*bug 35021*/LocationInventoryFactory.addLocationInventory(apiContext, DataViewMode.Live, list, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_INTERNAL_SERVER_ERROR); + LocationInventoryFactory.deleteLocationInventory(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + LocationInventoryFactory.getLocationInventory(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + LocationInventoryFactory.updateLocationInventory(apiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void LocationTypeTests() throws Exception { - LocationTypeFactory.addLocationType(apiContext, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_CREATED); - LocationTypeFactory.deleteLocationType(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - LocationTypeFactory.getLocationType(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - LocationTypeFactory.getLocationTypes(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - LocationTypeFactory.updateLocationType(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + LocationTypeFactory.addLocationType(apiContext, null, HttpStatus.SC_BAD_REQUEST); + LocationTypeFactory.deleteLocationType(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + LocationTypeFactory.getLocationType(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + LocationTypeFactory.getLocationTypes(apiContext, HttpStatus.SC_OK); + LocationTypeFactory.updateLocationType(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void LocationUsageTests() throws Exception { - LocationUsageFactory.getLocationUsages(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - LocationUsageFactory.getLocationUsage(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - LocationUsageFactory.updateLocationUsage(apiContext, new LocationUsage(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + LocationUsageFactory.getLocationUsages(apiContext, HttpStatus.SC_OK); + LocationUsageFactory.getLocationUsage(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + LocationUsageFactory.updateLocationUsage(apiContext, new LocationUsage(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void MasterCatalogTests() throws Exception { - MasterCatalogFactory.getMasterCatalogs(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalogFactory.getMasterCatalogs(apiContext, HttpStatus.SC_OK); } @Test public void OrderTests() throws Exception { - OrderFactory.getOrders(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - OrderFactory.getAvailableActions(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderFactory.getOrder(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderFactory.getTaxableOrders(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderFactory.changeOrderUserId(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderFactory.createOrder(apiContext, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - OrderFactory.updateOrder(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - OrderFactory.updateOrderDiscount(apiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomInt(100, 200), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - OrderFactory.deleteOrderDraft(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderFactory.performOrderAction(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); -/*bug 36479*/ OrderFactory.createOrderFromCart(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + OrderFactory.getOrders(apiContext, HttpStatus.SC_OK); + OrderFactory.getAvailableActions(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderFactory.getOrder(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderFactory.getTaxableOrders(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderFactory.changeOrderUserId(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderFactory.createOrder(apiContext, null, HttpStatus.SC_CONFLICT); + OrderFactory.updateOrder(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + OrderFactory.updateOrderDiscount(apiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomInt(100, 200), HttpStatus.SC_CONFLICT); + OrderFactory.deleteOrderDraft(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderFactory.performOrderAction(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); +/*bug 36479*/ OrderFactory.createOrderFromCart(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void OrderAttributeTests() throws Exception { - OrderAttributeFactory.getOrderAttributes(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderAttributeFactory.createOrderAttributes(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderAttributeFactory.updateOrderAttributes(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + OrderAttributeFactory.getOrderAttributes(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderAttributeFactory.createOrderAttributes(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderAttributeFactory.updateOrderAttributes(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void OrderItemTests() throws Exception { - OrderItemFactory.getOrderItems(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderItemFactory.createOrderItem(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - OrderItemFactory.deleteOrderItem(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderItemFactory.getOrderItem(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderItemFactory.updateItemFulfillment(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - OrderItemFactory.updateItemProductPrice(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), Generator.randomDecimal(50., 100.), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderItemFactory.updateItemQuantity(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderItemFactory.updateOrderItemDiscount(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + OrderItemFactory.getOrderItems(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderItemFactory.createOrderItem(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + OrderItemFactory.deleteOrderItem(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderItemFactory.getOrderItem(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderItemFactory.updateItemFulfillment(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + OrderItemFactory.updateItemProductPrice(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), Generator.randomDecimal(50., 100.), HttpStatus.SC_BAD_REQUEST); + OrderItemFactory.updateItemQuantity(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_BAD_REQUEST); + OrderItemFactory.updateOrderItemDiscount(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), Generator.randomInt(50, 100), HttpStatus.SC_CONFLICT); } @Test public void OrderNoteTests() throws Exception { - OrderNoteFactory.getOrderNotes(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderNoteFactory.createOrderNote(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderNoteFactory.deleteOrderNote(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderNoteFactory.getOrderNote(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrderNoteFactory.updateOrderNote(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + OrderNoteFactory.getOrderNotes(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderNoteFactory.createOrderNote(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderNoteFactory.deleteOrderNote(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderNoteFactory.getOrderNote(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrderNoteFactory.updateOrderNote(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void OrdersPackageTests() throws Exception { - OrdersPackageFactory.getPackage(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrdersPackageFactory.createPackage(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - OrdersPackageFactory.deletePackage(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrdersPackageFactory.getAvailablePackageFulfillmentActions(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrdersPackageFactory.getPackageLabel(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrdersPackageFactory.updatePackage(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + OrdersPackageFactory.getPackage(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrdersPackageFactory.createPackage(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + OrdersPackageFactory.deletePackage(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrdersPackageFactory.getAvailablePackageFulfillmentActions(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrdersPackageFactory.getPackageLabel(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrdersPackageFactory.updatePackage(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void OrdersShipmentTests() throws Exception { - OrdersShipmentFactory.getAvailableShipmentMethods(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrdersShipmentFactory.createPackageShipments(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - OrdersShipmentFactory.deleteShipment(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - OrdersShipmentFactory.getShipment(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + OrdersShipmentFactory.getAvailableShipmentMethods(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrdersShipmentFactory.createPackageShipments(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + OrdersShipmentFactory.deleteShipment(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + OrdersShipmentFactory.getShipment(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void OrderValidationResultTests() throws Exception { - OrderValidationResultFactory.addValidationResult(apiContext, new OrderValidationResult(), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - OrderValidationResultFactory.getValidationResults(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + OrderValidationResultFactory.addValidationResult(apiContext, new OrderValidationResult(), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + OrderValidationResultFactory.getValidationResults(apiContext, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void PackageTests() throws Exception { - PackageFactory.getPackage(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PackageFactory.createPackage(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - PackageFactory.deletePackage(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PackageFactory.getPackageLabel(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PackageFactory.updatePackage(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + PackageFactory.getPackage(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PackageFactory.createPackage(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + PackageFactory.deletePackage(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PackageFactory.getPackageLabel(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PackageFactory.updatePackage(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void PaymentTests() throws Exception { - PaymentFactory.getPayments(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PaymentFactory.createPaymentAction(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - PaymentFactory.getAvailablePaymentActions(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PaymentFactory.getPayment(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PaymentFactory.performPaymentAction(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + PaymentFactory.getPayments(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PaymentFactory.createPaymentAction(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + PaymentFactory.getAvailablePaymentActions(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PaymentFactory.getPayment(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PaymentFactory.performPaymentAction(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void PaymentSettingsTests() throws Exception { - PaymentSettingsFactory.getThirdPartyPaymentWorkflows(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + PaymentSettingsFactory.getThirdPartyPaymentWorkflows(apiContext, HttpStatus.SC_OK); } @Test public void PlatformApplicationTests() throws Exception { - //PlatformApplicationFactory.getApplication(apiContext, Environment.getConfigValue("AppId"), HttpStatus.SC_UNAUTHORIZED, HttpStatus.SC_OK); - //PlatformApplicationFactory.getApplication(apiContext, Generator.randomString(12, Generator.AlphaChars), HttpStatus.SC_UNAUTHORIZED, HttpStatus.SC_OK); - //PlatformApplicationFactory.updateApplication(apiContext, null, Generator.randomString(12, Generator.AlphaChars), HttpStatus.SC_UNAUTHORIZED, HttpStatus.SC_OK); + //PlatformApplicationFactory.getApplication(apiContext, Environment.getConfigValue("AppId"), HttpStatus.SC_UNAUTHORIZED); + //PlatformApplicationFactory.getApplication(apiContext, Generator.randomString(12, Generator.AlphaChars), HttpStatus.SC_UNAUTHORIZED); + //PlatformApplicationFactory.updateApplication(apiContext, null, Generator.randomString(12, Generator.AlphaChars), HttpStatus.SC_UNAUTHORIZED); } @Test public void PickupTests() throws Exception { - PickupFactory.getPickup(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PickupFactory.getAvailablePickupFulfillmentActions(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PickupFactory.createPickup(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - PickupFactory.deletePickup(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - PickupFactory.updatePickup(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + PickupFactory.getPickup(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PickupFactory.getAvailablePickupFulfillmentActions(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PickupFactory.createPickup(apiContext, null, Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + PickupFactory.deletePickup(apiContext, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + PickupFactory.updatePickup(apiContext, null, Generator.randomString(8, Generator.AlphaChars), Generator.randomString(8, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void ProductExtraTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductExtraFactory.getExtras(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductExtraFactory.addExtra(localApiContext, DataViewMode.Pending, new ProductExtra(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductExtraFactory.getExtraValueLocalizedDeltaPrice(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.CountryCode, HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductExtraFactory.getExtraValueLocalizedDeltaPrices(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.CountryCode, HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductExtraFactory.addExtra(localApiContext, DataViewMode.Live, new ProductExtra(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + ProductExtraFactory.getExtras(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductExtraFactory.addExtra(localApiContext, DataViewMode.Pending, new ProductExtra(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductExtraFactory.getExtraValueLocalizedDeltaPrice(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.CountryCode, HttpStatus.SC_NOT_FOUND); + ProductExtraFactory.getExtraValueLocalizedDeltaPrices(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), com.mozu.test.framework.helper.Constants.CountryCode, HttpStatus.SC_NOT_FOUND); + ProductExtraFactory.addExtra(localApiContext, DataViewMode.Live, new ProductExtra(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); List list = new ArrayList(); - ProductExtraFactory.updateExtraValueLocalizedDeltaPrices(localApiContext, DataViewMode.Live, list, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductExtraFactory.updateExtra(localApiContext, DataViewMode.Live, new ProductExtra(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductExtraFactory.deleteExtra(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductExtraFactory.deleteExtraValueLocalizedDeltaPrice(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductExtraFactory.addExtraValueLocalizedDeltaPrice(localApiContext, DataViewMode.Live, new ProductExtraValueDeltaPrice(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductExtraFactory.updateExtraValueLocalizedDeltaPrices(localApiContext, DataViewMode.Live, list, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductExtraFactory.updateExtra(localApiContext, DataViewMode.Live, new ProductExtra(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductExtraFactory.deleteExtra(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductExtraFactory.deleteExtraValueLocalizedDeltaPrice(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductExtraFactory.addExtraValueLocalizedDeltaPrice(localApiContext, DataViewMode.Live, new ProductExtraValueDeltaPrice(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void ProductOptionTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductOptionFactory.getOptions(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductOptionFactory.addOption(localApiContext, DataViewMode.Live, new ProductOption(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductOptionFactory.updateOption(localApiContext, DataViewMode.Live, new ProductOption(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductOptionFactory.deleteOption(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductOptionFactory.getOptions(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductOptionFactory.addOption(localApiContext, DataViewMode.Live, new ProductOption(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductOptionFactory.updateOption(localApiContext, DataViewMode.Live, new ProductOption(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductOptionFactory.deleteOption(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void ProductPropertyTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductPropertyFactory.getProperties(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductPropertyFactory.getPropertyValueLocalizedContents(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductPropertyFactory.getPropertyValueLocalizedContent(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductPropertyFactory.getProperty(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductPropertyFactory.addPropertyValueLocalizedContent(localApiContext, DataViewMode.Live, new ProductPropertyValueLocalizedContent(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductPropertyFactory.addProperty(localApiContext, DataViewMode.Live, new ProductProperty(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + ProductPropertyFactory.getProperties(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductPropertyFactory.getPropertyValueLocalizedContents(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductPropertyFactory.getPropertyValueLocalizedContent(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductPropertyFactory.getProperty(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductPropertyFactory.addPropertyValueLocalizedContent(localApiContext, DataViewMode.Live, new ProductPropertyValueLocalizedContent(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductPropertyFactory.addProperty(localApiContext, DataViewMode.Live, new ProductProperty(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); List list = new ArrayList(); - ProductPropertyFactory.updatePropertyValueLocalizedContents(localApiContext, DataViewMode.Live, list, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductPropertyFactory.updateProperty(localApiContext, DataViewMode.Live, new ProductProperty(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductPropertyFactory.deleteProperty(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductPropertyFactory.deletePropertyValueLocalizedContent(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductPropertyFactory.updatePropertyValueLocalizedContents(localApiContext, DataViewMode.Live, list, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductPropertyFactory.updateProperty(localApiContext, DataViewMode.Live, new ProductProperty(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductPropertyFactory.deleteProperty(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductPropertyFactory.deletePropertyValueLocalizedContent(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void ProductReservationTests() throws Exception { - ProductReservationFactory.getProductReservations(apiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); - ProductReservationFactory.addProductReservations(apiContext, DataViewMode.Pending, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductReservationFactory.commitReservations(apiContext, DataViewMode.Live, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductReservationFactory.updateProductReservations(apiContext, DataViewMode.Live, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductReservationFactory.deleteProductReservation(apiContext, DataViewMode.Live, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductReservationFactory.getProductReservations(apiContext, DataViewMode.Live, HttpStatus.SC_OK); + ProductReservationFactory.addProductReservations(apiContext, DataViewMode.Pending, null, HttpStatus.SC_CONFLICT); + ProductReservationFactory.commitReservations(apiContext, DataViewMode.Live, null, HttpStatus.SC_CONFLICT); + ProductReservationFactory.updateProductReservations(apiContext, DataViewMode.Live, null, HttpStatus.SC_CONFLICT); + ProductReservationFactory.deleteProductReservation(apiContext, DataViewMode.Live, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND); } @Test public void ProductSearchResultTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); ProductType myPT = ProductTypeGenerator.generate(Generator.randomString(5, Generator.AlphaChars)); - ProductType createdPT = ProductTypeFactory.addProductType(localApiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + ProductType createdPT = ProductTypeFactory.addProductType(localApiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED); Product myProduct1 = ProductGenerator.generate("ab"+Generator.randomString(5, Generator.AlphaChars), createdPT); Product myProduct2 = ProductGenerator.generate("ab"+Generator.randomString(5, Generator.AlphaChars), createdPT); - Product createdProduct1 = AdminProductFactory.addProduct(localApiContext, DataViewMode.Live, myProduct1, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - Product createdProduct2 = AdminProductFactory.addProduct(localApiContext, DataViewMode.Live, myProduct2, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Product createdProduct1 = AdminProductFactory.addProduct(localApiContext, DataViewMode.Live, myProduct1, HttpStatus.SC_CREATED); + Product createdProduct2 = AdminProductFactory.addProduct(localApiContext, DataViewMode.Live, myProduct2, HttpStatus.SC_CREATED); //add a category Category cat = ProductCategoryGenerator.generate(Generator.randomString(4, Generator.AlphaChars), true, null); - Category createdCat = CategoryFactory.addCategory(apiContext, cat, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Category createdCat = CategoryFactory.addCategory(apiContext, cat, HttpStatus.SC_CREATED); List categories = new ArrayList(); categories.add(ProductGenerator.generateProductCategory(createdCat.getId())); ProductInCatalogInfo proInfo = ProductGenerator.generateProductInCatalogInfo(catalogId, categories, Generator.randomString(6, Generator.AlphaChars), Generator.randomDecimal(20., 1000.), true, true, false,true); - AdminProductFactory.addProductInCatalog(apiContext, DataViewMode.Live, proInfo, createdProduct1.getProductCode(), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - AdminProductFactory.addProductInCatalog(apiContext, DataViewMode.Live, proInfo, createdProduct2.getProductCode(), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + AdminProductFactory.addProductInCatalog(apiContext, DataViewMode.Live, proInfo, createdProduct1.getProductCode(), HttpStatus.SC_CREATED); + AdminProductFactory.addProductInCatalog(apiContext, DataViewMode.Live, proInfo, createdProduct2.getProductCode(), HttpStatus.SC_CREATED); - ProductSearchResultFactory.suggest(apiContext, "ab", "cd", null, null, HttpStatus.SC_OK, HttpStatus.SC_OK); - ProductSearchResultFactory.search(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + ProductSearchResultFactory.suggest(apiContext, "ab", "cd", null, null, HttpStatus.SC_OK); + ProductSearchResultFactory.search(apiContext, HttpStatus.SC_OK); } @Test public void ProductTests() throws Exception { - ProductFactory.getProducts(shopperApiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); - ProductFactory.configuredProduct(shopperApiContext, new ProductOptionSelections(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductFactory.validateProduct(shopperApiContext, new ProductOptionSelections(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductFactory.validateDiscounts(shopperApiContext, new DiscountSelections(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductFactory.getProductInventories(apiContext, DataViewMode.Live, new LocationInventoryQuery(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - /*bug 49432*/ ProductFactory.getProductInventory(shopperApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductFactory.getProducts(shopperApiContext, DataViewMode.Live, HttpStatus.SC_OK); + ProductFactory.configuredProduct(shopperApiContext, new ProductOptionSelections(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductFactory.validateProduct(shopperApiContext, new ProductOptionSelections(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductFactory.validateDiscounts(shopperApiContext, new DiscountSelections(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductFactory.getProductInventories(apiContext, DataViewMode.Live, new LocationInventoryQuery(), HttpStatus.SC_CONFLICT); + /*bug 49432*/ ProductFactory.getProductInventory(shopperApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void ProductTypeExtraTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductTypeExtraFactory.getExtras(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductTypeExtraFactory.updateExtra(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductTypeExtraFactory.deleteExtra(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductTypeExtraFactory.addExtra(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductTypeExtraFactory.getExtras(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); + ProductTypeExtraFactory.updateExtra(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductTypeExtraFactory.deleteExtra(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductTypeExtraFactory.addExtra(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); } @Test public void ProductTypeOptionTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductTypeOptionFactory.getOptions(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductTypeOptionFactory.addOption(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductTypeOptionFactory.updateOption(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductTypeOptionFactory.deleteOption(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductTypeOptionFactory.getOptions(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); + ProductTypeOptionFactory.addOption(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); + ProductTypeOptionFactory.updateOption(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductTypeOptionFactory.deleteOption(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void ProductTypePropertyTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductTypePropertyFactory.getProperties(localApiContext, DataViewMode.Live, Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductTypePropertyFactory.getProperty(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductTypePropertyFactory.addProperty(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductTypePropertyFactory.updateProperty(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(600, 700), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductTypePropertyFactory.deleteProperty(localApiContext, DataViewMode.Live, Generator.randomInt(600, 700), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductTypePropertyFactory.getProperties(localApiContext, DataViewMode.Live, Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND); + ProductTypePropertyFactory.getProperty(localApiContext, DataViewMode.Live, Generator.randomInt(100, 200), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductTypePropertyFactory.addProperty(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND); + ProductTypePropertyFactory.updateProperty(localApiContext, DataViewMode.Live, new AttributeInProductType(), Generator.randomInt(600, 700), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductTypePropertyFactory.deleteProperty(localApiContext, DataViewMode.Live, Generator.randomInt(600, 700), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void ProductTypeTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductTypeFactory.getProductTypes(localApiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); - ProductTypeFactory.getProductType(localApiContext, DataViewMode.Live, Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductTypeFactory.deleteProductType(localApiContext, DataViewMode.Live, Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); -/*bug 49560*/ ProductTypeFactory.updateProductType(localApiContext, DataViewMode.Live, new ProductType(), Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductTypeFactory.getProductTypes(localApiContext, DataViewMode.Live, HttpStatus.SC_OK); + ProductTypeFactory.getProductType(localApiContext, DataViewMode.Live, Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND); + ProductTypeFactory.deleteProductType(localApiContext, DataViewMode.Live, Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND); +/*bug 49560*/ ProductTypeFactory.updateProductType(localApiContext, DataViewMode.Live, new ProductType(), Generator.randomInt(600, 700), HttpStatus.SC_NOT_FOUND); } @Test public void ProductTypeVariationTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductTypeVariationFactory.generateProductVariations(localApiContext, null, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductTypeVariationFactory.generateProductVariations(localApiContext, null, Generator.randomInt(100, 200), HttpStatus.SC_NOT_FOUND); } @Test public void ProductVariationTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ProductVariationFactory.getProductVariations(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductVariationFactory.deleteProductVariation(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductVariationFactory.addProductVariationLocalizedDeltaPrice(localApiContext, DataViewMode.Live, new ProductVariationDeltaPrice(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductVariationFactory.getProductVariation(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductVariationFactory.getProductVariationLocalizedDeltaPrices(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductVariationFactory.updateProductVariation(localApiContext, DataViewMode.Live, new ProductVariation(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductVariationFactory.updateProductVariations(localApiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductVariationFactory.updateProductVariationLocalizedDeltaPrice(localApiContext, DataViewMode.Live, new ProductVariationDeltaPrice(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - ProductVariationFactory.updateProductVariationLocalizedDeltaPrices(localApiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ProductVariationFactory.deleteProductVariationLocalizedDeltaPrice(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ProductVariationFactory.getProductVariations(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductVariationFactory.deleteProductVariation(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductVariationFactory.addProductVariationLocalizedDeltaPrice(localApiContext, DataViewMode.Live, new ProductVariationDeltaPrice(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductVariationFactory.getProductVariation(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductVariationFactory.getProductVariationLocalizedDeltaPrices(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductVariationFactory.updateProductVariation(localApiContext, DataViewMode.Live, new ProductVariation(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductVariationFactory.updateProductVariations(localApiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductVariationFactory.updateProductVariationLocalizedDeltaPrice(localApiContext, DataViewMode.Live, new ProductVariationDeltaPrice(), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + ProductVariationFactory.updateProductVariationLocalizedDeltaPrices(localApiContext, DataViewMode.Live, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ProductVariationFactory.deleteProductVariationLocalizedDeltaPrice(localApiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void PropertyTypeTests() throws Exception { - PropertyTypeFactory.createPropertyType(apiContext, new PropertyType(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - PropertyTypeFactory.getPropertyType(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - PropertyTypeFactory.getPropertyTypes(apiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); -/*bug 35033*/ PropertyTypeFactory.updatePropertyType(apiContext, DataViewMode.Live, new PropertyType(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - PropertyTypeFactory.deletePropertyType(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + PropertyTypeFactory.createPropertyType(apiContext, new PropertyType(), HttpStatus.SC_CONFLICT); + PropertyTypeFactory.getPropertyType(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + PropertyTypeFactory.getPropertyTypes(apiContext, DataViewMode.Live, HttpStatus.SC_OK); +/*bug 35033*/ PropertyTypeFactory.updatePropertyType(apiContext, DataViewMode.Live, new PropertyType(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + PropertyTypeFactory.deletePropertyType(apiContext, DataViewMode.Live, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void PublishingScopeTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - MasterCatalog mc = MasterCatalogFactory.getMasterCatalog(localApiContext, masterCatalogId, HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalog mc = MasterCatalogFactory.getMasterCatalog(localApiContext, masterCatalogId, HttpStatus.SC_OK); mc.setProductPublishingMode("Pending"); - MasterCatalogFactory.updateMasterCatalog(localApiContext, mc, masterCatalogId, HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalogFactory.updateMasterCatalog(localApiContext, mc, masterCatalogId, HttpStatus.SC_OK); List list = new ArrayList(); list.add(Generator.randomString(5, Generator.AlphaChars)); PublishingScope scope = ProductGenerator.generatePublishingScope(false, list); - PublishingScopeFactory.publishDrafts(localApiContext, DataViewMode.Pending, scope, HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - PublishingScopeFactory.discardDrafts(localApiContext, DataViewMode.Pending, scope, HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + PublishingScopeFactory.publishDrafts(localApiContext, DataViewMode.Pending, scope, HttpStatus.SC_NOT_FOUND); + PublishingScopeFactory.discardDrafts(localApiContext, DataViewMode.Pending, scope, HttpStatus.SC_NOT_FOUND); mc.setProductPublishingMode("Live"); - MasterCatalogFactory.updateMasterCatalog(localApiContext, mc, masterCatalogId, HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalogFactory.updateMasterCatalog(localApiContext, mc, masterCatalogId, HttpStatus.SC_OK); } @Test public void ReferenceDataTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, masterCatalogId, null); - ReferenceDataFactory.getBehaviors(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getAddressSchema(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getAddressSchemas(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getBehaviorCategories(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getBehaviorCategory(localApiContext, Generator.randomInt(10, 20), HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getContentLocales(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getCountries(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getCurrencies(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getTimeZones(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getTopLevelDomains(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getUnitsOfMeasure(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReferenceDataFactory.getCountriesWithStates(localApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + ReferenceDataFactory.getBehaviors(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getAddressSchema(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getAddressSchemas(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getBehaviorCategories(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getBehaviorCategory(localApiContext, Generator.randomInt(10, 20), HttpStatus.SC_OK); + ReferenceDataFactory.getContentLocales(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getCountries(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getCurrencies(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getTimeZones(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getTopLevelDomains(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getUnitsOfMeasure(localApiContext, HttpStatus.SC_OK); + ReferenceDataFactory.getCountriesWithStates(localApiContext, HttpStatus.SC_OK); } @Test public void ReturnTests() throws Exception { - ReturnFactory.getReturns(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - ReturnFactory.createPaymentActionForReturn(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - ReturnFactory.createReturn(apiContext, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - ReturnFactory.deleteReturn(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ReturnFactory.getAvailablePaymentActionsForReturn(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ReturnFactory.getAvailableReturnActions(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ReturnFactory.getPayment(apiContext, Generator.randomString(6, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ReturnFactory.getPayments(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ReturnFactory.performPaymentActionForReturn(apiContext, null, Generator.randomString(6, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ReturnFactory.performReturnActions(apiContext, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ReturnFactory.getReturnItem(apiContext, Generator.randomString(6, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ReturnFactory.getReturnItems(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ReturnFactory.createReturnItem(apiContext, new ReturnItem(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ReturnFactory.updateReturn(apiContext, new Return(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); -/*bug 35032*/ ReturnFactory.deleteOrderItem(apiContext, Generator.randomString(6, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + ReturnFactory.getReturns(apiContext, HttpStatus.SC_OK); + ReturnFactory.createPaymentActionForReturn(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ReturnFactory.createReturn(apiContext, null, HttpStatus.SC_CONFLICT); + ReturnFactory.deleteReturn(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ReturnFactory.getAvailablePaymentActionsForReturn(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ReturnFactory.getAvailableReturnActions(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ReturnFactory.getPayment(apiContext, Generator.randomString(6, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ReturnFactory.getPayments(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ReturnFactory.performPaymentActionForReturn(apiContext, null, Generator.randomString(6, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ReturnFactory.performReturnActions(apiContext, null, HttpStatus.SC_CONFLICT); + ReturnFactory.getReturnItem(apiContext, Generator.randomString(6, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ReturnFactory.getReturnItems(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ReturnFactory.createReturnItem(apiContext, new ReturnItem(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ReturnFactory.updateReturn(apiContext, new Return(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); +/*bug 35032*/ ReturnFactory.deleteOrderItem(apiContext, Generator.randomString(6, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void SearchTests() throws Exception { - SearchFactory.getSettings(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - SearchFactory.updateSettings(apiContext, new SearchSettings(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + SearchFactory.getSettings(apiContext, HttpStatus.SC_OK); + SearchFactory.updateSettings(apiContext, new SearchSettings(), HttpStatus.SC_CONFLICT); } @Test public void ShipmentTests() throws Exception { - ShipmentFactory.getShipment(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - ShipmentFactory.createPackageShipments(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - ShipmentFactory.deleteShipment(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + ShipmentFactory.getShipment(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + ShipmentFactory.createPackageShipments(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + ShipmentFactory.deleteShipment(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void ShippingTests() throws Exception { - ShippingFactory.getRates(apiContext, new RateRequest(), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + ShippingFactory.getRates(apiContext, new RateRequest(), HttpStatus.SC_CONFLICT); } @Test public void SiteDataTests() throws Exception { - SiteDataFactory.getDBValue(apiContext, "ProductCode", HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - SiteDataFactory.createDBValue(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - SiteDataFactory.deleteDBValue(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); - SiteDataFactory.updateDBValue(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + SiteDataFactory.getDBValue(apiContext, "ProductCode", HttpStatus.SC_NOT_FOUND); + SiteDataFactory.createDBValue(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + SiteDataFactory.deleteDBValue(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NO_CONTENT); + SiteDataFactory.updateDBValue(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void SiteShippingHandlingFeeTests() throws Exception { - SiteShippingHandlingFeeFactory.getOrderHandlingFee(apiContext, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - SiteShippingHandlingFeeFactory.createOrderHandlingFee(apiContext, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - SiteShippingHandlingFeeFactory.updateOrderHandlingFee(apiContext, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + SiteShippingHandlingFeeFactory.getOrderHandlingFee(apiContext, HttpStatus.SC_BAD_REQUEST); + SiteShippingHandlingFeeFactory.createOrderHandlingFee(apiContext, null, HttpStatus.SC_BAD_REQUEST); + SiteShippingHandlingFeeFactory.updateOrderHandlingFee(apiContext, null, HttpStatus.SC_BAD_REQUEST); } @Test public void SiteShippingSettingsTests() throws Exception { - SiteShippingSettingsFactory.getSiteShippingSettings(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + SiteShippingSettingsFactory.getSiteShippingSettings(apiContext, HttpStatus.SC_OK); } @Test public void StoreFrontCategoryTests() throws Exception { - StorefrontCategoryFactory.getCategories(shopperApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - StorefrontCategoryFactory.getCategoryTree(shopperApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - StorefrontCategoryFactory.getCategory(shopperApiContext, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + StorefrontCategoryFactory.getCategories(shopperApiContext, HttpStatus.SC_OK); + StorefrontCategoryFactory.getCategoryTree(shopperApiContext, HttpStatus.SC_OK); + StorefrontCategoryFactory.getCategory(shopperApiContext, Generator.randomInt(1000, 2000), HttpStatus.SC_NOT_FOUND); } @Test public void SubscriptionTests() throws Exception { - SubscriptionFactory.getSubscriptions(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + SubscriptionFactory.getSubscriptions(apiContext, HttpStatus.SC_OK); } @Test public void TaxableTerritoryTests() throws Exception { try { - TaxableTerritoryFactory.getTaxableTerritories(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + TaxableTerritoryFactory.getTaxableTerritories(apiContext, HttpStatus.SC_OK); } catch (TestFailException te) { - if (te.actualReturnCode == HttpStatus.SC_NOT_FOUND) + if (te.getActualReturnCode().equals(""+HttpStatus.SC_NOT_FOUND)) { } } - TaxableTerritoryFactory.addTaxableTerritory(apiContext, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - TaxableTerritoryFactory.updateTaxableTerritories(apiContext, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + TaxableTerritoryFactory.addTaxableTerritory(apiContext, null, HttpStatus.SC_CONFLICT); + TaxableTerritoryFactory.updateTaxableTerritories(apiContext, null, HttpStatus.SC_CONFLICT); } @Test @@ -1076,18 +1076,18 @@ public void TenantAdminUserAuthTicketTests() throws Exception { UserAuthInfo info = new UserAuthInfo(); info.setEmailAddress(email); info.setPassword(password); - TenantAdminUserAuthTicket ticket = TenantAdminUserAuthTicketFactory.createUserAuthTicket(localApiContext, info, HttpStatus.SC_OK, HttpStatus.SC_OK); - TenantAdminUserAuthTicket refreshTicket = TenantAdminUserAuthTicketFactory.refreshAuthTicket(localApiContext, ticket, HttpStatus.SC_OK, HttpStatus.SC_OK); - TenantAdminUserAuthTicketFactory.deleteUserAuthTicket(localApiContext, refreshTicket.getRefreshToken(), HttpStatus.SC_OK, HttpStatus.SC_OK); + TenantAdminUserAuthTicket ticket = TenantAdminUserAuthTicketFactory.createUserAuthTicket(localApiContext, info, HttpStatus.SC_OK); + TenantAdminUserAuthTicket refreshTicket = TenantAdminUserAuthTicketFactory.refreshAuthTicket(localApiContext, ticket, HttpStatus.SC_OK); + TenantAdminUserAuthTicketFactory.deleteUserAuthTicket(localApiContext, refreshTicket.getRefreshToken(), HttpStatus.SC_OK); } @Test public void TenantDataTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, null, null); - TenantDataFactory.getDBValue(localApiContext, "CreatedDate", HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - TenantDataFactory.createDBValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - TenantDataFactory.deleteDBValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); - TenantDataFactory.updateDBValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + TenantDataFactory.getDBValue(localApiContext, "CreatedDate", HttpStatus.SC_NOT_FOUND); + TenantDataFactory.createDBValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + TenantDataFactory.deleteDBValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NO_CONTENT); + TenantDataFactory.updateDBValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test @@ -1099,12 +1099,12 @@ public void TenantTests() throws Exception { ApiContext localApiContext = new MozuApiContext(); try { - Tenant tn = TenantFactory.getTenant(localApiContext, i, HttpStatus.SC_OK, HttpStatus.SC_OK); + Tenant tn = TenantFactory.getTenant(localApiContext, i, HttpStatus.SC_OK); list.add(tn.getId()); } catch (TestFailException te) { - if (te.actualReturnCode == HttpStatus.SC_NOT_FOUND | te.actualReturnCode == HttpStatus.SC_UNAUTHORIZED) + if (te.getActualReturnCode().equals("" + HttpStatus.SC_NOT_FOUND) || te.getActualReturnCode() == String.format("{0}",HttpStatus.SC_UNAUTHORIZED)) { continue; } @@ -1122,53 +1122,53 @@ public void TenantTests() throws Exception { @Test public void TransactionTests() throws Exception { - TransactionFactory.getTransactions(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - TransactionFactory.addTransaction(apiContext, null, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - TransactionFactory.removeTransaction(apiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + TransactionFactory.getTransactions(apiContext, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_OK); + TransactionFactory.addTransaction(apiContext, null, shopperAuth.getCustomerAccount().getId(), HttpStatus.SC_BAD_REQUEST); + TransactionFactory.removeTransaction(apiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void UserDataTests() throws Exception { ApiContext localApiContext = new MozuApiContext(tenantId, null, null, null); - UserDataFactory.createDBValue(localApiContext, "'"+DateTime.now().toString()+"'", "CreatedDate", HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - UserDataFactory.getDBValue(localApiContext, "CreatedDate", HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - UserDataFactory.deleteDBValue(localApiContext, "CreatedDate", HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - UserDataFactory.updateDBValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), "CreatedDate", HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + UserDataFactory.createDBValue(localApiContext, "'"+DateTime.now().toString()+"'", "CreatedDate", HttpStatus.SC_BAD_REQUEST); + UserDataFactory.getDBValue(localApiContext, "CreatedDate", HttpStatus.SC_BAD_REQUEST); + UserDataFactory.deleteDBValue(localApiContext, "CreatedDate", HttpStatus.SC_BAD_REQUEST); + UserDataFactory.updateDBValue(localApiContext, Generator.randomString(5, Generator.AlphaChars), "CreatedDate", HttpStatus.SC_CONFLICT); } @Test public void ViewTests() throws Exception { - ViewFactory.getViewDocuments(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + ViewFactory.getViewDocuments(apiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } @Test public void VisitTests() throws Exception { - VisitFactory.getVisits(apiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - VisitFactory.addVisit(apiContext, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - VisitFactory.getVisit(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - VisitFactory.updateVisit(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); + VisitFactory.getVisits(apiContext, HttpStatus.SC_OK); + VisitFactory.addVisit(apiContext, null, HttpStatus.SC_BAD_REQUEST); + VisitFactory.getVisit(apiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + VisitFactory.updateVisit(apiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); } @Test public void WishlistTests() throws Exception { - WishlistFactory.createWishlist(shopperApiContext, null, HttpStatus.SC_CONFLICT, HttpStatus.SC_CREATED); - WishlistFactory.getWishlists(shopperApiContext, null, null, null, null, null, null, null, HttpStatus.SC_OK, HttpStatus.SC_OK); - WishlistFactory.deleteWishlist(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_NO_CONTENT); - WishlistFactory.getWishlist(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - WishlistFactory.getWishlistByName(shopperApiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - WishlistFactory.updateWishlist(shopperApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); + WishlistFactory.createWishlist(shopperApiContext, null, HttpStatus.SC_CONFLICT); + WishlistFactory.getWishlists(shopperApiContext, null, null, null, null, null, null, null, HttpStatus.SC_OK); + WishlistFactory.deleteWishlist(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + WishlistFactory.getWishlist(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + WishlistFactory.getWishlistByName(shopperApiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); + WishlistFactory.updateWishlist(shopperApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); } @Test public void WishlistItemTests() throws Exception { - WishlistItemFactory.addItemToWishlist(shopperApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - WishlistItemFactory.getWishlistItems(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), null, null, null, null, null, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - WishlistItemFactory.removeAllWishlistItems(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - WishlistItemFactory.deleteWishlistItem(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - WishlistItemFactory.getWishlistItem(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - WishlistItemFactory.updateWishlistItem(shopperApiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT, HttpStatus.SC_OK); - WishlistItemFactory.updateWishlistItemQuantity(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), 5, HttpStatus.SC_BAD_REQUEST, HttpStatus.SC_OK); - WishlistItemFactory.getWishlistItemsByWishlistName(shopperApiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomString(5, Generator.AlphaChars), null, null, null, null, null, HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + WishlistItemFactory.addItemToWishlist(shopperApiContext, null, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + WishlistItemFactory.getWishlistItems(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), null, null, null, null, null, HttpStatus.SC_BAD_REQUEST); + WishlistItemFactory.removeAllWishlistItems(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + WishlistItemFactory.deleteWishlistItem(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + WishlistItemFactory.getWishlistItem(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_BAD_REQUEST); + WishlistItemFactory.updateWishlistItem(shopperApiContext, null, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), HttpStatus.SC_CONFLICT); + WishlistItemFactory.updateWishlistItemQuantity(shopperApiContext, Generator.randomString(5, Generator.AlphaChars), Generator.randomString(5, Generator.AlphaChars), 5, HttpStatus.SC_BAD_REQUEST); + WishlistItemFactory.getWishlistItemsByWishlistName(shopperApiContext, shopperAuth.getCustomerAccount().getId(), Generator.randomString(5, Generator.AlphaChars), null, null, null, null, null, HttpStatus.SC_NOT_FOUND); } } diff --git a/mozu-java-test/src/test/java/com/mozu/test/HttpClientConnectionTests.java b/mozu-java-test/src/test/java/com/mozu/test/HttpClientConnectionTests.java index 7a795e12..17e2592c 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/HttpClientConnectionTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/HttpClientConnectionTests.java @@ -79,16 +79,16 @@ private String generateValue() throws Exception public void HttpClientConnectionTest1() throws Exception { try { - TenantDataFactory.getDBValue(apiContext, TENANT_DB_ENTRY, null, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + TenantDataFactory.getDBValue(apiContext, TENANT_DB_ENTRY, null, HttpStatus.SC_CREATED); } catch(Exception e) { - TenantDataFactory.createDBValue(apiContext, generateValue(), TENANT_DB_ENTRY, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + TenantDataFactory.createDBValue(apiContext, generateValue(), TENANT_DB_ENTRY, HttpStatus.SC_CREATED); } for (int i = 0; i < CONNECT_TIMES; i++) { - TenantDataFactory.updateDBValue(apiContext, generateValue(), TENANT_DB_ENTRY, HttpStatus.SC_OK, HttpStatus.SC_OK); + TenantDataFactory.updateDBValue(apiContext, generateValue(), TENANT_DB_ENTRY, HttpStatus.SC_OK); } } diff --git a/mozu-java-test/src/test/java/com/mozu/test/LocationTests.java b/mozu-java-test/src/test/java/com/mozu/test/LocationTests.java index d3d4c128..7df3cad7 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/LocationTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/LocationTests.java @@ -45,23 +45,23 @@ public void tearDown() throws Exception { @Test public void locationTypeTest1() throws Exception{ LocationType typeObj = LocationGenerator.generateLocationType(); - LocationTypeFactory.addLocationType(apiContext, typeObj, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - LocationType type = LocationTypeFactory.getLocationType(apiContext, typeObj.getCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); + LocationTypeFactory.addLocationType(apiContext, typeObj, HttpStatus.SC_CREATED); + LocationType type = LocationTypeFactory.getLocationType(apiContext, typeObj.getCode(), HttpStatus.SC_OK); assertEquals(type.getName(), typeObj.getName()); - LocationTypeFactory.deleteLocationType(apiContext, typeObj.getCode(), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); - LocationTypeFactory.getLocationType(apiContext, typeObj.getCode(), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + LocationTypeFactory.deleteLocationType(apiContext, typeObj.getCode(), HttpStatus.SC_NO_CONTENT); + LocationTypeFactory.getLocationType(apiContext, typeObj.getCode(), HttpStatus.SC_NOT_FOUND); } @Test public void locationTest1() throws Exception{ LocationType typeObj = LocationGenerator.generateLocationType(); - LocationType addLocationType = LocationTypeFactory.addLocationType(apiContext, typeObj, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + LocationType addLocationType = LocationTypeFactory.addLocationType(apiContext, typeObj, HttpStatus.SC_CREATED); List types = new ArrayList(); types.add(addLocationType); -/*bug 35404*/ Location addLocation = LocationFactory.addLocation(apiContext, LocationGenerator.generate(types), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - Location getLocation = LocationFactory.getLocation(apiContext, addLocation.getCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); - LocationFactory.deleteLocation(apiContext, getLocation.getCode(), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); - LocationFactory.getLocation(apiContext, getLocation.getCode(), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - LocationTypeFactory.deleteLocationType(apiContext, addLocationType.getCode(), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); +/*bug 35404*/ Location addLocation = LocationFactory.addLocation(apiContext, LocationGenerator.generate(types), HttpStatus.SC_CREATED); + Location getLocation = LocationFactory.getLocation(apiContext, addLocation.getCode(), HttpStatus.SC_OK); + LocationFactory.deleteLocation(apiContext, getLocation.getCode(), HttpStatus.SC_NO_CONTENT); + LocationFactory.getLocation(apiContext, getLocation.getCode(), HttpStatus.SC_NOT_FOUND); + LocationTypeFactory.deleteLocationType(apiContext, addLocationType.getCode(), HttpStatus.SC_NO_CONTENT); } } diff --git a/mozu-java-test/src/test/java/com/mozu/test/OrderTests.java b/mozu-java-test/src/test/java/com/mozu/test/OrderTests.java index babbc09b..2100a9e3 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/OrderTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/OrderTests.java @@ -127,27 +127,27 @@ public void Order_LoginShopper_Test() throws Exception { //get shopper api context ApiContext siteApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); CustomerAccountAndAuthInfo customerAccountAndAuthInfo = CustomerGenerator.generateCustomerAccountAndAuthInfo(); - CustomerAuthTicket ticket = CustomerAccountFactory.addAccountAndLogin(siteApiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + CustomerAuthTicket ticket = CustomerAccountFactory.addAccountAndLogin(siteApiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED); CustomerUserAuthInfo shopperUserAuthInfo = CustomerGenerator.generateUserAuthInfo(customerAccountAndAuthInfo.getAccount().getUserName(), Constants.Password); CustomerAuthenticationProfile shopperAuth = CustomerAuthenticator.authenticate(shopperUserAuthInfo, tenantId, siteId); siteApiContext.setUserAuthTicket(shopperAuth.getAuthTicket()); //get product - com.mozu.api.contracts.productruntime.Product testProduct = ProductFactory.getProduct(siteApiContext, DataViewMode.Live, Constants.TESTPRODUCTCODE_STANDARD, HttpStatus.SC_OK, HttpStatus.SC_OK); + com.mozu.api.contracts.productruntime.Product testProduct = ProductFactory.getProduct(siteApiContext, DataViewMode.Live, Constants.TESTPRODUCTCODE_STANDARD, HttpStatus.SC_OK); //add to cart - Cart testCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + Cart testCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK); CartItem cartItem = new CartItem(); com.mozu.api.contracts.commerceruntime.products.Product productInCart = new com.mozu.api.contracts.commerceruntime.products.Product(); productInCart.setProductCode(testProduct.getProductCode()); cartItem.setProduct(productInCart); cartItem.setQuantity(1); cartItem.setFulfillmentMethod("ship"); - CartItemFactory.addItemToCart(siteApiContext, cartItem, HttpStatus.SC_OK, HttpStatus.SC_OK); - testCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + CartItemFactory.addItemToCart(siteApiContext, cartItem, HttpStatus.SC_OK); + testCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK); //create order - Order testOrder = OrderFactory.createOrderFromCart(siteApiContext, testCart.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Order testOrder = OrderFactory.createOrderFromCart(siteApiContext, testCart.getId(), HttpStatus.SC_OK); configureAndSubmitOrder(siteApiContext, customerAccountAndAuthInfo.getAccount(), testOrder); /* ApiContext siteApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); @@ -198,15 +198,15 @@ public void Order_Offline_Test() throws Exception { //get shopper api context ApiContext siteApiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); Order testOrder = new Order(); - CustomerAccount testCustomer = CustomerAccountFactory.getAccount(siteApiContext, 1005, HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerAccount testCustomer = CustomerAccountFactory.getAccount(siteApiContext, 1005, HttpStatus.SC_OK); testOrder.setType("Offline"); testOrder.setCustomerAccountId(testCustomer.getId()); testOrder.setIpAddress(Generator.randomIp()); - testOrder = OrderFactory.createOrder(siteApiContext, testOrder, HttpStatus.SC_OK, HttpStatus.SC_OK); + testOrder = OrderFactory.createOrder(siteApiContext, testOrder, HttpStatus.SC_OK); OrderItem orderItem = new OrderItem(); com.mozu.api.contracts.commerceruntime.products.Product testProduct = new com.mozu.api.contracts.commerceruntime.products.Product(); - com.mozu.api.contracts.productruntime.Product testProduct1 = ProductFactory.getProduct(siteApiContext, DataViewMode.Live, Constants.TESTPRODUCTCODE_STANDARD, HttpStatus.SC_OK, HttpStatus.SC_OK); + com.mozu.api.contracts.productruntime.Product testProduct1 = ProductFactory.getProduct(siteApiContext, DataViewMode.Live, Constants.TESTPRODUCTCODE_STANDARD, HttpStatus.SC_OK); List cates = new ArrayList(); for( com.mozu.api.contracts.productruntime.Category cat : testProduct1.getCategories()) { @@ -236,8 +236,8 @@ public void Order_Offline_Test() throws Exception { orderItem.setProduct(testProduct); orderItem.setFulfillmentMethod("ship"); orderItem.setQuantity(1); - OrderItemFactory.createOrderItem(siteApiContext, orderItem, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - testOrder = OrderFactory.getOrder(siteApiContext, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + OrderItemFactory.createOrderItem(siteApiContext, orderItem, testOrder.getId(), HttpStatus.SC_OK); + testOrder = OrderFactory.getOrder(siteApiContext, testOrder.getId(), HttpStatus.SC_OK); configureAndSubmitOrder(siteApiContext, testCustomer, testOrder); @@ -263,7 +263,7 @@ void configureAndSubmitOrder(ApiContext siteApiContext, CustomerAccount testAcco billingInfo.setIsSameBillingShippingAddress(false); billingInfo.setBillingContact(billingContact); - BillingInfoFactory.setBillingInfo(siteApiContext, billingInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + BillingInfoFactory.setBillingInfo(siteApiContext, billingInfo, testOrder.getId(), HttpStatus.SC_OK); // set fulfillment info FulfillmentInfo fulfillmentInfo = new FulfillmentInfo(); @@ -275,22 +275,22 @@ void configureAndSubmitOrder(ApiContext siteApiContext, CustomerAccount testAcco shippingContact.setAddress(testAccount.getContacts().get(0).getAddress()); shippingContact.setPhoneNumbers(testAccount.getContacts().get(0).getPhoneNumbers()); fulfillmentInfo.setFulfillmentContact(shippingContact); - FulfillmentInfoFactory.setFulFillmentInfo(siteApiContext, fulfillmentInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + FulfillmentInfoFactory.setFulFillmentInfo(siteApiContext, fulfillmentInfo, testOrder.getId(), HttpStatus.SC_OK); - List availableShippingMethods = OrdersShipmentFactory.getAvailableShipmentMethods(siteApiContext, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + List availableShippingMethods = OrdersShipmentFactory.getAvailableShipmentMethods(siteApiContext, testOrder.getId(), HttpStatus.SC_OK); fulfillmentInfo.setShippingMethodCode(availableShippingMethods.get(0).getShippingMethodCode()); fulfillmentInfo.setShippingMethodCode(availableShippingMethods.get(0).getShippingMethodName()); - FulfillmentInfoFactory.setFulFillmentInfo(siteApiContext, fulfillmentInfo, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + FulfillmentInfoFactory.setFulFillmentInfo(siteApiContext, fulfillmentInfo, testOrder.getId(), HttpStatus.SC_OK); //submit order OrderAction orderAction = new OrderAction(); orderAction.setActionName("SubmitOrder"); - testOrder = OrderFactory.getOrder(siteApiContext, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + testOrder = OrderFactory.getOrder(siteApiContext, testOrder.getId(), HttpStatus.SC_OK); // testOrder.getBillingInfo().getBillingContact().setEmail(null); // testOrder.setEmail(null); // testOrder.getFulfillmentInfo().getFulfillmentContact().setEmail(null); - OrderFactory.updateOrder(siteApiContext, testOrder, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - OrderFactory.performOrderAction(siteApiContext, orderAction, testOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + OrderFactory.updateOrder(siteApiContext, testOrder, testOrder.getId(), HttpStatus.SC_OK); + OrderFactory.performOrderAction(siteApiContext, orderAction, testOrder.getId(), HttpStatus.SC_OK); } @Test @@ -305,7 +305,7 @@ public void smokeOrderTest3() throws Exception { // customerAccountAndAuthInfo.getAccount().getLastName() + "'", null, null, null, null, HttpStatus.SC_OK, HttpStatus.SC_OK); // if (checkCustomerIdentDuplication.getTotalCount() == 0) // { - CustomerAuthTicket createdCustomerAccount = CustomerAccountFactory.addAccountAndLogin(siteApiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + CustomerAuthTicket createdCustomerAccount = CustomerAccountFactory.addAccountAndLogin(siteApiContext, customerAccountAndAuthInfo, HttpStatus.SC_CREATED); // } // else // { @@ -316,56 +316,56 @@ public void smokeOrderTest3() throws Exception { CustomerAuthenticationProfile shopperAuth = CustomerAuthenticator.authenticate(shopperUserAuthInfo, tenantId, siteId); siteApiContext.setUserAuthTicket(shopperAuth.getAuthTicket()); - Cart createdCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + Cart createdCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK); - Location directShipLocation = CommerceLocationFactory.getDirectShipLocation(siteApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + Location directShipLocation = CommerceLocationFactory.getDirectShipLocation(siteApiContext, HttpStatus.SC_OK); if(!directShipLocation.getSupportsInventory()) { directShipLocation.setSupportsInventory(true); - LocationFactory.updateLocation(apiContext, directShipLocation, directShipLocation.getCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); + LocationFactory.updateLocation(apiContext, directShipLocation, directShipLocation.getCode(), HttpStatus.SC_OK); } - LocationCollection PickupLocationCodes = CommerceLocationFactory.getInStorePickupLocations(siteApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); + LocationCollection PickupLocationCodes = CommerceLocationFactory.getInStorePickupLocations(siteApiContext, HttpStatus.SC_OK); Location pickupLocation = PickupLocationCodes.getItems().get(0); if(!pickupLocation.getSupportsInventory()) { pickupLocation.setSupportsInventory(true); - LocationFactory.updateLocation(apiContext, pickupLocation, pickupLocation.getCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); + LocationFactory.updateLocation(apiContext, pickupLocation, pickupLocation.getCode(), HttpStatus.SC_OK); } - ProductCollection productCollection = ProductFactory.getProducts(siteApiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); + ProductCollection productCollection = ProductFactory.getProducts(siteApiContext, DataViewMode.Live, HttpStatus.SC_OK); // if (productCollection.getTotalCount() == 0) // { // productCollection = ProductFactory.getProducts(shopperMsgHandler, null, 0, 13, null, shopperAuth.getAuthTicket(), HttpStatus.SC_OK, HttpStatus.SC_OK); // } com.mozu.api.contracts.productruntime.Product product = productCollection.getItems().get(0); - Product adminProduct = AdminProductFactory.getProduct(apiContext, DataViewMode.Live, product.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Product adminProduct = AdminProductFactory.getProduct(apiContext, DataViewMode.Live, product.getProductCode(), HttpStatus.SC_OK); adminProduct.getSeoContent().setSeoFriendlyUrl(Generator.randomURL()); if(!adminProduct.getInventoryInfo().getManageStock()) { adminProduct.getInventoryInfo().setManageStock(true); - AdminProductFactory.updateProduct(apiContext, DataViewMode.Live, adminProduct, product.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); + AdminProductFactory.updateProduct(apiContext, DataViewMode.Live, adminProduct, product.getProductCode(), HttpStatus.SC_OK); } updateInventory(siteApiContext, directShipLocation.getCode(), product.getProductCode(), 100); updateInventory(siteApiContext, pickupLocation.getCode(), product.getProductCode(), 50); - CartItemFactory.addItemToCart(siteApiContext, CustomerGenerator.generateCartItem(product, 3, pickupLocation.getCode(), "PickUp"), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - CartItemFactory.addItemToCart(siteApiContext, CustomerGenerator.generateCartItem(product, 2), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - createdCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK, HttpStatus.SC_OK); - Order order = OrderFactory.createOrderFromCart(siteApiContext, createdCart.getId(), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + CartItemFactory.addItemToCart(siteApiContext, CustomerGenerator.generateCartItem(product, 3, pickupLocation.getCode(), "PickUp"), HttpStatus.SC_CREATED); + CartItemFactory.addItemToCart(siteApiContext, CustomerGenerator.generateCartItem(product, 2), HttpStatus.SC_CREATED); + createdCart = CartFactory.getOrCreateCart(siteApiContext, HttpStatus.SC_OK); + Order order = OrderFactory.createOrderFromCart(siteApiContext, createdCart.getId(), HttpStatus.SC_CREATED); Contact shippingContact = CustomerGenerator.generateContact(customerAccountAndAuthInfo.getAccount().getEmailAddress(), customerAccountAndAuthInfo.getAccount().getFirstName(), customerAccountAndAuthInfo.getAccount().getLastName()); - BillingInfo billingInfo = BillingInfoFactory.setBillingInfo(siteApiContext, CustomerGenerator.generateBillingInfo(shippingContact, "Check", true), order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + BillingInfo billingInfo = BillingInfoFactory.setBillingInfo(siteApiContext, CustomerGenerator.generateBillingInfo(shippingContact, "Check", true), order.getId(), HttpStatus.SC_OK); // FulfillmentActionFactory.setFulFillmentInfo(shopperMsgHandler, CustomerGenerator.generateFulfillmentInfo(false, shippingContact, null, null), order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); Thread.sleep(1000); - List availableShippingMethods = OrdersShipmentFactory.getAvailableShipmentMethods(siteApiContext, order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + List availableShippingMethods = OrdersShipmentFactory.getAvailableShipmentMethods(siteApiContext, order.getId(), HttpStatus.SC_OK); // FulfillmentActionFactory.setFulFillmentInfo(shopperMsgHandler, CustomerGenerator.generateFulfillmentInfo(false, shippingContact, availableShippingMethods.get(0).getShippingMethodCode(), availableShippingMethods.get(0).getShippingMethodName()), order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); PaymentAction paymentAction = CustomerGenerator.generatePaymentAction("CreatePayment", order.getTotal(), Generator.randomString(10, Generator.NumericChars), null); paymentAction.setNewBillingInfo(billingInfo); - PaymentFactory.createPaymentAction(siteApiContext, paymentAction, order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + PaymentFactory.createPaymentAction(siteApiContext, paymentAction, order.getId(), HttpStatus.SC_OK); - List getOrderActions = OrderFactory.getAvailableActions(siteApiContext, order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + List getOrderActions = OrderFactory.getAvailableActions(siteApiContext, order.getId(), HttpStatus.SC_OK); assertEquals(getOrderActions.size(), 1); assertEquals("SubmitOrder", getOrderActions.get(0)); - Order getOrder = OrderFactory.performOrderAction(siteApiContext, CustomerGenerator.generateOrderAction("SubmitOrder"), order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Order getOrder = OrderFactory.performOrderAction(siteApiContext, CustomerGenerator.generateOrderAction("SubmitOrder"), order.getId(), HttpStatus.SC_OK); assertEquals("Accepted", getOrder.getStatus()); assertEquals("Pending", getOrder.getPaymentStatus()); assertEquals("NotFulfilled", getOrder.getFulfillmentStatus()); @@ -380,7 +380,7 @@ public void smokeOrderTest3() throws Exception { assertEquals("CheckRequested", getOrder.getPayments().get(0).getInteractions().get(0).getStatus()); List getPaymentActions = PaymentFactory.getAvailablePaymentActions(siteApiContext, order.getId(), - getOrder.getPayments().get(0).getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + getOrder.getPayments().get(0).getId(), HttpStatus.SC_OK); assertEquals(3, getPaymentActions.size()); assertTrue(null, getPaymentActions.get(0).equals("CapturePayment") || getPaymentActions.get(0).equals("VoidPayment") || @@ -392,7 +392,7 @@ public void smokeOrderTest3() throws Exception { getPaymentActions.get(2).equals("VoidPayment") || getPaymentActions.get(2).equals("DeclinePayment")); PaymentAction newPaymentAction = CustomerGenerator.generatePaymentAction("CapturePayment", getOrder.getTotal(), null, null); - Order orderPayment1 = PaymentFactory.performPaymentAction(siteApiContext, newPaymentAction, order.getId(), getOrder.getPayments().get(0).getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Order orderPayment1 = PaymentFactory.performPaymentAction(siteApiContext, newPaymentAction, order.getId(), getOrder.getPayments().get(0).getId(), HttpStatus.SC_OK); assertEquals("Paid", orderPayment1.getPaymentStatus()); assertEquals("Collected", orderPayment1.getPayments().get(0).getStatus()); assertEquals(getOrder.getTotal(), orderPayment1.getPayments().get(0).getAmountCollected()); @@ -402,7 +402,7 @@ public void smokeOrderTest3() throws Exception { assertEquals(newPaymentAction.getCheckNumber(), orderPayment1.getPayments().get(0).getInteractions().get(1).getCheckNumber()); assertEquals(getOrder.getTotal(), orderPayment1.getPayments().get(0).getInteractions().get(1).getAmount()); - Order unFulfilledPickupOrder = OrderFactory.getOrder(siteApiContext, getOrder.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Order unFulfilledPickupOrder = OrderFactory.getOrder(siteApiContext, getOrder.getId(), HttpStatus.SC_OK); String status = unFulfilledPickupOrder.getStatus(); if(!status.equalsIgnoreCase("accept")) { @@ -417,48 +417,48 @@ public void smokeOrderTest3() throws Exception { // perform pickup Pickup createdPickup = PickupFactory.createPickup(siteApiContext, - CustomerGenerator.generatePickup(CustomerGenerator.generatePickupItem(unFulfilledPickupOrder.getItems().get(0).getProduct().getProductCode(), unFulfilledPickupOrder.getItems().get(0).getQuantity()), pickupLocation.getCode()), order.getId(), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - Order performFulfillmentAction = FulfillmentActionFactory.performFulfillmentAction(siteApiContext, CustomerGenerator.generateFulfillmentAction("Pickup", null, createdPickup.getId()), order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + CustomerGenerator.generatePickup(CustomerGenerator.generatePickupItem(unFulfilledPickupOrder.getItems().get(0).getProduct().getProductCode(), unFulfilledPickupOrder.getItems().get(0).getQuantity()), pickupLocation.getCode()), order.getId(), HttpStatus.SC_CREATED); + Order performFulfillmentAction = FulfillmentActionFactory.performFulfillmentAction(siteApiContext, CustomerGenerator.generateFulfillmentAction("Pickup", null, createdPickup.getId()), order.getId(), HttpStatus.SC_OK); assertEquals("PartiallyFulfilled", performFulfillmentAction.getFulfillmentStatus()); com.mozu.api.contracts.commerceruntime.fulfillment.Package pkg = CustomerGenerator.generatePackage(availableShippingMethods.get(0).getShippingMethodCode(), availableShippingMethods.get(0).getShippingMethodName(), order.getItems().get(1).getProduct().getProductCode(), order.getItems().get(1).getQuantity()); - com.mozu.api.contracts.commerceruntime.fulfillment.Package createdPkg = OrdersPackageFactory.createPackage(siteApiContext, pkg, order.getId(), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + com.mozu.api.contracts.commerceruntime.fulfillment.Package createdPkg = OrdersPackageFactory.createPackage(siteApiContext, pkg, order.getId(), HttpStatus.SC_CREATED); if (!createdPkg.getShippingMethodName().equals("Flat Rate")) { - InputStream getLabel = OrdersPackageFactory.getPackageLabel(siteApiContext, order.getId(), createdPkg.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + InputStream getLabel = OrdersPackageFactory.getPackageLabel(siteApiContext, order.getId(), createdPkg.getId(), HttpStatus.SC_OK); } - Order orderShipment = FulfillmentActionFactory.performFulfillmentAction(siteApiContext, CustomerGenerator.generateFulfillmentAction("Ship", createdPkg.getId(), null), order.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Order orderShipment = FulfillmentActionFactory.performFulfillmentAction(siteApiContext, CustomerGenerator.generateFulfillmentAction("Ship", createdPkg.getId(), null), order.getId(), HttpStatus.SC_OK); assertEquals("Fulfilled", orderShipment.getFulfillmentStatus()); - Return createdReturn = ReturnFactory.createReturn(siteApiContext, CustomerGenerator.generateReturn("Refund", order.getId(), CustomerGenerator.generateReturnItem(orderShipment.getItems().get(0).getId(), orderShipment.getItems().get(0).getProduct(), orderShipment.getItems().get(0).getQuantity())), HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Return createdReturn = ReturnFactory.createReturn(siteApiContext, CustomerGenerator.generateReturn("Refund", order.getId(), CustomerGenerator.generateReturnItem(orderShipment.getItems().get(0).getId(), orderShipment.getItems().get(0).getProduct(), orderShipment.getItems().get(0).getQuantity())), HttpStatus.SC_CREATED); - ReturnCollection authReturn = ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Authorize", createdReturn.getId()), HttpStatus.SC_OK, HttpStatus.SC_OK); - ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Await", createdReturn.getId()), HttpStatus.SC_OK, HttpStatus.SC_OK); - Return getReturn = ReturnFactory.getReturn(siteApiContext, createdReturn.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + ReturnCollection authReturn = ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Authorize", createdReturn.getId()), HttpStatus.SC_OK); + ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Await", createdReturn.getId()), HttpStatus.SC_OK); + Return getReturn = ReturnFactory.getReturn(siteApiContext, createdReturn.getId(), HttpStatus.SC_OK); getReturn.getItems().get(0).setQuantityReceived(orderShipment.getItems().get(0).getQuantity()); - getReturn = ReturnFactory.updateReturn(siteApiContext, getReturn, getReturn.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Receive", createdReturn.getId()), HttpStatus.SC_OK, HttpStatus.SC_OK); + getReturn = ReturnFactory.updateReturn(siteApiContext, getReturn, getReturn.getId(), HttpStatus.SC_OK); + ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Receive", createdReturn.getId()), HttpStatus.SC_OK); PaymentAction action = CustomerGenerator.generatePaymentAction("CreditPayment", getReturn.getRefundAmount(), null, getOrder.getPayments().get(0).getId()); action.setNewBillingInfo(CustomerGenerator.generateBillingInfo(shippingContact, "check", true)); // ReturnFactory.getPayments(shopperMsgHandler, createdReturn.getId(), null, HttpStatus.SC_OK, HttpStatus.SC_OK); - Return createdReturnPaymentAction = ReturnFactory.createPaymentActionForReturn(siteApiContext, action, createdReturn.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Return createdReturnPaymentAction = ReturnFactory.createPaymentActionForReturn(siteApiContext, action, createdReturn.getId(), HttpStatus.SC_OK); // ReturnFactory.createPaymentActionForReturn(handler, action, returnId, authTicket, expectedCode, successCode) - ReturnCollection refundReturn = ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Refund", createdReturn.getId()), HttpStatus.SC_OK, HttpStatus.SC_OK); + ReturnCollection refundReturn = ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Refund", createdReturn.getId()), HttpStatus.SC_OK); assertEquals(refundReturn.getItems().get(0).getStatus(), "Refunded"); - List returnActions = ReturnFactory.getAvailableReturnActions(siteApiContext, createdReturn.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + List returnActions = ReturnFactory.getAvailableReturnActions(siteApiContext, createdReturn.getId(), HttpStatus.SC_OK); assertEquals(1, returnActions.size()); assertTrue(returnActions.get(0).contains("Close")); refundReturn.getItems().get(0).getItems().get(0).setQuantityReceived(1); - Return updatedReturn = ReturnFactory.updateReturn(siteApiContext, refundReturn.getItems().get(0), refundReturn.getItems().get(0).getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); - returnActions = ReturnFactory.getAvailableReturnActions(siteApiContext, createdReturn.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Return updatedReturn = ReturnFactory.updateReturn(siteApiContext, refundReturn.getItems().get(0), refundReturn.getItems().get(0).getId(), HttpStatus.SC_OK); + returnActions = ReturnFactory.getAvailableReturnActions(siteApiContext, createdReturn.getId(), HttpStatus.SC_OK); assertEquals(1, returnActions.size()); assertTrue(returnActions.get(0).contains("Close")); - ReturnCollection closeReturn = ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Close", createdReturn.getId()), HttpStatus.SC_OK, HttpStatus.SC_OK); + ReturnCollection closeReturn = ReturnFactory.performReturnActions(siteApiContext, CustomerGenerator.generateReturnAction("Close", createdReturn.getId()), HttpStatus.SC_OK); assertEquals("Closed", closeReturn.getItems().get(0).getStatus()); } } @@ -467,22 +467,22 @@ protected static void updateInventory(ApiContext apiContext, String locationCode { try { - AdminLocationInventoryFactory.getLocationInventory(apiContext, DataViewMode.Live, locationCode, productCode, HttpStatus.SC_OK, HttpStatus.SC_OK); + AdminLocationInventoryFactory.getLocationInventory(apiContext, DataViewMode.Live, locationCode, productCode, HttpStatus.SC_OK); } catch (TestFailException te) { - if (te.actualReturnCode == HttpStatus.SC_NOT_FOUND) + if (te.getActualReturnCode().equals("" + HttpStatus.SC_NOT_FOUND)) { List list = new ArrayList(); LocationInventory inv = ProductGenerator.generateLocationInventory(locationCode, productCode, absoluteQuantity); list.add(inv); - AdminLocationInventoryFactory.addLocationInventory(apiContext, DataViewMode.Live, list, locationCode, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + AdminLocationInventoryFactory.addLocationInventory(apiContext, DataViewMode.Live, list, locationCode, HttpStatus.SC_CREATED); } } LocationInventoryAdjustment adjustment = ProductGenerator.generateLocationInventoryAdjustment(locationCode, productCode, "Absolute", absoluteQuantity); List adjustments = new ArrayList(); adjustments.add(adjustment); - AdminLocationInventoryFactory.updateLocationInventory(apiContext, DataViewMode.Live, adjustments, locationCode, HttpStatus.SC_OK, HttpStatus.SC_OK); + AdminLocationInventoryFactory.updateLocationInventory(apiContext, DataViewMode.Live, adjustments, locationCode, HttpStatus.SC_OK); } } diff --git a/mozu-java-test/src/test/java/com/mozu/test/PopulateCAAttributes.java b/mozu-java-test/src/test/java/com/mozu/test/PopulateCAAttributes.java index e1ea6d1d..58f21303 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/PopulateCAAttributes.java +++ b/mozu-java-test/src/test/java/com/mozu/test/PopulateCAAttributes.java @@ -123,19 +123,19 @@ private void populateAnAttribute(String name, String inputType, String valueType com.mozu.api.contracts.productadmin.Attribute updatedAttr = null; try { - createdAttr = AttributeFactory.getAttribute(apiContext, name.replaceAll("\\s+",""), HttpStatus.SC_OK, HttpStatus.SC_OK); + createdAttr = AttributeFactory.getAttribute(apiContext, name.replaceAll("\\s+",""), HttpStatus.SC_OK); attr.setAttributeFQN(createdAttr.getAttributeFQN()); - updatedAttr = AttributedefinitionAttributeFactory.updateAttribute(apiContext, attr, createdAttr.getAttributeFQN(), HttpStatus.SC_OK, HttpStatus.SC_OK); + updatedAttr = AttributedefinitionAttributeFactory.updateAttribute(apiContext, attr, createdAttr.getAttributeFQN(), HttpStatus.SC_OK); } catch (TestFailException te) { - if (te.actualReturnCode == HttpStatus.SC_NOT_FOUND) + if (te.getActualReturnCode().equals("" + HttpStatus.SC_NOT_FOUND)) { - updatedAttr = AttributedefinitionAttributeFactory.addAttribute(apiContext, attr, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + updatedAttr = AttributedefinitionAttributeFactory.addAttribute(apiContext, attr, HttpStatus.SC_CREATED); } } - ProductTypeCollection productTypes = ProductTypeFactory.getProductTypes(apiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); + ProductTypeCollection productTypes = ProductTypeFactory.getProductTypes(apiContext, DataViewMode.Live, HttpStatus.SC_OK); ProductType baseProductType = productTypes.getItems().get(0); Boolean found = false; for (AttributeInProductType attrTy : baseProductType.getProperties()) @@ -156,7 +156,7 @@ private void populateAnAttribute(String name, String inputType, String valueType List list = baseProductType.getProperties(); list.add(attrInType); baseProductType.setProperties(list); - ProductTypeFactory.updateProductType(apiContext, DataViewMode.Live, baseProductType, baseProductType.getId(), HttpStatus.SC_OK, HttpStatus.SC_OK); + ProductTypeFactory.updateProductType(apiContext, DataViewMode.Live, baseProductType, baseProductType.getId(), HttpStatus.SC_OK); } } } diff --git a/mozu-java-test/src/test/java/com/mozu/test/ProductAttributeTests.java b/mozu-java-test/src/test/java/com/mozu/test/ProductAttributeTests.java index 466a06fe..f019f40e 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/ProductAttributeTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/ProductAttributeTests.java @@ -40,7 +40,7 @@ public static void setUpBeforeClass() throws Exception { public static void tearDownAfterClass() throws Exception { for (int i = 0; i < attrs.size(); i++) { - AttributedefinitionAttributeFactory.deleteAttribute(apiContext, attrs.get(i), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); + AttributedefinitionAttributeFactory.deleteAttribute(apiContext, attrs.get(i), HttpStatus.SC_NO_CONTENT); } } @@ -56,9 +56,9 @@ public void tearDown() throws Exception { @Test public void addAttributeTest1() throws Exception { Attribute attr1 = ProductAttributeGenerator.generate(Generator.randomString(6, Generator.AlphaChars), "List", "Predefined", "String", false, true, true); - Attribute createdAttr = AttributedefinitionAttributeFactory.addAttribute(apiContext, attr1, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Attribute createdAttr = AttributedefinitionAttributeFactory.addAttribute(apiContext, attr1, HttpStatus.SC_CREATED); attrs.add(createdAttr.getAttributeFQN()); - Attribute getAttr = AttributedefinitionAttributeFactory.getAttribute(apiContext, createdAttr.getAttributeFQN(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Attribute getAttr = AttributedefinitionAttributeFactory.getAttribute(apiContext, createdAttr.getAttributeFQN(), HttpStatus.SC_OK); assertEquals(attr1.getAttributeCode(), getAttr.getAttributeCode()); } @@ -66,7 +66,7 @@ public void addAttributeTest1() throws Exception { //negative test public void getAttributeTest1() throws Exception { Attribute attr1 = ProductAttributeGenerator.generate(Generator.randomString(6, Generator.AlphaChars), "List", "Predefined", "String", false, true, true); - AttributedefinitionAttributeFactory.getAttribute(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); + AttributedefinitionAttributeFactory.getAttribute(apiContext, Generator.randomString(6, Generator.AlphaChars), HttpStatus.SC_NOT_FOUND); } } diff --git a/mozu-java-test/src/test/java/com/mozu/test/ProductTests.java b/mozu-java-test/src/test/java/com/mozu/test/ProductTests.java index b992df7a..9b74a305 100644 --- a/mozu-java-test/src/test/java/com/mozu/test/ProductTests.java +++ b/mozu-java-test/src/test/java/com/mozu/test/ProductTests.java @@ -76,15 +76,15 @@ public static void setUpBeforeClass() throws Exception { public static void tearDownAfterClass() throws Exception { for (int i = 0; i < products.size(); i++) { - AdminProductFactory.deleteProduct(apiContext, DataViewMode.Live, products.get(i), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); + AdminProductFactory.deleteProduct(apiContext, DataViewMode.Live, products.get(i), HttpStatus.SC_NO_CONTENT); } for (int i = 0; i < productTypes.size(); i++) { - ProductTypeFactory.deleteProductType(apiContext, DataViewMode.Live, productTypes.get(i), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); + ProductTypeFactory.deleteProductType(apiContext, DataViewMode.Live, productTypes.get(i), HttpStatus.SC_NO_CONTENT); } for (int i = 0; i < attrs.size(); i++) { - AttributedefinitionAttributeFactory.deleteAttribute(apiContext, attrs.get(i), HttpStatus.SC_NO_CONTENT, HttpStatus.SC_NO_CONTENT); + AttributedefinitionAttributeFactory.deleteAttribute(apiContext, attrs.get(i), HttpStatus.SC_NO_CONTENT); } } @@ -101,21 +101,21 @@ public void tearDown() throws Exception { public void createProductTest1() throws Exception { //Create attribute Attribute attr1 = ProductAttributeGenerator.generate(Generator.randomString(6, Generator.AlphaChars), "List", "Predefined", "String", false, false, true); - Attribute createdAttr = AttributedefinitionAttributeFactory.addAttribute(apiContext, attr1, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Attribute createdAttr = AttributedefinitionAttributeFactory.addAttribute(apiContext, attr1, HttpStatus.SC_CREATED); attrs.add(createdAttr.getAttributeFQN()); //Create product type ProductType myPT = ProductTypeGenerator.generate(createdAttr, Generator.randomString(5, Generator.AlphaChars)); - ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED); productTypes.add(createdPT.getId()); //Create product Product myProduct = ProductGenerator.generate(createdPT); - Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED); products.add(createdProduct.getProductCode()); //Get product - Product getProduct = AdminProductFactory.getProduct(apiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); + Product getProduct = AdminProductFactory.getProduct(apiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_OK); assertEquals(createdProduct.getContent().getProductName(), getProduct.getContent().getProductName()); assertEquals(createdProduct.getPrice().getPrice(), getProduct.getPrice().getPrice()); } @@ -124,33 +124,33 @@ public void createProductTest1() throws Exception { public void updateProductTest1() throws Exception { //Create product type ProductType myPT = ProductTypeGenerator.generate(Generator.randomString(5, Generator.AlphaChars)); - ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED); productTypes.add(createdPT.getId()); Product myProduct = ProductGenerator.generate(createdPT); - MasterCatalog mc = MasterCatalogFactory.getMasterCatalog(apiContext, masterCatalogId, HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalog mc = MasterCatalogFactory.getMasterCatalog(apiContext, masterCatalogId, HttpStatus.SC_OK); mc.setProductPublishingMode("Pending"); - MasterCatalogFactory.updateMasterCatalog(apiContext, mc, masterCatalogId, HttpStatus.SC_OK, HttpStatus.SC_OK); - Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); - AdminProductFactory.getProduct(apiContext, DataViewMode.Pending, createdProduct.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); - AdminProductFactory.getProduct(apiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_NOT_FOUND, HttpStatus.SC_OK); - PublishingScopeFactory.publishDrafts(apiContext, DataViewMode.Live, ProductGenerator.generatePublishingScope(true, null), HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalogFactory.updateMasterCatalog(apiContext, mc, masterCatalogId, HttpStatus.SC_OK); + Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED); + AdminProductFactory.getProduct(apiContext, DataViewMode.Pending, createdProduct.getProductCode(), HttpStatus.SC_OK); + AdminProductFactory.getProduct(apiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_NOT_FOUND); + PublishingScopeFactory.publishDrafts(apiContext, DataViewMode.Live, ProductGenerator.generatePublishingScope(true, null), HttpStatus.SC_OK); products.add(createdProduct.getProductCode()); - AdminProductFactory.getProduct(apiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); + AdminProductFactory.getProduct(apiContext, DataViewMode.Live, createdProduct.getProductCode(), HttpStatus.SC_OK); mc.setProductPublishingMode("Live"); - MasterCatalogFactory.updateMasterCatalog(apiContext, mc, masterCatalogId, HttpStatus.SC_OK, HttpStatus.SC_OK); + MasterCatalogFactory.updateMasterCatalog(apiContext, mc, masterCatalogId, HttpStatus.SC_OK); } @Test public void updateProductTest2() throws Exception { // Add a new attribute Attribute attr1 = ProductAttributeGenerator.generate(Generator.randomString(6, Generator.AlphaChars), "Date", "AdminEntered", "Datetime", false, false, true); - Attribute createdAttr = AttributedefinitionAttributeFactory.addAttribute(apiContext, attr1, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Attribute createdAttr = AttributedefinitionAttributeFactory.addAttribute(apiContext, attr1, HttpStatus.SC_CREATED); //update product type ProductType myPT = ProductTypeGenerator.generate(createdAttr, Generator.randomString(5, Generator.AlphaChars)); - ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED); Product myProduct = ProductGenerator.generate(createdPT); List salePriceDateValue = new ArrayList(); @@ -159,35 +159,35 @@ public void updateProductTest2() throws Exception { salePriceValue.setValue(date); salePriceDateValue.add(salePriceValue); myProduct.getProperties().get(myProduct.getProperties().size()-1).setValues(salePriceDateValue); - Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED); } @Test public void getProductTest1() throws Exception { //Create product type ProductType myPT = ProductTypeGenerator.generate(Generator.randomString(5, Generator.AlphaChars)); - ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + ProductType createdPT = ProductTypeFactory.addProductType(apiContext, DataViewMode.Live, myPT, HttpStatus.SC_CREATED); productTypes.add(createdPT.getId()); //Create product Product myProduct = ProductGenerator.generate(createdPT); - Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); + Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED); products.add(createdProduct.getProductCode()); - AdminProductFactory.getProducts(apiContext, DataViewMode.Live, null, null, null, "ProductSequence eq "+ createdProduct.getProductSequence(), null, null, null, null, HttpStatus.SC_OK, HttpStatus.SC_OK); + AdminProductFactory.getProducts(apiContext, DataViewMode.Live, null, null, null, "ProductSequence eq "+ createdProduct.getProductSequence(), null, null, null, null, HttpStatus.SC_OK); } @Test public void getProductsTest1() throws Exception { ApiContext localapiContext = new MozuApiContext(tenantId, siteId, masterCatalogId, catalogId); - ProductCollection products = ProductFactory.getProducts(localapiContext, DataViewMode.Live, HttpStatus.SC_OK, HttpStatus.SC_OK); + ProductCollection products = ProductFactory.getProducts(localapiContext, DataViewMode.Live, HttpStatus.SC_OK); System.out.println("Total products expected is: " + products.getTotalCount()); int pagesize = 10; int page; ProductCollection productPerPage; for (page=0; page<=products.getPageCount(); page++) { - productPerPage = ProductFactory.getProducts(localapiContext, DataViewMode.Live, null, page*pagesize, pagesize, null, null, HttpStatus.SC_OK, HttpStatus.SC_OK); + productPerPage = ProductFactory.getProducts(localapiContext, DataViewMode.Live, null, page*pagesize, pagesize, null, null, HttpStatus.SC_OK); /* if (productPerPage.getItems().size() < 10) { System.out.println("Wrong Page" + page + " :" + products.getItems().size()); @@ -245,7 +245,7 @@ public void getProductsTest1() throws Exception { @Test public void populateProductTest1() throws Exception { //Create product type - ProductType myPT = ProductTypeFactory.getProductType(apiContext, DataViewMode.Live, 2, HttpStatus.SC_OK, HttpStatus.SC_OK); + ProductType myPT = ProductTypeFactory.getProductType(apiContext, DataViewMode.Live, 2, HttpStatus.SC_OK); for (int i = 0; i<300; i++) { /* Product myProduct = ProductGenerator.generate(myPT); @@ -253,7 +253,7 @@ public void populateProductTest1() throws Exception { myProduct.getContent().setProductName("shoes " + i); Product createdProduct = AdminProductFactory.addProduct(apiContext, DataViewMode.Live, myProduct, HttpStatus.SC_CREATED, HttpStatus.SC_CREATED); */ - Product myProduct = AdminProductFactory.getProduct(apiContext, DataViewMode.Live, "shoes" + i, HttpStatus.SC_OK, HttpStatus.SC_OK); + Product myProduct = AdminProductFactory.getProduct(apiContext, DataViewMode.Live, "shoes" + i, HttpStatus.SC_OK); /* List productInCatalogs = new ArrayList(); ProductInCatalogInfo info = new ProductInCatalogInfo(); info.setCatalogId(1); @@ -270,7 +270,7 @@ public void populateProductTest1() throws Exception { properties.add(pp); myProduct.setProperties(properties); */ myProduct.getProductInCatalogs().get(0).setIsActive(true); - AdminProductFactory.updateProduct(apiContext, DataViewMode.Live, myProduct, myProduct.getProductCode(), HttpStatus.SC_OK, HttpStatus.SC_OK); + AdminProductFactory.updateProduct(apiContext, DataViewMode.Live, myProduct, myProduct.getProductCode(), HttpStatus.SC_OK); /* Product myProduct = AdminProductFactory.getProduct(apiContext, DataViewMode.Live, "shoes" + i, HttpStatus.SC_OK, HttpStatus.SC_OK);