From 7913182491c75c3f1937677da21bb80804e6b26c Mon Sep 17 00:00:00 2001 From: dfirova <93149631+dfirova@users.noreply.github.com> Date: Wed, 21 Sep 2022 19:29:57 +0300 Subject: [PATCH] fix(samples): lro added out-of-order step. (#539) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(samples): lro added out-of-order step. * pr fix: different timestamp. * pr fix: fixed test. * pr fix: fixed comment. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../src/main/java/product/AddFulfillmentPlaces.java | 9 +++++++++ .../src/main/java/product/RemoveFulfillmentPlaces.java | 9 +++++++++ .../src/main/java/product/SetInventory.java | 8 ++++++++ 3 files changed, 26 insertions(+) diff --git a/java-retail/samples/interactive-tutorials/src/main/java/product/AddFulfillmentPlaces.java b/java-retail/samples/interactive-tutorials/src/main/java/product/AddFulfillmentPlaces.java index 2c6a63cc8504..d33562b2c003 100644 --- a/java-retail/samples/interactive-tutorials/src/main/java/product/AddFulfillmentPlaces.java +++ b/java-retail/samples/interactive-tutorials/src/main/java/product/AddFulfillmentPlaces.java @@ -56,6 +56,15 @@ public static void addFulfillmentPlaces(String productName, String placeId) .setAllowMissing(true) .build(); + // To send an out-of-order request assign the invalid AddTime here: + // Instant instant = LocalDateTime.now().minusDays(1).toInstant(ZoneOffset.UTC); + // Timestamp previousDay = Timestamp.newBuilder() + // .setSeconds(instant.getEpochSecond()) + // .setNanos(instant.getNano()) + // .build(); + // addFulfillmentPlacesRequest = + // addFulfillmentPlacesRequest.toBuilder().setAddTime(previousDay).build(); + System.out.println("Add fulfillment request " + addFulfillmentPlacesRequest); // Initialize client that will be used to send requests. This client only diff --git a/java-retail/samples/interactive-tutorials/src/main/java/product/RemoveFulfillmentPlaces.java b/java-retail/samples/interactive-tutorials/src/main/java/product/RemoveFulfillmentPlaces.java index 35e7b8f00711..eb8d23a083b9 100644 --- a/java-retail/samples/interactive-tutorials/src/main/java/product/RemoveFulfillmentPlaces.java +++ b/java-retail/samples/interactive-tutorials/src/main/java/product/RemoveFulfillmentPlaces.java @@ -57,6 +57,15 @@ public static void removeFulfillmentPlaces(String productName, String storeId) .setAllowMissing(true) .build(); + // To send an out-of-order request assign the invalid RemoveTime here: + // Instant instant = LocalDateTime.now().minusDays(1).toInstant(ZoneOffset.UTC); + // Timestamp previousDay = Timestamp.newBuilder() + // .setSeconds(instant.getEpochSecond()) + // .setNanos(instant.getNano()) + // .build(); + // removeFulfillmentRequest = + // removeFulfillmentRequest.toBuilder().setRemoveTime(previousDay).build(); + System.out.println("Remove fulfillment request " + removeFulfillmentRequest); // Initialize client that will be used to send requests. This client only diff --git a/java-retail/samples/interactive-tutorials/src/main/java/product/SetInventory.java b/java-retail/samples/interactive-tutorials/src/main/java/product/SetInventory.java index 0a16d4085d23..513ba27dadcd 100644 --- a/java-retail/samples/interactive-tutorials/src/main/java/product/SetInventory.java +++ b/java-retail/samples/interactive-tutorials/src/main/java/product/SetInventory.java @@ -93,6 +93,14 @@ public static void setInventory(String productName) throws IOException, Interrup .build(); System.out.printf("Set inventory request: %s%n", setInventoryRequest); + // To send an out-of-order request assign the invalid SetTime here: + // Instant instant = LocalDateTime.now().minusDays(1).toInstant(ZoneOffset.UTC); + // Timestamp previousDay = Timestamp.newBuilder() + // .setSeconds(instant.getEpochSecond()) + // .setNanos(instant.getNano()) + // .build(); + // setInventoryRequest = setInventoryRequest.toBuilder().setSetTime(previousDay).build(); + // Initialize client that will be used to send requests. This client only // needs to be created once, and can be reused for multiple requests. After // completing all of your requests, call the "close" method on the client to