use of org.opencastproject.security.api.SecurityService in project opencast by opencast.
the class TestSearchIndex method createSecurityService.
public static final SecurityService createSecurityService(DefaultOrganization organization) {
JaxbUser creator = new JaxbUser("creator", "password", "Creator", null, "test", organization, new HashSet<JaxbRole>());
SecurityService securityService = createNiceMock(SecurityService.class);
expect(securityService.getOrganization()).andReturn(organization).anyTimes();
expect(securityService.getUser()).andReturn(creator).anyTimes();
replay(securityService);
return securityService;
}
use of org.opencastproject.security.api.SecurityService in project opencast by opencast.
the class SchedulerMessageReceiverImplTest method setUp.
@Before
public void setUp() throws Exception {
SecurityService securityService = TestSearchIndex.createSecurityService(new DefaultOrganization());
scheduler = new SchedulerMessageReceiverImpl();
scheduler.setSecurityService(securityService);
scheduler.setSearchIndex(index);
}
use of org.opencastproject.security.api.SecurityService in project opencast by opencast.
the class EventCommentDatabaseImplTest method setUp.
@Before
public void setUp() throws Exception {
UserDirectoryService userDirectoryService = EasyMock.createNiceMock(UserDirectoryService.class);
EasyMock.expect(userDirectoryService.loadUser(EasyMock.anyObject(String.class))).andReturn(USER).anyTimes();
EasyMock.replay(userDirectoryService);
SecurityService securityService = EasyMock.createNiceMock(SecurityService.class);
EasyMock.expect(securityService.getOrganization()).andReturn(new DefaultOrganization()).anyTimes();
EasyMock.replay(securityService);
MessageSender messageSender = EasyMock.createNiceMock(MessageSender.class);
EasyMock.replay(messageSender);
persistence = new EventCommentDatabaseServiceImpl();
persistence.setEntityManagerFactory(newTestEntityManagerFactory(PERSISTENCE_UNIT));
persistence.setUserDirectoryService(userDirectoryService);
persistence.setMessageSender(messageSender);
persistence.setSecurityService(securityService);
persistence.activate(null);
}
use of org.opencastproject.security.api.SecurityService in project opencast by opencast.
the class TestEventsEndpoint method setupSecurityService.
private void setupSecurityService() {
// Prepare mocked security service
SecurityService securityService = createNiceMock(SecurityService.class);
expect(securityService.getOrganization()).andStubReturn(defaultOrg);
// Replay mocked objects
replay(securityService);
setSecurityService(securityService);
}
use of org.opencastproject.security.api.SecurityService in project opencast by opencast.
the class OaiPmhPersistenceTest method setUp.
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
// Mock up a security service
SecurityService securityService = EasyMock.createNiceMock(SecurityService.class);
User user = SecurityUtil.createSystemUser("admin", new DefaultOrganization());
EasyMock.expect(securityService.getOrganization()).andReturn(new DefaultOrganization()).anyTimes();
EasyMock.expect(securityService.getUser()).andReturn(user).anyTimes();
EasyMock.replay(securityService);
mp1 = MediaPackageSupport.loadFromClassPath("/mp1.xml");
mp2 = MediaPackageSupport.loadFromClassPath("/mp2.xml");
Workspace workspace = EasyMock.createNiceMock(Workspace.class);
EasyMock.expect(workspace.read(uri("series-dublincore.xml"))).andAnswer(() -> getClass().getResourceAsStream("/series-dublincore.xml")).anyTimes();
EasyMock.expect(workspace.read(uri("episode-dublincore.xml"))).andAnswer(() -> getClass().getResourceAsStream("/episode-dublincore.xml")).anyTimes();
EasyMock.expect(workspace.read(uri("mpeg7.xml"))).andAnswer(() -> getClass().getResourceAsStream("/mpeg7.xml")).anyTimes();
EasyMock.expect(workspace.read(uri("series-xacml.xml"))).andAnswer(() -> getClass().getResourceAsStream("/series-xacml.xml")).anyTimes();
EasyMock.replay(workspace);
oaiPmhDatabase = new OaiPmhDatabaseImpl();
oaiPmhDatabase.setEntityManagerFactory(newTestEntityManagerFactory(OaiPmhDatabaseImpl.PERSISTENCE_UNIT_NAME));
oaiPmhDatabase.setSecurityService(securityService);
oaiPmhDatabase.setWorkspace(workspace);
oaiPmhDatabase.activate(null);
}
Aggregations