Search in sources :

Example 66 with Keyword

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

the class ProfileKeywordManagerTest method displayIndexIsSetTo_0_FromAPI.

@Test
public void displayIndexIsSetTo_0_FromAPI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Keyword keyword = getKeyword();
    keyword.setContent(keyword.getContent() + " fromAPI1");
    keyword = profileKeywordManager.createKeyword(claimedOrcid, keyword, true);
    keyword = profileKeywordManager.getKeyword(claimedOrcid, keyword.getPutCode());
    assertNotNull(keyword);
    assertEquals(Long.valueOf(0), keyword.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Keyword(org.orcid.jaxb.model.record_v2.Keyword) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 67 with Keyword

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

the class ProfileKeywordManagerTest method testAddKeywordToUnclaimedRecordPreserveKeywordVisibility.

@Test
public void testAddKeywordToUnclaimedRecordPreserveKeywordVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Keyword keyword = getKeyword();
    keyword = profileKeywordManager.createKeyword(unclaimedOrcid, keyword, true);
    keyword = profileKeywordManager.getKeyword(unclaimedOrcid, keyword.getPutCode());
    assertNotNull(keyword);
    assertEquals(Visibility.PUBLIC, keyword.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Keyword(org.orcid.jaxb.model.record_v2.Keyword) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 68 with Keyword

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

the class ProfileKeywordManagerTest method displayIndexIsSetTo_1_FromUI.

@Test
public void displayIndexIsSetTo_1_FromUI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Keyword keyword = getKeyword();
    keyword.setContent(keyword.getContent() + " fromUI1");
    keyword = profileKeywordManager.createKeyword(claimedOrcid, keyword, false);
    keyword = profileKeywordManager.getKeyword(claimedOrcid, keyword.getPutCode());
    assertNotNull(keyword);
    assertEquals(Long.valueOf(1), keyword.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Keyword(org.orcid.jaxb.model.record_v2.Keyword) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 69 with Keyword

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

the class ProfileKeywordManagerTest method getKeyword.

private Keyword getKeyword() {
    Keyword keyword = new Keyword();
    keyword.setContent("keyword-1");
    keyword.setVisibility(Visibility.PUBLIC);
    return keyword;
}
Also used : Keyword(org.orcid.jaxb.model.record_v2.Keyword)

Example 70 with Keyword

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

the class MemberV2ApiServiceDelegatorImpl method viewKeywords.

@Override
public Response viewKeywords(String orcid) {
    Keywords keywords = profileKeywordManagerReadOnly.getKeywords(orcid, getLastModifiedTime(orcid));
    // Lets copy the list so we don't modify the cached collection
    if (keywords.getKeywords() != null) {
        List<Keyword> filteredList = new ArrayList<Keyword>(keywords.getKeywords());
        keywords = new Keywords();
        keywords.setKeywords(filteredList);
    }
    orcidSecurityManager.checkAndFilter(orcid, keywords.getKeywords(), ScopePathType.ORCID_BIO_READ_LIMITED);
    ElementUtils.setPathToKeywords(keywords, orcid);
    Api2_0_LastModifiedDatesHelper.calculateLastModified(keywords);
    sourceUtils.setSourceName(keywords);
    return Response.ok(keywords).build();
}
Also used : Keywords(org.orcid.jaxb.model.record_v2.Keywords) Keyword(org.orcid.jaxb.model.record_v2.Keyword) ArrayList(java.util.ArrayList)

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