use of com.google.cloud.talent.v4.Company in project olca-modules by GreenDelta.
the class ProcessDoc method addDefaultCompany.
private void addDefaultCompany() {
String id = "b35ea934-b41d-4830-b1aa-c7c678270240";
for (Company company : dataSet.masterData.companies) {
if (Objects.equals(id, company.id))
return;
}
Company company = new Company();
company.code = "UKNWN";
company.comment = "This is a default entry as we cannot create persons" + " without company information for the EcoEditor.";
company.id = id;
company.name = "Unknown";
dataSet.masterData.companies.add(company);
}
use of com.google.cloud.talent.v4.Company in project universal-db by teamapps-org.
the class DeleteTest method testRemoveReferencesOnEntityDeletion.
@Test
public void testRemoveReferencesOnEntityDeletion() {
Person p = Person.create().setLastName("p");
Company c = Company.create().setName("c").addEmployees(p).save();
assertEquals(p, c.getEmployees().get(0));
assertEquals(1, c.getEmployeesCount());
p.delete();
assertEquals(0, c.getEmployeesCount());
}
use of com.google.cloud.talent.v4.Company in project universal-db by teamapps-org.
the class DeleteTest method testDeleteReferences.
@Test
public void testDeleteReferences() {
Person p1 = Person.create().setLastName("p1").save();
Person p2 = Person.create().setLastName("p2").save();
Person p3 = Person.create().setLastName("p3").save();
Person p4 = Person.create().setLastName("p4").save();
Company c1 = Company.create().setName("c1").addEmployees(p1, p2, p3).save();
Company c2 = Company.create().setName("c2").addEmployees(p4).save();
assertTrue("employess of c1", TestBase.compareEntities(c1.getEmployees(), p1, p2, p3));
assertTrue("employess of c2", TestBase.compareEntities(c2.getEmployees(), p4));
assertEquals(p1.getCompany(), c1);
assertEquals(p2.getCompany(), c1);
assertEquals(p3.getCompany(), c1);
assertEquals(p4.getCompany(), c2);
c1.removeAllEmployees().save();
assertTrue("p1 has no c", p1.getCompany() == null);
assertTrue("p2 has no c", p2.getCompany() == null);
assertTrue("p3 has no c", p3.getCompany() == null);
assertTrue("p4 has c", p4.getCompany() != null);
assertEquals("c1 has no employees", 0, c1.getEmployeesCount());
assertTrue("employess of c1", TestBase.compareEntities(c1.getEmployees()));
}
use of com.google.cloud.talent.v4.Company in project java-talent by googleapis.
the class CompanyServiceClientTest method listCompaniesTest.
@Test
public void listCompaniesTest() throws Exception {
Company responsesElement = Company.newBuilder().build();
ListCompaniesResponse expectedResponse = ListCompaniesResponse.newBuilder().setNextPageToken("").addAllCompanies(Arrays.asList(responsesElement)).build();
mockCompanyService.addResponse(expectedResponse);
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
ListCompaniesPagedResponse pagedListResponse = client.listCompanies(parent);
List<Company> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getCompaniesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockCompanyService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListCompaniesRequest actualRequest = ((ListCompaniesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.talent.v4.Company in project java-talent by googleapis.
the class CompanyServiceClientTest method listCompaniesTest2.
@Test
public void listCompaniesTest2() throws Exception {
Company responsesElement = Company.newBuilder().build();
ListCompaniesResponse expectedResponse = ListCompaniesResponse.newBuilder().setNextPageToken("").addAllCompanies(Arrays.asList(responsesElement)).build();
mockCompanyService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListCompaniesPagedResponse pagedListResponse = client.listCompanies(parent);
List<Company> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getCompaniesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockCompanyService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListCompaniesRequest actualRequest = ((ListCompaniesRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations