Search in sources :

Example 1 with DisambiguatedOrganization

use of org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_DistinctionsTest method testUpdateDistinction.

@Test
public void testUpdateDistinction() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewDistinction(ORCID, 27L);
    assertNotNull(response);
    Distinction distinction = (Distinction) response.getEntity();
    assertNotNull(distinction);
    assertEquals("PUBLIC Department", distinction.getDepartmentName());
    assertEquals("PUBLIC", distinction.getRoleTitle());
    Utils.verifyLastModified(distinction.getLastModifiedDate());
    LastModifiedDate before = distinction.getLastModifiedDate();
    distinction.setDepartmentName("Updated department name");
    distinction.setRoleTitle("The updated role title");
    // disambiguated org is required in API v3
    DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
    disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
    disambiguatedOrg.setDisambiguationSource("WDB");
    distinction.getOrganization().setDisambiguatedOrganization(disambiguatedOrg);
    response = serviceDelegator.updateDistinction(ORCID, 27L, distinction);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    response = serviceDelegator.viewDistinction(ORCID, 27L);
    assertNotNull(response);
    distinction = (Distinction) response.getEntity();
    assertNotNull(distinction);
    Utils.verifyLastModified(distinction.getLastModifiedDate());
    assertTrue(distinction.getLastModifiedDate().after(before));
    assertEquals("Updated department name", distinction.getDepartmentName());
    assertEquals("The updated role title", distinction.getRoleTitle());
    // Rollback changes
    distinction.setDepartmentName("PUBLIC Department");
    distinction.setRoleTitle("PUBLIC");
    response = serviceDelegator.updateDistinction(ORCID, 27L, distinction);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) Distinction(org.orcid.jaxb.model.v3.dev1.record.Distinction) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 2 with DisambiguatedOrganization

use of org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_EducationsTest method testUpdateEducation.

@Test
public void testUpdateEducation() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewEducation(ORCID, 20L);
    assertNotNull(response);
    Education education = (Education) response.getEntity();
    assertNotNull(education);
    assertEquals("PUBLIC Department", education.getDepartmentName());
    assertEquals("PUBLIC", education.getRoleTitle());
    Utils.verifyLastModified(education.getLastModifiedDate());
    LastModifiedDate before = education.getLastModifiedDate();
    education.setDepartmentName("Updated department name");
    education.setRoleTitle("The updated role title");
    // disambiguated org is required in API v3
    DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
    disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
    disambiguatedOrg.setDisambiguationSource("WDB");
    education.getOrganization().setDisambiguatedOrganization(disambiguatedOrg);
    response = serviceDelegator.updateEducation(ORCID, 20L, education);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    response = serviceDelegator.viewEducation(ORCID, 20L);
    assertNotNull(response);
    education = (Education) response.getEntity();
    assertNotNull(education);
    Utils.verifyLastModified(education.getLastModifiedDate());
    assertTrue(education.getLastModifiedDate().after(before));
    assertEquals("Updated department name", education.getDepartmentName());
    assertEquals("The updated role title", education.getRoleTitle());
    // Rollback changes
    education.setDepartmentName("PUBLIC Department");
    education.setRoleTitle("PUBLIC");
    response = serviceDelegator.updateEducation(ORCID, 20L, education);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) Education(org.orcid.jaxb.model.v3.dev1.record.Education) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 3 with DisambiguatedOrganization

use of org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_EmploymentsTest method testUpdateEmployment.

@Test
public void testUpdateEmployment() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewEmployment(ORCID, 18L);
    assertNotNull(response);
    Employment employment = (Employment) response.getEntity();
    assertNotNull(employment);
    assertEquals("LIMITED Department", employment.getDepartmentName());
    assertEquals("LIMITED", employment.getRoleTitle());
    Utils.verifyLastModified(employment.getLastModifiedDate());
    LastModifiedDate before = employment.getLastModifiedDate();
    employment.setDepartmentName("Updated department name");
    employment.setRoleTitle("The updated role title");
    // disambiguated org is required in API v3
    DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
    disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
    disambiguatedOrg.setDisambiguationSource("WDB");
    employment.getOrganization().setDisambiguatedOrganization(disambiguatedOrg);
    response = serviceDelegator.updateEmployment(ORCID, 18L, employment);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    response = serviceDelegator.viewEmployment(ORCID, 18L);
    assertNotNull(response);
    employment = (Employment) response.getEntity();
    assertNotNull(employment);
    Utils.verifyLastModified(employment.getLastModifiedDate());
    assertTrue(employment.getLastModifiedDate().after(before));
    assertEquals("Updated department name", employment.getDepartmentName());
    assertEquals("The updated role title", employment.getRoleTitle());
    // Rollback changes
    employment.setDepartmentName("LIMITED Department");
    employment.setRoleTitle("LIMITED");
    response = serviceDelegator.updateEmployment(ORCID, 18L, employment);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 4 with DisambiguatedOrganization

