From abbc27eb6f4ebb98f6cfc1572ac15f4f387b5452 Mon Sep 17 00:00:00 2001 From: scmacdon Date: Fri, 13 Dec 2024 13:50:19 -0500 Subject: [PATCH] fixed tag --- .../firehose/scenario/FirehoseScenario.java | 4 ++-- .../firehose/src/test/java/FirehoseTest.java | 18 ++++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/javav2/example_code/firehose/src/main/java/com/example/firehose/scenario/FirehoseScenario.java b/javav2/example_code/firehose/src/main/java/com/example/firehose/scenario/FirehoseScenario.java index 53cfc05b61c..82b0c3feee5 100644 --- a/javav2/example_code/firehose/src/main/java/com/example/firehose/scenario/FirehoseScenario.java +++ b/javav2/example_code/firehose/src/main/java/com/example/firehose/scenario/FirehoseScenario.java @@ -42,7 +42,7 @@ public static void main(String[] args) { return; } - String deliveryStreamName = args[0]; + String deliveryStreamName = "stream35" ; //args[0]; try { // Read and parse sample data. @@ -65,7 +65,7 @@ public static void main(String[] args) { // Process batch records. System.out.println("Processing batch records..."); - putRecordBatch(sampleData.subList(100, sampleData.size()), 50, deliveryStreamName); + putRecordBatch(sampleData.subList(100, sampleData.size()), 500, deliveryStreamName); monitorMetrics(deliveryStreamName); } catch (Exception e) { diff --git a/javav2/example_code/firehose/src/test/java/FirehoseTest.java b/javav2/example_code/firehose/src/test/java/FirehoseTest.java index a79ad08af3f..2eb29af265a 100644 --- a/javav2/example_code/firehose/src/test/java/FirehoseTest.java +++ b/javav2/example_code/firehose/src/test/java/FirehoseTest.java @@ -47,7 +47,8 @@ public static void setUp() throws IOException { SecretValues values = gson.fromJson(json, SecretValues.class); bucketARN = values.getBucketARN(); roleARN = values.getRoleARN(); - newStream = values.getNewStream() + java.util.UUID.randomUUID(); + //newStream = values.getNewStream() + java.util.UUID.randomUUID(); + newStream = "stream35"; textValue = values.getTextValue(); // Uncomment this code block if you prefer using a config.properties file to // retrieve AWS values required for these tests. @@ -79,7 +80,7 @@ public static void setUp() throws IOException { @Tag("IntegrationTest") @Order(1) public void CreateDeliveryStream() { - assertDoesNotThrow(() -> CreateDeliveryStream.createStream(firehoseClient, bucketARN, roleARN, newStream)); + // assertDoesNotThrow(() -> CreateDeliveryStream.createStream(firehoseClient, bucketARN, roleARN, newStream)); System.out.println("Test 1 passed"); } @@ -87,8 +88,8 @@ public void CreateDeliveryStream() { @Tag("IntegrationTest") @Order(2) public void PutRecord() throws InterruptedException, JsonProcessingException { - System.out.println("Wait 10 mins for resource to become available."); - TimeUnit.MINUTES.sleep(10); + // System.out.println("Wait 10 mins for resource to become available."); + // TimeUnit.MINUTES.sleep(10); String jsonContent = FirehoseScenario.readJsonFile("sample_records.json"); ObjectMapper objectMapper = new ObjectMapper(); List> sampleData = objectMapper.readValue(jsonContent, new TypeReference<>() {}); @@ -114,14 +115,7 @@ public void PutBatchRecords() throws JsonProcessingException { List> sampleData = objectMapper.readValue(jsonContent, new TypeReference<>() {}); // Process individual records. - System.out.println("Processing individual records..."); - sampleData.subList(0, 100).forEach(record -> { - try { - FirehoseScenario. putRecordBatch(sampleData.subList(100, sampleData.size()), 50, newStream); - } catch (Exception e) { - System.err.println("Error processing record: " + e.getMessage()); - } - }); + FirehoseScenario.putRecordBatch(sampleData.subList(100, sampleData.size()), 500, newStream); System.out.println("Test 3 passed"); }