Search in sources :

Example 1 with ListOperationsResponse

use of com.google.container.v1.ListOperationsResponse 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 ListOperationsResponse

use of com.google.container.v1.ListOperationsResponse 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)

Example 3 with ListOperationsResponse

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

the class ITSystemTest method listOperationsTest.

@Test
public void listOperationsTest() {
    ListOperationsResponse listOperations = client.listOperations(PROJECT_ID, ZONE);
    List<Operation> operations = listOperations.getOperationsList();
    for (Operation actualOperation : operations) {
        if (actualOperation.getName().equals(operation.getName())) {
            assertEquals(operation.getName(), actualOperation.getName());
            assertEquals(ZONE, actualOperation.getZone());
        }
    }
}
Also used : ListOperationsResponse(com.google.container.v1.ListOperationsResponse) Operation(com.google.container.v1.Operation) Test(org.junit.Test)

Aggregations

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