use of org.orcid.jaxb.model.record_v2.ExternalID in project ORCID-Source by ORCID.
the class JpaJaxbNotificationAdapterTest method testToNotificationPermissionEntity.
@Test
public void testToNotificationPermissionEntity() {
NotificationPermission notification = new NotificationPermission();
notification.setNotificationType(NotificationType.PERMISSION);
String authorizationUrlString = "https://orcid.org/oauth/authorize?client_id=APP-U4UKCNSSIM1OCVQY&response_type=code&scope=/orcid-works/create&redirect_uri=http://somethirdparty.com";
AuthorizationUrl url = new AuthorizationUrl();
notification.setAuthorizationUrl(url);
notification.setNotificationIntro("This is the intro");
notification.setNotificationSubject("This is the subject");
Source source = new Source();
notification.setSource(source);
SourceClientId clientId = new SourceClientId();
source.setSourceClientId(clientId);
clientId.setPath("APP-5555-5555-5555-5555");
url.setUri(authorizationUrlString);
Items activities = new Items();
notification.setItems(activities);
Item activity = new Item();
activities.getItems().add(activity);
activity.setItemType(ItemType.WORK);
activity.setItemName("Latest Research Article");
ExternalID extId = new ExternalID();
activity.setExternalIdentifier(extId);
extId.setType("doi");
extId.setValue("1234/abc123");
NotificationEntity notificationEntity = jpaJaxbNotificationAdapter.toNotificationEntity(notification);
assertTrue(notificationEntity instanceof NotificationAddItemsEntity);
NotificationAddItemsEntity addActivitiesEntity = (NotificationAddItemsEntity) notificationEntity;
assertNotNull(notificationEntity);
assertEquals(NotificationType.PERMISSION, notificationEntity.getNotificationType());
assertEquals(authorizationUrlString, addActivitiesEntity.getAuthorizationUrl());
assertEquals(notification.getNotificationIntro(), notificationEntity.getNotificationIntro());
assertEquals(notification.getNotificationSubject(), notificationEntity.getNotificationSubject());
// Source
assertNull(notificationEntity.getSourceId());
assertNull(notificationEntity.getClientSourceId());
assertNull(notificationEntity.getElementSourceId());
Set<NotificationItemEntity> activityEntities = addActivitiesEntity.getNotificationItems();
assertNotNull(activityEntities);
assertEquals(1, activityEntities.size());
NotificationItemEntity activityEntity = activityEntities.iterator().next();
assertEquals(ItemType.WORK, activityEntity.getItemType());
assertEquals("Latest Research Article", activityEntity.getItemName());
assertEquals("DOI", activityEntity.getExternalIdType());
assertEquals("1234/abc123", activityEntity.getExternalIdValue());
}
use of org.orcid.jaxb.model.record_v2.ExternalID in project ORCID-Source by ORCID.
the class JpaJaxbWorkAdapterTest method fromProfileWorkEntityToWorkSummaryTest.
@Test
public void fromProfileWorkEntityToWorkSummaryTest() {
WorkEntity work = getWorkEntity();
assertNotNull(work);
WorkSummary ws = jpaJaxbWorkAdapter.toWorkSummary(work);
assertNotNull(ws);
assertEquals(Long.valueOf(12345), ws.getPutCode());
assertEquals(Visibility.LIMITED.value(), ws.getVisibility().value());
assertEquals("1234567890", ws.getDisplayIndex());
assertNotNull(ws.getExternalIdentifiers());
assertNotNull(ws.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, ws.getExternalIdentifiers().getExternalIdentifier().size());
ExternalID workExtId = ws.getExternalIdentifiers().getExternalIdentifier().get(0);
assertNotNull(workExtId.getValue());
assertEquals("123", workExtId.getValue());
assertNotNull(workExtId.getType());
assertEquals(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value(), workExtId.getType());
}
use of org.orcid.jaxb.model.record_v2.ExternalID in project ORCID-Source by ORCID.
the class EmailMessageSenderTest method createActivity.
private Item createActivity(ItemType actType, String actName, String doi) {
Item act = new Item();
act.setItemType(actType);
act.setItemName(actName);
ExternalID extId = new ExternalID();
extId.setType("doi");
extId.setValue(doi);
act.setExternalIdentifier(extId);
return act;
}
use of org.orcid.jaxb.model.record_v2.ExternalID in project ORCID-Source by ORCID.
the class OrcidSecurityManagerTestBase method createPeerReviewSummary.
protected PeerReviewSummary createPeerReviewSummary(Visibility v, String sourceId, String extIdValue) {
PeerReviewSummary p = new PeerReviewSummary();
p.setVisibility(v);
p.setGroupId(EXTID_SHARED);
setSource(p, sourceId);
ExternalID extId = new ExternalID();
extId.setValue(extIdValue);
ExternalIDs extIds = new ExternalIDs();
extIds.getExternalIdentifier().add(extId);
addSharedExtId(extIds);
p.setExternalIdentifiers(extIds);
return p;
}
use of org.orcid.jaxb.model.record_v2.ExternalID in project ORCID-Source by ORCID.
the class OrcidSecurityManagerTestBase method createFundingSummary.
protected FundingSummary createFundingSummary(Visibility v, String sourceId, String extIdValue) {
FundingSummary f = new FundingSummary();
f.setVisibility(v);
setSource(f, sourceId);
ExternalID extId = new ExternalID();
extId.setValue(extIdValue);
ExternalIDs extIds = new ExternalIDs();
extIds.getExternalIdentifier().add(extId);
addSharedExtId(extIds);
f.setExternalIdentifiers(extIds);
return f;
}
Aggregations