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);
}
Aggregations