use of org.orcid.persistence.jpa.entities.ClientDetailsEntity 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.persistence.jpa.entities.ClientDetailsEntity in project ORCID-Source by ORCID.
the class NotificationManagerTest method testCreateCustomNotification.
@Test
public void testCreateCustomNotification() {
SourceEntity sourceEntity = new SourceEntity(new ClientDetailsEntity("APP-5555555555555555"));
when(sourceManager.retrieveSourceEntity()).thenReturn(sourceEntity);
when(sourceManager.retrieveSourceOrcid()).thenReturn("APP-5555555555555555");
String testOrcid = "0000-0000-0000-0003";
NotificationCustom notification = new NotificationCustom();
notification.setSubject("Test subject");
notification.setLang("en-gb");
Notification result = notificationManager.createNotification(testOrcid, notification);
assertNotNull(result);
assertTrue(result instanceof NotificationCustom);
NotificationCustom customResult = (NotificationCustom) result;
assertEquals("Test subject", customResult.getSubject());
assertEquals("en-gb", customResult.getLang());
}
use of org.orcid.persistence.jpa.entities.ClientDetailsEntity in project ORCID-Source by ORCID.
the class IdentifierTypeManagerTest method createIdentifierType.
private IdentifierType createIdentifierType(int seed) {
IdentifierType id = new IdentifierType();
id.setName("test" + seed);
id.setDeprecated(true);
id.setResolutionPrefix("prefix" + seed);
id.setValidationRegex("validation" + seed);
id.setDateCreated(new Date(10, 10, 10));
id.setLastModified(new Date(11, 11, 11));
ClientDetailsEntity client = new ClientDetailsEntity();
client.setClientName(CLIENT_1_ID);
id.setSourceClient(client);
id.setPrimaryUse("pu" + seed);
id.setCaseSensitive(true);
return id;
}
use of org.orcid.persistence.jpa.entities.ClientDetailsEntity in project ORCID-Source by ORCID.
the class InstitutionalSignInManagerTest method testDontSendNotificationIfClientKnowUser.
@Test
public void testDontSendNotificationIfClientKnowUser() throws UnsupportedEncodingException {
ClientDetailsEntity testClient = new ClientDetailsEntity(clientId);
when(mock_userConnectionDao.findByProviderIdAndProviderUserIdAndIdType(anyString(), anyString(), anyString())).thenReturn(null);
when(mock_clientDetailsEntityCacheManager.retrieveByIdP(anyString())).thenReturn(testClient);
when(mock_orcidOauth2TokenDetailService.doesClientKnowUser(anyString(), anyString())).thenReturn(true);
institutionalSignInManager.createUserConnectionAndNotify("idType", "remoteUserId", "displayName", "providerId", userOrcid, Collections.<String, String>emptyMap());
verify(mock_userConnectionDao, times(1)).persist(any());
verify(mock_notificationManager, never()).sendAcknowledgeMessage(userOrcid, clientId);
}
use of org.orcid.persistence.jpa.entities.ClientDetailsEntity in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method testAddPeerReviewToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddPeerReviewToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PeerReview peer = getPeerReview(null);
peer = peerReviewManager.createPeerReview(claimedOrcid, peer, true);
peer = peerReviewManager.getPeerReview(claimedOrcid, peer.getPutCode());
assertNotNull(peer);
assertEquals(Visibility.LIMITED, peer.getVisibility());
}
Aggregations