use of org.orcid.jaxb.model.record_rc2.Name in project robovm by robovm.
the class X509CertSelectorTest method test_setPathToNamesLjava_util_Collection.
/**
* java.security.cert.X509CertSelector#setPathToNames(Collection<List<?>>)
*/
public void test_setPathToNamesLjava_util_Collection() throws Exception {
GeneralName san0 = new GeneralName(new OtherName("1.2.3.4.5", new byte[] { 1, 2, 0, 1 }));
GeneralName san1 = new GeneralName(1, "rfc@822.Name");
GeneralName san2 = new GeneralName(2, "dNSName");
GeneralName san3 = new GeneralName(new ORAddress());
GeneralName san4 = new GeneralName(new Name("O=Organization"));
GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
GeneralName san7 = new GeneralName(7, "1.1.1.1");
GeneralName san8 = new GeneralName(8, "1.2.3.4444.55555");
GeneralNames sans1 = new GeneralNames();
sans1.addName(san0);
sans1.addName(san1);
sans1.addName(san2);
sans1.addName(san3);
sans1.addName(san4);
sans1.addName(san6);
sans1.addName(san7);
sans1.addName(san8);
GeneralNames sans2 = new GeneralNames();
sans2.addName(san0);
TestCert cert1 = new TestCert(sans1);
TestCert cert2 = new TestCert(sans2);
X509CertSelector selector = new X509CertSelector();
selector.setMatchAllSubjectAltNames(true);
selector.setPathToNames(null);
assertTrue("Any certificate should match in the case of null " + "subjectAlternativeNames criteria.", selector.match(cert1) && selector.match(cert2));
Collection<List<?>> sans = sans1.getPairsList();
selector.setPathToNames(sans);
selector.getPathToNames();
}
use of org.orcid.jaxb.model.record_rc2.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 org.orcid.jaxb.model.record_rc2.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());
}
use of org.orcid.jaxb.model.record_rc2.Name in project ORCID-Source by ORCID.
the class RecordNameManagerTest method testFindByCreditName.
@Test
public void testFindByCreditName() {
Name name = recordNameManager.findByCreditName("Adm. Credit");
assertNotNull(name);
assertEquals("4444-4444-4444-4440", name.getPath());
}
use of org.orcid.jaxb.model.record_rc2.Name in project ORCID-Source by ORCID.
the class RecordNameManagerTest method testCreateRecordName.
@Test
public void testCreateRecordName() {
Name name = new Name();
long time = System.currentTimeMillis();
name.setCreditName(new CreditName("Credit Name " + time));
name.setFamilyName(new FamilyName("Family Name " + time));
name.setGivenNames(new GivenNames("Given Names " + time));
name.setVisibility(Visibility.PRIVATE);
String orcid = "0000-0000-0000-0005";
recordNameManager.createRecordName(orcid, name);
Name newName = recordNameManager.getRecordName(orcid, 0);
assertNotNull(newName);
assertEquals("Credit Name " + time, newName.getCreditName().getContent());
assertEquals("Family Name " + time, newName.getFamilyName().getContent());
assertEquals("Given Names " + time, newName.getGivenNames().getContent());
assertEquals(Visibility.PRIVATE, newName.getVisibility());
}
Aggregations