Search in sources :

Example 86 with OtherName

use of org.orcid.jaxb.model.record_rc3.OtherName in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testCollection_When_NotSource_ReadLimitedToken_AllPrivate.

@Test
public void testCollection_When_NotSource_ReadLimitedToken_AllPrivate() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
    List<OtherName> list = new ArrayList<OtherName>();
    OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o4 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o5 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    list.add(o1);
    list.add(o2);
    list.add(o3);
    list.add(o4);
    list.add(o5);
    assertFalse(list.isEmpty());
    orcidSecurityManager.checkAndFilter(ORCID_1, list, ScopePathType.ORCID_BIO_READ_LIMITED);
    assertTrue(list.isEmpty());
}
Also used : ArrayList(java.util.ArrayList) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Test(org.junit.Test)

Example 87 with OtherName

use of org.orcid.jaxb.model.record_rc3.OtherName in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testPersonalDetails_When_AllPublic_NoSource_ReadLimitedToken.

@Test
public void testPersonalDetails_When_AllPublic_NoSource_ReadLimitedToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
    Name name = createName(Visibility.PUBLIC);
    Biography bio = createBiography(Visibility.PUBLIC);
    OtherName o1 = createOtherName(Visibility.PUBLIC, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.PUBLIC, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.PUBLIC, CLIENT_2);
    OtherNames otherNames = new OtherNames();
    otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
    PersonalDetails p = new PersonalDetails();
    p.setBiography(bio);
    p.setName(name);
    p.setOtherNames(otherNames);
    orcidSecurityManager.checkAndFilter(ORCID_1, p);
    assertNotNull(p);
    assertEquals(name, p.getName());
    assertEquals(bio, p.getBiography());
    assertNotNull(p.getOtherNames());
    assertNotNull(p.getOtherNames().getOtherNames());
    assertEquals(3, p.getOtherNames().getOtherNames().size());
    assertTrue(p.getOtherNames().getOtherNames().contains(o1));
    assertTrue(p.getOtherNames().getOtherNames().contains(o2));
    assertTrue(p.getOtherNames().getOtherNames().contains(o3));
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Biography(org.orcid.jaxb.model.record_v2.Biography) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 88 with OtherName

use of org.orcid.jaxb.model.record_rc3.OtherName in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testPersonalDetails_When_AllPrivate_NoSource_ReadPublicToken.

@Test
public void testPersonalDetails_When_AllPrivate_NoSource_ReadPublicToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
    Name name = createName(Visibility.PRIVATE);
    Biography bio = createBiography(Visibility.PRIVATE);
    OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherNames otherNames = new OtherNames();
    otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
    PersonalDetails p = new PersonalDetails();
    p.setBiography(bio);
    p.setName(name);
    p.setOtherNames(otherNames);
    orcidSecurityManager.checkAndFilter(ORCID_1, p);
    assertNotNull(p);
    assertNull(p.getName());
    assertNull(p.getBiography());
    assertNotNull(p.getOtherNames());
    assertNotNull(p.getOtherNames().getOtherNames());
    assertTrue(p.getOtherNames().getOtherNames().isEmpty());
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Biography(org.orcid.jaxb.model.record_v2.Biography) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 89 with OtherName

use of org.orcid.jaxb.model.record_rc3.OtherName in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testPersonalDetails_When_SomePrivate_NoSource_ReadLimitedToken.

@Test
public void testPersonalDetails_When_SomePrivate_NoSource_ReadLimitedToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
    Name name = createName(Visibility.PRIVATE);
    Biography bio = createBiography(Visibility.PUBLIC);
    OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.PUBLIC, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.PUBLIC, CLIENT_2);
    OtherNames otherNames = new OtherNames();
    otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
    PersonalDetails p = new PersonalDetails();
    p.setBiography(bio);
    p.setName(name);
    p.setOtherNames(otherNames);
    orcidSecurityManager.checkAndFilter(ORCID_1, p);
    assertNotNull(p);
    assertNull(p.getName());
    assertEquals(bio, p.getBiography());
    assertNotNull(p.getOtherNames());
    assertNotNull(p.getOtherNames().getOtherNames());
    assertEquals(2, p.getOtherNames().getOtherNames().size());
    assertFalse(p.getOtherNames().getOtherNames().contains(o1));
    assertTrue(p.getOtherNames().getOtherNames().contains(o2));
    assertTrue(p.getOtherNames().getOtherNames().contains(o3));
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Biography(org.orcid.jaxb.model.record_v2.Biography) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 90 with OtherName

use of org.orcid.jaxb.model.record_rc3.OtherName in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testCollection_When_NotSource_WrongReadLimitedToken.

@Test
public void testCollection_When_NotSource_WrongReadLimitedToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_WORKS_READ_LIMITED);
    List<OtherName> list = new ArrayList<OtherName>();
    OtherName o1 = createOtherName(Visibility.PUBLIC, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.LIMITED, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    list.add(o1);
    list.add(o2);
    list.add(o3);
    orcidSecurityManager.checkAndFilter(ORCID_1, list, ScopePathType.ORCID_BIO_READ_LIMITED);
    assertEquals(1, list.size());
    assertTrue(list.contains(o1));
    assertFalse(list.contains(o2));
    assertFalse(list.contains(o3));
}
Also used : ArrayList(java.util.ArrayList) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Test(org.junit.Test)

Aggregations

OtherName (org.orcid.jaxb.model.record_v2.OtherName)114 Test (org.junit.Test)99 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)55 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)45 Biography (org.orcid.jaxb.model.record_v2.Biography)44 Address (org.orcid.jaxb.model.record_v2.Address)43 Keyword (org.orcid.jaxb.model.record_v2.Keyword)42 Name (org.orcid.jaxb.model.record_v2.Name)42 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)42 Email (org.orcid.jaxb.model.record_v2.Email)39 Addresses (org.orcid.jaxb.model.record_v2.Addresses)32 Emails (org.orcid.jaxb.model.record_v2.Emails)32 Keywords (org.orcid.jaxb.model.record_v2.Keywords)32 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)32 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)32 Person (org.orcid.jaxb.model.record_v2.Person)30 ArrayList (java.util.ArrayList)23 DBUnitTest (org.orcid.test.DBUnitTest)22 Response (javax.ws.rs.core.Response)20 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)18