Search in sources :

Example 96 with Address

use of okhttp3.Address in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method viewAddress.

@Override
public Response viewAddress(String orcid, Long putCode) {
    Address address = addressManagerReadOnly.getAddress(orcid, putCode);
    orcidSecurityManager.checkAndFilter(orcid, address, ScopePathType.ORCID_BIO_READ_LIMITED);
    ElementUtils.setPathToAddress(address, orcid);
    sourceUtils.setSourceName(address);
    return Response.ok(address).build();
}
Also used : Address(org.orcid.jaxb.model.record_v2.Address)

Example 97 with Address

use of okhttp3.Address in project ORCID-Source by ORCID.

the class AddressManagerTest method displayIndexIsSetTo_0_FromAPI.

@Test
public void displayIndexIsSetTo_0_FromAPI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Address address = getAddress(Iso3166Country.PE);
    address = addressManager.createAddress(claimedOrcid, address, true);
    address = addressManager.getAddress(claimedOrcid, address.getPutCode());
    assertNotNull(address);
    assertEquals(Long.valueOf(0), address.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Address(org.orcid.jaxb.model.record_v2.Address) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 98 with Address

use of okhttp3.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.record_v2.Address) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 99 with Address

use of okhttp3.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.record_v2.Address) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 100 with Address

use of okhttp3.Address in project ORCID-Source by ORCID.

the class ValidateV2RC2SamplesTest method testUnmarshallAddress.

@Test
public void testUnmarshallAddress() throws SAXException, URISyntaxException {
    Addresses addresses = (Addresses) unmarshallFromPath("/record_2.0_rc2/samples/addresses-2.0_rc2.xml", Addresses.class, "/record_2.0_rc2/address-2.0_rc2.xsd");
    assertNotNull(addresses);
    assertNotNull(addresses.getAddress());
    assertEquals(2, addresses.getAddress().size());
    for (Address address : addresses.getAddress()) {
        assertNotNull(address.getPutCode());
        assertNotNull(address.getCreatedDate());
        assertNotNull(address.getLastModifiedDate());
        assertNotNull(address.getCountry());
        if (address.getPutCode().equals(new Long(1))) {
            assertEquals(Iso3166Country.US, address.getCountry().getValue());
            assertEquals(Visibility.PUBLIC, address.getVisibility());
        } else {
            assertEquals(Iso3166Country.CR, address.getCountry().getValue());
            assertEquals(Visibility.LIMITED, address.getVisibility());
        }
    }
    Address address = (Address) unmarshallFromPath("/record_2.0_rc2/samples/address-2.0_rc2.xml", Address.class);
    assertNotNull(address);
    assertNotNull(address.getPutCode());
    assertNotNull(address.getCreatedDate());
    assertNotNull(address.getLastModifiedDate());
    assertNotNull(address.getCountry());
    assertEquals(Iso3166Country.US, address.getCountry().getValue());
    assertEquals(Visibility.PUBLIC, address.getVisibility());
}
Also used : Addresses(org.orcid.jaxb.model.record_rc2.Addresses) Address(org.orcid.jaxb.model.record_rc2.Address) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)92 Address (org.orcid.jaxb.model.record_v2.Address)84 Keyword (org.orcid.jaxb.model.record_v2.Keyword)44 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)44 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)44 OtherName (org.orcid.jaxb.model.record_v2.OtherName)43 Addresses (org.orcid.jaxb.model.record_v2.Addresses)42 Email (org.orcid.jaxb.model.record_v2.Email)41 Biography (org.orcid.jaxb.model.record_v2.Biography)34 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)34 Emails (org.orcid.jaxb.model.record_v2.Emails)32 Keywords (org.orcid.jaxb.model.record_v2.Keywords)32 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)32 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)32 Name (org.orcid.jaxb.model.record_v2.Name)30 Person (org.orcid.jaxb.model.record_v2.Person)30 DBUnitTest (org.orcid.test.DBUnitTest)20 Response (javax.ws.rs.core.Response)18 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)18 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)18