public NodeExistsDelegateTask(String name, String pathToCheck, Task ifTrue, Task ifFalse) { this(name, String.format("Execute task [%s] if node '%s' exists or [%s] if not.", ifTrue == null ? DO_NOTHING : ifTrue.getDescription(), pathToCheck, ifFalse == null ? DO_NOTHING : ifFalse.getDescription()), RepositoryConstants.CONFIG, pathToCheck, ifTrue, ifFalse); }
public IsModuleInstalledOrRegistered(String taskName, String moduleName, Task ifTrue, Task ifFalse) { this(taskName, String.format("Execute task [%s] if module '%s' is installed or task [%s] if not.", ifTrue == null ? DO_NOTHING : ifTrue.getDescription(), moduleName, ifFalse == null ? DO_NOTHING : ifFalse.getDescription()), moduleName, ifTrue, ifFalse); }
public IsAuthorInstanceDelegateTask(String taskName, Task isAuthor, Task isPublic) { this(taskName, String.format("Execute task [%s] if this is author instance or [%s] if this is public instance", isAuthor == null ? DO_NOTHING : isAuthor.getDescription(), isPublic == null ? DO_NOTHING : isPublic.getDescription()), isAuthor, isPublic); }
public ValueOfPropertyDelegateTask(String taskName, String parentPath, String propertyName, String expectedValue, boolean propertyMustExist, Task ifTrue, Task ifFalse) { this(taskName, String.format("Execute task [%s] if property '%s' has value '%s' or [%s] if not.", ifTrue == null ? DO_NOTHING : ifTrue.getDescription(), parentPath + "/" + propertyName, expectedValue, ifFalse == null ? DO_NOTHING : ifFalse.getDescription()), RepositoryConstants.CONFIG, parentPath, propertyName, expectedValue, propertyMustExist, ifTrue, ifFalse); }
public PropertyExistsDelegateTask(String taskName, String parentPath, String propertyName, Task ifTrue, Task ifFalse) { this(taskName, String.format("Execute task [%s] if property '%s' exists or [%s] if not.", ifTrue == null ? DO_NOTHING : ifTrue.getDescription(), parentPath + "/" + propertyName, ifFalse == null ? DO_NOTHING : ifFalse.getDescription()), RepositoryConstants.CONFIG, parentPath, propertyName, ifTrue, ifFalse); }
public PropertyValueDelegateTask(String taskName, String parentPath, String propertyName, String expectedValue, boolean propertyMustExist, Task ifTrue, Task ifFalse) { this(taskName, String.format("Execute task [%s] if property '%s' has value '%s' or [%s] if not.", ifTrue == null ? DO_NOTHING : ifTrue.getDescription(), parentPath + "/" + propertyName, expectedValue, ifFalse == null ? DO_NOTHING : ifFalse.getDescription()), RepositoryConstants.CONFIG, parentPath, propertyName, expectedValue, propertyMustExist, ifTrue, ifFalse); }
public IsAdminInstanceDelegateTask(String taskName, Task isAuthor, Task isPublic) { this(taskName, String.format("Execute task [%s] if this is author instance or [%s] if this is public instance", isAuthor == null ? DO_NOTHING : isAuthor.getDescription(), isPublic == null ? DO_NOTHING : isPublic.getDescription()), isAuthor, isPublic); }
@Test public void autoGeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new AddURIPermissionTask("name", "roleName", "/someUri", 0); // THEN assertEquals("Adds permission '/someUri=0' for workspace 'uri'.", task.getDescription()); } }
@Test public void autoGeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new ChangeAllPropertiesWithCertainValueTask("currentValue", "newValue"); // THEN assertEquals("Change value 'currentValue' of all properties in 'config' workspace to 'newValue'.", task.getDescription()); }
@Test public void autoGeneratedDescription() throws Exception { // GIVEN Task task = new AddPermissionTask("taskName", "roleName", RepositoryConstants.CONFIG, "/path", Permission.ADD, true); // WHEN // THEN assertEquals("Adds permission '/path*=1' for workspace 'config'.", task.getDescription()); } }
@Test public void autoGeneratedDescription() throws Exception { // GIVEN Task task = new CheckAndModifyPropertyValueTask("/nodePath", "propertyName", "expectedCurrentValue", "newValue"); // WHEN // THEN assertEquals("Changes property '/nodePath/propertyName' to 'newValue' if it has value 'expectedCurrentValue'.", task.getDescription()); }
@Test public void testAutogeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new RemoveNodeTask("name", "/pathToRemove1"); // THEN assertEquals("Remove node 'config:/pathToRemove1'.", task.getDescription()); } }
@Test public void autogeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new RenamePropertiesTask("name", RepositoryConstants.WEBSITE, "/path", "oldName", "newName"); // THEN assertEquals("Rename all properties under path 'website:/path' from 'oldName' to 'newName'.", task.getDescription()); } }
@Test public void testAutogeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new RemovePermissionTask("taskName", "roleName", RepositoryConstants.USER_GROUPS, "/pathToRemove", Permission.READ); // THEN assertEquals("Remove permission 'usergroups:/pathToRemove*=8' from role 'roleName'.", task.getDescription()); } }
@Test public void autoGeneratedDescription() throws Exception { // GIVEN Task task = new ChangeVirtualUriMappingTask("currentValue", "newValue"); // WHEN // THEN assertEquals("Changes virtual URI mappings (fromURI, toURI properties) from '[forward:, redirect:, permanent:]currentValue' to '[forward:, redirect:, permanent:]newValue'", task.getDescription()); }
@Test public void testAutogeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new RemoveDuplicatePermissionTask("roleB", "acl_Expression"); // THEN assertEquals("Remove duplicate permissions for role 'roleB' in 'Expression' workspace.", task.getDescription()); } }
@Test public void autoGeneratedDescription() throws Exception { // GIVEN Task task = new CheckAndModifyPartOfPropertyValueTask("/nodePath", "propertyName", "expectedCurrentValue", "newValue"); // WHEN // THEN assertEquals("Changes value of property '/nodePath/propertyName' to 'newValue' if its value contains 'expectedCurrentValue'.", task.getDescription()); }
@Test public void testExecute() throws RepositoryException, TaskExecutionException { // GIVEN session.getRootNode().addNode("someParent"); Task task = new CreateNodeTask("name", "/someParent", "someNode", NodeTypes.ContentNode.NAME); // WHEN task.execute(installContext); // THEN assertTrue("Node was created", session.nodeExists("/someParent/someNode")); assertEquals("Create node 'config:/someParent/someNode'.", task.getDescription()); } }
@Test public void testAutogeneratedDescription() throws Exception { // GIVEN Task task; // WHEN task = new NodeExistsDelegateTask("name", "/pathToCheck", new AddURIPermissionsToAllRoles(true)); // THEN assertEquals( "Execute task [Introduction of URI-based security. All existing roles will have GET/POST permissions on /*.] if node '/pathToCheck' exists or [do nothing] if not.", task.getDescription()); } }
@Test public void execute() throws Exception { // GIVEN Task task = new CreateNodePathTask("name", "/someParent/someNode", NodeTypes.ContentNode.NAME); // WHEN task.execute(installContext); // THEN assertTrue("Node was created", session.nodeExists("/someParent/someNode")); assertEquals("Create node path 'config:/someParent/someNode'.", task.getDescription()); } }