use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class SourceInActivitiesTest method before.
@Before
public void before() {
TargetProxyHelper.injectIntoProxy(workManager, "sourceManager", mockSourceManager);
TargetProxyHelper.injectIntoProxy(profileFundingManager, "sourceManager", mockSourceManager);
TargetProxyHelper.injectIntoProxy(affiliationsManager, "sourceManager", mockSourceManager);
TargetProxyHelper.injectIntoProxy(peerReviewManager, "sourceManager", mockSourceManager);
TargetProxyHelper.injectIntoProxy(orcidProfileManager, "sourceManager", mockSourceManager);
if (PojoUtil.isEmpty(userOrcid)) {
when(mockSourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
OrcidProfile newUser = getMinimalOrcidProfile();
userOrcid = newUser.getOrcidIdentifier().getPath();
}
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class JpaJaxbEntityAdapterToOrcidProfileTest method testToOrcidProfileWithNewWayOfDoingEmails.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testToOrcidProfileWithNewWayOfDoingEmails() throws SAXException, IOException {
ProfileEntity profileEntity = profileDao.find("4444-4444-4444-4445");
long start = System.currentTimeMillis();
OrcidProfile orcidProfile = adapter.toOrcidProfile(profileEntity, LoadOptions.ALL);
System.out.println("Took: " + Long.toString(System.currentTimeMillis() - start));
ContactDetails contactDetails = orcidProfile.getOrcidBio().getContactDetails();
Email primaryEmail = contactDetails.retrievePrimaryEmail();
assertNotNull(primaryEmail);
assertTrue(primaryEmail.isPrimary());
assertTrue(primaryEmail.isCurrent());
assertFalse(primaryEmail.isVerified());
assertEquals(Visibility.PRIVATE, primaryEmail.getVisibility());
assertEquals("andrew@timothy.com", primaryEmail.getValue());
assertEquals("4444-4444-4444-4441", primaryEmail.getSource());
Email nonPrimaryEmail = contactDetails.getEmailByString("andrew2@timothy.com");
assertNotNull(nonPrimaryEmail);
assertFalse(nonPrimaryEmail.isPrimary());
assertFalse(nonPrimaryEmail.isCurrent());
assertFalse(nonPrimaryEmail.isVerified());
assertEquals(Visibility.PRIVATE, nonPrimaryEmail.getVisibility());
assertEquals("andrew2@timothy.com", nonPrimaryEmail.getValue());
assertEquals("4444-4444-4444-4441", nonPrimaryEmail.getSource());
assertEquals(2, contactDetails.getEmail().size());
validateAgainstSchema(new OrcidMessage(orcidProfile));
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class JpaJaxbEntityAdapterToOrcidProfileTest method testToOrcidProfile.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testToOrcidProfile() throws SAXException, IOException {
ProfileEntity profileEntity = profileDao.find("4444-4444-4444-4443");
long start = System.currentTimeMillis();
OrcidProfile orcidProfile = adapter.toOrcidProfile(profileEntity, LoadOptions.ALL);
System.out.println("Took: " + Long.toString(System.currentTimeMillis() - start));
System.out.println(orcidProfile);
checkOrcidProfile(orcidProfile);
validateAgainstSchema(new OrcidMessage(orcidProfile));
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class S3UpdaterTest method updateS3_OrcidProfileTest.
@Test
public void updateS3_OrcidProfileTest() throws JAXBException, AmazonClientException, IOException {
String bucketPrefix = "bucket-production";
String orcid = "0000-0000-0000-000X";
OrcidMessage om = new OrcidMessage();
OrcidProfile op = new OrcidProfile();
op.setOrcidIdentifier(orcid);
om.setOrcidProfile(op);
S3Updater s3 = new S3Updater(bucketPrefix);
s3.setS3MessagingService(s3MessagingService);
s3.updateS3(orcid, om);
verify(s3MessagingService, times(1)).send(Matchers.eq(bucketPrefix + "-api-1-2-json-x"), Matchers.eq(orcid + ".json"), Matchers.any(), Matchers.any());
verify(s3MessagingService, times(1)).send(Matchers.eq(bucketPrefix + "-api-1-2-xml-x"), Matchers.eq(orcid + ".xml"), Matchers.any(), Matchers.any());
verify(s3MessagingService, times(0)).send(Matchers.eq(bucketPrefix + "-api-2-0-json-x"), Matchers.eq(orcid + ".xml"), Matchers.any(), Matchers.any());
verify(s3MessagingService, times(0)).send(Matchers.eq(bucketPrefix + "-api-2-0-xml-x"), Matchers.eq(orcid + ".xml"), Matchers.any(), Matchers.any());
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class RegistrationManagerImplTest method createBasicProfile.
private OrcidProfile createBasicProfile(String email, boolean claimed, String sourceId) {
OrcidProfile profile = new OrcidProfile();
profile.setPassword("password");
profile.setVerificationCode("1234");
OrcidBio bio = new OrcidBio();
ContactDetails contactDetails = new ContactDetails();
contactDetails.addOrReplacePrimaryEmail(new Email(email));
bio.setContactDetails(contactDetails);
profile.setOrcidBio(bio);
PersonalDetails personalDetails = new PersonalDetails();
bio.setPersonalDetails(personalDetails);
personalDetails.setGivenNames(new GivenNames("New"));
personalDetails.setFamilyName(new FamilyName("User"));
OrcidHistory orcidHistory = new OrcidHistory();
orcidHistory.setClaimed(new Claimed(claimed));
orcidHistory.setCreationMethod(CreationMethod.DIRECT);
orcidHistory.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
profile.setOrcidHistory(orcidHistory);
// Set the source
profile.getOrcidHistory().setSource(new Source(sourceId));
return profile;
}
Aggregations