Search in sources :

Example 26 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class ContributorUtilsTest method getWorkWithContributorWithoutOrcid.

private Work getWorkWithContributorWithoutOrcid() {
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("work with contributor without ORCID record"));
    work.setWorkTitle(workTitle);
    work.setWorkContributors(getWorkContributorWithoutOrcid());
    return work;
}
Also used : WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Work(org.orcid.jaxb.model.v3.dev1.record.Work) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle)

Example 27 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_ReadRecordTest method testReadPrivateEmails_OtherThingsJustPublic_Record.

@Test
public void testReadPrivateEmails_OtherThingsJustPublic_Record() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, "APP-5555555555555556", ScopePathType.EMAIL_READ_PRIVATE);
    Response response = serviceDelegator.viewRecord(ORCID);
    assertNotNull(response);
    assertEquals(Record.class.getName(), response.getEntity().getClass().getName());
    Record r = (Record) response.getEntity();
    assertNotNull(r);
    assertEquals("/0000-0000-0000-0003", r.getPath());
    Utils.assertIsPublicOrSource(r.getActivitiesSummary(), "APP-5555555555555556");
    Person p = r.getPerson();
    // Check email
    // Email
    assertNotNull(p.getEmails());
    Emails email = p.getEmails();
    assertNotNull(email);
    Utils.verifyLastModified(email.getLastModifiedDate());
    assertEquals(5, email.getEmails().size());
    boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
    for (Email element : email.getEmails()) {
        if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) {
            found1 = true;
        } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) {
            found2 = true;
        } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) {
            found3 = true;
        } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) {
            found4 = true;
        } else if (element.getEmail().equals("self_private_0000-0000-0000-0003@test.orcid.org")) {
            found5 = true;
        } else {
            fail("Invalid email " + element.getEmail());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    assertTrue(found5);
    this.assertAllPublicButEmails(p);
}
Also used : Response(javax.ws.rs.core.Response) Email(org.orcid.jaxb.model.v3.dev1.record.Email) GroupIdRecord(org.orcid.jaxb.model.groupid_v2.GroupIdRecord) Record(org.orcid.jaxb.model.v3.dev1.record.Record) Emails(org.orcid.jaxb.model.v3.dev1.record.Emails) Person(org.orcid.jaxb.model.v3.dev1.record.Person) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 28 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_ReadRecordTest method testViewRecordReadPublic.

@Test
public void testViewRecordReadPublic() {
    SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
    Response r = serviceDelegator.viewRecord(ORCID);
    Record record = (Record) r.getEntity();
    assertNotNull(record);
    assertEquals("/0000-0000-0000-0003", record.getPath());
    assertEquals("/0000-0000-0000-0003/activities", record.getActivitiesSummary().getPath());
    Utils.assertIsPublicOrSource(record.getActivitiesSummary(), "APP-5555555555555555");
    assertEquals("/0000-0000-0000-0003/person", record.getPerson().getPath());
    Utils.assertIsPublicOrSource(record.getPerson(), "APP-5555555555555555");
}
Also used : Response(javax.ws.rs.core.Response) GroupIdRecord(org.orcid.jaxb.model.groupid_v2.GroupIdRecord) Record(org.orcid.jaxb.model.v3.dev1.record.Record) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 29 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_ReadRecordTest method testReadPublicScope_Record.

@Test
public void testReadPublicScope_Record() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
    Response response = serviceDelegator.viewRecord(ORCID);
    assertNotNull(response);
    Record record = (Record) response.getEntity();
    assertEquals("/0000-0000-0000-0003", record.getPath());
    testPerson(record.getPerson(), ORCID);
    testActivities(record.getActivitiesSummary(), ORCID);
    assertNotNull(record.getHistory());
    assertEquals(OrcidType.USER, record.getOrcidType());
    assertNotNull(record.getPreferences());
    assertEquals(Locale.EN, record.getPreferences().getLocale());
    History history = record.getHistory();
    assertTrue(history.getClaimed());
    assertNotNull(history.getCompletionDate());
    assertEquals(CreationMethod.INTEGRATION_TEST, history.getCreationMethod());
    assertNull(history.getDeactivationDate());
    Utils.verifyLastModified(history.getLastModifiedDate());
    assertNotNull(history.getSource());
    assertEquals("APP-5555555555555555", history.getSource().retrieveSourcePath());
    assertNotNull(history.getSubmissionDate());
    assertNotNull(record.getOrcidIdentifier());
    OrcidIdentifier id = record.getOrcidIdentifier();
    assertEquals("0000-0000-0000-0003", id.getPath());
}
Also used : Response(javax.ws.rs.core.Response) OrcidIdentifier(org.orcid.jaxb.model.v3.dev1.common.OrcidIdentifier) GroupIdRecord(org.orcid.jaxb.model.groupid_v2.GroupIdRecord) Record(org.orcid.jaxb.model.v3.dev1.record.Record) History(org.orcid.jaxb.model.v3.dev1.record.History) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 30 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegator_ReadRecordTest method testViewRecordWrongScope.

@Test
public void testViewRecordWrongScope() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
    Response response = serviceDelegator.viewRecord(ORCID);
    // Verify everything inside is public
    Record record = (Record) response.getEntity();
    assertNotNull(record);
    assertEquals("/0000-0000-0000-0003", record.getPath());
    assertEquals("/0000-0000-0000-0003/activities", record.getActivitiesSummary().getPath());
    Utils.assertIsPublicOrSource(record.getActivitiesSummary(), SecurityContextTestUtils.DEFAULT_CLIENT_ID);
    assertEquals("/0000-0000-0000-0003/person", record.getPerson().getPath());
    Utils.assertIsPublicOrSource(record.getPerson(), SecurityContextTestUtils.DEFAULT_CLIENT_ID);
}
Also used : Response(javax.ws.rs.core.Response) GroupIdRecord(org.orcid.jaxb.model.groupid_v2.GroupIdRecord) Record(org.orcid.jaxb.model.v3.dev1.record.Record) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)34 Record (org.orcid.jaxb.model.v3.dev1.record.Record)33 Email (org.orcid.jaxb.model.v3.dev1.record.Email)18 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)18 Person (org.orcid.jaxb.model.v3.dev1.record.Person)17 Address (org.orcid.jaxb.model.v3.dev1.record.Address)16 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)16 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)16 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)16 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)15 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)15 Name (org.orcid.jaxb.model.v3.dev1.record.Name)15 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)15 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)15 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)15 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)14 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)14 InvitedPositionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary)14