use of com.google.cloud.logging.v2.ConfigClient.ListExclusionsPagedResponse in project java-logging by googleapis.
the class ConfigClientTest method listExclusionsTest4.
@Test
public void listExclusionsTest4() throws Exception {
LogExclusion responsesElement = LogExclusion.newBuilder().build();
ListExclusionsResponse expectedResponse = ListExclusionsResponse.newBuilder().setNextPageToken("").addAllExclusions(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
ListExclusionsPagedResponse pagedListResponse = client.listExclusions(parent);
List<LogExclusion> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExclusionsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExclusionsRequest actualRequest = ((ListExclusionsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.logging.v2.ConfigClient.ListExclusionsPagedResponse in project java-logging by googleapis.
the class ConfigClientTest method listExclusionsTest2.
@Test
public void listExclusionsTest2() throws Exception {
LogExclusion responsesElement = LogExclusion.newBuilder().build();
ListExclusionsResponse expectedResponse = ListExclusionsResponse.newBuilder().setNextPageToken("").addAllExclusions(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
FolderName parent = FolderName.of("[FOLDER]");
ListExclusionsPagedResponse pagedListResponse = client.listExclusions(parent);
List<LogExclusion> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExclusionsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExclusionsRequest actualRequest = ((ListExclusionsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.logging.v2.ConfigClient.ListExclusionsPagedResponse in project java-logging by googleapis.
the class ConfigClientTest method listExclusionsTest3.
@Test
public void listExclusionsTest3() throws Exception {
LogExclusion responsesElement = LogExclusion.newBuilder().build();
ListExclusionsResponse expectedResponse = ListExclusionsResponse.newBuilder().setNextPageToken("").addAllExclusions(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListExclusionsPagedResponse pagedListResponse = client.listExclusions(parent);
List<LogExclusion> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExclusionsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExclusionsRequest actualRequest = ((ListExclusionsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.logging.v2.ConfigClient.ListExclusionsPagedResponse in project java-logging by googleapis.
the class ConfigClientTest method listExclusionsTest5.
@Test
public void listExclusionsTest5() throws Exception {
LogExclusion responsesElement = LogExclusion.newBuilder().build();
ListExclusionsResponse expectedResponse = ListExclusionsResponse.newBuilder().setNextPageToken("").addAllExclusions(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
String parent = "parent-995424086";
ListExclusionsPagedResponse pagedListResponse = client.listExclusions(parent);
List<LogExclusion> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExclusionsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExclusionsRequest actualRequest = ((ListExclusionsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.logging.v2.ConfigClient.ListExclusionsPagedResponse in project java-logging by googleapis.
the class ConfigClientTest method listExclusionsTest.
@Test
public void listExclusionsTest() throws Exception {
LogExclusion responsesElement = LogExclusion.newBuilder().build();
ListExclusionsResponse expectedResponse = ListExclusionsResponse.newBuilder().setNextPageToken("").addAllExclusions(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
ListExclusionsPagedResponse pagedListResponse = client.listExclusions(parent);
List<LogExclusion> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExclusionsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExclusionsRequest actualRequest = ((ListExclusionsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations