use of com.google.spanner.admin.instance.v1.ProjectName in project java-logging by googleapis.
the class ConfigClientTest method listExclusionsExceptionTest4.
@Test
public void listExclusionsExceptionTest4() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
client.listExclusions(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.spanner.admin.instance.v1.ProjectName 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()));
}
use of com.google.spanner.admin.instance.v1.ProjectName in project java-logging by googleapis.
the class ConfigClientTest method createSinkExceptionTest4.
@Test
public void createSinkExceptionTest4() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
LogSink sink = LogSink.newBuilder().build();
client.createSink(parent, sink);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.spanner.admin.instance.v1.ProjectName in project java-logging by googleapis.
the class ConfigClientTest method createExclusionExceptionTest4.
@Test
public void createExclusionExceptionTest4() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockConfigServiceV2.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
client.createExclusion(parent, exclusion);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.spanner.admin.instance.v1.ProjectName in project java-logging by googleapis.
the class LoggingClientTest method listLogsExceptionTest4.
@Test
public void listLogsExceptionTest4() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockLoggingServiceV2.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
client.listLogs(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations