Search in sources :

Example 1 with ListOperationsRequest

use of com.google.container.v1.ListOperationsRequest in project java-container by googleapis.

the class ClusterManagerClientTest method listOperationsTest.

@Test
public void listOperationsTest() throws Exception {
    ListOperationsResponse expectedResponse = ListOperationsResponse.newBuilder().addAllOperations(new ArrayList<Operation>()).addAllMissingZones(new ArrayList<String>()).build();
    mockClusterManager.addResponse(expectedResponse);
    String projectId = "projectId-894832108";
    String zone = "zone3744684";
    ListOperationsResponse actualResponse = client.listOperations(projectId, zone);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockClusterManager.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListOperationsRequest actualRequest = ((ListOperationsRequest) 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) ListOperationsResponse(com.google.container.v1.ListOperationsResponse) ArrayList(java.util.ArrayList) ListOperationsRequest(com.google.container.v1.ListOperationsRequest) Operation(com.google.container.v1.Operation) Test(org.junit.Test)

Example 2 with ListOperationsRequest

use of com.google.container.v1.ListOperationsRequest in project java-container by googleapis.

the class ClusterManagerClientTest method listOperationsTest.

@Test
public void listOperationsTest() throws Exception {
    ListOperationsResponse expectedResponse = ListOperationsResponse.newBuilder().addAllOperations(new ArrayList<Operation>()).addAllMissingZones(new ArrayList<String>()).build();
    mockClusterManager.addResponse(expectedResponse);
    String projectId = "projectId-894832108";
    String zone = "zone3744684";
    ListOperationsResponse actualResponse = client.listOperations(projectId, zone);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockClusterManager.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListOperationsRequest actualRequest = ((ListOperationsRequest) 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) ListOperationsResponse(com.google.container.v1beta1.ListOperationsResponse) ArrayList(java.util.ArrayList) ListOperationsRequest(com.google.container.v1beta1.ListOperationsRequest) Operation(com.google.container.v1beta1.Operation) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 ListOperationsRequest (com.google.container.v1.ListOperationsRequest)1 ListOperationsResponse (com.google.container.v1.ListOperationsResponse)1 Operation (com.google.container.v1.Operation)1 ListOperationsRequest (com.google.container.v1beta1.ListOperationsRequest)1 ListOperationsResponse (com.google.container.v1beta1.ListOperationsResponse)1 Operation (com.google.container.v1beta1.Operation)1