use of com.google.monitoring.v3.FolderName in project java-logging by googleapis.
the class ConfigClientTest method listExclusionsExceptionTest2.
@Test
public void listExclusionsExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
FolderName parent = FolderName.of("[FOLDER]");
client.listExclusions(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.monitoring.v3.FolderName in project java-logging by googleapis.
the class ConfigClientTest method createSinkTest2.
@Test
public void createSinkTest2() throws Exception {
LogSink expectedResponse = LogSink.newBuilder().setName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString()).setDestination("destination-1429847026").setFilter("filter-1274492040").setDescription("description-1724546052").setDisabled(true).addAllExclusions(new ArrayList<LogExclusion>()).setWriterIdentity("writerIdentity925193809").setIncludeChildren(true).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).build();
mockConfigServiceV2.addResponse(expectedResponse);
FolderName parent = FolderName.of("[FOLDER]");
LogSink sink = LogSink.newBuilder().build();
LogSink actualResponse = client.createSink(parent, sink);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateSinkRequest actualRequest = ((CreateSinkRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(sink, actualRequest.getSink());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.FolderName in project java-logging by googleapis.
the class ConfigClientTest method listSinksExceptionTest2.
@Test
public void listSinksExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
FolderName parent = FolderName.of("[FOLDER]");
client.listSinks(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.monitoring.v3.FolderName in project java-monitoring by googleapis.
the class NotificationChannelServiceClientTest method listNotificationChannelDescriptorsTest.
@Test
public void listNotificationChannelDescriptorsTest() throws Exception {
NotificationChannelDescriptor responsesElement = NotificationChannelDescriptor.newBuilder().build();
ListNotificationChannelDescriptorsResponse expectedResponse = ListNotificationChannelDescriptorsResponse.newBuilder().setNextPageToken("").addAllChannelDescriptors(Arrays.asList(responsesElement)).build();
mockNotificationChannelService.addResponse(expectedResponse);
FolderName name = FolderName.of("[FOLDER]");
ListNotificationChannelDescriptorsPagedResponse pagedListResponse = client.listNotificationChannelDescriptors(name);
List<NotificationChannelDescriptor> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChannelDescriptorsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListNotificationChannelDescriptorsRequest actualRequest = ((ListNotificationChannelDescriptorsRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.FolderName in project java-monitoring by googleapis.
the class NotificationChannelServiceClientTest method listNotificationChannelDescriptorsExceptionTest.
@Test
public void listNotificationChannelDescriptorsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockNotificationChannelService.addException(exception);
try {
FolderName name = FolderName.of("[FOLDER]");
client.listNotificationChannelDescriptors(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations