Search in sources :

Example 1 with CreateExclusionRequest

use of com.google.logging.v2.CreateExclusionRequest in project java-logging by googleapis.

the class ConfigClientTest method createExclusionTest5.

@Test
public void createExclusionTest5() throws Exception {
    LogExclusion expectedResponse = LogExclusion.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).setDescription("description-1724546052").setFilter("filter-1274492040").setDisabled(true).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).build();
    mockConfigServiceV2.addResponse(expectedResponse);
    String parent = "parent-995424086";
    LogExclusion exclusion = LogExclusion.newBuilder().build();
    LogExclusion actualResponse = client.createExclusion(parent, exclusion);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateExclusionRequest actualRequest = ((CreateExclusionRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(exclusion, actualRequest.getExclusion());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateExclusionRequest(com.google.logging.v2.CreateExclusionRequest) AbstractMessage(com.google.protobuf.AbstractMessage) LogExclusion(com.google.logging.v2.LogExclusion) Test(org.junit.Test)

Example 2 with CreateExclusionRequest

use of com.google.logging.v2.CreateExclusionRequest in project java-logging by googleapis.

the class ConfigClientTest method createExclusionTest4.

@Test
public void createExclusionTest4() throws Exception {
    LogExclusion expectedResponse = LogExclusion.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).setDescription("description-1724546052").setFilter("filter-1274492040").setDisabled(true).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).build();
    mockConfigServiceV2.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    LogExclusion exclusion = LogExclusion.newBuilder().build();
    LogExclusion actualResponse = client.createExclusion(parent, exclusion);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateExclusionRequest actualRequest = ((CreateExclusionRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(exclusion, actualRequest.getExclusion());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateExclusionRequest(com.google.logging.v2.CreateExclusionRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ProjectName(com.google.logging.v2.ProjectName) LogExclusion(com.google.logging.v2.LogExclusion) Test(org.junit.Test)

Example 3 with CreateExclusionRequest

use of com.google.logging.v2.CreateExclusionRequest in project java-logging by googleapis.

the class ConfigClientTest method createExclusionTest3.

@Test
public void createExclusionTest3() throws Exception {
    LogExclusion expectedResponse = LogExclusion.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).setDescription("description-1724546052").setFilter("filter-1274492040").setDisabled(true).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).build();
    mockConfigServiceV2.addResponse(expectedResponse);
    OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
    LogExclusion exclusion = LogExclusion.newBuilder().build();
    LogExclusion actualResponse = client.createExclusion(parent, exclusion);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateExclusionRequest actualRequest = ((CreateExclusionRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(exclusion, actualRequest.getExclusion());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : OrganizationName(com.google.logging.v2.OrganizationName) CreateExclusionRequest(com.google.logging.v2.CreateExclusionRequest) AbstractMessage(com.google.protobuf.AbstractMessage) LogExclusion(com.google.logging.v2.LogExclusion) Test(org.junit.Test)

Example 4 with CreateExclusionRequest

use of com.google.logging.v2.CreateExclusionRequest in project java-logging by googleapis.

the class ConfigClientTest method createExclusionTest.

@Test
public void createExclusionTest() throws Exception {
    LogExclusion expectedResponse = LogExclusion.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).setDescription("description-1724546052").setFilter("filter-1274492040").setDisabled(true).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).build();
    mockConfigServiceV2.addResponse(expectedResponse);
    BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
    LogExclusion exclusion = LogExclusion.newBuilder().build();
    LogExclusion actualResponse = client.createExclusion(parent, exclusion);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateExclusionRequest actualRequest = ((CreateExclusionRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(exclusion, actualRequest.getExclusion());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateExclusionRequest(com.google.logging.v2.CreateExclusionRequest) AbstractMessage(com.google.protobuf.AbstractMessage) BillingAccountName(com.google.logging.v2.BillingAccountName) LogExclusion(com.google.logging.v2.LogExclusion) Test(org.junit.Test)

Example 5 with CreateExclusionRequest

use of com.google.logging.v2.CreateExclusionRequest in project java-logging by googleapis.

the class ConfigClientTest method createExclusionTest2.

@Test
public void createExclusionTest2() throws Exception {
    LogExclusion expectedResponse = LogExclusion.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).setDescription("description-1724546052").setFilter("filter-1274492040").setDisabled(true).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).build();
    mockConfigServiceV2.addResponse(expectedResponse);
    FolderName parent = FolderName.of("[FOLDER]");
    LogExclusion exclusion = LogExclusion.newBuilder().build();
    LogExclusion actualResponse = client.createExclusion(parent, exclusion);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateExclusionRequest actualRequest = ((CreateExclusionRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(exclusion, actualRequest.getExclusion());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateExclusionRequest(com.google.logging.v2.CreateExclusionRequest) AbstractMessage(com.google.protobuf.AbstractMessage) LogExclusion(com.google.logging.v2.LogExclusion) FolderName(com.google.logging.v2.FolderName) 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