UserSettingsService { public UserSettings findUserSettings(int limit, int offset) throws UserSettingsServiceException { UserSettings userSettings = getUserSettings(limit, offset); if (userSettings == null) { userSettings = new UserSettings(); } userSettings.setTotal(getUserSettingsTotal()); userSettings.setLimit(limit); userSettings.setOffset(offset); return userSettings; }  @Activate void activate(ComponentContext cc); @Reference(target = "(osgi.unit.name=org.opencastproject.adminui)") void setEntityManagerFactory(EntityManagerFactory emf); @Reference void setUserDirectoryService(UserDirectoryService userDirectoryService); @Reference void setSecurityService(SecurityService securityService); void setOrganizationDirectoryService(OrganizationDirectoryService organizationDirectoryService); UserSettings findUserSettings(int limit, int offset); UserSetting addUserSetting(String key, String value); UserSetting updateUserSetting(String key, String value, String oldValue); UserSetting updateUserSetting(long id, String key, String value); void deleteUserSetting(long id); static final String PERSISTENCE_UNIT; }
@Test public void findUserSettingsInputNoSettingsNoSignaturesExpectsEmptyUserSettings() throws UserSettingsServiceException { int offset = 0; int limit = 10; EntityManagerFactory emf = setupEntityManagerFactory(0, 0, limit, limit, offset, limit); UserSettingsService userSettingsService = setupUserSettingsService(emf); userSettingsService.findUserSettings(limit, offset); }
@Test public void findUserSettingsInputOneSettingsOneSignaturesExpectsProperUserSettings() throws UserSettingsServiceException { int offset = 0; int limit = 1; EntityManagerFactory emf = setupEntityManagerFactory(limit, limit, limit, limit, offset, limit); UserSettingsService userSettingsService = setupUserSettingsService(emf); userSettingsService.findUserSettings(limit, offset); }
@Test public void findUserSettingsInputManySettingsManySignaturesExpectsProperUserSettings() throws UserSettingsServiceException { int offset = 0; int limit = 10; EntityManagerFactory emf = setupEntityManagerFactory(limit, limit, limit, limit, offset, limit); UserSettingsService userSettingsService = setupUserSettingsService(emf); userSettingsService.findUserSettings(limit, offset); }