Search in sources :

Example 26 with Keyword

use of org.orcid.jaxb.model.record_rc3.Keyword in project ORCID-Source by ORCID.

the class KeywordsTest method testInvalidPutCodeReturns404_rc3.

@Test
public void testInvalidPutCodeReturns404_rc3() throws InterruptedException, JSONException {
    String accessToken = getAccessToken();
    assertNotNull(accessToken);
    org.orcid.jaxb.model.record_rc3.Keyword keyword = new org.orcid.jaxb.model.record_rc3.Keyword();
    keyword.setContent("keyword-3");
    keyword.setVisibility(org.orcid.jaxb.model.common_rc3.Visibility.PUBLIC);
    keyword.setPutCode(1234567890L);
    ClientResponse response = memberV2ApiClient_rc3.updateKeyword(getUser1OrcidId(), keyword, accessToken);
    assertNotNull(response);
    assertEquals(ClientResponse.Status.NOT_FOUND.getStatusCode(), response.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) Keyword(org.orcid.jaxb.model.record_rc3.Keyword) Keyword(org.orcid.jaxb.model.record_rc3.Keyword) Test(org.junit.Test)

Example 27 with Keyword

use of org.orcid.jaxb.model.record_rc3.Keyword in project ORCID-Source by ORCID.

the class KeywordsTest method testGetKeywordWithPublicAPI.

/**
     * --------- -- -- -- All -- -- -- ---------
     * 
     */
/**
     * PRECONDITIONS: The user should have two public keywords keyword1 and
     * keyword2
     * 
     * @throws JSONException
     * @throws InterruptedException
     */
@Test
public void testGetKeywordWithPublicAPI() throws InterruptedException, JSONException {
    changeCurrentKeywordsVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    // RC2
    ClientResponse response = publicV2ApiClient_rc2.viewKeywordsXML(getUser1OrcidId());
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    org.orcid.jaxb.model.record_rc2.Keywords keywordsRc2 = response.getEntity(org.orcid.jaxb.model.record_rc2.Keywords.class);
    assertNotNull(keywordsRc2);
    assertNotNull(keywordsRc2.getKeywords());
    // There should be at least two, one public and one limited
    boolean found1 = false;
    boolean found2 = false;
    for (org.orcid.jaxb.model.record_rc2.Keyword keyword : keywordsRc2.getKeywords()) {
        assertEquals(org.orcid.jaxb.model.common_rc2.Visibility.PUBLIC, keyword.getVisibility());
        if (keyword.getContent().equals(keyword1)) {
            found1 = true;
        } else if (keyword.getContent().equals(keyword2)) {
            found2 = true;
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    // RC3
    response = publicV2ApiClient_rc3.viewKeywordsXML(getUser1OrcidId());
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    org.orcid.jaxb.model.record_rc3.Keywords keywordsRc3 = response.getEntity(org.orcid.jaxb.model.record_rc3.Keywords.class);
    assertNotNull(keywordsRc3);
    assertNotNull(keywordsRc3.getKeywords());
    // There should be at least two, one public and one limited
    found1 = false;
    found2 = false;
    for (org.orcid.jaxb.model.record_rc3.Keyword keyword : keywordsRc3.getKeywords()) {
        assertEquals(org.orcid.jaxb.model.common_rc3.Visibility.PUBLIC, keyword.getVisibility());
        if (keyword.getContent().equals(keyword1)) {
            found1 = true;
        } else if (keyword.getContent().equals(keyword2)) {
            found2 = true;
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    // RC4
    response = publicV2ApiClient_rc4.viewKeywordsXML(getUser1OrcidId());
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    org.orcid.jaxb.model.record_rc4.Keywords keywordsRc4 = response.getEntity(org.orcid.jaxb.model.record_rc4.Keywords.class);
    assertNotNull(keywordsRc4);
    assertNotNull(keywordsRc4.getKeywords());
    // There should be at least two, one public and one limited
    found1 = false;
    found2 = false;
    for (org.orcid.jaxb.model.record_rc4.Keyword keyword : keywordsRc4.getKeywords()) {
        assertEquals(org.orcid.jaxb.model.common_rc4.Visibility.PUBLIC, keyword.getVisibility());
        if (keyword.getContent().equals(keyword1)) {
            found1 = true;
        } else if (keyword.getContent().equals(keyword2)) {
            found2 = true;
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    // Release
    response = publicV2ApiClient_release.viewKeywordsXML(getUser1OrcidId());
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    org.orcid.jaxb.model.record_v2.Keywords keywordsV2 = response.getEntity(org.orcid.jaxb.model.record_v2.Keywords.class);
    assertNotNull(keywordsV2);
    assertNotNull(keywordsV2.getKeywords());
    // There should be at least two, one public and one limited
    found1 = false;
    found2 = false;
    for (org.orcid.jaxb.model.record_v2.Keyword keyword : keywordsV2.getKeywords()) {
        assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC, keyword.getVisibility());
        if (keyword.getContent().equals(keyword1)) {
            found1 = true;
        } else if (keyword.getContent().equals(keyword2)) {
            found2 = true;
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    // V2.1
    response = publicV2_1ApiClient_release.viewKeywordsXML(getUser1OrcidId());
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    org.orcid.jaxb.model.record_v2.Keywords keywordsV2_1 = response.getEntity(org.orcid.jaxb.model.record_v2.Keywords.class);
    assertNotNull(keywordsV2_1);
    assertNotNull(keywordsV2_1.getKeywords());
    // There should be at least two, one public and one limited
    found1 = false;
    found2 = false;
    for (org.orcid.jaxb.model.record_v2.Keyword keyword : keywordsV2_1.getKeywords()) {
        assertEquals(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC, keyword.getVisibility());
        if (keyword.getContent().equals(keyword1)) {
            found1 = true;
        } else if (keyword.getContent().equals(keyword2)) {
            found2 = true;
        }
    }
    assertTrue(found1);
    assertTrue(found2);
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) Keywords(org.orcid.jaxb.model.record_rc3.Keywords) Keyword(org.orcid.jaxb.model.record_rc3.Keyword) Test(org.junit.Test)

Example 28 with Keyword

use of org.orcid.jaxb.model.record_rc3.Keyword in project ORCID-Source by ORCID.

the class ValidateV2SamplesTest method testUnmarshallPerson.

@Test
public void testUnmarshallPerson() throws SAXException, URISyntaxException {
    Person person = (Person) unmarshallFromPath("/record_2.0/samples/read_samples/person-2.0.xml", Person.class, "/record_2.0/person-2.0.xsd");
    assertNotNull(person);
    assertNotNull(person.getName());
    assertEquals("give-names", person.getName().getGivenNames().getContent());
    assertEquals("family-name", person.getName().getFamilyName().getContent());
    assertEquals("credit-name", person.getName().getCreditName().getContent());
    assertEquals(Visibility.PUBLIC, person.getName().getVisibility());
    assertNotNull(person.getOtherNames());
    assertNotNull(person.getOtherNames().getOtherNames());
    assertEquals(1, person.getOtherNames().getOtherNames().size());
    OtherName otherName = person.getOtherNames().getOtherNames().get(0);
    assertEquals("other-name-1", otherName.getContent());
    assertNotNull(otherName.getCreatedDate());
    assertNotNull(otherName.getCreatedDate().getValue());
    assertEquals(2001, otherName.getCreatedDate().getValue().getYear());
    assertEquals(12, otherName.getCreatedDate().getValue().getMonth());
    assertEquals(31, otherName.getCreatedDate().getValue().getDay());
    assertNotNull(otherName.getLastModifiedDate().getValue());
    assertEquals(2001, otherName.getLastModifiedDate().getValue().getYear());
    assertEquals(12, otherName.getLastModifiedDate().getValue().getMonth());
    assertEquals(31, otherName.getLastModifiedDate().getValue().getDay());
    assertNotNull(otherName.getSource());
    assertEquals("8888-8888-8888-8880", otherName.getSource().retrieveSourcePath());
    assertNotNull(person.getBiography());
    assertEquals(Visibility.PUBLIC, person.getBiography().getVisibility());
    assertEquals("biography", person.getBiography().getContent());
    assertNotNull(person.getResearcherUrls());
    assertNotNull(person.getResearcherUrls().getResearcherUrls());
    assertEquals(1, person.getResearcherUrls().getResearcherUrls().size());
    ResearcherUrl rUrl = person.getResearcherUrls().getResearcherUrls().get(0);
    assertEquals(Visibility.PUBLIC, rUrl.getVisibility());
    assertEquals(Long.valueOf(1248), rUrl.getPutCode());
    assertEquals("url-name-1", rUrl.getUrlName());
    assertNotNull(rUrl.getUrl());
    assertEquals("http://url.com/", rUrl.getUrl().getValue());
    assertNotNull(rUrl.getCreatedDate());
    assertEquals(2001, rUrl.getCreatedDate().getValue().getYear());
    assertEquals(12, rUrl.getCreatedDate().getValue().getMonth());
    assertEquals(31, rUrl.getCreatedDate().getValue().getDay());
    assertNotNull(rUrl.getLastModifiedDate());
    assertEquals(2001, rUrl.getLastModifiedDate().getValue().getYear());
    assertEquals(12, rUrl.getLastModifiedDate().getValue().getMonth());
    assertEquals(31, rUrl.getLastModifiedDate().getValue().getDay());
    assertNotNull(rUrl.getSource());
    assertEquals("8888-8888-8888-8880", rUrl.getSource().retrieveSourcePath());
    assertNotNull(person.getEmails());
    assertNotNull(person.getEmails().getEmails());
    assertEquals(1, person.getEmails().getEmails().size());
    Email email = person.getEmails().getEmails().get(0);
    assertEquals(Visibility.PUBLIC, email.getVisibility());
    assertEquals("user1@email.com", email.getEmail());
    assertNotNull(email.getCreatedDate());
    assertNotNull(email.getCreatedDate().getValue());
    assertEquals(2001, email.getCreatedDate().getValue().getYear());
    assertEquals(12, email.getCreatedDate().getValue().getMonth());
    assertEquals(31, email.getCreatedDate().getValue().getDay());
    assertNotNull(email.getLastModifiedDate());
    assertNotNull(email.getLastModifiedDate().getValue());
    assertEquals(2001, email.getLastModifiedDate().getValue().getYear());
    assertEquals(12, email.getLastModifiedDate().getValue().getMonth());
    assertEquals(31, email.getLastModifiedDate().getValue().getDay());
    assertNotNull(email.getSource());
    assertEquals("8888-8888-8888-8880", email.retrieveSourcePath());
    assertNotNull(person.getAddresses());
    assertNotNull(person.getAddresses().getAddress());
    assertEquals(1, person.getAddresses().getAddress().size());
    Address address = person.getAddresses().getAddress().get(0);
    assertEquals(Visibility.PUBLIC, address.getVisibility());
    assertEquals(Long.valueOf(1), address.getPutCode());
    assertNotNull(address.getCountry());
    assertEquals(Iso3166Country.US, address.getCountry().getValue());
    assertNotNull(address.getCreatedDate());
    assertNotNull(address.getCreatedDate().getValue());
    assertEquals(2001, address.getCreatedDate().getValue().getYear());
    assertEquals(12, address.getCreatedDate().getValue().getMonth());
    assertEquals(31, address.getCreatedDate().getValue().getDay());
    assertNotNull(address.getLastModifiedDate());
    assertNotNull(address.getLastModifiedDate().getValue());
    assertEquals(2001, address.getLastModifiedDate().getValue().getYear());
    assertEquals(12, address.getLastModifiedDate().getValue().getMonth());
    assertEquals(31, address.getLastModifiedDate().getValue().getDay());
    assertNotNull(address.getSource());
    assertEquals("8888-8888-8888-8880", address.getSource().retrieveSourcePath());
    assertNotNull(person.getKeywords());
    assertNotNull(person.getKeywords().getKeywords());
    assertEquals(1, person.getKeywords().getKeywords().size());
    Keyword keyword = person.getKeywords().getKeywords().get(0);
    assertEquals(Visibility.PUBLIC, keyword.getVisibility());
    assertEquals(Long.valueOf(1), keyword.getPutCode());
    assertEquals("keyword1", keyword.getContent());
    assertNotNull(keyword.getCreatedDate());
    assertNotNull(keyword.getCreatedDate().getValue());
    assertEquals(2001, keyword.getCreatedDate().getValue().getYear());
    assertEquals(12, keyword.getCreatedDate().getValue().getMonth());
    assertEquals(31, keyword.getCreatedDate().getValue().getDay());
    assertNotNull(keyword.getLastModifiedDate());
    assertNotNull(keyword.getLastModifiedDate().getValue());
    assertEquals(2001, keyword.getLastModifiedDate().getValue().getYear());
    assertEquals(12, keyword.getLastModifiedDate().getValue().getMonth());
    assertEquals(31, keyword.getLastModifiedDate().getValue().getDay());
    assertNotNull(keyword.getSource());
    assertEquals("8888-8888-8888-8880", keyword.getSource().retrieveSourcePath());
    assertNotNull(person.getExternalIdentifiers());
    assertNotNull(person.getExternalIdentifiers().getExternalIdentifiers());
    assertEquals(1, person.getExternalIdentifiers().getExternalIdentifiers().size());
    PersonExternalIdentifier extId = person.getExternalIdentifiers().getExternalIdentifiers().get(0);
    assertEquals(Visibility.PUBLIC, extId.getVisibility());
    assertEquals(Long.valueOf(1), extId.getPutCode());
    assertEquals("type-1", extId.getType());
    assertEquals("value-1", extId.getValue());
    assertNotNull(extId.getUrl());
    assertEquals("http://url.com/1", extId.getUrl().getValue());
    assertNotNull(extId.getCreatedDate());
    assertNotNull(extId.getCreatedDate().getValue());
    assertEquals(2001, extId.getCreatedDate().getValue().getYear());
    assertEquals(12, extId.getCreatedDate().getValue().getMonth());
    assertEquals(31, extId.getCreatedDate().getValue().getDay());
    assertNotNull(extId.getLastModifiedDate());
    assertNotNull(extId.getLastModifiedDate().getValue());
    assertEquals(2001, extId.getLastModifiedDate().getValue().getYear());
    assertEquals(12, extId.getLastModifiedDate().getValue().getMonth());
    assertEquals(31, extId.getLastModifiedDate().getValue().getDay());
    assertNotNull(extId.getSource());
    assertEquals("8888-8888-8888-8880", extId.getSource().retrieveSourcePath());
}
Also used : Email(org.orcid.jaxb.model.record_v2.Email) Address(org.orcid.jaxb.model.record_v2.Address) Keyword(org.orcid.jaxb.model.record_v2.Keyword) OtherName(org.orcid.jaxb.model.record_v2.OtherName) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Person(org.orcid.jaxb.model.record_v2.Person) Test(org.junit.Test)

Example 29 with Keyword

use of org.orcid.jaxb.model.record_rc3.Keyword in project ORCID-Source by ORCID.

the class ValidateV2SamplesTest method unmarshallFromPath.

private Object unmarshallFromPath(String path, Class<?> type, String schemaPath) throws SAXException, URISyntaxException {
    try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
        Object obj = unmarshall(reader, type, schemaPath);
        Object result = null;
        if (ResearcherUrls.class.equals(type)) {
            result = (ResearcherUrls) obj;
        } else if (ResearcherUrl.class.equals(type)) {
            result = (ResearcherUrl) obj;
        } else if (PersonalDetails.class.equals(type)) {
            result = (PersonalDetails) obj;
        } else if (PersonExternalIdentifier.class.equals(type)) {
            result = (PersonExternalIdentifier) obj;
        } else if (PersonExternalIdentifiers.class.equals(type)) {
            result = (PersonExternalIdentifiers) obj;
        } else if (Biography.class.equals(type)) {
            result = (Biography) obj;
        } else if (Name.class.equals(type)) {
            result = (Name) obj;
        } else if (CreditName.class.equals(type)) {
            result = (CreditName) obj;
        } else if (OtherName.class.equals(type)) {
            result = (OtherName) obj;
        } else if (OtherNames.class.equals(type)) {
            result = (OtherNames) obj;
        } else if (Keywords.class.equals(type)) {
            result = (Keywords) obj;
        } else if (Keyword.class.equals(type)) {
            result = (Keyword) obj;
        } else if (Addresses.class.equals(type)) {
            result = (Addresses) obj;
        } else if (Address.class.equals(type)) {
            result = (Address) obj;
        } else if (Emails.class.equals(type)) {
            result = (Emails) obj;
        } else if (Email.class.equals(type)) {
            result = (Email) obj;
        } else if (Person.class.equals(type)) {
            result = (Person) obj;
        } else if (Deprecated.class.equals(type)) {
            result = (Deprecated) obj;
        } else if (Preferences.class.equals(type)) {
            result = (Preferences) obj;
        } else if (History.class.equals(type)) {
            result = (History) obj;
        } else if (Record.class.equals(type)) {
            result = (Record) obj;
        } else if (ActivitiesSummary.class.equals(type)) {
            result = (ActivitiesSummary) obj;
        } else if (Works.class.equals(type)) {
            result = (Works) obj;
        }
        return result;
    } catch (IOException e) {
        throw new RuntimeException("Error reading notification from classpath", e);
    }
}
Also used : Email(org.orcid.jaxb.model.record_v2.Email) InputStreamReader(java.io.InputStreamReader) Keyword(org.orcid.jaxb.model.record_v2.Keyword) Address(org.orcid.jaxb.model.record_v2.Address) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) CreditName(org.orcid.jaxb.model.record_v2.CreditName) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) IOException(java.io.IOException) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) History(org.orcid.jaxb.model.record_v2.History) ActivitiesSummary(org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary) Deprecated(org.orcid.jaxb.model.record_v2.Deprecated) Biography(org.orcid.jaxb.model.record_v2.Biography) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl)

Example 30 with Keyword

use of org.orcid.jaxb.model.record_rc3.Keyword in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_ReadPersonTest method testViewPerson.

@Test
public void testViewPerson() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.PERSON_READ_LIMITED);
    Response response = serviceDelegator.viewPerson(ORCID);
    assertNotNull(response);
    assertEquals(Person.class.getName(), response.getEntity().getClass().getName());
    Person p = (Person) response.getEntity();
    assertNotNull(p);
    assertEquals("/0000-0000-0000-0003/person", p.getPath());
    Utils.verifyLastModified(p.getLastModifiedDate());
    // Address
    assertNotNull(p.getAddresses());
    Addresses a = p.getAddresses();
    assertNotNull(a);
    Utils.verifyLastModified(a.getLastModifiedDate());
    assertEquals(4, a.getAddress().size());
    boolean found1 = false, found2 = false, found3 = false, found4 = false;
    for (Address element : a.getAddress()) {
        Utils.verifyLastModified(element.getLastModifiedDate());
        if (element.getPutCode() == 9) {
            found1 = true;
        } else if (element.getPutCode() == 10) {
            found2 = true;
        } else if (element.getPutCode() == 11) {
            found3 = true;
        } else if (element.getPutCode() == 12) {
            found4 = true;
        } else {
            fail("Invalid put code " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    // Biography
    assertNotNull(p.getBiography());
    Biography b = p.getBiography();
    assertNotNull(b);
    Utils.verifyLastModified(b.getLastModifiedDate());
    assertEquals("Biography for 0000-0000-0000-0003", b.getContent());
    // Email
    assertNotNull(p.getEmails());
    Emails email = p.getEmails();
    assertNotNull(email);
    Utils.verifyLastModified(email.getLastModifiedDate());
    assertEquals(4, email.getEmails().size());
    found1 = false;
    found2 = false;
    found3 = false;
    found4 = false;
    for (Email element : email.getEmails()) {
        if (element.getEmail().equals("public_0000-0000-0000-0003@test.orcid.org")) {
            found1 = true;
        } else if (element.getEmail().equals("limited_0000-0000-0000-0003@test.orcid.org")) {
            found2 = true;
        } else if (element.getEmail().equals("private_0000-0000-0000-0003@test.orcid.org")) {
            found3 = true;
        } else if (element.getEmail().equals("self_limited_0000-0000-0000-0003@test.orcid.org")) {
            found4 = true;
        } else {
            fail("Invalid email " + element.getEmail());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    // External identifiers
    assertNotNull(p.getExternalIdentifiers());
    PersonExternalIdentifiers extIds = p.getExternalIdentifiers();
    assertNotNull(extIds);
    Utils.verifyLastModified(extIds.getLastModifiedDate());
    assertEquals(4, extIds.getExternalIdentifiers().size());
    found1 = false;
    found2 = false;
    found3 = false;
    found4 = false;
    for (PersonExternalIdentifier element : extIds.getExternalIdentifiers()) {
        Utils.verifyLastModified(element.getLastModifiedDate());
        if (element.getPutCode() == 13) {
            found1 = true;
        } else if (element.getPutCode() == 14) {
            found2 = true;
        } else if (element.getPutCode() == 15) {
            found3 = true;
        } else if (element.getPutCode() == 16) {
            found4 = true;
        } else {
            fail("Invalid put code " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    // Keywords
    assertNotNull(p.getKeywords());
    Keywords k = p.getKeywords();
    assertNotNull(k);
    Utils.verifyLastModified(k.getLastModifiedDate());
    assertEquals(4, k.getKeywords().size());
    found1 = false;
    found2 = false;
    found3 = false;
    found4 = false;
    for (Keyword element : k.getKeywords()) {
        Utils.verifyLastModified(element.getLastModifiedDate());
        if (element.getPutCode() == 9) {
            found1 = true;
        } else if (element.getPutCode() == 10) {
            found2 = true;
        } else if (element.getPutCode() == 11) {
            found3 = true;
        } else if (element.getPutCode() == 12) {
            found4 = true;
        } else {
            fail("Invalid put code " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    // Name
    assertNotNull(p.getName());
    assertEquals("Credit Name", p.getName().getCreditName().getContent());
    assertEquals("Given Names", p.getName().getGivenNames().getContent());
    assertEquals("Family Name", p.getName().getFamilyName().getContent());
    // Other names
    assertNotNull(p.getOtherNames());
    OtherNames o = p.getOtherNames();
    assertNotNull(o);
    Utils.verifyLastModified(o.getLastModifiedDate());
    assertEquals(4, o.getOtherNames().size());
    found1 = false;
    found2 = false;
    found3 = false;
    found4 = false;
    for (OtherName element : o.getOtherNames()) {
        Utils.verifyLastModified(element.getLastModifiedDate());
        if (element.getPutCode() == 13) {
            found1 = true;
        } else if (element.getPutCode() == 14) {
            found2 = true;
        } else if (element.getPutCode() == 15) {
            found3 = true;
        } else if (element.getPutCode() == 16) {
            found4 = true;
        } else {
            fail("Invalid put code " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    // Researcher urls
    assertNotNull(p.getResearcherUrls());
    ResearcherUrls ru = p.getResearcherUrls();
    assertNotNull(ru);
    Utils.verifyLastModified(ru.getLastModifiedDate());
    assertEquals(4, ru.getResearcherUrls().size());
    found1 = false;
    found2 = false;
    found3 = false;
    found4 = false;
    for (ResearcherUrl element : ru.getResearcherUrls()) {
        Utils.verifyLastModified(element.getLastModifiedDate());
        if (element.getPutCode() == 13) {
            found1 = true;
        } else if (element.getPutCode() == 14) {
            found2 = true;
        } else if (element.getPutCode() == 15) {
            found3 = true;
        } else if (element.getPutCode() == 16) {
            found4 = true;
        } else {
            fail("Invalid put code " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    assertNotNull(p.getPath());
}
Also used : Email(org.orcid.jaxb.model.record_v2.Email) Keywords(org.orcid.jaxb.model.record_v2.Keywords) Address(org.orcid.jaxb.model.record_v2.Address) Keyword(org.orcid.jaxb.model.record_v2.Keyword) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Response(javax.ws.rs.core.Response) Addresses(org.orcid.jaxb.model.record_v2.Addresses) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) Biography(org.orcid.jaxb.model.record_v2.Biography) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) Emails(org.orcid.jaxb.model.record_v2.Emails) Person(org.orcid.jaxb.model.record_v2.Person) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)88 Keyword (org.orcid.jaxb.model.record_v2.Keyword)82 Address (org.orcid.jaxb.model.record_v2.Address)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)42 Email (org.orcid.jaxb.model.record_v2.Email)41 Keywords (org.orcid.jaxb.model.record_v2.Keywords)41 Biography (org.orcid.jaxb.model.record_v2.Biography)33 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)33 Addresses (org.orcid.jaxb.model.record_v2.Addresses)31 Emails (org.orcid.jaxb.model.record_v2.Emails)31 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)31 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)31 Person (org.orcid.jaxb.model.record_v2.Person)30 Name (org.orcid.jaxb.model.record_v2.Name)29 ClientResponse (com.sun.jersey.api.client.ClientResponse)22 DBUnitTest (org.orcid.test.DBUnitTest)20 Keyword (org.orcid.jaxb.model.record_rc3.Keyword)19 Response (javax.ws.rs.core.Response)18