use of com.google.cloud.talent.v4beta1.ProjectName in project gapic-generator-java by googleapis.
the class SchemaServiceClientTest method listSchemasTest.
@Test
public void listSchemasTest() throws Exception {
Schema responsesElement = Schema.newBuilder().build();
ListSchemasResponse expectedResponse = ListSchemasResponse.newBuilder().setNextPageToken("").addAllSchemas(Arrays.asList(responsesElement)).build();
mockSchemaService.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
ListSchemasPagedResponse pagedListResponse = client.listSchemas(parent);
List<Schema> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getSchemasList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockSchemaService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListSchemasRequest actualRequest = ((ListSchemasRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.talent.v4beta1.ProjectName in project gapic-generator-java by googleapis.
the class SyncGetServiceAccountProjectname method syncGetServiceAccountProjectname.
public static void syncGetServiceAccountProjectname() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ServiceAccount response = storageClient.getServiceAccount(project);
}
}
use of com.google.cloud.talent.v4beta1.ProjectName in project gapic-generator-java by googleapis.
the class SyncCreateNotificationProjectnameNotification method syncCreateNotificationProjectnameNotification.
public static void syncCreateNotificationProjectnameNotification() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Notification notification = Notification.newBuilder().build();
Notification response = storageClient.createNotification(parent, notification);
}
}
use of com.google.cloud.talent.v4beta1.ProjectName in project gapic-generator-java by googleapis.
the class SyncGetHmacKeyStringProjectname method syncGetHmacKeyStringProjectname.
public static void syncGetHmacKeyStringProjectname() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String accessId = "accessId-2146437729";
ProjectName project = ProjectName.of("[PROJECT]");
HmacKeyMetadata response = storageClient.getHmacKey(accessId, project);
}
}
use of com.google.cloud.talent.v4beta1.ProjectName in project java-recaptchaenterprise by googleapis.
the class RecaptchaEnterpriseServiceClientTest method listRelatedAccountGroupsExceptionTest.
@Test
public void listRelatedAccountGroupsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecaptchaEnterpriseService.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
client.listRelatedAccountGroups(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations