use of com.google.logging.v2.LogExclusion in project java-logging by googleapis.
the class LoggingImplTest method testUpdateExclusion.
@Test
public void testUpdateExclusion() {
LogExclusion exclusionPb = EXCLUSION1.toProtobuf();
ApiFuture<LogExclusion> response = ApiFutures.immediateFuture(exclusionPb);
UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder().setName(EXCLUSION_NAME_PB).setExclusion(exclusionPb).build();
EasyMock.expect(loggingRpcMock.update(request)).andReturn(response);
EasyMock.replay(rpcFactoryMock, loggingRpcMock);
logging = options.getService();
Exclusion exclusion = logging.update(EXCLUSION1);
assertEquals(EXCLUSION_NAME, exclusion.getName());
assertEquals(DESCRIPTION, exclusion.getDescription());
assertEquals(EXCLUSION_FILTER, exclusion.getFilter());
assertEquals(DISABLED, exclusion.isDisabled());
assertEquals(EXCLUSION_UPDATED_TIME, exclusion.getUpdateTime());
}
use of com.google.logging.v2.LogExclusion 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.LogExclusion in project java-logging by googleapis.
the class LoggingImplTest method testUpdateExclusionAsync.
@Test
public void testUpdateExclusionAsync() throws ExecutionException, InterruptedException {
LogExclusion exclusionPb = EXCLUSION1.toProtobuf();
ApiFuture<LogExclusion> response = ApiFutures.immediateFuture(exclusionPb);
UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder().setName(EXCLUSION_NAME_PB).setExclusion(exclusionPb).build();
EasyMock.expect(loggingRpcMock.update(request)).andReturn(response);
EasyMock.replay(rpcFactoryMock, loggingRpcMock);
logging = options.getService();
Exclusion exclusion = logging.updateAsync(EXCLUSION1).get();
assertEquals(EXCLUSION_NAME, exclusion.getName());
assertEquals(DESCRIPTION, exclusion.getDescription());
assertEquals(EXCLUSION_FILTER, exclusion.getFilter());
assertEquals(DISABLED, exclusion.isDisabled());
assertEquals(EXCLUSION_UPDATED_TIME, exclusion.getUpdateTime());
}
use of com.google.logging.v2.LogExclusion 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());
}
use of com.google.logging.v2.LogExclusion in project java-logging by googleapis.
the class LoggingImplTest method testGetExclusion_Null.
@Test
public void testGetExclusion_Null() {
ApiFuture<LogExclusion> response = ApiFutures.immediateFuture(null);
GetExclusionRequest request = GetExclusionRequest.newBuilder().setName(EXCLUSION_NAME_PB).build();
EasyMock.expect(loggingRpcMock.get(request)).andReturn(response);
EasyMock.replay(rpcFactoryMock, loggingRpcMock);
logging = options.getService();
Exclusion exclusion = logging.getExclusion(EXCLUSION_NAME);
assertNull(exclusion);
}
Aggregations