Search in sources :

Example 1 with DeleteSinkRequest

use of com.google.logging.v2.DeleteSinkRequest in project google-cloud-java by GoogleCloudPlatform.

the class ConfigClientTest method deleteSinkTest.

@Test
@SuppressWarnings("all")
public void deleteSinkTest() {
    Empty expectedResponse = Empty.newBuilder().build();
    mockConfigServiceV2.addResponse(expectedResponse);
    SinkNameOneof sinkName = SinkNameOneof.from(SinkName.create("[PROJECT]", "[SINK]"));
    client.deleteSink(sinkName);
    List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteSinkRequest actualRequest = (DeleteSinkRequest) actualRequests.get(0);
    Assert.assertEquals(sinkName, actualRequest.getSinkNameAsSinkNameOneof());
}
Also used : Empty(com.google.protobuf.Empty) DeleteSinkRequest(com.google.logging.v2.DeleteSinkRequest) SinkNameOneof(com.google.logging.v2.SinkNameOneof) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Example 2 with DeleteSinkRequest

use of com.google.logging.v2.DeleteSinkRequest in project google-cloud-java by GoogleCloudPlatform.

the class LoggingImplTest method testDeleteSinkAsync_Null.

@Test
public void testDeleteSinkAsync_Null() throws ExecutionException, InterruptedException {
    DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkName(SINK_NAME_PB).build();
    ApiFuture<Empty> response = ApiFutures.immediateFuture(null);
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response);
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertFalse(logging.deleteSinkAsync(SINK_NAME).get());
}
Also used : Empty(com.google.protobuf.Empty) DeleteSinkRequest(com.google.logging.v2.DeleteSinkRequest) Test(org.junit.Test)

Example 3 with DeleteSinkRequest

use of com.google.logging.v2.DeleteSinkRequest in project google-cloud-java by GoogleCloudPlatform.

the class LoggingImplTest method testDeleteSink.

@Test
public void testDeleteSink() {
    DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkName(SINK_NAME_PB).build();
    ApiFuture<Empty> response = ApiFutures.immediateFuture(Empty.getDefaultInstance());
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response);
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertTrue(logging.deleteSink(SINK_NAME));
}
Also used : Empty(com.google.protobuf.Empty) DeleteSinkRequest(com.google.logging.v2.DeleteSinkRequest) Test(org.junit.Test)

Example 4 with DeleteSinkRequest

use of com.google.logging.v2.DeleteSinkRequest in project google-cloud-java by GoogleCloudPlatform.

the class LoggingImplTest method testDeleteSink_Null.

@Test
public void testDeleteSink_Null() {
    DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkName(SINK_NAME_PB).build();
    ApiFuture<Empty> response = ApiFutures.immediateFuture(null);
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response);
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertFalse(logging.deleteSink(SINK_NAME));
}
Also used : Empty(com.google.protobuf.Empty) DeleteSinkRequest(com.google.logging.v2.DeleteSinkRequest) Test(org.junit.Test)

Example 5 with DeleteSinkRequest

use of com.google.logging.v2.DeleteSinkRequest in project google-cloud-java by GoogleCloudPlatform.

the class LoggingImplTest method testDeleteSinkAsync.

@Test
public void testDeleteSinkAsync() throws ExecutionException, InterruptedException {
    DeleteSinkRequest request = DeleteSinkRequest.newBuilder().setSinkName(SINK_NAME_PB).build();
    ApiFuture<Empty> response = ApiFutures.immediateFuture(Empty.getDefaultInstance());
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(response);
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertTrue(logging.deleteSinkAsync(SINK_NAME).get());
}
Also used : Empty(com.google.protobuf.Empty) DeleteSinkRequest(com.google.logging.v2.DeleteSinkRequest) Test(org.junit.Test)

Aggregations

DeleteSinkRequest (com.google.logging.v2.DeleteSinkRequest)6 Empty (com.google.protobuf.Empty)5 Test (org.junit.Test)5 SinkNameOneof (com.google.logging.v2.SinkNameOneof)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1