use of com.google.bigtable.admin.v2.SnapshotName in project java-pubsub by googleapis.
the class SubscriptionAdminClientTest method createSnapshotTest2.
@Test
public void createSnapshotTest2() throws Exception {
Snapshot expectedResponse = Snapshot.newBuilder().setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()).setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()).setExpireTime(Timestamp.newBuilder().build()).putAllLabels(new HashMap<String, String>()).build();
mockSubscriber.addResponse(expectedResponse);
SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
String subscription = "subscription341203229";
Snapshot actualResponse = client.createSnapshot(name, subscription);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateSnapshotRequest actualRequest = ((CreateSnapshotRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertEquals(subscription, actualRequest.getSubscription());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.admin.v2.SnapshotName in project gapic-generator-java by googleapis.
the class SyncDeleteSnapshotSnapshotname method syncDeleteSnapshotSnapshotname.
public static void syncDeleteSnapshotSnapshotname() throws Exception {
// It may require modifications to work in your environment.
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
subscriptionAdminClient.deleteSnapshot(snapshot);
}
}
use of com.google.bigtable.admin.v2.SnapshotName in project gapic-generator-java by googleapis.
the class SyncCreateSnapshotSnapshotnameString method syncCreateSnapshotSnapshotnameString.
public static void syncCreateSnapshotSnapshotnameString() throws Exception {
// It may require modifications to work in your environment.
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
}
}
use of com.google.bigtable.admin.v2.SnapshotName in project gapic-generator-java by googleapis.
the class SyncCreateSnapshotSnapshotnameSubscriptionname method syncCreateSnapshotSnapshotnameSubscriptionname.
public static void syncCreateSnapshotSnapshotnameSubscriptionname() throws Exception {
// It may require modifications to work in your environment.
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
}
}
use of com.google.bigtable.admin.v2.SnapshotName in project gapic-generator-java by googleapis.
the class SubscriptionAdminClientTest method deleteSnapshotTest.
@Test
public void deleteSnapshotTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockSubscriber.addResponse(expectedResponse);
SnapshotName snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
client.deleteSnapshot(snapshot);
List<AbstractMessage> actualRequests = mockSubscriber.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteSnapshotRequest actualRequest = ((DeleteSnapshotRequest) actualRequests.get(0));
Assert.assertEquals(snapshot.toString(), actualRequest.getSnapshot());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations