use of com.google.logging.v2.DeleteExclusionRequest in project gapic-generator-java by googleapis.
the class SyncDeleteExclusion method syncDeleteExclusion.
public static void syncDeleteExclusion() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).build();
configClient.deleteExclusion(request);
}
}
use of com.google.logging.v2.DeleteExclusionRequest in project java-logging by googleapis.
the class ConfigClientTest method deleteExclusionTest.
@Test
public void deleteExclusionTest() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockConfigServiceV2.addResponse(expectedResponse);
LogExclusionName name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]");
client.deleteExclusion(name);
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteExclusionRequest actualRequest = ((DeleteExclusionRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.logging.v2.DeleteExclusionRequest in project java-logging by googleapis.
the class ConfigClientTest method deleteExclusionTest2.
@Test
public void deleteExclusionTest2() throws Exception {
Empty expectedResponse = Empty.newBuilder().build();
mockConfigServiceV2.addResponse(expectedResponse);
String name = "name3373707";
client.deleteExclusion(name);
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
DeleteExclusionRequest actualRequest = ((DeleteExclusionRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.logging.v2.DeleteExclusionRequest in project java-logging by googleapis.
the class LoggingImplTest method testDeleteExclusion_Null.
@Test
public void testDeleteExclusion_Null() {
DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(EXCLUSION_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.deleteExclusion(EXCLUSION_NAME));
}
use of com.google.logging.v2.DeleteExclusionRequest in project java-logging by googleapis.
the class LoggingImplTest method testDeleteExclusionAsync_Null.
@Test
public void testDeleteExclusionAsync_Null() throws ExecutionException, InterruptedException {
DeleteExclusionRequest request = DeleteExclusionRequest.newBuilder().setName(EXCLUSION_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.deleteExclusionAsync(EXCLUSION_NAME).get());
}
Aggregations