@Test public void test() { File fromDir = new File(transformedAppFolder, "blah"); File toDir = new File(transformedAppFolder, "/src/main/resources/blah"); assertTrue(fromDir.exists()); assertTrue(fromDir.isDirectory()); assertFalse(toDir.exists()); int fromDirChildrenCount = fromDir.listFiles().length; MoveDirectory moveDirectory = new MoveDirectory().relative("blah").setToRelative("src/main/resources/blah"); TOExecutionResult executionResult = moveDirectory.execution(transformedAppFolder, transformationContext); assertEquals(executionResult.getType(), TOExecutionResult.Type.SUCCESS); assertEquals(moveDirectory.getDescription(), "Move a directory from blah to src/main/resources/blah"); assertEquals(executionResult.getDetails(), "Directory '/blah' has been moved to '/src/main/resources/blah'"); assertFalse(fromDir.exists()); assertTrue(toDir.exists()); assertTrue(toDir.isDirectory()); assertEquals(fromDirChildrenCount, toDir.listFiles().length); }
@Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.moveDirectory(filesFrom, fileTo); String details = String.format("Directory '%s' has been moved to '%s'", getRelativePath(transformedAppFolder, filesFrom), getRelativePath(transformedAppFolder, fileTo)); result = TOExecutionResult.success(this, details); } catch (IOException e) { result = TOExecutionResult.error(this, new TransformationOperationException("Directory could not be moved", e)); } return result; }
MoveDirectory extends AbstractToOperation<MoveDirectory> { @Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.moveDirectory(filesFrom, fileTo); String details = String.format("Directory '%s' has been moved to '%s'", getRelativePath(transformedAppFolder, filesFrom), getRelativePath(transformedAppFolder, fileTo)); result = TOExecutionResult.success(this, details); } catch (IOException e) { result = TOExecutionResult.error(this, new TransformationOperationException("Directory could not be moved", e)); } return result; } }
MoveDirectory extends AbstractToOperation<MoveDirectory> { @Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.moveDirectory(filesFrom, fileTo); String details = String.format("Directory '%s' has been moved to '%s'", getRelativePath(transformedAppFolder, filesFrom), getRelativePath(transformedAppFolder, fileTo)); result = TOExecutionResult.success(this, details); } catch (IOException e) { result = TOExecutionResult.error(this, new TransformationOperationException("Directory could not be moved", e)); } return result; } MoveDirectory(); }
MoveDirectory extends AbstractToOperation<MoveDirectory> { @Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.moveDirectory(filesFrom, fileTo); String details = String.format("Directory '%s' has been moved to '%s'", getRelativePath(transformedAppFolder, filesFrom), getRelativePath(transformedAppFolder, fileTo)); result = TOExecutionResult.success(this, details); } catch (IOException e) { result = TOExecutionResult.error(this, new TransformationOperationException("Directory could not be moved", e)); } return result; } MoveDirectory();  }
MoveDirectory extends AbstractToOperation<MoveDirectory> { @Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.moveDirectory(filesFrom, fileTo); String details = String.format("Directory '%s' has been moved to '%s'", getRelativePath(transformedAppFolder, filesFrom), getRelativePath(transformedAppFolder, fileTo)); result = TOExecutionResult.success(this, details); } catch (IOException e) { result = TOExecutionResult.error(this, new TransformationOperationException("Directory could not be moved", e)); } return result; } MoveDirectory();   }