use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method displayIndexIsSetTo_1_FromUI.
@Test
public void displayIndexIsSetTo_1_FromUI() {
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, false);
extId1 = externalIdentifierManager.getExternalIdentifier(claimedOrcid, extId1.getPutCode());
assertNotNull(extId1);
assertEquals(Long.valueOf(1), extId1.getDisplayIndex());
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier 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.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method testAddExternalIdentifierToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddExternalIdentifierToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId = getExternalIdentifier();
extId = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
extId = externalIdentifierManager.getExternalIdentifier(claimedOrcid, extId.getPutCode());
assertNotNull(extId);
assertEquals(Visibility.LIMITED, extId.getVisibility());
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method getAllTest.
@Test
public void getAllTest() {
String orcid = "0000-0000-0000-0003";
PersonExternalIdentifiers elements = externalIdentifierManager.getExternalIdentifiers(orcid);
assertNotNull(elements);
assertNotNull(elements.getExternalIdentifiers());
assertEquals(5, elements.getExternalIdentifiers().size());
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (PersonExternalIdentifier element : elements.getExternalIdentifiers()) {
if (13 == element.getPutCode()) {
found1 = true;
} else if (14 == element.getPutCode()) {
found2 = true;
} else if (15 == element.getPutCode()) {
found3 = true;
} else if (16 == element.getPutCode()) {
found4 = true;
} else if (17 == element.getPutCode()) {
found5 = true;
} else {
fail("Invalid put code found: " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier 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());
}
Aggregations