Search in sources :

Example 6 with ListClustersResponse

use of com.google.container.v1beta1.ListClustersResponse in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method listClustersTest.

@Test
public void listClustersTest() throws Exception {
    ListClustersResponse expectedResponse = ListClustersResponse.newBuilder().addAllClusters(new ArrayList<Cluster>()).addAllFailedLocations(new ArrayList<String>()).setNextPageToken("nextPageToken-1386094857").build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
    ListClustersResponse actualResponse = client.listClusters(parent);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListClustersRequest actualRequest = ((ListClustersRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : InstanceName(com.google.bigtable.admin.v2.InstanceName) AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) ListClustersRequest(com.google.bigtable.admin.v2.ListClustersRequest) ListClustersResponse(com.google.bigtable.admin.v2.ListClustersResponse) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 7 with ListClustersResponse

use of com.google.container.v1beta1.ListClustersResponse in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method listClustersTest2.

@Test
public void listClustersTest2() throws Exception {
    ListClustersResponse expectedResponse = ListClustersResponse.newBuilder().addAllClusters(new ArrayList<Cluster>()).addAllFailedLocations(new ArrayList<String>()).setNextPageToken("nextPageToken-1386094857").build();
    mockBigtableInstanceAdmin.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListClustersResponse actualResponse = client.listClusters(parent);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListClustersRequest actualRequest = ((ListClustersRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) ListClustersRequest(com.google.bigtable.admin.v2.ListClustersRequest) ListClustersResponse(com.google.bigtable.admin.v2.ListClustersResponse) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 8 with ListClustersResponse

use of com.google.container.v1beta1.ListClustersResponse in project java-container by googleapis.

the class ClusterManagerClientTest method listClustersTest2.

@Test
public void listClustersTest2() throws Exception {
    ListClustersResponse expectedResponse = ListClustersResponse.newBuilder().addAllClusters(new ArrayList<Cluster>()).addAllMissingZones(new ArrayList<String>()).build();
    mockClusterManager.addResponse(expectedResponse);
    String projectId = "projectId-894832108";
    String zone = "zone3744684";
    ListClustersResponse actualResponse = client.listClusters(projectId, zone);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockClusterManager.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListClustersRequest actualRequest = ((ListClustersRequest) actualRequests.get(0));
    Assert.assertEquals(projectId, actualRequest.getProjectId());
    Assert.assertEquals(zone, actualRequest.getZone());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) Cluster(com.google.container.v1.Cluster) ListClustersRequest(com.google.container.v1.ListClustersRequest) ListClustersResponse(com.google.container.v1.ListClustersResponse) Test(org.junit.Test)

Example 9 with ListClustersResponse

use of com.google.container.v1beta1.ListClustersResponse in project java-container by googleapis.

the class ClusterManagerClientTest method listClustersTest.

@Test
public void listClustersTest() throws Exception {
    ListClustersResponse expectedResponse = ListClustersResponse.newBuilder().addAllClusters(new ArrayList<Cluster>()).addAllMissingZones(new ArrayList<String>()).build();
    mockClusterManager.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListClustersResponse actualResponse = client.listClusters(parent);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockClusterManager.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListClustersRequest actualRequest = ((ListClustersRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) Cluster(com.google.container.v1.Cluster) ListClustersRequest(com.google.container.v1.ListClustersRequest) ListClustersResponse(com.google.container.v1.ListClustersResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 AbstractMessage (com.google.protobuf.AbstractMessage)5 ArrayList (java.util.ArrayList)5 Cluster (com.google.container.v1.Cluster)4 ListClustersResponse (com.google.container.v1.ListClustersResponse)4 ListClustersRequest (com.google.bigtable.admin.v2.ListClustersRequest)2 ListClustersResponse (com.google.bigtable.admin.v2.ListClustersResponse)2 ListClustersRequest (com.google.container.v1.ListClustersRequest)2 ByteString (com.google.protobuf.ByteString)2 ListClustersResponse (io.confluent.kafkarest.entities.v3.ListClustersResponse)2 Test (org.junit.jupiter.api.Test)2 InstanceName (com.google.bigtable.admin.v2.InstanceName)1 NodePool (com.google.container.v1.NodePool)1 Cluster (com.google.container.v1beta1.Cluster)1 ListClustersRequest (com.google.container.v1beta1.ListClustersRequest)1 ListClustersResponse (com.google.container.v1beta1.ListClustersResponse)1 GetClusterResponse (io.confluent.kafkarest.entities.v3.GetClusterResponse)1 FakeAsyncResponse (io.confluent.kafkarest.response.FakeAsyncResponse)1 Response (javax.ws.rs.core.Response)1