Search in sources :

Example 6 with CreateExclusionRequest

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());
}
Also used : CreateExclusionRequest(com.google.logging.v2.CreateExclusionRequest) LogExclusion(com.google.logging.v2.LogExclusion) LogExclusion(com.google.logging.v2.LogExclusion) Test(org.junit.Test)

Example 7 with CreateExclusionRequest

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());
}
Also used : CreateExclusionRequest(com.google.logging.v2.CreateExclusionRequest) LogExclusion(com.google.logging.v2.LogExclusion) LogExclusion(com.google.logging.v2.LogExclusion) Test(org.junit.Test)

Aggregations

CreateExclusionRequest (com.google.logging.v2.CreateExclusionRequest)7 LogExclusion (com.google.logging.v2.LogExclusion)7 Test (org.junit.Test)7 AbstractMessage (com.google.protobuf.AbstractMessage)5 BillingAccountName (com.google.logging.v2.BillingAccountName)1 FolderName (com.google.logging.v2.FolderName)1 OrganizationName (com.google.logging.v2.OrganizationName)1 ProjectName (com.google.logging.v2.ProjectName)1