use of com.beanit.asn1bean.compiler.pkix1explicit88.Name 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());
}
use of com.beanit.asn1bean.compiler.pkix1explicit88.Name 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));
}
use of com.beanit.asn1bean.compiler.pkix1explicit88.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPersonalDetails_When_AllPrivate_Source_ReadPublicToken.
@Test
public void testPersonalDetails_When_AllPrivate_Source_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_1);
OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_1);
OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_1);
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());
assertEquals(3, p.getOtherNames().getOtherNames().size());
assertTrue(p.getOtherNames().getOtherNames().contains(o1));
assertTrue(p.getOtherNames().getOtherNames().contains(o2));
assertTrue(p.getOtherNames().getOtherNames().contains(o3));
}
use of com.beanit.asn1bean.compiler.pkix1explicit88.Name in project ORCID-Source by ORCID.
the class JpaJaxbNameAdapterTest method fromOtherNameEntityToOtherNameTest.
@Test
public void fromOtherNameEntityToOtherNameTest() {
RecordNameEntity entity = new RecordNameEntity();
entity.setCreditName("Credit Name");
entity.setFamilyName("Family Name");
entity.setGivenNames("Given Names");
entity.setVisibility(Visibility.PUBLIC);
entity.setProfile(new ProfileEntity("0000-0000-0000-0000"));
Name name = adapter.toName(entity);
assertNotNull(name);
assertEquals("Credit Name", name.getCreditName().getContent());
assertEquals("Family Name", name.getFamilyName().getContent());
assertEquals("Given Names", name.getGivenNames().getContent());
assertEquals("0000-0000-0000-0000", name.getPath());
assertEquals(Visibility.PUBLIC, name.getVisibility());
}
use of com.beanit.asn1bean.compiler.pkix1explicit88.Name in project ORCID-Source by ORCID.
the class JpaJaxbNameAdapterTest method fromNameToRecordNameEntityTest.
@Test
public void fromNameToRecordNameEntityTest() throws JAXBException {
Name name = new Name();
name.setCreditName(new CreditName("Credit Name"));
name.setFamilyName(new FamilyName("Family Name"));
name.setGivenNames(new GivenNames("Given Names"));
name.setPath("0000-0000-0000-0000");
name.setVisibility(Visibility.PUBLIC);
name.setSource(new Source("0000-0000-0000-0000"));
RecordNameEntity entity = adapter.toRecordNameEntity(name);
assertNotNull(entity);
assertEquals("Credit Name", entity.getCreditName());
assertEquals("Family Name", entity.getFamilyName());
assertEquals("Given Names", entity.getGivenNames());
assertEquals(Visibility.PUBLIC, entity.getVisibility());
assertNotNull(entity.getProfile());
assertEquals("0000-0000-0000-0000", entity.getProfile().getId());
}
Aggregations