Search in sources :

Example 6 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class ITSystemTest method getJobTest.

@Test
public void getJobTest() {
    GetJobRequest request = GetJobRequest.newBuilder().setName(jobName.toString()).build();
    Job actual = jobServiceClient.getJob(request);
    assertEquals(job.getName(), actual.getName());
    assertEquals(job.getCompany(), actual.getCompany());
    assertEquals(job.getRequisitionId(), actual.getRequisitionId());
    assertEquals(job.getTitle(), actual.getTitle());
    assertEquals(job.getDescription(), actual.getDescription());
    assertEquals(job.getApplicationInfo(), actual.getApplicationInfo());
    assertEquals(job.getAddressesCount(), actual.getAddressesCount());
    assertEquals(job.getLanguageCode(), actual.getLanguageCode());
}
Also used : GetJobRequest(com.google.cloud.talent.v4beta1.GetJobRequest) Job(com.google.cloud.talent.v4beta1.Job) Test(org.junit.Test)

Example 7 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class JobServiceClientTest method listJobsTest.

@Test
public void listJobsTest() throws Exception {
    Job responsesElement = Job.newBuilder().build();
    ListJobsResponse expectedResponse = ListJobsResponse.newBuilder().setNextPageToken("").addAllJobs(Arrays.asList(responsesElement)).build();
    mockJobService.addResponse(expectedResponse);
    TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
    String filter = "filter-1274492040";
    ListJobsPagedResponse pagedListResponse = client.listJobs(parent, filter);
    List<Job> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getJobsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockJobService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListJobsRequest actualRequest = ((ListJobsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(filter, actualRequest.getFilter());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListJobsPagedResponse(com.google.cloud.talent.v4.JobServiceClient.ListJobsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 8 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class JobSearchListJobs method sampleListJobs.

/**
 * List Jobs
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenant
 */
public static void sampleListJobs(String projectId, String tenantId, String filter) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build();
        for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) {
            System.out.printf("Job name: %s\n", responseItem.getName());
            System.out.printf("Job requisition ID: %s\n", responseItem.getRequisitionId());
            System.out.printf("Job title: %s\n", responseItem.getTitle());
            System.out.printf("Job description: %s\n", responseItem.getDescription());
        }
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : ListJobsRequest(com.google.cloud.talent.v4beta1.ListJobsRequest) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName) Job(com.google.cloud.talent.v4beta1.Job)

Example 9 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class CommuteSearchJobs method searchJobs.

// Search Jobs with histogram queries.
public static void searchJobs(String projectId, String tenantId) throws IOException {
    // 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());
        }
    }
}
Also used : SearchJobsRequest(com.google.cloud.talent.v4.SearchJobsRequest) SearchJobsResponse(com.google.cloud.talent.v4.SearchJobsResponse) TenantName(com.google.cloud.talent.v4.TenantName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Duration(com.google.protobuf.Duration) RequestMetadata(com.google.cloud.talent.v4.RequestMetadata) CommuteFilter(com.google.cloud.talent.v4.CommuteFilter) JobQuery(com.google.cloud.talent.v4.JobQuery) LatLng(com.google.type.LatLng) Job(com.google.cloud.talent.v4.Job) CommuteMethod(com.google.cloud.talent.v4.CommuteMethod)

Example 10 with Job

use of com.google.cloud.talent.v4.Job in project java-talent by googleapis.

the class CustomRankingSearchJobs method searchCustomRankingJobs.

// Search Jobs using custom rankings.
public static void searchCustomRankingJobs(String projectId, String tenantId) throws IOException {
    // 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());
        }
    }
}
Also used : SearchJobsRequest(com.google.cloud.talent.v4.SearchJobsRequest) SearchJobsResponse(com.google.cloud.talent.v4.SearchJobsResponse) TenantName(com.google.cloud.talent.v4.TenantName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job) RequestMetadata(com.google.cloud.talent.v4.RequestMetadata)

Aggregations

Job (org.pentaho.platform.api.scheduler2.Job)94 Test (org.junit.Test)89 Job (io.fabric8.kubernetes.api.model.batch.v1.Job)38 Serializable (java.io.Serializable)25 ArrayList (java.util.ArrayList)24 SimpleJobTrigger (org.pentaho.platform.api.scheduler2.SimpleJobTrigger)21 Job (com.google.cloud.talent.v4beta1.Job)20 HashMap (java.util.HashMap)20 JobScheduleRequest (org.pentaho.platform.web.http.api.resources.JobScheduleRequest)19 ComplexJobTrigger (org.pentaho.platform.api.scheduler2.ComplexJobTrigger)18 SchedulerException (org.pentaho.platform.api.scheduler2.SchedulerException)17 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)16 Date (java.util.Date)14 IJobFilter (org.pentaho.platform.api.scheduler2.IJobFilter)14 Job (com.google.cloud.video.transcoder.v1.Job)13 TranscoderServiceClient (com.google.cloud.video.transcoder.v1.TranscoderServiceClient)13 JobBuilder (io.fabric8.kubernetes.api.model.batch.v1.JobBuilder)13 IJobTrigger (org.pentaho.platform.api.scheduler2.IJobTrigger)12 Map (java.util.Map)11 Test (org.junit.jupiter.api.Test)10