Search in sources :

Example 11 with InvitedPositions

use of org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions in project ORCID-Source by ORCID.

the class PublicV3ApiServiceDelegatorTest method testGetPublicInvitedPositions.

@Test
public void testGetPublicInvitedPositions() {
    Response r = serviceDelegator.viewInvitedPositions(ORCID);
    assertNotNull(r);
    InvitedPositions invitedPositions = (InvitedPositions) r.getEntity();
    assertNotNull(invitedPositions);
    assertNotNull(invitedPositions.getLastModifiedDate());
    assertNotNull(invitedPositions.getLastModifiedDate().getValue());
    assertNotNull(invitedPositions.getSummaries());
    assertEquals(1, invitedPositions.getSummaries().size());
    assertEquals(Long.valueOf(32), invitedPositions.getSummaries().get(0).getPutCode());
    assertEquals(Visibility.PUBLIC, invitedPositions.getSummaries().get(0).getVisibility());
    assertNotNull(invitedPositions.getSummaries().get(0).getLastModifiedDate());
    assertNotNull(invitedPositions.getSummaries().get(0).getLastModifiedDate().getValue());
}
Also used : Response(javax.ws.rs.core.Response) InvitedPositions(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 12 with InvitedPositions

use of org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions in project ORCID-Source by ORCID.

the class PublicV3ApiServiceDelegatorTest method testViewInvitedPositions.

@Test
public void testViewInvitedPositions() {
    Response response = serviceDelegator.viewInvitedPositions(ORCID);
    assertNotNull(response);
    InvitedPositions invitedPositions = (InvitedPositions) response.getEntity();
    assertNotNull(invitedPositions);
    assertEquals("/0000-0000-0000-0003/invited-positions", invitedPositions.getPath());
    assertNotNull(invitedPositions.getLastModifiedDate());
    assertNotNull(invitedPositions.getLastModifiedDate().getValue());
    assertEquals(1, invitedPositions.getSummaries().size());
    InvitedPositionSummary invitedPosition = invitedPositions.getSummaries().get(0);
    assertEquals(Long.valueOf(32), invitedPosition.getPutCode());
    assertNotNull(invitedPosition.getLastModifiedDate());
    assertNotNull(invitedPosition.getLastModifiedDate().getValue());
    assertEquals("/0000-0000-0000-0003/invited-position/32", invitedPosition.getPath());
    assertEquals("PUBLIC Department", invitedPosition.getDepartmentName());
    assertEquals(Visibility.PUBLIC.value(), invitedPosition.getVisibility().value());
    assertEquals("APP-5555555555555555", invitedPosition.getSource().retrieveSourcePath());
}
Also used : Response(javax.ws.rs.core.Response) InvitedPositionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary) InvitedPositions(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 13 with InvitedPositions

use of org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV3Test method getInvitedPositions.

private InvitedPositions getInvitedPositions(Visibility... vs) {
    InvitedPositions e = new InvitedPositions();
    for (Visibility v : vs) {
        InvitedPositionSummary s = new InvitedPositionSummary();
        s.setVisibility(v);
        e.getSummaries().add(s);
    }
    return e;
}
Also used : InvitedPositionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary) Visibility(org.orcid.jaxb.model.v3.dev1.common.Visibility) InvitedPositions(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions)

Example 14 with InvitedPositions

use of org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV3Test method filterInvitedPositionsTest.

@Test
public void filterInvitedPositionsTest() {
    InvitedPositions e = getInvitedPositions(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.PUBLIC);
    assertEquals(3, e.getSummaries().size());
    publicAPISecurityManagerV3.filter(e);
    assertEquals(3, e.getSummaries().size());
    assertContainerContainsOnlyPublicElements(e);
    e = getInvitedPositions(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.LIMITED);
    assertEquals(3, e.getSummaries().size());
    publicAPISecurityManagerV3.filter(e);
    assertEquals(2, e.getSummaries().size());
    assertContainerContainsOnlyPublicElements(e);
    e = getInvitedPositions(Visibility.PUBLIC, Visibility.LIMITED, Visibility.PRIVATE);
    assertEquals(3, e.getSummaries().size());
    publicAPISecurityManagerV3.filter(e);
    assertEquals(1, e.getSummaries().size());
    assertContainerContainsOnlyPublicElements(e);
    e = getInvitedPositions(Visibility.PRIVATE, Visibility.LIMITED, Visibility.PRIVATE);
    assertEquals(3, e.getSummaries().size());
    publicAPISecurityManagerV3.filter(e);
    assertTrue(e.getSummaries().isEmpty());
}
Also used : InvitedPositions(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions) Test(org.junit.Test)

Example 15 with InvitedPositions

use of org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions in project ORCID-Source by ORCID.

the class ActivityUtilsTest method setPathToInvitedPositionsTest.

@Test
public void setPathToInvitedPositionsTest() {
    InvitedPositions x = getInvitedPositions();
    ActivityUtils.setPathToAffiliations(x, ORCID);
    assertEquals("/" + ORCID + "/invited-position/123", x.getSummaries().get(0).getPath());
}
Also used : InvitedPositions(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions) Test(org.junit.Test)

Aggregations

InvitedPositions (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositions)16 Test (org.junit.Test)11 InvitedPositionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary)10 Response (javax.ws.rs.core.Response)5 DBUnitTest (org.orcid.test.DBUnitTest)5 Address (org.orcid.jaxb.model.v3.dev1.record.Address)4 Email (org.orcid.jaxb.model.v3.dev1.record.Email)4 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)4 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)4 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)4 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)4 Distinctions (org.orcid.jaxb.model.v3.dev1.record.summary.Distinctions)4 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)4 Educations (org.orcid.jaxb.model.v3.dev1.record.summary.Educations)4 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)3 Name (org.orcid.jaxb.model.v3.dev1.record.Name)3 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)3 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)3 Record (org.orcid.jaxb.model.v3.dev1.record.Record)3 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)3