use of org.orcid.jaxb.model.v3.dev1.common.SourceClientId in project ORCID-Source by ORCID.
the class JpaJaxbNotificationAdapterTest method testToNotificationAmendedEntity.
@Test
public void testToNotificationAmendedEntity() {
NotificationAmended notification = new NotificationAmended();
notification.setNotificationType(NotificationType.AMENDED);
Source source = new Source();
notification.setSource(source);
SourceClientId clientId = new SourceClientId();
source.setSourceClientId(clientId);
clientId.setPath("APP-5555-5555-5555-5555");
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 NotificationAmendedEntity);
NotificationAmendedEntity notificationAmendedEntity = (NotificationAmendedEntity) notificationEntity;
assertNotNull(notificationEntity);
assertEquals(org.orcid.jaxb.model.notification_v2.NotificationType.AMENDED, notificationEntity.getNotificationType());
// Source
assertNull(notificationAmendedEntity.getSourceId());
assertNull(notificationAmendedEntity.getClientSourceId());
assertNull(notificationAmendedEntity.getElementSourceId());
}
use of org.orcid.jaxb.model.v3.dev1.common.SourceClientId in project ORCID-Source by ORCID.
the class ActivityValidatorTest method checkDupesNormalized.
// validate normalization is being used
@Test(expected = OrcidDuplicatedActivityException.class)
public void checkDupesNormalized() {
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("agr");
id1.setValue("UPPER");
ExternalIDs ids1 = new ExternalIDs();
ids1.getExternalIdentifier().add(id1);
ExternalID id2 = new ExternalID();
id2.setRelationship(Relationship.SELF);
id2.setType("agr");
id2.setValue("upper");
id2.setNormalized(new TransientNonEmptyString("upper"));
ExternalIDs ids2 = new ExternalIDs();
ids2.getExternalIdentifier().add(id2);
SourceEntity source1 = mock(SourceEntity.class);
when(source1.getSourceName()).thenReturn("source name");
when(source1.getSourceId()).thenReturn("APP-00000000000000");
SourceClientId sourceClientId = new SourceClientId();
sourceClientId.setPath("APP-00000000000000");
Source source2 = mock(Source.class);
when(source2.getSourceName()).thenReturn(new SourceName("source name"));
when(source2.getSourceClientId()).thenReturn(sourceClientId);
activityValidator.checkExternalIdentifiersForDuplicates(ids1, ids2, source2, source1);
}
Aggregations