Search in sources :

Example 16 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.

the class AffiliationsManagerTest method testAddEmploymentToClaimedRecordPreserveUserDefaultVisibility.

@Test
public void testAddEmploymentToClaimedRecordPreserveUserDefaultVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Employment employment = getEmployment();
    employment = affiliationsManager.createEmploymentAffiliation(claimedOrcid, employment, true);
    employment = affiliationsManager.getEmploymentAffiliation(claimedOrcid, employment.getPutCode());
    assertNotNull(employment);
    assertEquals(Visibility.LIMITED, employment.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Employment(org.orcid.jaxb.model.record_v2.Employment) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 17 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.

the class AddressManagerTest method displayIndexIsSetTo_1_FromUI.

@Test
public void displayIndexIsSetTo_1_FromUI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Address address = getAddress(Iso3166Country.MX);
    address = addressManager.createAddress(claimedOrcid, address, false);
    address = addressManager.getAddress(claimedOrcid, address.getPutCode());
    assertNotNull(address);
    assertEquals(Long.valueOf(1), address.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Address(org.orcid.jaxb.model.record_v2.Address) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 18 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.

the class AffiliationsManagerTest method testAddEducationToUnclaimedRecordPreserveEducationVisibility.

@Test
public void testAddEducationToUnclaimedRecordPreserveEducationVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Education education = getEducation();
    education = affiliationsManager.createEducationAffiliation(unclaimedOrcid, education, true);
    education = affiliationsManager.getEducationAffiliation(unclaimedOrcid, education.getPutCode());
    assertNotNull(education);
    assertEquals(Visibility.PUBLIC, education.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Education(org.orcid.jaxb.model.record_v2.Education) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 19 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateDuplicatedExtIds_noDuplicatesTest.

/**
     * VALIDATE DUPLICATED EXTERNAL IDENTIFIERS
     * */
@SuppressWarnings("deprecation")
@Test
public void validateDuplicatedExtIds_noDuplicatesTest() {
    SourceEntity source1 = mock(SourceEntity.class);
    when(source1.getSourceName()).thenReturn("source name");
    when(source1.getSourceId()).thenReturn("APP-00000000000000");
    SourceOrcid sourceOrcid = new SourceOrcid();
    sourceOrcid.setPath("0000-0000-0000-0000");
    Source source2 = mock(Source.class);
    when(source2.getSourceName()).thenReturn(new SourceName("other source name"));
    when(source2.getSourceOrcid()).thenReturn(sourceOrcid);
    ExternalIDs extIds1 = getExternalIDs();
    ExternalIDs extIds2 = getExternalIDs();
    activityValidator.checkExternalIdentifiersForDuplicates(extIds1, extIds2, source2, source1);
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) SourceName(org.orcid.jaxb.model.common_v2.SourceName) SourceOrcid(org.orcid.jaxb.model.common_v2.SourceOrcid) Source(org.orcid.jaxb.model.common_v2.Source) Test(org.junit.Test)

Example 20 with SourceEntity

use of org.orcid.persistence.jpa.entities.SourceEntity 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.groupid_v2.GroupIdRecord) Test(org.junit.Test)

Aggregations

SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)111 Test (org.junit.Test)58 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)57 BaseTest (org.orcid.core.BaseTest)44 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)28 Date (java.util.Date)19 HashMap (java.util.HashMap)15 OrcidDuplicatedElementException (org.orcid.core.exception.OrcidDuplicatedElementException)14 Work (org.orcid.jaxb.model.record_v2.Work)14 OrgEntity (org.orcid.persistence.jpa.entities.OrgEntity)13 Visibility (org.orcid.jaxb.model.common_v2.Visibility)12 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)11 Transactional (org.springframework.transaction.annotation.Transactional)11 Funding (org.orcid.jaxb.model.record_v2.Funding)10 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)6 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)6 OrgAffiliationRelationEntity (org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)6 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)6 WorkEntity (org.orcid.persistence.jpa.entities.WorkEntity)6 GroupIdRecord (org.orcid.jaxb.model.groupid_v2.GroupIdRecord)5