Search in sources :

Example 1 with UserTrackingService

use of org.opencastproject.usertracking.api.UserTrackingService in project opencast by opencast.

the class UserTrackingRestServiceTest method setUp.

@Before
public void setUp() throws UserTrackingException {
    SecurityService security = EasyMock.createMock(SecurityService.class);
    EasyMock.expect(security.getUser()).andReturn(new JaxbUser(MOCK_USER, "test", new DefaultOrganization(), new JaxbRole("ROLE_USER", new DefaultOrganization()))).anyTimes();
    BundleContext bc = EasyMock.createMock(BundleContext.class);
    EasyMock.expect(bc.getProperty(OpencastConstants.SERVER_URL_PROPERTY)).andReturn("http://www.example.org:8080").anyTimes();
    @SuppressWarnings("rawtypes") Dictionary dict = EasyMock.createMock(Dictionary.class);
    EasyMock.expect(dict.get(RestConstants.SERVICE_PATH_PROPERTY)).andReturn("/usertracking").anyTimes();
    ComponentContext context = EasyMock.createMock(ComponentContext.class);
    EasyMock.expect(context.getBundleContext()).andReturn(bc).anyTimes();
    EasyMock.expect(context.getProperties()).andReturn(dict).anyTimes();
    UserActionImpl ua = EasyMock.createMock(UserActionImpl.class);
    EasyMock.expect(ua.getId()).andReturn(4L).anyTimes();
    UserTrackingService usertracking = EasyMock.createMock(UserTrackingService.class);
    EasyMock.expect(usertracking.addUserFootprint(EasyMock.isA(UserAction.class), EasyMock.isA(UserSession.class))).andReturn(ua).anyTimes();
    EasyMock.replay(security, bc, dict, context, ua, usertracking);
    service = new UserTrackingRestService();
    service.setSecurityService(security);
    service.setService(usertracking);
    service.activate(context);
}
Also used : Dictionary(java.util.Dictionary) UserTrackingService(org.opencastproject.usertracking.api.UserTrackingService) JaxbRole(org.opencastproject.security.api.JaxbRole) ComponentContext(org.osgi.service.component.ComponentContext) UserTrackingRestService(org.opencastproject.usertracking.endpoint.UserTrackingRestService) SecurityService(org.opencastproject.security.api.SecurityService) JaxbUser(org.opencastproject.security.api.JaxbUser) DefaultOrganization(org.opencastproject.security.api.DefaultOrganization) BundleContext(org.osgi.framework.BundleContext) Before(org.junit.Before)

Aggregations

Dictionary (java.util.Dictionary)1 Before (org.junit.Before)1 DefaultOrganization (org.opencastproject.security.api.DefaultOrganization)1 JaxbRole (org.opencastproject.security.api.JaxbRole)1 JaxbUser (org.opencastproject.security.api.JaxbUser)1 SecurityService (org.opencastproject.security.api.SecurityService)1 UserTrackingService (org.opencastproject.usertracking.api.UserTrackingService)1 UserTrackingRestService (org.opencastproject.usertracking.endpoint.UserTrackingRestService)1 BundleContext (org.osgi.framework.BundleContext)1 ComponentContext (org.osgi.service.component.ComponentContext)1