ModuleManagerImpl implements ModuleManager, ReadOnlyModeCapable { @Override public OperationResult uninstall(String bundleKey, String target) { readOnlyModeLock.readLock().lock(); try { return performOperation(bundleKey, target, new BundleOperation() { @Override public String getName() { return BundleOperation.UNINSTALL; } @Override public boolean changesModuleState() { return true; } @Override public void perform(BundleInfo info, String target) { bundleService.uninstall(info, target); } }); } 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 moduleUninstallShouldFailInReadOnlyMode() { verifyFailureInReadOnlyMode(() -> moduleManager.uninstall("bundleKey", null)); }