Search in sources :

Example 6 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project java-talent by googleapis.

the class ITSystemTest method updateTenantTest.

@Test
public void updateTenantTest() {
    String external_id = String.valueOf(Instant.now().getEpochSecond());
    Tenant updateTenant = tenant.toBuilder().setExternalId(external_id).build();
    UpdateTenantRequest request = UpdateTenantRequest.newBuilder().setTenant(updateTenant).build();
    Tenant actual = tenantServiceClient.updateTenant(request);
    assertEquals(tenant.getName(), actual.getName());
    assertEquals(external_id, actual.getExternalId());
}
Also used : Tenant(com.google.cloud.talent.v4beta1.Tenant) UpdateTenantRequest(com.google.cloud.talent.v4beta1.UpdateTenantRequest) Test(org.junit.Test)

Example 7 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project java-talent by googleapis.

the class ITSystemTest method beforeTest.

@BeforeClass
public static void beforeTest() throws IOException {
    /* create tenant */
    tenantServiceClient = TenantServiceClient.create();
    Tenant createTenant = Tenant.newBuilder().setName(TENANT_NAME).setExternalId(EXTERNAL_ID).build();
    CreateTenantRequest request = CreateTenantRequest.newBuilder().setParent(PROJECT_NAME.toString()).setTenant(createTenant).build();
    tenant = tenantServiceClient.createTenant(request);
    tenantId = getId(tenant.getName());
    tenantName = TenantName.of(PROJECT_ID, tenantId);
    /* create company */
    companyServiceClient = CompanyServiceClient.create();
    Company createCompany = Company.newBuilder().setDisplayName(DISPLAY_NAME).setExternalId(EXTERNAL_ID).build();
    CreateCompanyRequest companyRequest = CreateCompanyRequest.newBuilder().setParent(tenantName.toString()).setCompany(createCompany).build();
    company = companyServiceClient.createCompany(companyRequest);
    companyId = getId(company.getName());
    companyName = CompanyName.ofProjectTenantCompanyName(PROJECT_ID, tenantId, companyId);
    /* create job */
    jobServiceClient = JobServiceClient.create();
    Job.ApplicationInfo applicationInfo = Job.ApplicationInfo.newBuilder().addAllUris(Arrays.asList(JOB_APPLICATION_URL)).build();
    Job createJob = Job.newBuilder().setCompany(companyId).setRequisitionId(REQUISITION_ID).setTitle(TITLE).setDescription(DESCRIPTION).setApplicationInfo(applicationInfo).addAllAddresses(Arrays.asList(ADDRESS_ONE, ADDRESS_TWO)).setLanguageCode(LANGUAGE_CODE).build();
    CreateJobRequest jobRequest = CreateJobRequest.newBuilder().setParent(tenantName.toString()).setJob(createJob).build();
    job = jobServiceClient.createJob(jobRequest);
    jobId = getId(job.getName());
    jobName = JobName.ofProjectTenantJobName(PROJECT_ID, tenantId, jobId);
    /*create event */
    eventServiceClient = EventServiceClient.create();
    // create completion
    completionClient = CompletionClient.create();
}
Also used : CreateTenantRequest(com.google.cloud.talent.v4beta1.CreateTenantRequest) Company(com.google.cloud.talent.v4beta1.Company) Tenant(com.google.cloud.talent.v4beta1.Tenant) CreateCompanyRequest(com.google.cloud.talent.v4beta1.CreateCompanyRequest) Job(com.google.cloud.talent.v4beta1.Job) CreateJobRequest(com.google.cloud.talent.v4beta1.CreateJobRequest) BeforeClass(org.junit.BeforeClass)

Example 8 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project java-talent by googleapis.

the class ITSystemTest method getTenantTest.

@Test
public void getTenantTest() {
    GetTenantRequest request = GetTenantRequest.newBuilder().setName(tenantName.toString()).build();
    Tenant actual = tenantServiceClient.getTenant(request);
    assertEquals(tenant.getName(), actual.getName());
    assertEquals(tenant.getExternalId(), actual.getExternalId());
}
Also used : Tenant(com.google.cloud.talent.v4beta1.Tenant) GetTenantRequest(com.google.cloud.talent.v4beta1.GetTenantRequest) Test(org.junit.Test)

Example 9 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project java-talent by googleapis.

the class ProfileServiceClientTest method listProfilesTest.

