diff --git a/java-pubsub/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java b/java-pubsub/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java
index 39155c848582..fe6b8ec43ca3 100644
--- a/java-pubsub/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java
+++ b/java-pubsub/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/v1/PublisherImplTest.java
@@ -512,21 +512,19 @@ public void testEnableMessageOrdering_overwritesMaxAttempts() throws Exception {
*
publish with key orderA, which should now succeed
*
*/
- /*
- Temporarily disabled due to https://github.com/googleapis/java-pubsub/issues/1861.
- TODO(maitrimangal): Enable once resolved.
@Test
public void testResumePublish() throws Exception {
Publisher publisher =
getTestPublisherBuilder()
.setBatchingSettings(
- Publisher.Builder.DEFAULT_BATCHING_SETTINGS
- .toBuilder()
+ Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder()
.setElementCountThreshold(2L)
.build())
.setEnableMessageOrdering(true)
.build();
+ testPublisherServiceImpl.setExecutor(fakeExecutor);
+
ApiFuture future1 = sendTestMessageWithOrderingKey(publisher, "m1", "orderA");
ApiFuture future2 = sendTestMessageWithOrderingKey(publisher, "m2", "orderA");
@@ -536,7 +534,6 @@ public void testResumePublish() throws Exception {
// This exception should stop future publishing to the same key
testPublisherServiceImpl.addPublishError(new StatusException(Status.INVALID_ARGUMENT));
-
fakeExecutor.advanceTime(Duration.ZERO);
try {
@@ -576,8 +573,8 @@ public void testResumePublish() throws Exception {
testPublisherServiceImpl.addPublishResponse(
PublishResponse.newBuilder().addMessageIds("5").addMessageIds("6"));
- Assert.assertEquals("5", future5.get());
- Assert.assertEquals("6", future6.get());
+ assertEquals("5", future5.get());
+ assertEquals("6", future6.get());
// Resume publishing of "orderA", which should now succeed
publisher.resumePublish("orderA");
@@ -588,8 +585,8 @@ public void testResumePublish() throws Exception {
testPublisherServiceImpl.addPublishResponse(
PublishResponse.newBuilder().addMessageIds("7").addMessageIds("8"));
- Assert.assertEquals("7", future7.get());
- Assert.assertEquals("8", future8.get());
+ assertEquals("7", future7.get());
+ assertEquals("8", future8.get());
shutdownTestPublisher(publisher);
}
@@ -598,10 +595,8 @@ public void testResumePublish() throws Exception {
public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws Exception {
Publisher publisher =
getTestPublisherBuilder()
- .setExecutorProvider(SINGLE_THREAD_EXECUTOR)
.setBatchingSettings(
- Publisher.Builder.DEFAULT_BATCHING_SETTINGS
- .toBuilder()
+ Publisher.Builder.DEFAULT_BATCHING_SETTINGS.toBuilder()
.setElementCountThreshold(2L)
.setDelayThresholdDuration(Duration.ofSeconds(500))
.build())
@@ -644,7 +639,6 @@ public void testPublishThrowExceptionForUnsubmittedOrderingKeyMessage() throws E
assertEquals(SequentialExecutorService.CallbackExecutor.CANCELLATION_EXCEPTION, e.getCause());
}
}
- */
private ApiFuture sendTestMessageWithOrderingKey(
Publisher publisher, String data, String orderingKey) {