use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateWorkBlankTitleTest.
@Test(expected = ActivityTitleValidationException.class)
public void validateWorkBlankTitleTest() {
Work work = getWork();
work.getWorkTitle().getTitle().setContent(" ");
activityValidator.validateWork(work, null, true, true, Visibility.PUBLIC);
}
use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class OrcidSecurityManager_WorkBulkTest method testPrivateWorkBulkReadLimitedTokenMixedSources.
@Test
public void testPrivateWorkBulkReadLimitedTokenMixedSources() {
WorkBulk workBulk = new WorkBulk();
workBulk.setBulk(Arrays.asList(createWork(Visibility.PRIVATE, CLIENT_1), createWork(Visibility.PRIVATE, CLIENT_2)));
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_2, ScopePathType.READ_LIMITED);
orcidSecurityManager.checkAndFilter(ORCID_1, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
assertNotNull(workBulk);
assertEquals(2, workBulk.getBulk().size());
assertTrue(workBulk.getBulk().get(0) instanceof OrcidError);
assertTrue(workBulk.getBulk().get(1) instanceof Work);
}
use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class OrcidSecurityManager_WorkBulkTest method testMixedPublicAndLimitedWorkBulkReadLimitedToken.
@Test
public void testMixedPublicAndLimitedWorkBulkReadLimitedToken() {
WorkBulk workBulk = new WorkBulk();
workBulk.setBulk(Arrays.asList(createWork(Visibility.PUBLIC, CLIENT_2), createWork(Visibility.LIMITED, CLIENT_2)));
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_LIMITED);
orcidSecurityManager.checkAndFilter(ORCID_1, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
assertNotNull(workBulk);
assertEquals(2, workBulk.getBulk().size());
assertTrue(workBulk.getBulk().get(0) instanceof Work);
assertTrue(workBulk.getBulk().get(1) instanceof Work);
}
use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class OrcidSecurityManager_WorkBulkTest method testMixedPublicAndLimitedWorkBulkReadPublicToken.
@Test
public void testMixedPublicAndLimitedWorkBulkReadPublicToken() {
WorkBulk workBulk = new WorkBulk();
workBulk.setBulk(Arrays.asList(createWork(Visibility.PUBLIC, CLIENT_2), createWork(Visibility.LIMITED, CLIENT_2)));
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
orcidSecurityManager.checkAndFilter(ORCID_1, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
assertNotNull(workBulk);
assertEquals(2, workBulk.getBulk().size());
assertTrue(workBulk.getBulk().get(0) instanceof Work);
assertTrue(workBulk.getBulk().get(1) instanceof OrcidError);
}
use of org.orcid.jaxb.model.v3.dev1.record.Work in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testWork_ThrowException_When_TokenIsForOtherUser_IsSource.
@Test(expected = OrcidUnauthorizedException.class)
public void testWork_ThrowException_When_TokenIsForOtherUser_IsSource() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Work work = createWork(Visibility.PUBLIC, CLIENT_1);
orcidSecurityManager.checkAndFilter(ORCID_2, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
fail();
}
Aggregations