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());
}
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());
}
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());
}
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);
}
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);
}
Aggregations