use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method getPeerReview.
private PeerReview getPeerReview(String extIdValue) {
PeerReview peerReview = new PeerReview();
peerReview.setRole(Role.CHAIR);
ExternalIDs extIds = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
extId.setType("doi");
extId.setUrl(new Url("http://orcid.org"));
if (extIdValue == null) {
extId.setValue("ext-id-value");
} else {
extId.setValue("ext-id-value-" + extIdValue);
}
extIds.getExternalIdentifier().add(extId);
peerReview.setExternalIdentifiers(extIds);
if (extIdValue == null) {
peerReview.setSubjectContainerName(new Title("Peer review title"));
} else {
peerReview.setSubjectContainerName(new Title("Peer review title " + extIdValue));
}
peerReview.setSubjectExternalIdentifier(extId);
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
disambiguatedOrg.setDisambiguationSource("WDB");
org.setDisambiguatedOrganization(disambiguatedOrg);
peerReview.setOrganization(org);
peerReview.setType(PeerReviewType.EVALUATION);
peerReview.setVisibility(Visibility.PUBLIC);
return peerReview;
}
use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class AddressManagerTest method testAddAddressToUnclaimedRecordPreserveAddressVisibility.
@Test
public void testAddAddressToUnclaimedRecordPreserveAddressVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.CR);
address = addressManager.createAddress(unclaimedOrcid, address, true);
address = addressManager.getAddress(unclaimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Visibility.PUBLIC, address.getVisibility());
}
use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class AddressManagerTest method getAllTest.
@Test
public void getAllTest() {
String orcid = "0000-0000-0000-0003";
Addresses elements = addressManager.getAddresses(orcid);
assertNotNull(elements);
assertNotNull(elements.getAddress());
assertEquals(5, elements.getAddress().size());
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (Address element : elements.getAddress()) {
if (9 == element.getPutCode()) {
found1 = true;
} else if (10 == element.getPutCode()) {
found2 = true;
} else if (11 == element.getPutCode()) {
found3 = true;
} else if (12 == element.getPutCode()) {
found4 = true;
} else if (13 == element.getPutCode()) {
found5 = true;
} else {
fail("Invalid put code found: " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
}
use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class AddressManagerTest method testAddAddressToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddAddressToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.US);
address = addressManager.createAddress(claimedOrcid, address, true);
address = addressManager.getAddress(claimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Visibility.LIMITED, address.getVisibility());
}
use of org.orcid.jaxb.model.v3.dev1.record.Address in project ORCID-Source by ORCID.
the class AddressManagerTest method displayIndexIsSetTo_1_FromUI.
@Test
public void displayIndexIsSetTo_1_FromUI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.MX);
address = addressManager.createAddress(claimedOrcid, address, false);
address = addressManager.getAddress(claimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Long.valueOf(1), address.getDisplayIndex());
}
Aggregations