use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class AddressManagerTest method displayIndexIsSetTo_0_FromAPI.
@Test
public void displayIndexIsSetTo_0_FromAPI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.PE);
address = addressManager.createAddress(claimedOrcid, address, true);
address = addressManager.getAddress(claimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Long.valueOf(0), address.getDisplayIndex());
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class AffiliationsManagerTest method testAddEducationToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddEducationToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Education education = getEducation();
education = affiliationsManager.createEducationAffiliation(claimedOrcid, education, true);
education = affiliationsManager.getEducationAffiliation(claimedOrcid, education.getPutCode());
assertNotNull(education);
assertEquals(Visibility.LIMITED, education.getVisibility());
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class AddressManagerTest method testAddAddressToUnclaimedRecordPreserveAddressVisibility.
@Test
public void testAddAddressToUnclaimedRecordPreserveAddressVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.CR);
address = addressManager.createAddress(unclaimedOrcid, address, true);
address = addressManager.getAddress(unclaimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Visibility.PUBLIC, address.getVisibility());
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class AddressManagerTest method testAddAddressToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddAddressToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.US);
address = addressManager.createAddress(claimedOrcid, address, true);
address = addressManager.getAddress(claimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Visibility.LIMITED, address.getVisibility());
}
use of org.orcid.persistence.jpa.entities.SourceEntity in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method testAddEqualsExternalIdentifiersFromSameSource.
@Test(expected = OrcidDuplicatedElementException.class)
public void testAddEqualsExternalIdentifiersFromSameSource() {
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());
// Remove the put code and the source
extId1.setPutCode(null);
extId1.setSource(null);
externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
fail();
}
Aggregations