Search in sources :

Example 61 with Name

use of org.openmuc.jasn1.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());
}
Also used : RecordNameEntity(org.orcid.persistence.jpa.entities.RecordNameEntity) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) CreditName(org.orcid.jaxb.model.common_v2.CreditName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 62 with Name

use of org.openmuc.jasn1.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());
}
Also used : FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) GivenNames(org.orcid.jaxb.model.record_v2.GivenNames) CreditName(org.orcid.jaxb.model.common_v2.CreditName) RecordNameEntity(org.orcid.persistence.jpa.entities.RecordNameEntity) Source(org.orcid.jaxb.model.common_v2.Source) FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) CreditName(org.orcid.jaxb.model.common_v2.CreditName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 63 with Name

use of org.openmuc.jasn1.compiler.pkix1explicit88.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());
}
Also used : FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) CreditName(org.orcid.jaxb.model.common_v2.CreditName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 64 with Name

use of org.openmuc.jasn1.compiler.pkix1explicit88.Name in project robovm by robovm.

the class X509CertSelectorTest method test_setSubjectAlternativeNamesLjava_util_Collection.

/**
     * java.security.cert.X509CertSelector#setSubjectAlternativeNames(Collection<List<?>>)
     */
public void test_setSubjectAlternativeNamesLjava_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.setSubjectAlternativeNames(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.setSubjectAlternativeNames(sans);
    selector.getSubjectAlternativeNames();
}
Also used : GeneralNames(org.apache.harmony.security.x509.GeneralNames) OtherName(org.apache.harmony.security.x509.OtherName) X509CertSelector(java.security.cert.X509CertSelector) List(java.util.List) ArrayList(java.util.ArrayList) GeneralName(org.apache.harmony.security.x509.GeneralName) ORAddress(org.apache.harmony.security.x509.ORAddress) GeneralName(org.apache.harmony.security.x509.GeneralName) OtherName(org.apache.harmony.security.x509.OtherName) Name(org.apache.harmony.security.x501.Name)

Example 65 with Name

use of org.openmuc.jasn1.compiler.pkix1explicit88.Name in project robovm by robovm.

the class X509CertSelectorTest method test_addSubjectAlternativeNameLintLjava_lang_String2.

/**
     * java.security.cert.X509CertSelector#addSubjectAlternativeName(int, String)
     */
public void test_addSubjectAlternativeNameLintLjava_lang_String2() throws Exception {
    GeneralName san6 = new GeneralName(6, "http://uniform.Resource.Id");
    GeneralName san2 = new GeneralName(2, "dNSName");
    GeneralNames sans1 = new GeneralNames();
    sans1.addName(san6);
    sans1.addName(san2);
    X509CertSelector selector = new X509CertSelector();
    selector.addSubjectAlternativeName(6, "http://uniform.Resource.Id");
    selector.addSubjectAlternativeName(2, "dNSName");
    GeneralNames sans2 = new GeneralNames();
    sans2.addName(san2);
    TestCert cert1 = new TestCert(sans1);
    TestCert cert2 = new TestCert(sans2);
    assertTrue(selector.match(cert1));
    assertFalse(selector.match(cert2));
    selector.setSubjectAlternativeNames(null);
    GeneralName name = new GeneralName(new Name("O=Android"));
    try {
        selector.addSubjectAlternativeName(0, (name.toString()));
    } catch (IOException e) {
    // ok
    }
}
Also used : GeneralNames(org.apache.harmony.security.x509.GeneralNames) X509CertSelector(java.security.cert.X509CertSelector) GeneralName(org.apache.harmony.security.x509.GeneralName) IOException(java.io.IOException) GeneralName(org.apache.harmony.security.x509.GeneralName) OtherName(org.apache.harmony.security.x509.OtherName) Name(org.apache.harmony.security.x501.Name)

Aggregations

Test (org.junit.Test)78 Name (org.orcid.jaxb.model.record_v2.Name)74 OtherName (org.orcid.jaxb.model.record_v2.OtherName)62 Biography (org.orcid.jaxb.model.record_v2.Biography)46 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)41 Address (org.orcid.jaxb.model.record_v2.Address)31 Email (org.orcid.jaxb.model.record_v2.Email)30 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)30 Addresses (org.orcid.jaxb.model.record_v2.Addresses)29 Emails (org.orcid.jaxb.model.record_v2.Emails)29 Keyword (org.orcid.jaxb.model.record_v2.Keyword)29 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)29 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)29 Keywords (org.orcid.jaxb.model.record_v2.Keywords)28 Person (org.orcid.jaxb.model.record_v2.Person)28 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)28 Record (org.orcid.jaxb.model.record_v2.Record)19 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)18 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)17 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)17