Search in sources :

Example 26 with Name

use of com.epri._2016.cimidentities_.Name in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testName_CantRead_When_DontHaveReadScope_IsPrivate.

@Test(expected = OrcidAccessControlException.class)
public void testName_CantRead_When_DontHaveReadScope_IsPrivate() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_UPDATE);
    Name name = createName(Visibility.PRIVATE);
    orcidSecurityManager.checkAndFilter(ORCID_1, name, ScopePathType.ORCID_BIO_READ_LIMITED);
    fail();
}
Also used : OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 27 with Name

use of com.epri._2016.cimidentities_.Name in project ORCID-Source by ORCID.

the class RecordNameManagerTest method testFailOnCreatingOnARecordThatAlreadyHaveRecordName.

@Test(expected = IllegalArgumentException.class)
public void testFailOnCreatingOnARecordThatAlreadyHaveRecordName() {
    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-0001";
    recordNameManager.createRecordName(orcid, name);
    fail();
}
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) 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 28 with Name

use of com.epri._2016.cimidentities_.Name in project ORCID-Source by ORCID.

the class ValidateV2RC3SamplesTest method testUnmarshallName.

@Test
public void testUnmarshallName() throws SAXException, URISyntaxException {
    Name name = (Name) unmarshallFromPath("/record_2.0_rc3/samples/name-2.0_rc3.xml", Name.class, "/record_2.0_rc3/personal-details-2.0_rc3.xsd");
    assertNotNull(name);
    assertNotNull(name.getCreditName());
    assertEquals("credit-name", name.getCreditName().getContent());
    assertNotNull(name.getFamilyName());
    assertEquals("family-name", name.getFamilyName().getContent());
    assertNotNull(name.getGivenNames());
    assertEquals("given-names", name.getGivenNames().getContent());
    assertNotNull(name.getVisibility());
    assertEquals(Visibility.PUBLIC, name.getVisibility());
}
Also used : OtherName(org.orcid.jaxb.model.record_rc3.OtherName) CreditName(org.orcid.jaxb.model.record_rc3.CreditName) Name(org.orcid.jaxb.model.record_rc3.Name) Test(org.junit.Test)

Example 29 with Name

use of com.epri._2016.cimidentities_.Name in project ORCID-Source by ORCID.

the class ValidateV2_1SamplesTest method testUnmarshallName.

@Test
public void testUnmarshallName() throws SAXException, URISyntaxException {
    Name name = (Name) unmarshallFromPath("/record_2.1/samples/read_samples/name-2.1.xml", Name.class, "/record_2.1/personal-details-2.1.xsd");
    assertNotNull(name);
    assertNotNull(name.getCreditName());
    assertEquals("credit-name", name.getCreditName().getContent());
    assertNotNull(name.getFamilyName());
    assertEquals("family-name", name.getFamilyName().getContent());
    assertNotNull(name.getGivenNames());
    assertEquals("given-names", name.getGivenNames().getContent());
    assertNotNull(name.getVisibility());
    assertEquals(Visibility.PUBLIC, name.getVisibility());
}
Also used : CreditName(org.orcid.jaxb.model.record_v2.CreditName) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 30 with Name

use of com.epri._2016.cimidentities_.Name in project ORCID-Source by ORCID.

the class ValidateV2_1SamplesTest method testMarshallName.

@Test
public void testMarshallName() throws JAXBException, SAXException, URISyntaxException {
    Name object = (Name) unmarshallFromPath("/record_2.1/samples/read_samples/name-2.1.xml", Name.class);
    marshall(object, "/record_2.1/personal-details-2.1.xsd");
}
Also used : CreditName(org.orcid.jaxb.model.record_v2.CreditName) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)77 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