Skip to content

Commit

Permalink
Split integration tests for TopicSnippets
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Sep 16, 2016
1 parent d1e470f commit 26ee6d9
Showing 1 changed file with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,31 @@ public void testTopic() throws ExecutionException, InterruptedException {
assertEquals(2, topicSnippets.publishMessageListAsync().size());
assertEquals(2, topicSnippets.publishMessages().size());
assertEquals(2, topicSnippets.publishMessagesAsync().size());
}

@Test
public void testTopicSubscriptions() throws ExecutionException, InterruptedException {
TopicSnippets topicSnippets = new TopicSnippets(topic);
pubsub.create(SubscriptionInfo.of(TOPIC, SUBSCRIPTION));
Page<SubscriptionId> subscriptions = topicSnippets.listSubscriptionsForTopic();
while (Iterators.size(subscriptions.values().iterator()) < 1) {
subscriptions = topicSnippets.listSubscriptionsForTopic();
}
assertEquals(SUBSCRIPTION, subscriptions.values().iterator().next().subscription());
subscriptions = topicSnippets.listSubscriptionsForTopicAsync();
while (Iterators.size(subscriptions.values().iterator()) < 1) {
subscriptions = topicSnippets.listSubscriptionsForTopic();
try {
Page<SubscriptionId> subscriptions = topicSnippets.listSubscriptionsForTopic();
while (Iterators.size(subscriptions.values().iterator()) < 1) {
subscriptions = topicSnippets.listSubscriptionsForTopic();
}
assertEquals(SUBSCRIPTION, subscriptions.values().iterator().next().subscription());
subscriptions = topicSnippets.listSubscriptionsForTopicAsync();
while (Iterators.size(subscriptions.values().iterator()) < 1) {
subscriptions = topicSnippets.listSubscriptionsForTopic();
}
assertEquals(SUBSCRIPTION, subscriptions.values().iterator().next().subscription());
} finally {
pubsub.deleteSubscription(SUBSCRIPTION);
}
assertEquals(SUBSCRIPTION, subscriptions.values().iterator().next().subscription());
pubsub.deleteSubscription(SUBSCRIPTION);
}

@Test
public void testPolicy() throws ExecutionException, InterruptedException {
TopicSnippets topicSnippets = new TopicSnippets(topic);
Policy policy = topicSnippets.getPolicy();
assertNotNull(policy);
assertEquals(policy, topicSnippets.getPolicyAsync());
Expand Down

0 comments on commit 26ee6d9

Please sign in to comment.