Search in sources :

Example 51 with Record

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

the class OrcidSecurityManager_generalTest method testPublicClient_checkAndFilter_Record.

@Test(expected = OrcidUnauthorizedException.class)
public void testPublicClient_checkAndFilter_Record() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, PUBLIC_CLIENT, ScopePathType.READ_PUBLIC);
    orcidSecurityManager.checkAndFilter(ORCID_1, new Record());
}
Also used : Record(org.orcid.jaxb.model.v3.dev1.record.Record) Test(org.junit.Test)

Example 52 with Record

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

the class EmailManagerTest method moveEmailToOtherAccountTest.

@Test
public void moveEmailToOtherAccountTest() {
    String email = "public@email.com";
    String from = "4444-4444-4444-4441";
    String to = "4444-4444-4444-4499";
    ProfileEntity destinationBefore = profileDao.find(to);
    Date beforeLastModified = destinationBefore.getLastModified();
    Map<String, String> map = emailManager.findOricdIdsByCommaSeparatedEmails(email);
    assertNotNull(map);
    assertEquals(from, map.get(email));
    emailManager.moveEmailToOtherAccount(email, from, to);
    ProfileEntity destinationAfter = profileDao.find(to);
    Date afterLastModified = destinationAfter.getLastModified();
    assertFalse(beforeLastModified.equals(afterLastModified));
    assertTrue(afterLastModified.getTime() > beforeLastModified.getTime());
    // Assert the email was moved
    map = emailManager.findOricdIdsByCommaSeparatedEmails(email);
    assertNotNull(map);
    assertEquals(to, map.get(email));
    // Assert the email is not anymore in the from record
    Emails emails = emailManager.getEmails(from);
    for (Email e : emails.getEmails()) {
        assertFalse(email.equals(e.getEmail()));
    }
    // Assert the email belongs to the to record
    emails = emailManager.getEmails(to);
    boolean found = false;
    for (Email e : emails.getEmails()) {
        if (email.equals(e.getEmail())) {
            found = true;
        }
    }
    assertTrue(found);
}
Also used : Email(org.orcid.jaxb.model.v3.dev1.record.Email) Emails(org.orcid.jaxb.model.v3.dev1.record.Emails) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Date(java.util.Date) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 53 with Record

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

the class RecordManagerTest method testGetPublicRecord.

@Test
public void testGetPublicRecord() {
    Record record = recordManager.getPublicRecord(ORCID);
    assertNotNull(record);
    assertNotNull(record.getActivitiesSummary());
    assertNotNull(record.getPerson());
    Person person = record.getPerson();
    assertNotNull(person);
    assertNotNull(person.getExternalIdentifiers());
    assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers());
    assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size());
    assertEquals(Long.valueOf(13), person.getExternalIdentifiers().getExternalIdentifiers().get(0).getPutCode());
    assertNotNull(person.getResearcherUrls());
    assertNotNull(person.getResearcherUrls().getResearcherUrls());
    assertEquals(1, person.getResearcherUrls().getResearcherUrls().size());
    assertEquals(Long.valueOf(13), person.getResearcherUrls().getResearcherUrls().get(0).getPutCode());
    assertNotNull(person.getOtherNames());
    assertNotNull(person.getOtherNames().getOtherNames());
    assertEquals(1, person.getOtherNames().getOtherNames().size());
    assertEquals(Long.valueOf(13), person.getOtherNames().getOtherNames().get(0).getPutCode());
    assertNotNull(person.getAddresses());
    assertNotNull(person.getAddresses().getAddress());
    assertEquals(1, person.getAddresses().getAddress().size());
    assertEquals(Long.valueOf(9), person.getAddresses().getAddress().get(0).getPutCode());
    assertNotNull(person.getKeywords());
    assertNotNull(person.getKeywords().getKeywords());
    assertEquals(1, person.getKeywords().getKeywords().size());
    assertEquals(Long.valueOf(9), person.getKeywords().getKeywords().get(0).getPutCode());
    assertNotNull(person.getEmails());
    assertNotNull(person.getEmails().getEmails());
    assertEquals(1, person.getEmails().getEmails().size());
    assertEquals("public_0000-0000-0000-0003@test.orcid.org", person.getEmails().getEmails().get(0).getEmail());
    assertNotNull(person.getBiography());
    assertEquals(Visibility.PUBLIC, person.getBiography().getVisibility());
    assertEquals("Biography for 0000-0000-0000-0003", person.getBiography().getContent());
    assertNotNull(person.getName());
    assertNotNull(person.getName().getCreditName());
    assertEquals("Credit Name", person.getName().getCreditName().getContent());
    assertNotNull(person.getName().getFamilyName());
    assertEquals("Family Name", person.getName().getFamilyName().getContent());
    assertNotNull(person.getName().getGivenNames());
    assertEquals("Given Names", person.getName().getGivenNames().getContent());
    assertEquals(Visibility.PUBLIC, person.getName().getVisibility());
    ActivitiesSummary activities = record.getActivitiesSummary();
    assertNotNull(activities.getEducations());
    assertNotNull(activities.getEducations().getSummaries());
    assertEquals(1, activities.getEducations().getSummaries().size());
    assertEquals(Long.valueOf(20), activities.getEducations().getSummaries().get(0).getPutCode());
    assertNotNull(activities.getEmployments());
    assertNotNull(activities.getEmployments().getSummaries());
    assertEquals(1, activities.getEmployments().getSummaries().size());
    assertEquals(Long.valueOf(17), activities.getEmployments().getSummaries().get(0).getPutCode());
    assertNotNull(activities.getFundings());
    assertNotNull(activities.getFundings().getFundingGroup());
    assertEquals(1, activities.getFundings().getFundingGroup().size());
    assertEquals(Long.valueOf(10), activities.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getPutCode());
    assertNotNull(activities.getPeerReviews());
    assertNotNull(activities.getPeerReviews().getPeerReviewGroup());
    assertEquals(1, activities.getPeerReviews().getPeerReviewGroup().size());
    assertEquals(Long.valueOf(9), activities.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getPutCode());
    assertNotNull(activities.getWorks());
    assertNotNull(activities.getWorks().getWorkGroup());
    assertEquals(1, activities.getWorks().getWorkGroup().size());
    assertEquals(Long.valueOf(11), activities.getWorks().getWorkGroup().get(0).getWorkSummary().get(0).getPutCode());
}
Also used : Record(org.orcid.jaxb.model.v3.dev1.record.Record) Person(org.orcid.jaxb.model.v3.dev1.record.Person) ActivitiesSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary) Test(org.junit.Test) DBUnitTest(org.orcid.test.DBUnitTest)

Example 54 with Record

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

the class ActivityValidatorTest method validateGroupId_validTest.

/**
 * VALIDATE GROUP ID RECORD
 */
@Test
public void validateGroupId_validTest() {
    SourceEntity source = mock(SourceEntity.class);
    when(source.getSourceName()).thenReturn("source name");
    GroupIdRecord g = getGroupIdRecord();
    activityValidator.validateGroupIdRecord(g, true, source);
}
Also used : SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) GroupIdRecord(org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecord) Test(org.junit.Test)

Example 55 with Record

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

the class MemberV3ApiServiceDelegatorImpl method viewGroupIdRecord.

@Override
public Response viewGroupIdRecord(Long putCode) {
    orcidSecurityManager.checkScopes(ScopePathType.GROUP_ID_RECORD_READ);
    GroupIdRecord record = groupIdRecordManagerReadOnly.getGroupIdRecord(putCode);
    return Response.ok(record).build();
}
Also used : GroupIdRecord(org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecord)

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