Search in sources :

Example 1 with ListClustersRequest

use of com.google.container.v1beta1.ListClustersRequest 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 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.v1beta1.Cluster) ListClustersRequest(com.google.container.v1beta1.ListClustersRequest) ListClustersResponse(com.google.container.v1beta1.ListClustersResponse) Test(org.junit.Test)

Example 2 with ListClustersRequest

use of com.google.container.v1beta1.ListClustersRequest 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 3 with ListClustersRequest

use of com.google.container.v1beta1.ListClustersRequest 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 4 with ListClustersRequest

use of com.google.container.v1beta1.ListClustersRequest 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 5 with ListClustersRequest

use of com.google.container.v1beta1.ListClustersRequest 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

AbstractMessage (com.google.protobuf.AbstractMessage)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 ListClustersRequest (com.google.bigtable.admin.v2.ListClustersRequest)2 ListClustersResponse (com.google.bigtable.admin.v2.ListClustersResponse)2 Cluster (com.google.container.v1.Cluster)2 ListClustersRequest (com.google.container.v1.ListClustersRequest)2 ListClustersResponse (com.google.container.v1.ListClustersResponse)2 ByteString (com.google.protobuf.ByteString)2 InstanceName (com.google.bigtable.admin.v2.InstanceName)1 Cluster (com.google.container.v1beta1.Cluster)1 ListClustersRequest (com.google.container.v1beta1.ListClustersRequest)1 ListClustersResponse (com.google.container.v1beta1.ListClustersResponse)1