From 18b72cf43a2f70f3547f652171dde64d5636a68e Mon Sep 17 00:00:00 2001 From: Charlie Yu Date: Thu, 17 Nov 2022 12:12:07 -0500 Subject: [PATCH 1/2] cleanup: Remove migrated files --- .../com/example/jobs/CommuteSearchJobs.java | 95 ------------------- .../example/jobs/CustomRankingSearchJobs.java | 81 ---------------- .../com/example/jobs/HistogramSearchJobs.java | 78 --------------- .../jobs/JobSearchAutoCompleteJobTitle.java | 61 ------------ .../jobs/JobSearchCreateClientEvent.java | 85 ----------------- .../example/jobs/JobSearchCreateCompany.java | 63 ------------ .../com/example/jobs/JobSearchCreateJob.java | 88 ----------------- .../JobSearchCreateJobCustomAttributes.java | 75 --------------- .../example/jobs/JobSearchCreateTenant.java | 55 ----------- .../example/jobs/JobSearchDeleteCompany.java | 53 ----------- .../com/example/jobs/JobSearchDeleteJob.java | 51 ---------- .../example/jobs/JobSearchDeleteTenant.java | 51 ---------- .../com/example/jobs/JobSearchGetCompany.java | 54 ----------- .../com/example/jobs/JobSearchGetJob.java | 65 ------------- .../com/example/jobs/JobSearchGetTenant.java | 52 ---------- .../example/jobs/JobSearchListCompanies.java | 55 ----------- .../com/example/jobs/JobSearchListJobs.java | 55 ----------- .../example/jobs/JobSearchListTenants.java | 53 ----------- .../src/test/java/CommuteSearchJobsTest.java | 55 ----------- .../java/CustomRankingSearchJobsTest.java | 56 ----------- .../test/java/HistogramSearchJobsTest.java | 55 ----------- .../JobSearchAutoCompleteJobTitleTest.java | 54 ----------- .../test/java/JobSearchCreateCompanyTest.java | 64 ------------- .../src/test/java/JobSearchCreateJobTest.java | 72 -------------- .../JobSearchCreateJobWithCustomAttrTest.java | 71 -------------- .../test/java/JobSearchCreateTenantTest.java | 63 ------------ .../test/java/JobSearchDeleteCompanyTest.java | 68 ------------- .../src/test/java/JobSearchDeleteJobTest.java | 73 -------------- .../test/java/JobSearchDeleteTenantTest.java | 65 ------------- .../test/java/JobSearchGetCompanyTest.java | 55 ----------- .../src/test/java/JobSearchGetJobTest.java | 63 ------------ .../src/test/java/JobSearchGetTenantTest.java | 53 ----------- .../test/java/JobSearchListCompaniesTest.java | 55 ----------- .../src/test/java/JobSearchListJobsTest.java | 59 ------------ .../test/java/JobSearchListTenantsTest.java | 52 ---------- 35 files changed, 2203 deletions(-) delete mode 100644 samples/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java delete mode 100644 samples/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java delete mode 100644 samples/snippets/src/test/java/CommuteSearchJobsTest.java delete mode 100644 samples/snippets/src/test/java/CustomRankingSearchJobsTest.java delete mode 100644 samples/snippets/src/test/java/HistogramSearchJobsTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchAutoCompleteJobTitleTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchCreateCompanyTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchCreateJobTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchCreateJobWithCustomAttrTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchCreateTenantTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchDeleteCompanyTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchDeleteJobTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchDeleteTenantTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchGetCompanyTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchGetJobTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchGetTenantTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchListCompaniesTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchListJobsTest.java delete mode 100644 samples/snippets/src/test/java/JobSearchListTenantsTest.java diff --git a/samples/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java b/samples/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java deleted file mode 100644 index 3218faac..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_commute_search] - -import com.google.cloud.talent.v4.CommuteFilter; -import com.google.cloud.talent.v4.CommuteMethod; -import com.google.cloud.talent.v4.Job; -import com.google.cloud.talent.v4.JobQuery; -import com.google.cloud.talent.v4.JobServiceClient; -import com.google.cloud.talent.v4.RequestMetadata; -import com.google.cloud.talent.v4.SearchJobsRequest; -import com.google.cloud.talent.v4.SearchJobsResponse; -import com.google.cloud.talent.v4.TenantName; -import com.google.protobuf.Duration; -import com.google.type.LatLng; -import java.io.IOException; - -public class CommuteSearchJobs { - - public static void searchJobs() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - searchJobs(projectId, tenantId); - } - - // Search Jobs with histogram queries. - public static void searchJobs(String projectId, String tenantId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - String domain = "www.example.com"; - String sessionId = "Hashed session identifier"; - String userId = "Hashed user identifier"; - RequestMetadata requestMetadata = - RequestMetadata.newBuilder() - .setDomain(domain) - .setSessionId(sessionId) - .setUserId(userId) - .build(); - - CommuteMethod commuteMethod = CommuteMethod.DRIVING; - long seconds = 3600L; - Duration travelDuration = Duration.newBuilder().setSeconds(seconds).build(); - - double latitude = 37.422408; - double longitude = -122.084068; - LatLng startCoordinates = - LatLng.newBuilder().setLatitude(latitude).setLongitude(longitude).build(); - - CommuteFilter commuteFilter = - CommuteFilter.newBuilder() - .setCommuteMethod(commuteMethod) - .setTravelDuration(travelDuration) - .setStartCoordinates(startCoordinates) - .build(); - - JobQuery jobQuery = JobQuery.newBuilder().setCommuteFilter(commuteFilter).build(); - SearchJobsRequest request = - SearchJobsRequest.newBuilder() - .setParent(parent.toString()) - .setRequestMetadata(requestMetadata) - .setJobQuery(jobQuery) - .build(); - - for (SearchJobsResponse.MatchingJob responseItem : - jobServiceClient.searchJobs(request).getMatchingJobsList()) { - System.out.format("Job summary: %s%n", responseItem.getJobSummary()); - System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet()); - Job job = responseItem.getJob(); - System.out.format("Job name: %s%n", job.getName()); - System.out.format("Job title: %s%n", job.getTitle()); - } - } - } -} -// [END job_search_commute_search] diff --git a/samples/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java b/samples/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java deleted file mode 100644 index cf0e95d4..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_custom_ranking_search] - -import com.google.cloud.talent.v4.Job; -import com.google.cloud.talent.v4.JobServiceClient; -import com.google.cloud.talent.v4.RequestMetadata; -import com.google.cloud.talent.v4.SearchJobsRequest; -import com.google.cloud.talent.v4.SearchJobsResponse; -import com.google.cloud.talent.v4.TenantName; -import java.io.IOException; - -public class CustomRankingSearchJobs { - - public static void searchCustomRankingJobs() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - searchCustomRankingJobs(projectId, tenantId); - } - - // Search Jobs using custom rankings. - public static void searchCustomRankingJobs(String projectId, String tenantId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - String domain = "www.example.com"; - String sessionId = "Hashed session identifier"; - String userId = "Hashed user identifier"; - RequestMetadata requestMetadata = - RequestMetadata.newBuilder() - .setDomain(domain) - .setSessionId(sessionId) - .setUserId(userId) - .build(); - SearchJobsRequest.CustomRankingInfo.ImportanceLevel importanceLevel = - SearchJobsRequest.CustomRankingInfo.ImportanceLevel.EXTREME; - String rankingExpression = "(someFieldLong + 25) * 0.25"; - SearchJobsRequest.CustomRankingInfo customRankingInfo = - SearchJobsRequest.CustomRankingInfo.newBuilder() - .setImportanceLevel(importanceLevel) - .setRankingExpression(rankingExpression) - .build(); - String orderBy = "custom_ranking desc"; - SearchJobsRequest request = - SearchJobsRequest.newBuilder() - .setParent(parent.toString()) - .setRequestMetadata(requestMetadata) - .setCustomRankingInfo(customRankingInfo) - .setOrderBy(orderBy) - .build(); - for (SearchJobsResponse.MatchingJob responseItem : - jobServiceClient.searchJobs(request).getMatchingJobsList()) { - System.out.format("Job summary: %s%n", responseItem.getJobSummary()); - System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet()); - Job job = responseItem.getJob(); - System.out.format("Job name: %s%n", job.getName()); - System.out.format("Job title: %s%n", job.getTitle()); - } - } - } -} -// [END job_search_custom_ranking_search] diff --git a/samples/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java b/samples/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java deleted file mode 100644 index 5f6bde45..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_histogram_search] - -import com.google.cloud.talent.v4.HistogramQuery; -import com.google.cloud.talent.v4.Job; -import com.google.cloud.talent.v4.JobServiceClient; -import com.google.cloud.talent.v4.RequestMetadata; -import com.google.cloud.talent.v4.SearchJobsRequest; -import com.google.cloud.talent.v4.SearchJobsResponse; -import com.google.cloud.talent.v4.TenantName; -import java.io.IOException; - -public class HistogramSearchJobs { - - public static void searchJobs() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String query = "count(base_compensation, [bucket(12, 20)])"; - searchJobs(projectId, tenantId, query); - } - - // Search Jobs with histogram queries. - public static void searchJobs(String projectId, String tenantId, String query) - throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - - String domain = "http://www.jobUrl.com"; - String sessionId = "Hashed session identifier"; - String userId = "Hashed user identifier"; - RequestMetadata requestMetadata = - RequestMetadata.newBuilder() - .setDomain(domain) - .setSessionId(sessionId) - .setUserId(userId) - .build(); - HistogramQuery histogramQueriesElement = - HistogramQuery.newBuilder().setHistogramQuery(query).build(); - SearchJobsRequest request = - SearchJobsRequest.newBuilder() - .setParent(parent.toString()) - .setRequestMetadata(requestMetadata) - .addHistogramQueries(histogramQueriesElement) - .build(); - - for (SearchJobsResponse.MatchingJob responseItem : - jobServiceClient.searchJobs(request).getMatchingJobsList()) { - System.out.format("Job summary: %s%n", responseItem.getJobSummary()); - System.out.format("Job title snippet: %s%n", responseItem.getJobTitleSnippet()); - Job job = responseItem.getJob(); - System.out.format("Job name: %s%n", job.getName()); - System.out.format("Job title: %s%n", job.getTitle()); - } - } - } -} -// [END job_search_histogram_search] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java deleted file mode 100644 index 321e416d..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_autocomplete_job_title] - -import com.google.cloud.talent.v4.CompleteQueryRequest; -import com.google.cloud.talent.v4.CompleteQueryResponse; -import com.google.cloud.talent.v4.CompletionClient; -import com.google.cloud.talent.v4.TenantName; -import java.io.IOException; - -public class JobSearchAutoCompleteJobTitle { - - public static void completeQuery() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String query = "your-query-for-job-title"; - completeQuery(projectId, tenantId, query); - } - - // Complete job title given partial text (autocomplete). - public static void completeQuery(String projectId, String tenantId, String query) - throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (CompletionClient completionClient = CompletionClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - CompleteQueryRequest request = - CompleteQueryRequest.newBuilder() - .setTenant(parent.toString()) - .setQuery(query) - .setPageSize(5) // limit for number of results - .addLanguageCodes("en-US") // language code - .build(); - CompleteQueryResponse response = completionClient.completeQuery(request); - for (CompleteQueryResponse.CompletionResult result : response.getCompletionResultsList()) { - System.out.format("Suggested title: %s%n", result.getSuggestion()); - // Suggestion type is JOB_TITLE or COMPANY_TITLE - System.out.format("Suggestion type: %s%n", result.getType()); - } - } - } -} -// [END job_search_autocomplete_job_title] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java deleted file mode 100644 index a8273ae5..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_create_client_event] - -import com.google.cloud.talent.v4.ClientEvent; -import com.google.cloud.talent.v4.CreateClientEventRequest; -import com.google.cloud.talent.v4.EventServiceClient; -import com.google.cloud.talent.v4.JobEvent; -import com.google.cloud.talent.v4.TenantName; -import com.google.protobuf.Timestamp; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -public class JobSearchCreateClientEvent { - - public static void createClientEvent() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String requestId = "your-req-id-from-response-metadata"; - String eventId = "your-unique-identifier-id"; - createClientEvent(projectId, tenantId, requestId, eventId); - } - - // Creates a client event. - public static void createClientEvent( - String projectId, String tenantId, String requestId, String eventId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (EventServiceClient eventServiceClient = EventServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - - // The timestamp of the event as seconds of UTC time since Unix epoch - // For more information on how to create google.protobuf.Timestamps - // See: - // https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto - long seconds = 3L; - Timestamp createTime = Timestamp.newBuilder().setSeconds(seconds).build(); - - // The type of event attributed to the behavior of the end user - JobEvent.JobEventType type = JobEvent.JobEventType.VIEW; - - // List of job names associated with this event - String jobsElement = "projects/[Project ID]/tenants/[Tenant ID]/jobs/[Job ID]"; - String jobsElement2 = "projects/[Project ID]/tenants/[Tenant ID]/jobs/[Job ID]"; - - List jobs = Arrays.asList(jobsElement, jobsElement2); - JobEvent jobEvent = JobEvent.newBuilder().setType(type).addAllJobs(jobs).build(); - ClientEvent clientEvent = - ClientEvent.newBuilder() - .setRequestId(requestId) - .setEventId(eventId) - .setCreateTime(createTime) - .setJobEvent(jobEvent) - .build(); - CreateClientEventRequest request = - CreateClientEventRequest.newBuilder() - .setParent(parent.toString()) - .setClientEvent(clientEvent) - .build(); - ClientEvent response = eventServiceClient.createClientEvent(request); - System.out.println("Created client event. "); - System.out.println(response.toString()); - } - } -} -// [END job_search_create_client_event] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java deleted file mode 100644 index 587c48e4..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_create_company_beta] - -import com.google.cloud.talent.v4.Company; -import com.google.cloud.talent.v4.CompanyServiceClient; -import com.google.cloud.talent.v4.CreateCompanyRequest; -import com.google.cloud.talent.v4.TenantName; -import java.io.IOException; - -public class JobSearchCreateCompany { - - public static void createCompany() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String displayName = "your-company-display-name"; - String externalId = "your-external-id"; - createCompany(projectId, tenantId, displayName, externalId); - } - - // Create a company. - public static void createCompany( - String projectId, String tenantId, String displayName, String externalId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - Company company = - Company.newBuilder().setDisplayName(displayName).setExternalId(externalId).build(); - - CreateCompanyRequest request = - CreateCompanyRequest.newBuilder() - .setParent(parent.toString()) - .setCompany(company) - .build(); - - Company response = companyServiceClient.createCompany(request); - System.out.println("Created Company"); - System.out.format("Name: %s%n", response.getName()); - System.out.format("Display Name: %s%n", response.getDisplayName()); - System.out.format("External ID: %s%n", response.getExternalId()); - } - } -} -// [END job_search_create_company_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java deleted file mode 100644 index af2dad8e..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_create_job_beta] - -import com.google.cloud.talent.v4.CreateJobRequest; -import com.google.cloud.talent.v4.Job; -import com.google.cloud.talent.v4.JobServiceClient; -import com.google.cloud.talent.v4.TenantName; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -public class JobSearchCreateJob { - - public static void createJob() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String companyId = "your-company-id"; - String requisitionId = "your-unique-req-id"; - String jobApplicationUrl = "your-job-url"; - // String projectId = "me-qa-1"; - // String tenantId = "8ed97629-27ee-4215-909b-18cfe3b7e8e3"; - // String companyId = "05317758-b30e-4b26-a57d-d9e54e4cccd8"; - // String requisitionId = "test-requisitionid-1"; - // String jobApplicationUrl = "http://job.url"; - createJob(projectId, tenantId, companyId, requisitionId, jobApplicationUrl); - } - - // Create a job. - public static void createJob( - String projectId, - String tenantId, - String companyId, - String requisitionId, - String jobApplicationUrl) - throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - Job.ApplicationInfo applicationInfo = - Job.ApplicationInfo.newBuilder().addUris(jobApplicationUrl).build(); - - List addresses = - Arrays.asList( - "1600 Amphitheatre Parkway, Mountain View, CA 94043", - "111 8th Avenue, New York, NY 10011"); - - // By default, job will expire in 30 days. - // https://cloud.google.com/talent-solution/job-search/docs/jobs - Job job = - Job.newBuilder() - .setCompany(companyId) - .setRequisitionId(requisitionId) - .setTitle("Software Developer") - .setDescription("Develop, maintain the software solutions.") - .setApplicationInfo(applicationInfo) - .addAllAddresses(addresses) - .setLanguageCode("en-US") - .build(); - - CreateJobRequest request = - CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build(); - - Job response = jobServiceClient.createJob(request); - System.out.format("Created job: %s%n", response.getName()); - } - } -} -// [END job_search_create_job_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java deleted file mode 100644 index 7e79d55a..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_create_job_custom_attributes] - -import com.google.cloud.talent.v4.CreateJobRequest; -import com.google.cloud.talent.v4.CustomAttribute; -import com.google.cloud.talent.v4.Job; -import com.google.cloud.talent.v4.JobServiceClient; -import com.google.cloud.talent.v4.TenantName; -import java.io.IOException; - -public class JobSearchCreateJobCustomAttributes { - - public static void createJob() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String companyId = "your-company-id"; - String requisitionId = "your-unique-req-id"; - createJob(projectId, tenantId, companyId, requisitionId); - } - - // Create Job with Custom Attributes. - public static void createJob( - String projectId, String tenantId, String companyId, String requisitionId) - throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - - // Custom attribute can be string or numeric value, and can be filtered in search queries. - // https://cloud.google.com/talent-solution/job-search/docs/custom-attributes - CustomAttribute customAttribute = - CustomAttribute.newBuilder() - .addStringValues("Internship") - .addStringValues("Apprenticeship") - .setFilterable(true) - .build(); - - Job job = - Job.newBuilder() - .setCompany(companyId) - .setTitle("Software Developer I") - .setDescription("This is a description of this wonderful job!") - .putCustomAttributes("FOR_STUDENTS", customAttribute) - .setRequisitionId(requisitionId) - .setLanguageCode("en-US") - .build(); - - CreateJobRequest request = - CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build(); - Job response = jobServiceClient.createJob(request); - System.out.printf("Created job: %s\n", response.getName()); - } - } -} -// [END job_search_create_job_custom_attributes] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java deleted file mode 100644 index abcab4a9..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_create_tenant_beta] - -import com.google.cloud.talent.v4.CreateTenantRequest; -import com.google.cloud.talent.v4.ProjectName; -import com.google.cloud.talent.v4.Tenant; -import com.google.cloud.talent.v4.TenantServiceClient; -import java.io.IOException; - -public class JobSearchCreateTenant { - - public static void createTenant() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String externalId = "your-external-id"; - createTenant(projectId, externalId); - } - - // Create Tenant for scoping resources, e.g. companies and jobs. - public static void createTenant(String projectId, String externalId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { - ProjectName parent = ProjectName.of(projectId); - Tenant tenant = Tenant.newBuilder().setExternalId(externalId).build(); - - CreateTenantRequest request = - CreateTenantRequest.newBuilder().setParent(parent.toString()).setTenant(tenant).build(); - - Tenant response = tenantServiceClient.createTenant(request); - System.out.println("Created Tenant"); - System.out.format("Name: %s%n", response.getName()); - System.out.format("External ID: %s%n", response.getExternalId()); - } - } -} -// [END job_search_create_tenant_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java deleted file mode 100644 index 5472de65..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_delete_company_beta] - -import com.google.cloud.talent.v4.CompanyName; -import com.google.cloud.talent.v4.CompanyServiceClient; -import com.google.cloud.talent.v4.DeleteCompanyRequest; -import java.io.IOException; - -public class JobSearchDeleteCompany { - - public static void deleteCompany() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String companyId = "your-company-id"; - deleteCompany(projectId, tenantId, companyId); - } - - // Delete Company. - public static void deleteCompany(String projectId, String tenantId, String companyId) - throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { - CompanyName name = CompanyName.of(projectId, tenantId, companyId); - - DeleteCompanyRequest request = - DeleteCompanyRequest.newBuilder().setName(name.toString()).build(); - - companyServiceClient.deleteCompany(request); - System.out.println("Deleted company"); - } - } -} -// [END job_search_delete_company_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java deleted file mode 100644 index 9603f163..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_delete_job_beta] - -import com.google.cloud.talent.v4.DeleteJobRequest; -import com.google.cloud.talent.v4.JobName; -import com.google.cloud.talent.v4.JobServiceClient; -import java.io.IOException; - -public class JobSearchDeleteJob { - - public static void deleteJob() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String jobId = "your-job-id"; - deleteJob(projectId, tenantId, jobId); - } - - // Delete Job. - public static void deleteJob(String projectId, String tenantId, String jobId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - JobName name = JobName.of(projectId, tenantId, jobId); - - DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build(); - - jobServiceClient.deleteJob(request); - System.out.println("Deleted job."); - } - } -} -// [END job_search_delete_job_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java deleted file mode 100644 index d7f949f4..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_delete_tenant_beta] - -import com.google.cloud.talent.v4.DeleteTenantRequest; -import com.google.cloud.talent.v4.TenantName; -import com.google.cloud.talent.v4.TenantServiceClient; -import java.io.IOException; - -public class JobSearchDeleteTenant { - - public static void deleteTenant() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - deleteTenant(projectId, tenantId); - } - - // Delete Tenant. - public static void deleteTenant(String projectId, String tenantId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { - TenantName name = TenantName.of(projectId, tenantId); - - DeleteTenantRequest request = - DeleteTenantRequest.newBuilder().setName(name.toString()).build(); - - tenantServiceClient.deleteTenant(request); - System.out.println("Deleted Tenant."); - } - } -} -// [END job_search_delete_tenant_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java deleted file mode 100644 index 9a4da2d0..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_get_company_beta] - -import com.google.cloud.talent.v4.Company; -import com.google.cloud.talent.v4.CompanyName; -import com.google.cloud.talent.v4.CompanyServiceClient; -import com.google.cloud.talent.v4.GetCompanyRequest; -import java.io.IOException; - -public class JobSearchGetCompany { - - public static void getCompany() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String companyId = "your-company-id"; - getCompany(projectId, tenantId, companyId); - } - - // Get Company. - public static void getCompany(String projectId, String tenantId, String companyId) - throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { - CompanyName name = CompanyName.of(projectId, tenantId, companyId); - - GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(name.toString()).build(); - - Company response = companyServiceClient.getCompany(request); - System.out.format("Company name: %s%n", response.getName()); - System.out.format("Display name: %s%n", response.getDisplayName()); - } - } -} -// [END job_search_get_company_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java deleted file mode 100644 index 0314f149..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_get_job_beta] - -import com.google.cloud.talent.v4.GetJobRequest; -import com.google.cloud.talent.v4.Job; -import com.google.cloud.talent.v4.JobName; -import com.google.cloud.talent.v4.JobServiceClient; -import java.io.IOException; - -public class JobSearchGetJob { - - public static void getJob() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String jobId = "your-job-id"; - getJob(projectId, tenantId, jobId); - } - - // Get Job. - public static void getJob(String projectId, String tenantId, String jobId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - JobName name = JobName.of(projectId, tenantId, jobId); - - GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build(); - - Job response = jobServiceClient.getJob(request); - System.out.format("Job name: %s%n", response.getName()); - System.out.format("Requisition ID: %s%n", response.getRequisitionId()); - System.out.format("Title: %s%n", response.getTitle()); - System.out.format("Description: %s%n", response.getDescription()); - System.out.format("Posting language: %s%n", response.getLanguageCode()); - for (String address : response.getAddressesList()) { - System.out.format("Address: %s%n", address); - } - for (String email : response.getApplicationInfo().getEmailsList()) { - System.out.format("Email: %s%n", email); - } - for (String websiteUri : response.getApplicationInfo().getUrisList()) { - System.out.format("Website: %s%n", websiteUri); - } - } - } -} -// [END job_search_get_job_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java deleted file mode 100644 index c9163104..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_get_tenant_beta] - -import com.google.cloud.talent.v4.GetTenantRequest; -import com.google.cloud.talent.v4.Tenant; -import com.google.cloud.talent.v4.TenantName; -import com.google.cloud.talent.v4.TenantServiceClient; -import java.io.IOException; - -public class JobSearchGetTenant { - - public static void getTenant() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - getTenant(projectId, tenantId); - } - - // Get Tenant by name. - public static void getTenant(String projectId, String tenantId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { - TenantName name = TenantName.of(projectId, tenantId); - - GetTenantRequest request = GetTenantRequest.newBuilder().setName(name.toString()).build(); - - Tenant response = tenantServiceClient.getTenant(request); - System.out.format("Name: %s%n", response.getName()); - System.out.format("External ID: %s%n", response.getExternalId()); - } - } -} -// [END job_search_get_tenant_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java deleted file mode 100644 index 0313045f..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_list_companies_beta] - -import com.google.cloud.talent.v4.Company; -import com.google.cloud.talent.v4.CompanyServiceClient; -import com.google.cloud.talent.v4.ListCompaniesRequest; -import com.google.cloud.talent.v4.TenantName; -import java.io.IOException; - -public class JobSearchListCompanies { - - public static void listCompanies() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - listCompanies(projectId, tenantId); - } - - // List Companies. - public static void listCompanies(String projectId, String tenantId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - - ListCompaniesRequest request = - ListCompaniesRequest.newBuilder().setParent(parent.toString()).build(); - - for (Company responseItem : companyServiceClient.listCompanies(request).iterateAll()) { - System.out.format("Company Name: %s%n", responseItem.getName()); - System.out.format("Display Name: %s%n", responseItem.getDisplayName()); - System.out.format("External ID: %s%n", responseItem.getExternalId()); - } - } - } -} -// [END job_search_list_companies_beta] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java deleted file mode 100644 index 9fe1bbc8..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_list_jobs] - -import com.google.cloud.talent.v4.Job; -import com.google.cloud.talent.v4.JobServiceClient; -import com.google.cloud.talent.v4.ListJobsRequest; -import com.google.cloud.talent.v4.TenantName; -import java.io.IOException; - -public class JobSearchListJobs { - - public static void listJobs() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - String tenantId = "your-tenant-id"; - String query = "count(base_compensation, [bucket(12, 20)])"; - listJobs(projectId, tenantId, query); - } - - // Search Jobs with histogram queries. - public static void listJobs(String projectId, String tenantId, String filter) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (JobServiceClient jobServiceClient = JobServiceClient.create()) { - TenantName parent = TenantName.of(projectId, tenantId); - ListJobsRequest request = - ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build(); - for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) { - System.out.format("Job name: %s%n", responseItem.getName()); - System.out.format("Job requisition ID: %s%n", responseItem.getRequisitionId()); - System.out.format("Job title: %s%n", responseItem.getTitle()); - System.out.format("Job description: %s%n", responseItem.getDescription()); - } - } - } -} -// [END job_search_list_jobs] diff --git a/samples/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java b/samples/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java deleted file mode 100644 index d71191f0..00000000 --- a/samples/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example.jobs; - -// [START job_search_list_tenants_beta] - -import com.google.cloud.talent.v4.ListTenantsRequest; -import com.google.cloud.talent.v4.ProjectName; -import com.google.cloud.talent.v4.Tenant; -import com.google.cloud.talent.v4.TenantServiceClient; -import java.io.IOException; - -public class JobSearchListTenants { - - public static void listTenants() throws IOException { - // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; - listTenants(projectId); - } - - // List Tenants. - public static void listTenants(String projectId) throws IOException { - // Initialize client that will be used to send requests. This client only needs to be created - // once, and can be reused for multiple requests. After completing all of your requests, call - // the "close" method on the client to safely clean up any remaining background resources. - try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) { - ProjectName parent = ProjectName.of(projectId); - - ListTenantsRequest request = - ListTenantsRequest.newBuilder().setParent(parent.toString()).build(); - - for (Tenant responseItem : tenantServiceClient.listTenants(request).iterateAll()) { - System.out.format("Tenant Name: %s%n", responseItem.getName()); - System.out.format("External ID: %s%n", responseItem.getExternalId()); - } - } - } -} -// [END job_search_list_tenants_beta] diff --git a/samples/snippets/src/test/java/CommuteSearchJobsTest.java b/samples/snippets/src/test/java/CommuteSearchJobsTest.java deleted file mode 100644 index 15836240..00000000 --- a/samples/snippets/src/test/java/CommuteSearchJobsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.CommuteSearchJobs; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class CommuteSearchJobsTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testCommuteSearchJobs() throws IOException { - // retrieve a job. - CommuteSearchJobs.searchJobs(PROJECT_ID, TENANT_ID); - String got = bout.toString(); - - assertThat(got).contains("Job summary:"); - assertThat(got).contains("Job title snippet:"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/CustomRankingSearchJobsTest.java b/samples/snippets/src/test/java/CustomRankingSearchJobsTest.java deleted file mode 100644 index 2f5aa257..00000000 --- a/samples/snippets/src/test/java/CustomRankingSearchJobsTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.CustomRankingSearchJobs; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class CustomRankingSearchJobsTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testCustomRankingSearchJobs() throws IOException { - // retrieve a job. - CustomRankingSearchJobs.searchCustomRankingJobs(PROJECT_ID, TENANT_ID); - String got = bout.toString(); - - assertThat(got).contains("Job summary:"); - assertThat(got).contains("Job title snippet:"); - assertThat(got).contains("Job title:"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/HistogramSearchJobsTest.java b/samples/snippets/src/test/java/HistogramSearchJobsTest.java deleted file mode 100644 index 8e2b7b04..00000000 --- a/samples/snippets/src/test/java/HistogramSearchJobsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.HistogramSearchJobs; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class HistogramSearchJobsTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testHistogramSearch() throws IOException { - // retrieve a job. - HistogramSearchJobs.searchJobs( - PROJECT_ID, TENANT_ID, "count(base_compensation, [bucket(12, 20)])"); - String got = bout.toString(); - assertThat(got).contains("Job summary:"); - assertThat(got).contains("Job title snippet:"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchAutoCompleteJobTitleTest.java b/samples/snippets/src/test/java/JobSearchAutoCompleteJobTitleTest.java deleted file mode 100644 index 61b36650..00000000 --- a/samples/snippets/src/test/java/JobSearchAutoCompleteJobTitleTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchAutoCompleteJobTitle; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchAutoCompleteJobTitleTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testAutoCompleteJobTitle() throws IOException { - // retrieve a tenant. - JobSearchAutoCompleteJobTitle.completeQuery(PROJECT_ID, TENANT_ID, "Developer Program"); - String got = bout.toString(); - assertThat(got).contains("Suggested title:"); - assertThat(got).contains("Suggestion type:"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchCreateCompanyTest.java b/samples/snippets/src/test/java/JobSearchCreateCompanyTest.java deleted file mode 100644 index 325e1af4..00000000 --- a/samples/snippets/src/test/java/JobSearchCreateCompanyTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchCreateCompany; -import com.example.jobs.JobSearchDeleteCompany; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchCreateCompanyTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - - private static final String COMPANY_EXT_ID = - String.format("COMP_EXT_ID_%s", UUID.randomUUID().toString().substring(0, 20)); - private static final String COMPANY_DISPLAY_NAME = "DO_NOT_DELETE_COMPANY"; - - private String companyId; - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testCreateCompany() throws IOException { - // retrieve a tenant. - JobSearchCreateCompany.createCompany( - PROJECT_ID, TENANT_ID, COMPANY_DISPLAY_NAME, COMPANY_EXT_ID); - String got = bout.toString(); - assertThat(got).contains("Created Company"); - - companyId = JobSearchGetJobTest.extractLastId(got.split("\n")[1]); - } - - @After - public void tearDown() throws IOException { - // delete that job. - JobSearchDeleteCompany.deleteCompany(PROJECT_ID, TENANT_ID, companyId); - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchCreateJobTest.java b/samples/snippets/src/test/java/JobSearchCreateJobTest.java deleted file mode 100644 index c53cf1b5..00000000 --- a/samples/snippets/src/test/java/JobSearchCreateJobTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchCreateJob; -import com.example.jobs.JobSearchDeleteJob; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchCreateJobTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); - private static final String POST_UNIQUE_ID = - String.format( - "TEST_POST_ID_%s", - UUID.randomUUID().toString().substring(0, 20)); // Posting ID. Unique per job. - - private String jobId; - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testCreateJob() throws IOException { - // create a job. - JobSearchCreateJob.createJob( - PROJECT_ID, TENANT_ID, COMPANY_ID, POST_UNIQUE_ID, "http://www.jobUrl.com"); - String got = bout.toString(); - - assertThat(got).contains("Created job:"); - jobId = JobSearchGetJobTest.extractLastId(got.split("\n")[0].trim()); - - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @After - public void tearDown() throws IOException { - // delete that job. - JobSearchDeleteJob.deleteJob(PROJECT_ID, TENANT_ID, jobId); - String got = bout.toString(); - assertThat(got).contains("Deleted job"); - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchCreateJobWithCustomAttrTest.java b/samples/snippets/src/test/java/JobSearchCreateJobWithCustomAttrTest.java deleted file mode 100644 index 0671921b..00000000 --- a/samples/snippets/src/test/java/JobSearchCreateJobWithCustomAttrTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchCreateJobCustomAttributes; -import com.example.jobs.JobSearchDeleteJob; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchCreateJobWithCustomAttrTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); - private static final String POST_UNIQUE_ID = - String.format( - "TEST_POST_ID_%s", - UUID.randomUUID().toString().substring(0, 20)); // Posting ID. Unique per job. - - private String jobId; - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testCreateJob() throws IOException { - // create a job with custom attributes. - JobSearchCreateJobCustomAttributes.createJob(PROJECT_ID, TENANT_ID, COMPANY_ID, POST_UNIQUE_ID); - String got = bout.toString(); - - assertThat(got).contains("Created job:"); - jobId = JobSearchGetJobTest.extractLastId(got.split("\n")[0].trim()); - - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @After - public void tearDown() throws IOException { - // delete that job. - JobSearchDeleteJob.deleteJob(PROJECT_ID, TENANT_ID, jobId); - String got = bout.toString(); - assertThat(got).contains("Deleted job"); - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchCreateTenantTest.java b/samples/snippets/src/test/java/JobSearchCreateTenantTest.java deleted file mode 100644 index fdbe9932..00000000 --- a/samples/snippets/src/test/java/JobSearchCreateTenantTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchCreateTenant; -import com.example.jobs.JobSearchDeleteTenant; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchCreateTenantTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_EXT_ID = - String.format("EXTERNAL_TEMP_TENANT_ID_%s", UUID.randomUUID().toString().substring(0, 20)); - - private String tenantId; - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testCreateTenant() throws IOException { - // create a tenant. - JobSearchCreateTenant.createTenant(PROJECT_ID, TENANT_EXT_ID); - - String got = bout.toString(); - assertThat(got).contains("Created Tenant"); - - tenantId = JobSearchGetJobTest.extractLastId(got.split("\n")[1]); - } - - @After - public void tearDown() throws IOException { - - // clean up. - JobSearchDeleteTenant.deleteTenant(PROJECT_ID, tenantId); - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchDeleteCompanyTest.java b/samples/snippets/src/test/java/JobSearchDeleteCompanyTest.java deleted file mode 100644 index a321d80e..00000000 --- a/samples/snippets/src/test/java/JobSearchDeleteCompanyTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchCreateCompany; -import com.example.jobs.JobSearchDeleteCompany; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchDeleteCompanyTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - - private static final String COMPANY_EXT_ID = - String.format("COMP_EXT_ID_%s", UUID.randomUUID().toString().substring(0, 20)); - private static final String COMPANY_DISPLAY_NAME = "DO_NOT_DELETE_COMPANY"; - - private String companyId; - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() throws IOException { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - - // create a company - JobSearchCreateCompany.createCompany( - PROJECT_ID, TENANT_ID, COMPANY_DISPLAY_NAME, COMPANY_EXT_ID); - String got = bout.toString(); - assertThat(got).contains("Created Company"); - - companyId = JobSearchGetJobTest.extractLastId(got.split("\n")[1]); - } - - @Test - public void testDeleteCompany() throws IOException { - // retrieve a tenant. - JobSearchDeleteCompany.deleteCompany(PROJECT_ID, TENANT_ID, companyId); - String got = bout.toString(); - assertThat(got).contains("Deleted company"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchDeleteJobTest.java b/samples/snippets/src/test/java/JobSearchDeleteJobTest.java deleted file mode 100644 index 7896a43d..00000000 --- a/samples/snippets/src/test/java/JobSearchDeleteJobTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchCreateJob; -import com.example.jobs.JobSearchDeleteJob; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchDeleteJobTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); - private static final String POST_UNIQUE_ID = - String.format( - "TEST_POST_ID_%s", - UUID.randomUUID().toString().substring(0, 20)); // Posting ID. Unique per job. - - private String jobId; - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() throws IOException { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - - JobSearchCreateJob.createJob( - PROJECT_ID, TENANT_ID, COMPANY_ID, POST_UNIQUE_ID, "http://www.jobUrl.com"); - - String got = bout.toString(); - assertThat(got).contains("Created job:"); - jobId = JobSearchGetJobTest.extractLastId(got.split("\n")[0].trim()); - - bout = new ByteArrayOutputStream(); - out = new PrintStream(bout); - System.setOut(out); - } - - @Test - public void testDeleteJob() throws IOException { - // delete a job. - JobSearchDeleteJob.deleteJob(PROJECT_ID, TENANT_ID, jobId); - String got = bout.toString(); - - assertThat(got).contains("Deleted job"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchDeleteTenantTest.java b/samples/snippets/src/test/java/JobSearchDeleteTenantTest.java deleted file mode 100644 index 5f2b1867..00000000 --- a/samples/snippets/src/test/java/JobSearchDeleteTenantTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchCreateTenant; -import com.example.jobs.JobSearchDeleteTenant; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.util.UUID; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchDeleteTenantTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_EXT_ID = - String.format("EXTERNAL_TEMP_TENANT_ID_%s", UUID.randomUUID().toString().substring(0, 20)); - private String tenantId; - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() throws IOException { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - - // create a tenant for job and company - JobSearchCreateTenant.createTenant(PROJECT_ID, TENANT_EXT_ID); - - String got = bout.toString(); - assertThat(got).contains("Created Tenant"); - - tenantId = JobSearchGetJobTest.extractLastId(got.split("\n")[1]); - } - - @Test - public void testDeleteTenantTest() throws IOException { - // delete a tenant. - JobSearchDeleteTenant.deleteTenant(PROJECT_ID, tenantId); - String got = bout.toString(); - assertThat(got).contains("Deleted Tenant."); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchGetCompanyTest.java b/samples/snippets/src/test/java/JobSearchGetCompanyTest.java deleted file mode 100644 index 95d915bd..00000000 --- a/samples/snippets/src/test/java/JobSearchGetCompanyTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchGetCompany; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchGetCompanyTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testGetCompany() throws IOException { - // retrieve a tenant. - JobSearchGetCompany.getCompany(PROJECT_ID, TENANT_ID, COMPANY_ID); - String got = bout.toString(); - assertThat(got).contains("Company name:"); - assertThat(got).contains("Display name:"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchGetJobTest.java b/samples/snippets/src/test/java/JobSearchGetJobTest.java deleted file mode 100644 index ad1b9501..00000000 --- a/samples/snippets/src/test/java/JobSearchGetJobTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchGetJob; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchGetJobTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - private static final String JOB_ID = System.getenv("CTS_GET_JOB_ID"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() throws IOException { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testGetJob() throws IOException { - // retrieve a job. - JobSearchGetJob.getJob(PROJECT_ID, TENANT_ID, JOB_ID); - String got = bout.toString(); - assertThat(got).contains("Job name: "); - assertThat(got).contains("Website:"); - } - - @After - public void tearDown() { - System.setOut(out); - } - - // Helper method for getting the last id from the full path. - public static String extractLastId(String fullPath) { - if (fullPath == null || fullPath.length() < 1 || !fullPath.contains("/")) { - throw new IllegalArgumentException("Not valid path"); - } - String[] parts = fullPath.split("/"); - return parts[parts.length - 1]; - } -} diff --git a/samples/snippets/src/test/java/JobSearchGetTenantTest.java b/samples/snippets/src/test/java/JobSearchGetTenantTest.java deleted file mode 100644 index ccd1d1b5..00000000 --- a/samples/snippets/src/test/java/JobSearchGetTenantTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchGetTenant; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchGetTenantTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testGetTenant() throws IOException { - // retrieve a tenant. - JobSearchGetTenant.getTenant(PROJECT_ID, TENANT_ID); - String got = bout.toString(); - assertThat(got).contains("Name:"); - assertThat(got).contains("External ID:"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchListCompaniesTest.java b/samples/snippets/src/test/java/JobSearchListCompaniesTest.java deleted file mode 100644 index 4138c6bd..00000000 --- a/samples/snippets/src/test/java/JobSearchListCompaniesTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchListCompanies; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchListCompaniesTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testListCompanies() throws IOException { - // retrieve a tenant. - JobSearchListCompanies.listCompanies(PROJECT_ID, TENANT_ID); - String got = bout.toString(); - assertThat(got).contains("Company Name:"); - assertThat(got).contains("Display Name:"); - assertThat(got).contains("External ID:"); - } - - @After - public void tearDown() { - // delete that job. - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchListJobsTest.java b/samples/snippets/src/test/java/JobSearchListJobsTest.java deleted file mode 100644 index c3070fcc..00000000 --- a/samples/snippets/src/test/java/JobSearchListJobsTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchListJobs; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchListJobsTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - private static final String TENANT_ID = System.getenv("CTS_TENANT_ID"); - private static final String COMPANY_ID = System.getenv("CTS_COMPANY_ID"); - - private static final String FILTER = "companyName=\"projects/%s/companies/%s\""; - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testListJobs() throws IOException { - // retrieve a job. - JobSearchListJobs.listJobs( - PROJECT_ID, TENANT_ID, String.format(FILTER, PROJECT_ID, COMPANY_ID)); - String got = bout.toString(); - - assertThat(got).contains("Job name:"); - assertThat(got).contains("Job requisition ID:"); - assertThat(got).contains("Job title:"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} diff --git a/samples/snippets/src/test/java/JobSearchListTenantsTest.java b/samples/snippets/src/test/java/JobSearchListTenantsTest.java deleted file mode 100644 index d615bebf..00000000 --- a/samples/snippets/src/test/java/JobSearchListTenantsTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import static com.google.common.truth.Truth.assertThat; - -import com.example.jobs.JobSearchListTenants; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class JobSearchListTenantsTest { - private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); - - private ByteArrayOutputStream bout; - private PrintStream out; - - @Before - public void setUp() { - bout = new ByteArrayOutputStream(); - out = System.out; - System.setOut(new PrintStream(bout)); - } - - @Test - public void testListTenants() throws IOException { - // retrieve a tenant. - JobSearchListTenants.listTenants(PROJECT_ID); - String got = bout.toString(); - assertThat(got).contains("Tenant Name:"); - assertThat(got).contains("External ID:"); - } - - @After - public void tearDown() { - System.setOut(out); - } -} From 1694109c4d8fb0b00420d5710990e0f5d97eb22c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Thu, 17 Nov 2022 17:15:24 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index dff63350..8cc61364 100644 --- a/README.md +++ b/README.md @@ -26,20 +26,20 @@ If you are using Maven, add this to your pom.xml file: com.google.cloud google-cloud-talent - 2.6.0 + 2.7.0 ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-talent:2.6.0' +implementation 'com.google.cloud:google-cloud-talent:2.7.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-talent" % "2.6.0" +libraryDependencies += "com.google.cloud" % "google-cloud-talent" % "2.7.0" ``` ## Authentication @@ -77,32 +77,6 @@ use this Talent Solution Client Library. -## Samples - -Samples are in the [`samples/`](https://github.com/googleapis/java-talent/tree/main/samples) directory. - -| Sample | Source Code | Try it | -| --------------------------- | --------------------------------- | ------ | -| Commute Search Jobs | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/CommuteSearchJobs.java) | -| Custom Ranking Search Jobs | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/CustomRankingSearchJobs.java) | -| Histogram Search Jobs | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/HistogramSearchJobs.java) | -| Job Search Auto Complete Job Title | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchAutoCompleteJobTitle.java) | -| Job Search Create Client Event | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchCreateClientEvent.java) | -| Job Search Create Company | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchCreateCompany.java) | -| Job Search Create Job | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJob.java) | -| Job Search Create Job Custom Attributes | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchCreateJobCustomAttributes.java) | -| Job Search Create Tenant | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchCreateTenant.java) | -| Job Search Delete Company | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteCompany.java) | -| Job Search Delete Job | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteJob.java) | -| Job Search Delete Tenant | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchDeleteTenant.java) | -| Job Search Get Company | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchGetCompany.java) | -| Job Search Get Job | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchGetJob.java) | -| Job Search Get Tenant | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchGetTenant.java) | -| Job Search List Companies | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchListCompanies.java) | -| Job Search List Jobs | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchListJobs.java) | -| Job Search List Tenants | [source code](https://github.com/googleapis/java-talent/blob/main/samples/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-talent&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/jobs/JobSearchListTenants.java) | - - ## Troubleshooting