public void testShouldReturnAllArtifactsForTheBuild() throws Exception { String projectName = "p1"; String timeStamp = "20001212050505"; File artifactsRoot = FilesystemUtils.createDirectory(projectName); File artifactsDir = FilesystemUtils.createDirectory(timeStamp, projectName); FilesystemUtils.createFile("p1.jar", artifactsDir); FilesystemUtils.createFile("p1.war", artifactsDir); FilesystemUtils.createFile("p1.ear", artifactsDir); Map props = new HashMap(); LogFile logFile = new LogFile("log20001212050505.xml"); props.put("artifactfolder", artifactsRoot); final BuildDetail detail = new BuildDetail(logFile, props); assertEquals(getErrMsgTimeZone(timeStamp, detail), 3, detail.getArtifactFiles().size()); }
public void testShouldGetArtifactsInSubDirectories() throws Exception { String projectName = "p2"; String timeStamp = "20001212050505"; File artifactsRoot = FilesystemUtils.createDirectory(projectName); File artifactsDir = FilesystemUtils.createDirectory(timeStamp, projectName); FilesystemUtils.createFile("p2.jar", artifactsDir); FilesystemUtils.createFile("p2.war", artifactsDir); FilesystemUtils.createFile("p2.ear", artifactsDir); File subDir = new File(artifactsDir, "subdir"); FileUtils.forceMkdir(subDir); FilesystemUtils.createFile("p3.ear", subDir); FilesystemUtils.createFile("p4.ear", subDir); Map props = new HashMap(); LogFile logFile = new LogFile("log20001212050505.xml"); props.put("artifactfolder", artifactsRoot); final BuildDetail detail = new BuildDetail(logFile, props); List artifactNames = toFileNameList(detail.getArtifactFiles()); assertEquals(getErrMsgTimeZone(timeStamp, detail), 4, artifactNames.size()); assertTrue(artifactNames.contains("p2.war")); assertTrue(artifactNames.contains("p2.jar")); assertTrue(artifactNames.contains("p2.ear")); assertTrue(artifactNames.contains("subdir")); }