PreferenceStorageImpl implements PreferenceStorage { String buildScopePath(final PreferenceScope scope) { if (scope == null) { throw new InvalidPreferenceScopeException("The scope must not be null when building a scope path."); } String path = "/config/"; for (PreferenceScope currentScope = scope; currentScope != null; currentScope = currentScope.childScope()) { path += currentScope.type() + "/" + currentScope.key() + "/"; } return path; } protected  PreferenceStorageImpl(); @Inject  PreferenceStorageImpl(@Named("ioStrategy") final IOService ioService,
                                 final SessionInfo sessionInfo,
                                 @Customizable final PreferenceScopeTypes scopeTypes,
                                 final PreferenceScopeFactory scopeFactory,
                                 final ObjectStorage objectStorage,
                                 final SpacesAPI spaces,
                                 final Event<PreferenceUpdatedEvent> preferenceUpdatedEvent); @PostConstruct void init(); @Override boolean exists(final PreferenceScope preferenceScope,
                          final String key); @Override boolean exists(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                          final String key); @Override T read(final PreferenceScope preferenceScope,
                      final String key); @Override T read(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                      final String key); @Override PreferenceScopedValue<T> readWithScope(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                                                      final String key); @Override void write(final PreferenceScope preferenceScope,
                      final String key,
                      final Object value); @Override void delete(final PreferenceScope preferenceScope,
                       final String key); @Override Collection<String> allKeys(final PreferenceScope scope); @Override Collection<String> allKeys(final List<PreferenceScope> scopes); static final String FILE_FORMAT; static final int FILE_FORMAT_SIZE; }
@Test public void buildScopePathForAllUsersEntireApplicationScope() { final String path = preferenceStorageServiceBackendImpl.buildScopePath(allUsersEntireApplicationScope); assertEquals("/config/all-users/all-users/entire-application/entire-application/", path); }
@Test public void buildScopePathForUserScope() { final String path = preferenceStorageServiceBackendImpl.buildScopePath(userEntireApplicationScope); assertEquals("/config/user/my-user/entire-application/entire-application/", path); }