@Test
public void listProfilesTest() throws Exception {
    Profile responsesElement = Profile.newBuilder().build();
    ListProfilesResponse expectedResponse = ListProfilesResponse.newBuilder().setNextPageToken("").addAllProfiles(Arrays.asList(responsesElement)).build();
    mockProfileService.addResponse(expectedResponse);
    TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
    ListProfilesPagedResponse pagedListResponse = client.listProfiles(parent);
    List<Profile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProfileService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProfilesRequest actualRequest = ((ListProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListProfilesPagedResponse(com.google.cloud.talent.v4beta1.ProfileServiceClient.ListProfilesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 10 with Tenant

use of com.google.cloud.talent.v4beta1.Tenant in project java-talent by googleapis.

the class ProfileServiceClientTest method searchProfilesTest.

@Test
public void searchProfilesTest() throws Exception {
    HistogramQueryResult responsesElement = HistogramQueryResult.newBuilder().build();
    SearchProfilesResponse expectedResponse = SearchProfilesResponse.newBuilder().setNextPageToken("").addAllHistogramQueryResults(Arrays.asList(responsesElement)).build();
    mockProfileService.addResponse(expectedResponse);
    SearchProfilesRequest request = SearchProfilesRequest.newBuilder().setParent(TenantName.of("[PROJECT]", "[TENANT]").toString()).setRequestMetadata(RequestMetadata.newBuilder().build()).setProfileQuery(ProfileQuery.newBuilder().build()).setPageSize(883849137).setPageToken("pageToken873572522").setOffset(-1019779949).setDisableSpellCheck(true).setOrderBy("orderBy-1207110587").setCaseSensitiveSort(true).addAllHistogramQueries(new ArrayList<HistogramQuery>()).setResultSetId("resultSetId-548600064").setStrictKeywordsSearch(true).build();
    SearchProfilesPagedResponse pagedListResponse = client.searchProfiles(request);
    List<HistogramQueryResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getHistogramQueryResultsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProfileService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    SearchProfilesRequest actualRequest = ((SearchProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(request.getParent(), actualRequest.getParent());
    Assert.assertEquals(request.getRequestMetadata(), actualRequest.getRequestMetadata());
    Assert.assertEquals(request.getProfileQuery(), actualRequest.getProfileQuery());
    Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize());
    Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken());
    Assert.assertEquals(request.getOffset(), actualRequest.getOffset());
    Assert.assertEquals(request.getDisableSpellCheck(), actualRequest.getDisableSpellCheck());
    Assert.assertEquals(request.getOrderBy(), actualRequest.getOrderBy());
    Assert.assertEquals(request.getCaseSensitiveSort(), actualRequest.getCaseSensitiveSort());
    Assert.assertEquals(request.getHistogramQueriesList(), actualRequest.getHistogramQueriesList());
    Assert.assertEquals(request.getResultSetId(), actualRequest.getResultSetId());
    Assert.assertEquals(request.getStrictKeywordsSearch(), actualRequest.getStrictKeywordsSearch());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) SearchProfilesPagedResponse(com.google.cloud.talent.v4beta1.ProfileServiceClient.SearchProfilesPagedResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)12 Tenant (com.google.cloud.talent.v4beta1.Tenant)10 AbstractMessage (com.google.protobuf.AbstractMessage)9 TenantServiceClient (com.google.cloud.talent.v4beta1.TenantServiceClient)8 Job (com.google.cloud.talent.v4beta1.Job)5 TenantName (com.google.cloud.talent.v4beta1.TenantName)5 TenantOrProjectName (com.google.cloud.talent.v4beta1.TenantOrProjectName)5 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)4 ProjectName (com.google.cloud.talent.v4beta1.ProjectName)4 Tenant (com.google.cloud.talent.v4.Tenant)3 TenantServiceClient (com.google.cloud.talent.v4.TenantServiceClient)3 Company (com.google.cloud.talent.v4beta1.Company)3 CreateTenantRequest (com.google.cloud.talent.v4beta1.CreateTenantRequest)3 DeleteTenantRequest (com.google.cloud.talent.v4beta1.DeleteTenantRequest)3 GetTenantRequest (com.google.cloud.talent.v4beta1.GetTenantRequest)3 ListTenantsRequest (com.google.cloud.talent.v4beta1.ListTenantsRequest)3 ProjectName (com.google.cloud.talent.v4.ProjectName)2 BatchOperationMetadata (com.google.cloud.talent.v4beta1.BatchOperationMetadata)2 ClientEvent (com.google.cloud.talent.v4beta1.ClientEvent)2 CompanyServiceClient (com.google.cloud.talent.v4beta1.CompanyServiceClient)2