use of com.google.cloud.datalabeling.v1beta1.ProjectName in project java-monitoring by googleapis.
the class UptimeCheckServiceClientTest method createUptimeCheckConfigTest3.
@Test
public void createUptimeCheckConfigTest3() throws Exception {
UptimeCheckConfig expectedResponse = UptimeCheckConfig.newBuilder().setName(UptimeCheckConfigName.ofProjectUptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]").toString()).setDisplayName("displayName1714148973").setPeriod(Duration.newBuilder().build()).setTimeout(Duration.newBuilder().build()).addAllContentMatchers(new ArrayList<UptimeCheckConfig.ContentMatcher>()).addAllSelectedRegions(new ArrayList<UptimeCheckRegion>()).setIsInternal(true).addAllInternalCheckers(new ArrayList<InternalChecker>()).build();
mockUptimeCheckService.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
UptimeCheckConfig actualResponse = client.createUptimeCheckConfig(parent, uptimeCheckConfig);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateUptimeCheckConfigRequest actualRequest = ((CreateUptimeCheckConfigRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(uptimeCheckConfig, actualRequest.getUptimeCheckConfig());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.datalabeling.v1beta1.ProjectName in project gapic-generator-java by googleapis.
the class TopicAdminClientTest method listTopicsExceptionTest.
@Test
public void listTopicsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockPublisher.addException(exception);
try {
ProjectName project = ProjectName.of("[PROJECT]");
client.listTopics(project);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.datalabeling.v1beta1.ProjectName in project gapic-generator-java by googleapis.
the class TopicAdminClientTest method listTopicsTest.
@Test
public void listTopicsTest() throws Exception {
Topic responsesElement = Topic.newBuilder().build();
ListTopicsResponse expectedResponse = ListTopicsResponse.newBuilder().setNextPageToken("").addAllTopics(Arrays.asList(responsesElement)).build();
mockPublisher.addResponse(expectedResponse);
ProjectName project = ProjectName.of("[PROJECT]");
ListTopicsPagedResponse pagedListResponse = client.listTopics(project);
List<Topic> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTopicsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPublisher.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTopicsRequest actualRequest = ((ListTopicsRequest) actualRequests.get(0));
Assert.assertEquals(project.toString(), actualRequest.getProject());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.datalabeling.v1beta1.ProjectName in project gapic-generator-java 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.cloud.datalabeling.v1beta1.ProjectName in project gapic-generator-java by googleapis.
the class ConfigClientTest method listSinksTest4.
@Test
public void listSinksTest4() throws Exception {
LogSink responsesElement = LogSink.newBuilder().build();
ListSinksResponse expectedResponse = ListSinksResponse.newBuilder().setNextPageToken("").addAllSinks(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
ListSinksPagedResponse pagedListResponse = client.listSinks(parent);
List<LogSink> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getSinksList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListSinksRequest actualRequest = ((ListSinksRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations