Search in sources :

Example 31 with Address

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;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) Organization(org.orcid.jaxb.model.v3.dev1.common.Organization) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) OrganizationAddress(org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress) Title(org.orcid.jaxb.model.v3.dev1.common.Title) PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 32 with Address

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());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Address(org.orcid.jaxb.model.v3.dev1.record.Address) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 33 with Address

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);
}
Also used : Addresses(org.orcid.jaxb.model.v3.dev1.record.Addresses) Address(org.orcid.jaxb.model.v3.dev1.record.Address) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 34 with Address

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());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Address(org.orcid.jaxb.model.v3.dev1.record.Address) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 35 with Address

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());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Address(org.orcid.jaxb.model.v3.dev1.record.Address) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

Address (org.orcid.jaxb.model.v3.dev1.record.Address)77 Test (org.junit.Test)59 Addresses (org.orcid.jaxb.model.v3.dev1.record.Addresses)44 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)39 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)39 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)38 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)38 Email (org.orcid.jaxb.model.v3.dev1.record.Email)37 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)33 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)33 Keywords (org.orcid.jaxb.model.v3.dev1.record.Keywords)32 PersonExternalIdentifiers (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers)32 ResearcherUrls (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls)32 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)30 Person (org.orcid.jaxb.model.v3.dev1.record.Person)28 Name (org.orcid.jaxb.model.v3.dev1.record.Name)27 DBUnitTest (org.orcid.test.DBUnitTest)21 Response (javax.ws.rs.core.Response)19 FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)16 Record (org.orcid.jaxb.model.v3.dev1.record.Record)15