Search in sources :

Example 1 with DeleteLogRequest

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

the class LoggingClientTest method deleteLogTest.

@Test
@SuppressWarnings("all")
public void deleteLogTest() {
    Empty expectedResponse = Empty.newBuilder().build();
    mockLoggingServiceV2.addResponse(expectedResponse);
    LogNameOneof logName = LogNameOneof.from(LogName.create("[PROJECT]", "[LOG]"));
    client.deleteLog(logName);
    List<GeneratedMessageV3> actualRequests = mockLoggingServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteLogRequest actualRequest = (DeleteLogRequest) actualRequests.get(0);
    Assert.assertEquals(logName, actualRequest.getLogNameAsLogNameOneof());
}
Also used : DeleteLogRequest(com.google.logging.v2.DeleteLogRequest) Empty(com.google.protobuf.Empty) LogNameOneof(com.google.logging.v2.LogNameOneof) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Example 2 with DeleteLogRequest

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

the class LoggingImplTest method testDeleteLog.

@Test
public void testDeleteLog() {
    DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogName(LOG_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.deleteLog(LOG_NAME));
}
Also used : DeleteLogRequest(com.google.logging.v2.DeleteLogRequest) Empty(com.google.protobuf.Empty) Test(org.junit.Test)

Example 3 with DeleteLogRequest

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

the class LoggingImplTest method testDeleteLogAync.

@Test
public void testDeleteLogAync() throws ExecutionException, InterruptedException {
    DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogName(LOG_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.deleteLogAsync(LOG_NAME).get());
}
Also used : DeleteLogRequest(com.google.logging.v2.DeleteLogRequest) Empty(com.google.protobuf.Empty) Test(org.junit.Test)

Example 4 with DeleteLogRequest

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

the class LoggingImplTest method testDeleteLog_Null.

@Test
public void testDeleteLog_Null() {
    DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogName(LOG_NAME_PB).build();
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(ApiFutures.<Empty>immediateFuture(null));
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertFalse(logging.deleteLog(LOG_NAME));
}
Also used : DeleteLogRequest(com.google.logging.v2.DeleteLogRequest) Test(org.junit.Test)

Example 5 with DeleteLogRequest

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

the class LoggingImplTest method testDeleteLogAsync_Null.

@Test
public void testDeleteLogAsync_Null() throws ExecutionException, InterruptedException {
    DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogName(LOG_NAME_PB).build();
    EasyMock.expect(loggingRpcMock.delete(request)).andReturn(ApiFutures.<Empty>immediateFuture(null));
    EasyMock.replay(rpcFactoryMock, loggingRpcMock);
    logging = options.getService();
    assertFalse(logging.deleteLogAsync(LOG_NAME).get());
}
Also used : DeleteLogRequest(com.google.logging.v2.DeleteLogRequest) Test(org.junit.Test)

Aggregations

DeleteLogRequest (com.google.logging.v2.DeleteLogRequest)6 Test (org.junit.Test)5 Empty (com.google.protobuf.Empty)3 LogNameOneof (com.google.logging.v2.LogNameOneof)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1