RestoreSnapshotTaskRunner extends AbstractSnapshotTaskRunner { protected String setRestoreSpaceUserPermissions(final String spaceId) { try { Retrier retrier = new Retrier(); return retrier.execute(new Retriable() { @Override public String retry() throws Exception { Map<String, AclType> spaceACLs = new HashMap<>(); spaceACLs.put(StorageProvider.PROPERTIES_SPACE_ACL + dcSnapshotUser, AclType.READ); spaceACLs.put(StorageProvider.PROPERTIES_SPACE_ACL + dcSnapshotUser, AclType.WRITE); snapshotProvider.setSpaceACLs(spaceId, spaceACLs); return spaceId; } }); } catch (Exception e) { throw new TaskException("Unable to initialize snapshot restore, " + "failed setting space permissions due to: " + e.getMessage(), e); } } RestoreSnapshotTaskRunner(StorageProvider snapshotProvider,
                                     SnapshotStorageProvider unwrappedSnapshotProvider,
                                     String dcHost,
                                     String dcPort,
                                     String dcStoreId,
                                     String dcSnapshotUser,
                                     String bridgeAppHost,
                                     String bridgeAppPort,
                                     String bridgeAppUser,
                                     String bridgeAppPass); @Override String getName(); @Override String performTask(String taskParameters);  }
@Test public void testSetRestoreSpaceUserPermissions() { String spaceId = "space-id"; Capture<Map<String, AclType>> spaceACLsCapture = new Capture<>(); snapshotProvider.setSpaceACLs(EasyMock.eq(spaceId), EasyMock.capture(spaceACLsCapture)); replayMocks(); taskRunner.setRestoreSpaceUserPermissions(spaceId); Map<String, AclType> capSpaceACLs = spaceACLsCapture.getValue(); String user = StorageProvider.PROPERTIES_SPACE_ACL + dcSnapshotUser; assertEquals(capSpaceACLs.get(user), AclType.WRITE); }