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 84fc50cfd..d143bfd65 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 @@ -501,93 +501,6 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception { assertTrue(publisher.awaitTermination(1, TimeUnit.MINUTES)); } - @Test - /** - * Make sure that resume publishing works as expected: - * - *
    - *
  1. publish with key orderA which returns a failure. - *
  2. publish with key orderA again, which should fail immediately - *
  3. publish with key orderB, which should succeed - *
  4. resume publishing on key orderA - *
  5. publish with key orderA, which should now succeed - *
- */ - public void testResumePublish() throws Exception { - Publisher publisher = - getTestPublisherBuilder() - .setExecutorProvider(SINGLE_THREAD_EXECUTOR) - .setBatchingSettings( - Publisher.Builder.DEFAULT_BATCHING_SETTINGS - .toBuilder() - .setElementCountThreshold(2L) - .setDelayThreshold(Duration.ofSeconds(100)) - .build()) - .setEnableMessageOrdering(true) - .build(); - - ApiFuture future1 = sendTestMessageWithOrderingKey(publisher, "m1", "orderA"); - ApiFuture future2 = sendTestMessageWithOrderingKey(publisher, "m2", "orderA"); - - assertFalse(future1.isDone()); - assertFalse(future2.isDone()); - - // This exception should stop future publishing to the same key - testPublisherServiceImpl.addPublishError(new StatusException(Status.INVALID_ARGUMENT)); - - try { - future1.get(); - Assert.fail("This should fail."); - } catch (ExecutionException e) { - } - - try { - future2.get(); - Assert.fail("This should fail."); - } catch (ExecutionException e) { - } - - // Submit new requests with orderA that should fail. - ApiFuture future3 = sendTestMessageWithOrderingKey(publisher, "m3", "orderA"); - ApiFuture future4 = sendTestMessageWithOrderingKey(publisher, "m4", "orderA"); - - try { - future3.get(); - Assert.fail("This should fail."); - } catch (ExecutionException e) { - assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause()); - } - - try { - future4.get(); - Assert.fail("This should fail."); - } catch (ExecutionException e) { - assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause()); - } - - // Submit a new request with orderB, which should succeed - ApiFuture future5 = sendTestMessageWithOrderingKey(publisher, "m5", "orderB"); - ApiFuture future6 = sendTestMessageWithOrderingKey(publisher, "m6", "orderB"); - - testPublisherServiceImpl.addPublishResponse( - PublishResponse.newBuilder().addMessageIds("5").addMessageIds("6")); - - Assert.assertEquals("5", future5.get()); - Assert.assertEquals("6", future6.get()); - - // Resume publishing of "orderA", which should now succeed - publisher.resumePublish("orderA"); - - ApiFuture future7 = sendTestMessageWithOrderingKey(publisher, "m7", "orderA"); - ApiFuture future8 = sendTestMessageWithOrderingKey(publisher, "m8", "orderA"); - - testPublisherServiceImpl.addPublishResponse( - PublishResponse.newBuilder().addMessageIds("7").addMessageIds("8")); - - Assert.assertEquals("7", future7.get()); - Assert.assertEquals("8", future8.get()); - } - @Test public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws Exception { Publisher publisher =