use of com.google.logging.v2.CreateExclusionRequest in project java-logging by googleapis.
the class LoggingImplTest method testCreateExclusion.
@Test
public void testCreateExclusion() {
LogExclusion exclusionPb = EXCLUSION.toProtobuf();
ApiFuture<LogExclusion> response = ApiFutures.immediateFuture(exclusionPb);
CreateExclusionRequest request = CreateExclusionRequest.newBuilder().setParent(PROJECT_PARENT).setExclusion(exclusionPb).build();
EasyMock.expect(loggingRpcMock.create(request)).andReturn(response);
EasyMock.replay(rpcFactoryMock, loggingRpcMock);
logging = options.getService();
Exclusion exclusion = logging.create(EXCLUSION);
assertEquals(EXCLUSION_NAME, exclusion.getName());
assertEquals(DESCRIPTION, exclusion.getDescription());
assertEquals(EXCLUSION_FILTER, exclusion.getFilter());
assertEquals(DISABLED, exclusion.isDisabled());
assertEquals(EXCLUSION_CREATED_TIME, exclusion.getCreateTime());
}
use of com.google.logging.v2.CreateExclusionRequest in project java-logging by googleapis.
the class LoggingImplTest method testCreateExclusionAsync.
@Test
public void testCreateExclusionAsync() throws ExecutionException, InterruptedException {
LogExclusion exclusionPb = EXCLUSION.toProtobuf();
ApiFuture<LogExclusion> response = ApiFutures.immediateFuture(exclusionPb);
CreateExclusionRequest request = CreateExclusionRequest.newBuilder().setParent(PROJECT_PARENT).setExclusion(exclusionPb).build();
EasyMock.expect(loggingRpcMock.create(request)).andReturn(response);
EasyMock.replay(rpcFactoryMock, loggingRpcMock);
logging = options.getService();
Exclusion exclusion = logging.createAsync(EXCLUSION).get();
assertEquals(EXCLUSION_NAME, exclusion.getName());
assertEquals(DESCRIPTION, exclusion.getDescription());
assertEquals(EXCLUSION_FILTER, exclusion.getFilter());
assertEquals(DISABLED, exclusion.isDisabled());
assertEquals(EXCLUSION_CREATED_TIME, exclusion.getCreateTime());
}
Aggregations