use of org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_QualificationsTest method testUpdateQualification.

@Test
public void testUpdateQualification() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewQualification(ORCID, 43L);
    assertNotNull(response);
    Qualification qualification = (Qualification) response.getEntity();
    assertNotNull(qualification);
    assertEquals("LIMITED Department", qualification.getDepartmentName());
    assertEquals("LIMITED", qualification.getRoleTitle());
    Utils.verifyLastModified(qualification.getLastModifiedDate());
    LastModifiedDate before = qualification.getLastModifiedDate();
    qualification.setDepartmentName("Updated department name");
    qualification.setRoleTitle("The updated role title");
    // disambiguated org is required in API v3
    DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
    disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
    disambiguatedOrg.setDisambiguationSource("WDB");
    qualification.getOrganization().setDisambiguatedOrganization(disambiguatedOrg);
    response = serviceDelegator.updateQualification(ORCID, 43L, qualification);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    response = serviceDelegator.viewQualification(ORCID, 43L);
    assertNotNull(response);
    qualification = (Qualification) response.getEntity();
    assertNotNull(qualification);
    Utils.verifyLastModified(qualification.getLastModifiedDate());
    assertTrue(qualification.getLastModifiedDate().after(before));
    assertEquals("Updated department name", qualification.getDepartmentName());
    assertEquals("The updated role title", qualification.getRoleTitle());
    // Rollback changes
    qualification.setDepartmentName("LIMITED Department");
    qualification.setRoleTitle("QUALIFICATION");
    response = serviceDelegator.updateQualification(ORCID, 43L, qualification);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) Qualification(org.orcid.jaxb.model.v3.dev1.record.Qualification) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 5 with DisambiguatedOrganization

use of org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_ServicesTest method testUpdateService.

@Test
public void testUpdateService() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewService(ORCID, 47L);
    assertNotNull(response);
    Service service = (Service) response.getEntity();
    assertNotNull(service);
    assertEquals("PUBLIC Department", service.getDepartmentName());
    assertEquals("PUBLIC", service.getRoleTitle());
    Utils.verifyLastModified(service.getLastModifiedDate());
    LastModifiedDate before = service.getLastModifiedDate();
    service.setDepartmentName("Updated department name");
    service.setRoleTitle("The updated role title");
    // disambiguated org is required in API v3
    DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
    disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
    disambiguatedOrg.setDisambiguationSource("WDB");
    service.getOrganization().setDisambiguatedOrganization(disambiguatedOrg);
    response = serviceDelegator.updateService(ORCID, 47L, service);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    response = serviceDelegator.viewService(ORCID, 47L);
    assertNotNull(response);
    service = (Service) response.getEntity();
    assertNotNull(service);
    Utils.verifyLastModified(service.getLastModifiedDate());
    assertTrue(service.getLastModifiedDate().after(before));
    assertEquals("Updated department name", service.getDepartmentName());
    assertEquals("The updated role title", service.getRoleTitle());
    // Rollback changes
    service.setDepartmentName("PUBLIC Department");
    service.setRoleTitle("PUBLIC");
    response = serviceDelegator.updateService(ORCID, 47L, service);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) Service(org.orcid.jaxb.model.v3.dev1.record.Service) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

DisambiguatedOrganization (org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization)18 Response (javax.ws.rs.core.Response)9 Test (org.junit.Test)9 DBUnitTest (org.orcid.test.DBUnitTest)9 Organization (org.orcid.jaxb.model.v3.dev1.common.Organization)8 OrganizationAddress (org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress)8 LastModifiedDate (org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate)7 Url (org.orcid.jaxb.model.v3.dev1.common.Url)7 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)5 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)4 PeerReview (org.orcid.jaxb.model.v3.dev1.record.PeerReview)4 FuzzyDate (org.orcid.jaxb.model.v3.dev1.common.FuzzyDate)3 Title (org.orcid.jaxb.model.v3.dev1.common.Title)3 Distinction (org.orcid.jaxb.model.v3.dev1.record.Distinction)2 Education (org.orcid.jaxb.model.v3.dev1.record.Education)2 Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)2 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)2 FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)2 InvitedPosition (org.orcid.jaxb.model.v3.dev1.record.InvitedPosition)2 Membership (org.orcid.jaxb.model.v3.dev1.record.Membership)2