Search in sources :

Example 1 with GetClusterRequest

use of com.google.cloud.dataproc.v1.GetClusterRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method getClusterTest.

@Test
public void getClusterTest() throws Exception {
    Cluster expectedResponse = Cluster.newBuilder().setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()).setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setServeNodes(-1288838783).setDefaultStorageType(StorageType.forNumber(0)).setEncryptionConfig(Cluster.EncryptionConfig.newBuilder().build()).build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    ClusterName name = ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]");
    Cluster actualResponse = client.getCluster(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetClusterRequest actualRequest = ((GetClusterRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : GetClusterRequest(com.google.bigtable.admin.v2.GetClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) Cluster(com.google.bigtable.admin.v2.Cluster) ClusterName(com.google.bigtable.admin.v2.ClusterName) Test(org.junit.Test)

Example 2 with GetClusterRequest

use of com.google.cloud.dataproc.v1.GetClusterRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method getClusterTest2.

@Test
public void getClusterTest2() throws Exception {
    Cluster expectedResponse = Cluster.newBuilder().setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()).setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setServeNodes(-1288838783).setDefaultStorageType(StorageType.forNumber(0)).setEncryptionConfig(Cluster.EncryptionConfig.newBuilder().build()).build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    String name = "name3373707";
    Cluster actualResponse = client.getCluster(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetClusterRequest actualRequest = ((GetClusterRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : GetClusterRequest(com.google.bigtable.admin.v2.GetClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) Cluster(com.google.bigtable.admin.v2.Cluster) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Aggregations

Cluster (com.google.bigtable.admin.v2.Cluster)2 GetClusterRequest (com.google.bigtable.admin.v2.GetClusterRequest)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 ClusterName (com.google.bigtable.admin.v2.ClusterName)1 ByteString (com.google.protobuf.ByteString)1