From f58238c058c59c73853316f9df712d7f21c4a4e5 Mon Sep 17 00:00:00 2001 From: hannahrogers-google <52459909+hannahrogers-google@users.noreply.github.com> Date: Fri, 12 Jan 2024 08:57:00 -0800 Subject: [PATCH] Update PublisherImplTest.java --- .../cloud/pubsub/v1/PublisherImplTest.java | 60 ------------------- 1 file changed, 60 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 841d63c25..78502d55f 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 @@ -592,66 +592,6 @@ public void testResumePublish() throws Exception { shutdownTestPublisher(publisher); } - @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( - PubsubMessage.newBuilder() - .setOrderingKey(orderingKey) - .setData(ByteString.copyFromUtf8(data)) - .build()); - } - @Test public void testErrorPropagation() throws Exception { Publisher publisher =