Search in sources :

Example 61 with Work

use of org.orcid.jaxb.model.v3.dev1.record.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.v3.dev1.record.WorkTitle) Work(org.orcid.jaxb.model.v3.dev1.record.Work) Title(org.orcid.jaxb.model.v3.dev1.common.Title) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 62 with Work

use of org.orcid.jaxb.model.v3.dev1.record.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.v3.dev1.record.ExternalIDs) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Work(org.orcid.jaxb.model.v3.dev1.record.Work) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 63 with Work

use of org.orcid.jaxb.model.v3.dev1.record.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.v3.dev1.record.Work) Citation(org.orcid.jaxb.model.v3.dev1.record.Citation) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 64 with Work

use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateWork_emptyContributorEmailTest.

@Test(expected = OrcidValidationException.class)
public void validateWork_emptyContributorEmailTest() {
    Work work = getWork();
    work.getWorkContributors().getContributor().get(0).getContributorEmail().setValue("");
    activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Also used : Work(org.orcid.jaxb.model.v3.dev1.record.Work) Test(org.junit.Test)

Example 65 with Work

use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateWork_emptyCitationTest.

@Test(expected = OrcidValidationException.class)
public void validateWork_emptyCitationTest() {
    Work work = getWork();
    work.getWorkCitation().setCitation(null);
    activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
Also used : Work(org.orcid.jaxb.model.v3.dev1.record.Work) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)154 Work (org.orcid.jaxb.model.v3.dev1.record.Work)141 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)46 DBUnitTest (org.orcid.test.DBUnitTest)41 Response (javax.ws.rs.core.Response)39 Title (org.orcid.jaxb.model.v3.dev1.common.Title)29 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)29 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)29 Url (org.orcid.jaxb.model.v3.dev1.common.Url)28 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)24 WorkBulk (org.orcid.jaxb.model.v3.dev1.record.WorkBulk)22 OrcidError (org.orcid.jaxb.model.v3.dev1.error.OrcidError)21 BaseTest (org.orcid.core.BaseTest)20 NoResultException (javax.persistence.NoResultException)17 OrcidAccessControlException (org.orcid.core.exception.OrcidAccessControlException)17 OrcidUnauthorizedException (org.orcid.core.exception.OrcidUnauthorizedException)17 OrcidVisibilityException (org.orcid.core.exception.OrcidVisibilityException)17 VisibilityMismatchException (org.orcid.core.exception.VisibilityMismatchException)17 WrongSourceException (org.orcid.core.exception.WrongSourceException)17 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)15