Search in sources :

Example 1 with ListNodePoolsResponse

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

the class ITSystemTest method listNodePoolsTest.

@Test
public void listNodePoolsTest() {
    ListNodePoolsResponse response = client.listNodePools(PROJECT_ID, ZONE, CLUSTER_NAME);
    List<NodePool> nodePools = response.getNodePoolsList();
    for (NodePool nodePool : nodePools) {
        if (NODE_POOL_NAME.equals(nodePool.getName())) {
            assertEquals(NODE_POOL_NAME, nodePool.getName());
            assertEquals(INITIAL_NODE_COUNT, nodePool.getInitialNodeCount());
            assertEquals(NODE_POOL_SEL_LINK, nodePool.getSelfLink());
        }
    }
}
Also used : NodePool(com.google.container.v1.NodePool) ListNodePoolsResponse(com.google.container.v1.ListNodePoolsResponse) Test(org.junit.Test)

Example 2 with ListNodePoolsResponse

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

the class ClusterManagerClientTest method listNodePoolsTest.

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

Example 3 with ListNodePoolsResponse

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

the class ClusterManagerClientTest method listNodePoolsTest.

@Test
public void listNodePoolsTest() throws Exception {
    ListNodePoolsResponse expectedResponse = ListNodePoolsResponse.newBuilder().addAllNodePools(new ArrayList<NodePool>()).build();
    mockClusterManager.addResponse(expectedResponse);
    String projectId = "projectId-894832108";
    String zone = "zone3744684";
    String clusterId = "clusterId561939637";
    ListNodePoolsResponse actualResponse = client.listNodePools(projectId, zone, clusterId);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockClusterManager.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListNodePoolsRequest actualRequest = ((ListNodePoolsRequest) actualRequests.get(0));
    Assert.assertEquals(projectId, actualRequest.getProjectId());
    Assert.assertEquals(zone, actualRequest.getZone());
    Assert.assertEquals(clusterId, actualRequest.getClusterId());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListNodePoolsRequest(com.google.container.v1beta1.ListNodePoolsRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) ListNodePoolsResponse(com.google.container.v1beta1.ListNodePoolsResponse) Test(org.junit.Test)

Example 4 with ListNodePoolsResponse

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

the class ClusterManagerClientTest method listNodePoolsTest2.

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

Aggregations

Test (org.junit.Test)4 ListNodePoolsResponse (com.google.container.v1.ListNodePoolsResponse)3 AbstractMessage (com.google.protobuf.AbstractMessage)3 ArrayList (java.util.ArrayList)3 ListNodePoolsRequest (com.google.container.v1.ListNodePoolsRequest)2 NodePool (com.google.container.v1.NodePool)1 ListNodePoolsRequest (com.google.container.v1beta1.ListNodePoolsRequest)1 ListNodePoolsResponse (com.google.container.v1beta1.ListNodePoolsResponse)1