Search in sources :

Example 36 with Company

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

the class CompanyServiceClientTest method listCompaniesTest3.

@Test
public void listCompaniesTest3() 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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListCompaniesPagedResponse(com.google.cloud.talent.v4beta1.CompanyServiceClient.ListCompaniesPagedResponse) Test(org.junit.Test)

Example 37 with Company

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

the class ITSystemTest method listCompaniesTest.

@Test
public void listCompaniesTest() {
    ListCompaniesRequest request = ListCompaniesRequest.newBuilder().setParent(tenantName.toString()).build();
    for (Company actual : companyServiceClient.listCompanies(request).iterateAll()) {
        if (company.getName().equals(actual.getName())) {
            assertEquals(company.getName(), actual.getName());
            assertEquals(company.getDisplayName(), actual.getDisplayName());
            assertEquals(company.getExternalId(), actual.getExternalId());
        }
    }
}
Also used : ListCompaniesRequest(com.google.cloud.talent.v4beta1.ListCompaniesRequest) Company(com.google.cloud.talent.v4beta1.Company) Test(org.junit.Test)

Example 38 with Company

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

the class ITSystemTest method afterTest.

@AfterClass
public static void afterTest() {
    completionClient.close();
    eventServiceClient.close();
    /* delete job */
    DeleteJobRequest jobRequest = DeleteJobRequest.newBuilder().setName(jobName.toString()).build();
    jobServiceClient.deleteJob(jobRequest);
    jobServiceClient.close();
    /* delete company */
    DeleteCompanyRequest companyRequest = DeleteCompanyRequest.newBuilder().setName(companyName.toString()).build();
    companyServiceClient.deleteCompany(companyRequest);
    companyServiceClient.close();
    /* delete tenant */
    DeleteTenantRequest request = DeleteTenantRequest.newBuilder().setName(tenantName.toString()).build();
    tenantServiceClient.deleteTenant(request);
    tenantServiceClient.close();
}
Also used : DeleteJobRequest(com.google.cloud.talent.v4beta1.DeleteJobRequest) DeleteCompanyRequest(com.google.cloud.talent.v4beta1.DeleteCompanyRequest) DeleteTenantRequest(com.google.cloud.talent.v4beta1.DeleteTenantRequest) AfterClass(org.junit.AfterClass)

Example 39 with Company

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

the class ITSystemTest method getCompanyTest.

@Test
public void getCompanyTest() {
    GetCompanyRequest request = GetCompanyRequest.newBuilder().setName(companyName.toString()).build();
    Company actual = companyServiceClient.getCompany(request);
    assertEquals(company.getName(), actual.getName());
    assertEquals(company.getDisplayName(), actual.getDisplayName());
    assertEquals(company.getExternalId(), actual.getExternalId());
}
Also used : Company(com.google.cloud.talent.v4beta1.Company) GetCompanyRequest(com.google.cloud.talent.v4beta1.GetCompanyRequest) Test(org.junit.Test)

Example 40 with Company

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

the class JobSearchGetCompany method getCompany.

// Get Company.
public static void getCompany(String projectId, String tenantId, String companyId) throws IOException {
    // 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());
    }
}
Also used : CompanyName(com.google.cloud.talent.v4.CompanyName) CompanyServiceClient(com.google.cloud.talent.v4.CompanyServiceClient) Company(com.google.cloud.talent.v4.Company) GetCompanyRequest(com.google.cloud.talent.v4.GetCompanyRequest)

Aggregations

Test (org.junit.Test)14 Company (com.google.cloud.talent.v4beta1.Company)10 CompanyServiceClient (com.google.cloud.talent.v4beta1.CompanyServiceClient)8 Company (com.google.api.ads.admanager.axis.v202202.Company)7 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202202.CompanyServiceInterface)7 AdManagerSession (com.google.api.ads.admanager.lib.client.AdManagerSession)6 MockHttpIntegrationTest (com.google.api.ads.common.lib.testing.MockHttpIntegrationTest)6 GoogleCredential (com.google.api.client.googleapis.auth.oauth2.GoogleCredential)6 NetHttpTransport (com.google.api.client.http.javanet.NetHttpTransport)5 JacksonFactory (com.google.api.client.json.jackson2.JacksonFactory)5 Company (com.google.api.ads.admanager.axis.v202108.Company)4 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202108.CompanyServiceInterface)4 Company (com.google.api.ads.admanager.axis.v202111.Company)4 CompanyServiceInterface (com.google.api.ads.admanager.axis.v202111.CompanyServiceInterface)4 CompanyName (com.google.cloud.talent.v4beta1.CompanyName)4 Diff (org.xmlunit.diff.Diff)4 AdManagerServices (com.google.api.ads.admanager.axis.factory.AdManagerServices)3 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202108.StatementBuilder)3 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202111.StatementBuilder)3 StatementBuilder (com.google.api.ads.admanager.axis.utils.v202202.StatementBuilder)3