use of org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.SubscriptionPath in project beam by apache.
the class PubsubJsonClientTest method listSubscriptions.
@Test
public void listSubscriptions() throws Exception {
ListSubscriptionsResponse expectedResponse1 = new ListSubscriptionsResponse();
expectedResponse1.setSubscriptions(Collections.singletonList(buildSubscription(1)));
expectedResponse1.setNextPageToken("AVgJH3Z7aHxiDBs");
ListSubscriptionsResponse expectedResponse2 = new ListSubscriptionsResponse();
expectedResponse2.setSubscriptions(Collections.singletonList(buildSubscription(2)));
Subscriptions.List request = mockPubsub.projects().subscriptions().list(PROJECT.getPath());
when((Object) request.execute()).thenReturn(expectedResponse1, expectedResponse2);
final TopicPath topic101 = PubsubClient.topicPathFromName("testProject", "Topic2");
List<SubscriptionPath> subscriptionPaths = client.listSubscriptions(PROJECT, topic101);
assertEquals(1, subscriptionPaths.size());
}
use of org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.SubscriptionPath in project beam by apache.
the class FhirIOReadIT method deleteFHIRtore.
@After
public void deleteFHIRtore() throws IOException {
HealthcareApiClient client = new HttpHealthcareApiClient();
client.deleteFhirStore(healthcareDataset + "/fhirStores/" + fhirStoreName);
TopicPath topicPath = PubsubClient.topicPathFromPath(pubsubTopic);
SubscriptionPath subscriptionPath = PubsubClient.subscriptionPathFromPath(pubsubSubscription);
pubsub.deleteSubscription(subscriptionPath);
pubsub.deleteTopic(topicPath);
pubsub.close();
}
use of org.apache.beam.sdk.io.gcp.pubsub.PubsubClient.SubscriptionPath in project beam by apache.
the class PubsubClientTest method subscriptionPathFromNameWellFormed.
@Test
public void subscriptionPathFromNameWellFormed() {
SubscriptionPath path = PubsubClient.subscriptionPathFromName("test", "something");
assertEquals("projects/test/subscriptions/something", path.getPath());
assertEquals("/subscriptions/test/something", path.getFullPath());
}
Aggregations