use of org.orcid.jaxb.model.record_rc1.Work in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testWork_CanRead_When_HaveReadScope_IsPublic_NotSource.
@Test
public void testWork_CanRead_When_HaveReadScope_IsPublic_NotSource() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_WORKS_READ_LIMITED);
Work work = createWork(Visibility.PUBLIC, CLIENT_2);
orcidSecurityManager.checkAndFilter(ORCID_1, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
}
use of org.orcid.jaxb.model.record_rc1.Work in project ORCID-Source by ORCID.
the class WorkManagerTest method displayIndexIsSetTo_1_FromUI.
@Test
public void displayIndexIsSetTo_1_FromUI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Work w1 = getWork("fromUI-1");
w1 = workManager.createWork(claimedOrcid, w1, false);
WorkEntity w = workDao.find(w1.getPutCode());
assertNotNull(w1);
assertEquals(Long.valueOf(1), w.getDisplayIndex());
}
use of org.orcid.jaxb.model.record_rc1.Work in project ORCID-Source by ORCID.
the class WorkManagerTest method displayIndexIsSetTo_0_FromAPI.
@Test
public void displayIndexIsSetTo_0_FromAPI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Work w1 = getWork("fromAPI-1");
w1 = workManager.createWork(claimedOrcid, w1, true);
WorkEntity w = workDao.find(w1.getPutCode());
assertNotNull(w1);
assertEquals(Long.valueOf(0), w.getDisplayIndex());
}
use of org.orcid.jaxb.model.record_rc1.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);
}
use of org.orcid.jaxb.model.record_rc1.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);
}
Aggregations