@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()); CopyDirectory copyDirectory = new CopyDirectory().relative("blah").setToRelative("src/main/resources/blah"); TOExecutionResult executionResult = copyDirectory.execution(transformedAppFolder, transformationContext); assertEquals(executionResult.getType(), TOExecutionResult.Type.SUCCESS); assertEquals(copyDirectory.getDescription(), "Copy directory content from blah to src/main/resources/blah"); assertEquals(executionResult.getDetails(), "Files from '/blah' have been copied to '/src/main/resources/blah'"); assertTrue(fromDir.exists()); assertTrue(fromDir.isDirectory()); assertTrue(toDir.exists()); assertTrue(toDir.isDirectory()); assertEquals(fromDir.listFiles().length, 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.copyDirectory(filesFrom, fileTo); String details = String.format("Files from '%s' have been copied 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 copied", e)); } return result; }
CopyDirectory extends AbstractToOperation<CopyDirectory> { @Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.copyDirectory(filesFrom, fileTo); String details = String.format("Files from '%s' have been copied 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 copied", e)); } return result; } }
CopyDirectory extends AbstractToOperation<CopyDirectory> { @Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.copyDirectory(filesFrom, fileTo); String details = String.format("Files from '%s' have been copied 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 copied", e)); } return result; } CopyDirectory(); }
CopyDirectory extends AbstractToOperation<CopyDirectory> { @Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.copyDirectory(filesFrom, fileTo); String details = String.format("Files from '%s' have been copied 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 copied", e)); } return result; } CopyDirectory();  }
CopyDirectory extends AbstractToOperation<CopyDirectory> { @Override protected TOExecutionResult execution(File transformedAppFolder, TransformationContext transformationContext) { File filesFrom = getAbsoluteFile(transformedAppFolder, transformationContext); File fileTo = getFileTo(transformedAppFolder, transformationContext); TOExecutionResult result = null; try { FileUtils.copyDirectory(filesFrom, fileTo); String details = String.format("Files from '%s' have been copied 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 copied", e)); } return result; } CopyDirectory();   }