*/
public void runBasicDirTest(IDirectory dir, long len, long time) throws IOException
{
assertNull("for some reason our fake app has a fake blueprint file.", dir.getFile("OSGI-INF/blueprint/aries.xml"));
IFile file = dir.getFile(AppConstants.APPLICATION_MF);
assertNotNull("we could not find the application manifest", file);
assertEquals(AppConstants.APPLICATION_MF, file.getName().replace('\\', '/'));
assertTrue("The last update time is not within 2 seconds of the expected value. Expected: " + time + " Actual: " + file.getLastModified(), Math.abs(time - file.getLastModified()) < 2000);
assertEquals(len, file.getSize());
assertEquals("META-INF", file.getParent().getName());
assertFalse(file.isDirectory());
assertTrue(file.isFile());
List<IFile> files = dir.listFiles();
Iterator<IFile> it = files.iterator();
while (it.hasNext()) {
IFile f = it.next();
if (f.getName().equalsIgnoreCase(".svn")) {
it.remove();
}
}
assertEquals(1, files.size());
List<IFile> allFiles = dir.listAllFiles();
Iterator<IFile> its = allFiles.iterator();
while (its.hasNext()) {
IFile f = its.next();
if (f.getName().toLowerCase().contains(".svn")) {
its.remove();
}
}
assertEquals(3, allFiles.size());
IFile metaInf = files.get(0);
assertTrue(metaInf.isDirectory());
assertEquals("META-INF", metaInf.getName());
assertNotNull(metaInf.convert());
for (IFile aFile : dir) {
if (!aFile.getName().equalsIgnoreCase(".svn")) {
assertTrue(aFile.isDirectory());
assertEquals("META-INF", aFile.getName());
assertNotNull(aFile.convert());
}
}
InputStream is = file.open();
Manifest man = new Manifest(is);
//remember to close the input stream after use
is.close();
assertEquals("com.travel.reservation", man.getMainAttributes().getValue("Application-SymbolicName"));
IFile applicationMF2 = dir.getFile(AppConstants.APPLICATION_MF);
Assert.assertEqualsContract(file, applicationMF2, dir);
Assert.assertHashCodeEquals(file, applicationMF2, true);
}