use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method testAddEqualsExternalIdentifiersFromDifferentSource.
@Test
public void testAddEqualsExternalIdentifiersFromDifferentSource() {
PersonExternalIdentifier extId = getExternalIdentifier();
extId.setType(extId.getType() + System.currentTimeMillis());
// Create from client # 1
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId1 = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
assertNotNull(extId1);
assertNotNull(extId1.getPutCode());
// Create from client # 2
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_2_ID)));
PersonExternalIdentifier extId2 = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
assertNotNull(extId2);
assertNotNull(extId2.getPutCode());
// Verify both ext ids are not the same one
assertNotEquals(extId1.getPutCode(), extId2.getPutCode());
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method displayIndexIsSetTo_0_FromAPI.
@Test
public void displayIndexIsSetTo_0_FromAPI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId = getExternalIdentifier();
extId.setType(extId.getType() + System.currentTimeMillis());
PersonExternalIdentifier extId1 = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
extId1 = externalIdentifierManager.getExternalIdentifier(claimedOrcid, extId1.getPutCode());
assertNotNull(extId1);
assertEquals(Long.valueOf(0), extId1.getDisplayIndex());
}
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());
}
Aggregations