List of usage examples for org.apache.commons.io FileUtils touch
public static void touch(File file) throws IOException
From source file:net.sourceforge.vulcan.core.support.WorkingCopyUpdateExpertTest.java
public void testDaily() throws Exception { assertTrue("Cannot create test directory", workDir.mkdirs()); FileUtils.touch(new File(workDir, "foo")); config.setUpdateStrategy(UpdateStrategy.CleanDaily); config.setRepositoryTagName("trunk"); previousStatus.setStatus(PASS);//from w w w. j a v a 2 s .c o m previousStatus.setTagName("trunk"); previousStatus.setCompletionDate(new Date(day1.getTime())); assertEquals(UpdateType.Full, expert.determineUpdateStrategy(config, previousStatus)); }
From source file:net.sourceforge.vulcan.core.support.WorkingCopyUpdateExpertTest.java
public void testDailyAlreadyBuilt() throws Exception { assertTrue("Cannot create test directory", workDir.mkdirs()); FileUtils.touch(new File(workDir, "foo")); config.setUpdateStrategy(UpdateStrategy.CleanDaily); config.setRepositoryTagName("trunk"); previousStatus.setStatus(PASS);/* w w w . j av a 2 s. c om*/ previousStatus.setTagName("trunk"); previousStatus.setCompletionDate(new Date(day2.getTime())); assertEquals(UpdateType.Incremental, expert.determineUpdateStrategy(config, previousStatus)); }
From source file:net.sourceforge.vulcan.dotnet.MSBuildToolInvocation.java
public void testFailsOnManyProjectFilesNoneSpecified() throws Exception { final File otherFile = new File(projectConfig.getWorkDir(), "other.proj"); FileUtils.touch(otherFile); try {/* ww w .java 2 s.com*/ try { tool.buildProject(projectConfig, status, buildLog, detailCallback); fail("expected exception"); } catch (BuildFailedException e) { assertEquals(1, e.getExitCode()); } } finally { otherFile.delete(); } }
From source file:net.sourceforge.vulcan.dotnet.MSBuildToolInvocation.java
public void testSpecifyProjectFile() throws Exception { final File otherFile = new File(projectConfig.getWorkDir(), "other.proj"); FileUtils.touch(otherFile); dotNetProjectConfig.setBuildScript("msbuild.proj"); try {//from ww w . j av a2 s . com tool.buildProject(projectConfig, status, buildLog, detailCallback); } finally { otherFile.delete(); } }
From source file:net.sourceforge.vulcan.dotnet.NAntBuildToolInvocation.java
public void testFailsOnManyProjectFilesNoneSpecified() throws Exception { final File otherFile = new File(projectConfig.getWorkDir(), "other.build"); FileUtils.touch(otherFile); try {//from w w w. j a va 2s .c o m try { tool.buildProject(projectConfig, status, buildLog, detailCallback); fail("expected exception"); } catch (BuildFailedException e) { assertEquals(1, e.getExitCode()); } } finally { otherFile.delete(); } }
From source file:net.sourceforge.vulcan.dotnet.NAntBuildToolInvocation.java
public void testSpecifyProjectFile() throws Exception { final File otherFile = new File(projectConfig.getWorkDir(), "other.build"); FileUtils.touch(otherFile); dotNetProjectConfig.setBuildScript("nant.build"); try {/*w w w . j a va2 s. c om*/ tool.buildProject(projectConfig, status, buildLog, detailCallback); } finally { otherFile.delete(); } }
From source file:net.sourceforge.vulcan.filesystem.FileSystemRepositoryAdaptor.java
public void createPristineWorkingCopy(BuildDetailCallback buildDetailCallback) throws RepositoryException { final File sourceDir = new File(config.getSourceDirectory()); final File targetDir = new File(projectConfig.getWorkDir()); new RepositoryUtils().createOrCleanWorkingCopy(targetDir, buildDetailCallback); try {//from w w w .j a va 2s . com FileUtils.copyDirectory(sourceDir, targetDir); FileUtils.touch(new File(targetDir, WORKING_COPY_MARKER)); } catch (IOException e) { throw new RepositoryException(e); } }
From source file:net.sourceforge.vulcan.filesystem.FileSystemRepositoryAdaptorTest.java
public void testIsWorkingCopyWhenMarkerPresent() throws Exception { assertTrue(dir.mkdir());//from w w w. j a va 2 s .c om FileUtils.touch(new File(dir, FileSystemRepositoryAdaptor.WORKING_COPY_MARKER)); assertEquals(true, ra.isWorkingCopy()); }
From source file:net.sourceforge.vulcan.spring.SpringFileStoreTest.java
public void testExtractPluginOverOldVersion() throws Exception { final File zip = TestUtils.resolveRelativeFile("source/test/pluginTests/mockPlugin.zip"); assertTrue(zip.exists());//from ww w . j a v a 2 s . co m assertTrue(mockPluginDir.mkdirs()); final File versionFile = new File(mockPluginDir, "plugin-version.xml"); final OutputStream os = new FileOutputStream(versionFile); try { IOUtils.copy(new ByteArrayInputStream("<vulcan-version-descriptor pluginRevision=\"1\"/>".getBytes()), os); } finally { os.close(); } final File shouldBeDeleted = new File(mockPluginDir, "shouldBeDeleted"); FileUtils.touch(shouldBeDeleted); InputStream is = new FileInputStream(zip); store.extractPlugin(is); assertTrue(mockPluginDir.isDirectory()); is = new FileInputStream(versionFile); try { assertEquals("<vulcan-version-descriptor pluginRevision=\"354\"/>", IOUtils.toString(is).trim()); } finally { is.close(); } assertTrue(versionFile.exists()); assertFalse("Did not delete old file", shouldBeDeleted.exists()); }
From source file:net.sourceforge.vulcan.spring.SpringFileStoreTest.java
public void testGetOutcomeIds() throws Exception { final File dir1 = new File(projectsDir + File.separator + "fake", "outcomes"); final File dir2 = new File(projectsDir + File.separator + "fakey", "outcomes"); final UUID u1 = UUID.fromString("aff75fcf-7be4-11da-ad42-53827a9f1c52"); final UUID u2 = UUID.fromString("9ff75fcf-7be4-11da-ad42-53827a9f1c52"); final UUID u3 = UUID.fromString("9ff75fcf-7be4-11da-ad42-53827a9f1c52"); dir1.mkdirs();//from w w w. ja va 2 s. c o m dir2.mkdirs(); FileUtils.touch(new File(dir1, u1.toString())); FileUtils.touch(new File(dir1, u2.toString())); FileUtils.touch(new File(dir2, u3.toString())); final Map<String, List<UUID>> ids = store.getBuildOutcomeIDs(); assertEquals(2, ids.size()); assertTrue(ids.containsKey("fakey")); assertTrue(ids.containsKey("fake")); assertTrue(ids.get("fake").contains(u1)); assertTrue(ids.get("fake").contains(u2)); assertTrue(ids.get("fakey").contains(u3)); }