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());
}
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();
}
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());
}
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()));
}
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()));
}
Aggregations