use of org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString in project ORCID-Source by ORCID.
the class ActivitiesGroupGenerator_GroupingWorksTest method testNormalizedGrouping.
@Test
public void testNormalizedGrouping() {
ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
List<WorkSummary> sums = new ArrayList<WorkSummary>();
for (int i = 0; i < 2; i++) {
String title = "work-" + i;
WorkSummary work = new WorkSummary();
// Set title
WorkTitle workTitle = new WorkTitle();
workTitle.setTitle(new Title(title));
work.setTitle(workTitle);
ExternalIDs wei = new ExternalIDs();
ExternalID e1 = new ExternalID();
e1.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.DOI.value());
e1.setValue("a");
e1.setNormalized(new TransientNonEmptyString("a"));
wei.getExternalIdentifier().add(e1);
work.setExternalIdentifiers(wei);
sums.add(work);
}
sums.get(0).getExternalIdentifiers().getExternalIdentifier().get(0).setValue("A");
generator.group(sums.get(0));
generator.group(sums.get(1));
assertEquals(1, generator.getGroups().size());
checkActivitiesBelongsToTheSameGroup(generator.getGroups(), sums.get(0), sums.get(1));
for (int i = 2; i < 4; i++) {
String title = "work-" + i;
WorkSummary work = new WorkSummary();
// Set title
WorkTitle workTitle = new WorkTitle();
workTitle.setTitle(new Title(title));
work.setTitle(workTitle);
ExternalIDs wei = new ExternalIDs();
ExternalID e1 = new ExternalID();
e1.setType(org.orcid.jaxb.model.message.WorkExternalIdentifierType.AGR.value());
e1.setValue("https://dx.doi.org/10/UPPER");
e1.setNormalized(new TransientNonEmptyString("10/upper"));
wei.getExternalIdentifier().add(e1);
work.setExternalIdentifiers(wei);
sums.add(work);
}
sums.get(0).getExternalIdentifiers().getExternalIdentifier().get(0).setValue("http://doi.org/10/upper");
generator.group(sums.get(2));
generator.group(sums.get(3));
assertEquals(2, generator.getGroups().size());
checkActivitiesBelongsToTheSameGroup(generator.getGroups(), sums.get(0), sums.get(1));
checkActivitiesBelongsToTheSameGroup(generator.getGroups(), sums.get(2), sums.get(3));
}
use of org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString in project ORCID-Source by ORCID.
the class NormalizationServiceTest method checkISBNAndCaseNormalized.
@Test
public void checkISBNAndCaseNormalized() {
ExternalID normed = new ExternalID();
normed.setRelationship(Relationship.SELF);
normed.setType("isbn");
normed.setValue("ISBN: 123-456-7-89x junk");
// everything should normalize to this.
normed.setNormalized(new TransientNonEmptyString("123456789X"));
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("isbn");
id1.setValue("ISBN: 123-456-7-89x junk");
id1.setNormalized(new TransientNonEmptyString(norm.normalise(id1.getType(), id1.getValue())));
assertEquals(normed, id1);
}
use of org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString in project ORCID-Source by ORCID.
the class NormalizationServiceTest method checkCaseNormalized.
@Test
public void checkCaseNormalized() {
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("agr");
id1.setValue("UPPER");
id1.setNormalized(new TransientNonEmptyString(norm.normalise(id1.getType(), id1.getValue())));
ExternalID id2 = new ExternalID();
id2.setRelationship(Relationship.SELF);
id2.setType("agr");
id2.setValue("upper");
id2.setNormalized(new TransientNonEmptyString("upper"));
assertEquals(id1, id2);
}
use of org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString in project ORCID-Source by ORCID.
the class NormalizationServiceTest method checkBibcodeAndCaseNormalized.
@Test
public void checkBibcodeAndCaseNormalized() {
ExternalID normed = new ExternalID();
normed.setRelationship(Relationship.SELF);
normed.setType("bibcode");
normed.setValue(" 123456789.A23456789 ");
// everything should normalize to this.
normed.setNormalized(new TransientNonEmptyString("123456789.A23456789"));
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("bibcode");
id1.setValue(" 123456789.A23456789 ");
id1.setNormalized(new TransientNonEmptyString(norm.normalise(id1.getType(), id1.getValue())));
assertEquals(normed, id1);
}
use of org.orcid.jaxb.model.v3.dev1.common.TransientNonEmptyString in project ORCID-Source by ORCID.
the class NormalizationServiceTest method checkDOIAndCaseNormalized.
@Test
public void checkDOIAndCaseNormalized() {
ExternalID normed = new ExternalID();
normed.setRelationship(Relationship.SELF);
normed.setType("doi");
normed.setValue("10.1/upper");
// everything should normalize to this.
normed.setNormalized(new TransientNonEmptyString("10.1/upper"));
ExternalID id1 = new ExternalID();
id1.setRelationship(Relationship.SELF);
id1.setType("doi");
id1.setValue("https://dx.doi.org/10.1/UPPER");
id1.setNormalized(new TransientNonEmptyString(norm.normalise(id1.getType(), id1.getValue())));
assertEquals(id1, normed);
id1.setValue("http://doi.org/10.1/UPPER");
id1.setNormalized(new TransientNonEmptyString(norm.normalise(id1.getType(), id1.getValue())));
assertEquals(id1, normed);
id1.setValue("10.1/UPPER");
id1.setNormalized(new TransientNonEmptyString(norm.normalise(id1.getType(), id1.getValue())));
assertEquals(id1, normed);
}
Aggregations