use of org.orcid.persistence.jpa.entities.ClientDetailsEntity in project ORCID-Source by ORCID.
the class IdentifierTypeConverterTest method testToPojo.
@Test
public void testToPojo() {
IdentifierTypeEntity entity1 = new IdentifierTypeEntity();
entity1.setId(1l);
entity1.setName("NAME_TEST");
entity1.setIsDeprecated(true);
entity1.setResolutionPrefix("prefix");
entity1.setValidationRegex("validation");
entity1.setDateCreated(new Date(10, 10, 10));
entity1.setLastModified(new Date(11, 11, 11));
ClientDetailsEntity client = new ClientDetailsEntity();
client.setClientName("clientName");
entity1.setSourceClient(client);
IdentifierType id = new IdentifierTypePOJOConverter().fromEntity(entity1);
assertEquals(Long.valueOf(1l), id.getPutCode());
assertEquals("name-test", id.getName());
assertEquals(true, id.getDeprecated());
assertEquals("prefix", id.getResolutionPrefix());
assertEquals("validation", id.getValidationRegex());
assertEquals(new Date(10, 10, 10), id.getDateCreated());
assertEquals(new Date(11, 11, 11), id.getLastModified());
assertEquals("clientName", id.getSourceClient().getClientName());
}
use of org.orcid.persistence.jpa.entities.ClientDetailsEntity in project ORCID-Source by ORCID.
the class OrcidClientGroupManagerTest method testCreateOrcidCreatorClientGroup.
@Test
public void testCreateOrcidCreatorClientGroup() {
OrcidClientGroup createdGroup = orcidClientGroupManager.createOrUpdateOrcidClientGroup(group);
assertNotNull(createdGroup);
assertEquals(group.getGroupName(), createdGroup.getGroupName());
assertEquals(group.getEmail(), createdGroup.getEmail());
assertNotNull(createdGroup.getGroupOrcid());
List<OrcidClient> createdClients = createdGroup.getOrcidClient();
assertNotNull(createdClients);
assertEquals(2, createdClients.size());
Map<String, OrcidClient> createdClientsMappedByName = new HashMap<String, OrcidClient>();
for (OrcidClient createdClient : createdClients) {
assertNotNull(createdClient.getClientId());
assertNotNull(createdClient.getClientSecret());
assertNotNull(createdClient.getIdp());
createdClientsMappedByName.put(createdClient.getDisplayName(), createdClient);
}
OrcidClient complexityClient = createdClientsMappedByName.get("Ecological Complexity");
assertNotNull(complexityClient);
assertEquals("http://www.journals.elsevier.com/ecological-complexity", complexityClient.getWebsite());
assertEquals("An International Journal on Biocomplexity in the Environment and Theoretical Ecology", complexityClient.getShortDescription());
List<RedirectUri> createdRedirectUris = complexityClient.getRedirectUris().getRedirectUri();
assertNotNull(createdRedirectUris);
assertEquals(1, createdRedirectUris.size());
assertEquals("http://www.journals.elsevier.com/ecological-complexity/orcid-callback", createdRedirectUris.get(0).getValue());
// Look up client details directly to check scopes
ClientDetailsEntity complexityEntity = clientDetailsManager.findByClientId(complexityClient.getClientId());
Set<String> clientScopeTypes = complexityEntity.getScope();
assertNotNull(clientScopeTypes);
assertTrue(clientScopeTypes.contains("/orcid-profile/read-limited"));
assertTrue(clientScopeTypes.contains("/orcid-bio/read-limited"));
assertTrue(clientScopeTypes.contains("/orcid-works/read-limited"));
}
use of org.orcid.persistence.jpa.entities.ClientDetailsEntity in project ORCID-Source by ORCID.
the class NotificationManagerTest method testAdminDelegateRequest.
@Test
public void testAdminDelegateRequest() throws JAXBException, IOException, URISyntaxException {
SourceEntity sourceEntity = new SourceEntity(new ClientDetailsEntity("APP-5555555555555555"));
when(sourceManager.retrieveSourceEntity()).thenReturn(sourceEntity);
when(sourceManager.retrieveSourceOrcid()).thenReturn("APP-5555555555555555");
for (Locale locale : Locale.values()) {
notificationManager.sendDelegationRequestEmail("0000-0000-0000-0003", "0000-0000-0000-0003", "http://test.orcid.org");
}
}
use of org.orcid.persistence.jpa.entities.ClientDetailsEntity in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method testAddExternalIdentifierToUnclaimedRecordPreserveExternalIdentifierVisibility.
@Test
public void testAddExternalIdentifierToUnclaimedRecordPreserveExternalIdentifierVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId = getExternalIdentifier();
extId = externalIdentifierManager.createExternalIdentifier(unclaimedOrcid, extId, true);
extId = externalIdentifierManager.getExternalIdentifier(unclaimedOrcid, extId.getPutCode());
assertNotNull(extId);
assertEquals(Visibility.PUBLIC, extId.getVisibility());
}
use of org.orcid.persistence.jpa.entities.ClientDetailsEntity 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());
}
Aggregations