Java Code Examples for org.apache.maven.shared.utils.io.FileUtils#copyDirectoryStructure()
The following examples show how to use
org.apache.maven.shared.utils.io.FileUtils#copyDirectoryStructure() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownstreamParentTest.java From brooklyn-library with Apache License 2.0 | 5 votes |
/** Replicates the behaviour of getBasedir in JUnit's TestResources class */ public File getBasedir(String project) throws IOException { File src = (new File(PROJECTS_DIR, project)).getCanonicalFile(); assertTrue(src.isDirectory(), "Test project directory does not exist: " + src.getPath()); File basedir = (new File(WORK_DIR, getClass().getSimpleName() + "_" + project)).getCanonicalFile(); FileUtils.deleteDirectory(basedir); assertTrue(basedir.mkdirs(), "Test project working directory created"); FileUtils.copyDirectoryStructure(src, basedir); return basedir; }
Example 2
Source File: AbstractMojoTest.java From sarl with Apache License 2.0 | 5 votes |
/** Execute a Mojo. * * @param projectName the name of the project to test for the unit test. * @param goalName the goal to run. * @return the verifier. * @throws Exception any exception. */ protected Verifier executeMojo(String projectName, String goalName) throws Exception { String tempDirPath = System.getProperty("maven.test.tmpdir", //$NON-NLS-1$ System.getProperty("java.io.tmpdir")); //$NON-NLS-1$ File tempDir = new File(tempDirPath); File baseDir = new File(tempDir, projectName); assertNotNull(baseDir); FileUtils.deleteDirectory(baseDir); URL url = getClass().getResource("/projects/" + projectName); //$NON-NLS-1$ if (url == null) { throw new IllegalArgumentException("Resource not found: " + projectName); //$NON-NLS-1$ } File resourceFile = new File(new URI(url.toExternalForm())); assertTrue(resourceFile.isDirectory()); FileUtils.copyDirectoryStructure(resourceFile, baseDir); assertTrue(baseDir.exists()); assertTrue(baseDir.isDirectory()); recursiveDeleteOnShutdownHook(baseDir); Verifier verifier = new Verifier(baseDir.getAbsolutePath()); verifier.setAutoclean(false); verifier.setDebug(false); final String m2home = findDefaultMavenHome(); if (m2home != null && !m2home.isEmpty()) { verifier.setForkJvm(false); verifier.getSystemProperties().put("maven.multiModuleProjectDirectory", m2home); //$NON-NLS-1$ verifier.getVerifierProperties().put("use.mavenRepoLocal", Boolean.FALSE.toString()); //$NON-NLS-1$ } verifier.executeGoals(Arrays.asList("clean", goalName)); //$NON-NLS-1$ return verifier; }
Example 3
Source File: BaseDevTest.java From ci.maven with Apache License 2.0 | 4 votes |
protected static void setUpBeforeClass(String params, String projectRoot, boolean isDevMode) throws IOException, InterruptedException, FileNotFoundException { basicDevProj = new File(projectRoot); tempProj = Files.createTempDirectory("temp").toFile(); assertTrue(tempProj.exists()); assertTrue(basicDevProj.exists()); FileUtils.copyDirectoryStructure(basicDevProj, tempProj); assertTrue(tempProj.listFiles().length > 0); logFile = new File(basicDevProj, "logFile.txt"); assertTrue(logFile.createNewFile()); pom = new File(tempProj, "pom.xml"); assertTrue(pom.exists()); replaceVersion(); startProcess(params, isDevMode); }