ModuleManagerImpl implements ModuleManager, ReadOnlyModeCapable { @Override public Collection<BundlePersistentInfo> storeAllLocalPersistentStates() { readOnlyModeLock.readLock().lock(); try { assertWritable(); Collection<BundlePersistentInfo> bundleInfos = Arrays.stream(FrameworkService.getBundleContext().getBundles()) .map(BundlePersistentInfo::new) .collect(Collectors.toSet()); BundleInfoJcrHelper.storePersistentStates(bundleInfos); return bundleInfos; } catch (ModuleManagementException e) { throw e; } catch (Exception e) { throw new ModuleManagementException(e); } finally { readOnlyModeLock.readLock().unlock(); } }  @Override OperationResult install(Resource bundleResource, String target); @Override OperationResult install(Resource bundleResource, String target, boolean start); @Override OperationResult install(Collection<Resource> bundleResources, String target, boolean start); void setBundleService(BundleService bundleService); void setPersister(BundlePersister persister); @Override OperationResult start(String bundleKey, String target); @Override OperationResult stop(String bundleKey, String target); @Override OperationResult uninstall(String bundleKey, String target); @Override OperationResult refresh(String bundleKey, String target); @Override OperationResult update(String bundleKey, String target); @Override Map<String, BundleService.BundleInformation> getInfo(String bundleKey, String target); @Override Map<String, Map<String, BundleService.BundleInformation>> getInfos(Collection<String> bundleKeys, String target); @Override Map<String, Map<String, BundleInformation>> getBucketInfos(String bundleBucketKey, String target); @Override Map<String, Map<String, BundleService.BundleInformation>> getAllInfos(String target); @Override BundleState getLocalState(String bundleKey); @Override BundleService.BundleInformation getLocalInfo(String bundleKey); @Override Map<String, BundleInformation> getBucketLocalInfos(String bundleBucketKey); @Override Map<String, BundleInformation> getAllLocalInfos(); void setTemplateManagerService(JahiaTemplateManagerService templateManagerService); @Override void switchReadOnlyMode(boolean enable); @Override int getReadOnlyModePriority(); @Override Collection<BundlePersistentInfo> storeAllLocalPersistentStates(); @Override OperationResult applyBundlesPersistentStates(String target);  }
@Test public void storeAllLocalPersistentStatesShouldFailInReadOnlyMode() { verifyFailureInReadOnlyMode(() -> moduleManager.storeAllLocalPersistentStates()); }