Search in sources :

Example 36 with Work

use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.

the class WorkManagerTest method testAddWorkToUnclaimedRecordPreserveWorkVisibility.

@Test
public void testAddWorkToUnclaimedRecordPreserveWorkVisibility() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Work work = getWork(null);
    work = workManager.createWork(unclaimedOrcid, work, true);
    work = workManager.getWork(unclaimedOrcid, work.getPutCode(), 0);
    assertNotNull(work);
    assertEquals("Work title", work.getWorkTitle().getTitle().getContent());
    assertEquals(Visibility.PUBLIC, work.getVisibility());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 37 with Work

use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.

the class BibtexManagerTest method testDOIManagerIsInvoked.

@Test
public void testDOIManagerIsInvoked() {
    when(doiManager.fetchDOIBibtex("111")).thenReturn("OK");
    Work w = new Work();
    w.setWorkExternalIdentifiers(new ExternalIDs());
    ExternalID id = new ExternalID();
    id.setType("doi");
    id.setValue("111");
    w.getExternalIdentifiers().getExternalIdentifier().add(id);
    String bib = bibtexManager.generateBibtex(ORCID, w);
    Assert.assertEquals("OK", bib);
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 38 with Work

use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.

the class BibtexManagerTest method testGenerateBibtexForSingleWorkEsaped.

@Test
public void testGenerateBibtexForSingleWorkEsaped() {
    Work w = new Work();
    WorkTitle title = new WorkTitle();
    title.setTitle(new Title("Escapes θ à À È © ë Ö ì"));
    w.setWorkTitle(title);
    w.setWorkType(WorkType.JOURNAL_ARTICLE);
    w.setPutCode(100l);
    String bib = bibtexManager.generateBibtex(ORCID, w);
    Assert.assertEquals("@article{Credit_Name100,\ntitle={Escapes \\texttheta {\\`a} \\`{A} \\`{E} \\textcopyright {\\\"e} {\\\"O} {\\`i}},\nauthor={Credit Name}\n}", bib);
}
Also used : WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Work(org.orcid.jaxb.model.record_v2.Work) Title(org.orcid.jaxb.model.common_v2.Title) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 39 with Work

use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.

the class BibtexManagerTest method testGenerateBibtexForSingleWorkFromCitationField.

@Test
public void testGenerateBibtexForSingleWorkFromCitationField() {
    Work w = new Work();
    Citation c = new Citation();
    c.setWorkCitationType(CitationType.BIBTEX);
    c.setCitation("HELLO");
    w.setWorkCitation(c);
    String bib = bibtexManager.generateBibtex(ORCID, w);
    Assert.assertEquals("HELLO", bib);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Citation(org.orcid.jaxb.model.record_v2.Citation) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 40 with Work

use of org.orcid.jaxb.model.record_rc4.Work in project ORCID-Source by ORCID.

the class WorkManagerTest method testFindWorkBulk.

@Test
public void testFindWorkBulk() {
    String putCodes = "11,12,13";
    WorkBulk workBulk = workManager.findWorkBulk("0000-0000-0000-0003", putCodes, System.currentTimeMillis());
    assertNotNull(workBulk);
    assertNotNull(workBulk.getBulk());
    assertEquals(3, workBulk.getBulk().size());
    assertTrue(workBulk.getBulk().get(0) instanceof Work);
    assertTrue(workBulk.getBulk().get(1) instanceof Work);
    assertTrue(workBulk.getBulk().get(2) instanceof Work);
}
Also used : WorkBulk(org.orcid.jaxb.model.record_v2.WorkBulk) Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

Work (org.orcid.jaxb.model.record_v2.Work)150 Test (org.junit.Test)148 ClientResponse (com.sun.jersey.api.client.ClientResponse)52 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)33 DBUnitTest (org.orcid.test.DBUnitTest)24 Response (javax.ws.rs.core.Response)23 Title (org.orcid.jaxb.model.common_v2.Title)22 WorkBulk (org.orcid.jaxb.model.record_v2.WorkBulk)22 Url (org.orcid.jaxb.model.common_v2.Url)21 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)21 OrcidError (org.orcid.jaxb.model.error_v2.OrcidError)19 ArrayList (java.util.ArrayList)16 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)16 BaseTest (org.orcid.core.BaseTest)14 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)13 Work (org.orcid.jaxb.model.record_rc1.Work)12 Work (org.orcid.jaxb.model.record_rc3.Work)11 ExternalID (org.orcid.jaxb.model.record_rc4.ExternalID)11 Work (org.orcid.jaxb.model.record_rc4.Work)11 Funding (org.orcid.jaxb.model.record_v2.Funding)11