From 4f46d6845eebf0da0e0478e49a985a196c14359e Mon Sep 17 00:00:00 2001 From: hannahrogers-google <52459909+hannahrogers-google@users.noreply.github.com> Date: Fri, 12 Jan 2024 11:06:15 -0800 Subject: [PATCH] Update PublisherImplTest.java --- .../cloud/pubsub/v1/PublisherImplTest.java | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java index e050dc963..9efea5e5c 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java @@ -500,57 +500,6 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception { assertTrue(publisher.awaitTermination(1, TimeUnit.MINUTES)); } - @Test - public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws Exception { - Publisher publisher = - getTestPublisherBuilder() - .setExecutorProvider(SINGLE_THREAD_EXECUTOR) - .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(500)) - .build()) - .setEnableMessageOrdering(true) - .build(); - - // Send two messages that will fulfill the first batch, which will return a failure. - testPublisherServiceImpl.addPublishError(new StatusException(Status.INVALID_ARGUMENT)); - ApiFuture publishFuture1 = sendTestMessageWithOrderingKey(publisher, "A", "a"); - ApiFuture publishFuture2 = sendTestMessageWithOrderingKey(publisher, "B", "a"); - - // A third message will fail because the first attempt to publish failed. - ApiFuture publishFuture3 = sendTestMessageWithOrderingKey(publisher, "C", "a"); - - try { - publishFuture1.get(); - fail("Should have failed."); - } catch (ExecutionException e) { - } - - try { - publishFuture2.get(); - fail("Should have failed."); - } catch (ExecutionException e) { - } - - try { - publishFuture3.get(); - fail("Should have failed."); - } catch (ExecutionException e) { - assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause()); - } - - // A subsequent attempt fails immediately. - ApiFuture publishFuture4 = sendTestMessageWithOrderingKey(publisher, "D", "a"); - try { - publishFuture4.get(); - fail("Should have failed."); - } catch (ExecutionException e) { - assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause()); - } - } - private ApiFuture sendTestMessageWithOrderingKey( Publisher publisher, String data, String orderingKey) { return publisher.publish(