Search in sources :

Example 1 with UserSetting

use of org.opencastproject.adminui.usersettings.UserSetting in project opencast by opencast.

the class TestUserSettingsEndpoint method createUserSettings.

private UserSettings createUserSettings(int start, int finish, int limit, int offset, int total) {
    UserSettings userSettings = new UserSettings();
    for (int i = 1; i <= 10; i++) {
        UserSetting userSetting = new UserSetting(i, "key-" + i, "value-" + i);
        userSettings.addUserSetting(userSetting);
    }
    userSettings.setTotal(total);
    userSettings.setLimit(limit);
    userSettings.setOffset(offset);
    return userSettings;
}
Also used : UserSettings(org.opencastproject.adminui.usersettings.UserSettings) UserSetting(org.opencastproject.adminui.usersettings.UserSetting)

Example 2 with UserSetting

use of org.opencastproject.adminui.usersettings.UserSetting in project opencast by opencast.

the class TestUserSettingsEndpoint method setupUserSettingsService.

private void setupUserSettingsService() throws UserSettingsServiceException {
    int start = 1;
    int finish = 10;
    int limit = 100;
    int offset = 0;
    int total = 10;
    UserSettings userSettings = createUserSettings(start, finish, limit, offset, total);
    userSettingsService = EasyMock.createNiceMock(UserSettingsService.class);
    EasyMock.expect(userSettingsService.findUserSettings(limit, 0)).andReturn(userSettings);
    final Capture<String> inputKey = new Capture<String>();
    final Capture<String> inputValue = new Capture<String>();
    EasyMock.expect(userSettingsService.addUserSetting(EasyMock.capture(inputKey), EasyMock.capture(inputValue))).andAnswer(new IAnswer<UserSetting>() {

        public UserSetting answer() {
            UserSetting userSetting = new UserSetting(19, inputKey.getValue(), inputValue.getValue());
            return userSetting;
        }
    });
    userSettingsService.deleteUserSetting(18L);
    EasyMock.expectLastCall();
    EasyMock.expect(userSettingsService.updateUserSetting(18, EXAMPLE_KEY, EXAMPLE_VALUE)).andReturn(new UserSetting(18L, EXAMPLE_KEY, EXAMPLE_VALUE));
    EasyMock.replay(userSettingsService);
}
Also used : UserSettings(org.opencastproject.adminui.usersettings.UserSettings) UserSettingsService(org.opencastproject.adminui.usersettings.UserSettingsService) Capture(org.easymock.Capture) UserSetting(org.opencastproject.adminui.usersettings.UserSetting)

Aggregations

UserSetting (org.opencastproject.adminui.usersettings.UserSetting)2 UserSettings (org.opencastproject.adminui.usersettings.UserSettings)2 Capture (org.easymock.Capture)1 UserSettingsService (org.opencastproject.adminui.usersettings.UserSettingsService)1