ArtificerArchive implements Serializable { public Collection<ArtificerArchiveEntry> getEntries() throws ArtificerArchiveException { Collection<File> files = FileUtils.listFiles(workDir, new String[] { "atom" }, true); Collection<ArtificerArchiveEntry> entries = new ArrayList<ArtificerArchiveEntry>(files.size()); for (File metaDataFile : files) { String metaDataAbsPath = metaDataFile.getAbsolutePath(); File contentFile = new File(metaDataAbsPath.substring(0, metaDataAbsPath.length() - 5)); String path = contentFile.getAbsolutePath(); path = path.substring(this.workDir.getAbsolutePath().length() + 1); path = path.replace('\\', '/'); entries.add(new ArtificerArchiveEntry(path, metaDataFile, contentFile)); } return entries; } ArtificerArchive();  ArtificerArchive(File file);  ArtificerArchive(InputStream input); void close(); static void closeQuietly(ArtificerArchive archive); Collection<ArtificerArchiveEntry> getEntries(); InputStream getInputStream(ArtificerArchiveEntry entry); void addEntry(String path, BaseArtifactType metaData, InputStream content); void updateEntry(ArtificerArchiveEntry entry, InputStream content); File pack(); ArtificerArchiveEntry getEntry(String archivePath); boolean containsEntry(String archivePath); boolean removeEntry(String archivePath);  }
@Test public void testGetEntries() throws Exception { InputStream resourceAsStream = null; File tempFile = null; FileOutputStream tempFileStream = null; ArtificerArchive archive = null; try { resourceAsStream = ArtificerArchiveTest.class.getResourceAsStream("simple-sramp-archive.zip"); tempFile = File.createTempFile("sramp_test", "ar"); tempFileStream = new FileOutputStream(tempFile); IOUtils.copy(resourceAsStream, tempFileStream); } finally { IOUtils.closeQuietly(resourceAsStream); IOUtils.closeQuietly(tempFileStream); } try { archive = new ArtificerArchive(tempFile); Collection<ArtificerArchiveEntry> entries = archive.getEntries(); Assert.assertEquals(1, entries.size()); ArtificerArchiveEntry entry = entries.iterator().next(); Assert.assertEquals("simple-sramp-archive/sample.xsd", entry.getPath()); Assert.assertNotNull(entry.getMetaData()); Assert.assertEquals("d658b181-975c-42c5-ad5c-dc65cb9aa4a1", entry.getMetaData().getUuid()); Assert.assertEquals("sample.xsd", entry.getMetaData().getName()); Assert.assertEquals("1.0", entry.getMetaData().getVersion()); } finally { FileUtils.deleteQuietly(tempFile); ArtificerArchive.closeQuietly(archive); } }