public void testBasicSnapshotRelease() throws Exception { File fpom = IO.getFile(local, "commons-cli/commons-cli/1.4-SNAPSHOT/commons-cli-1.4-SNAPSHOT.pom"); File rpom = IO.getFile( remote, "commons-cli/commons-cli/1.4-SNAPSHOT/commons-cli-1.4-19700101.000010.pom"); Program program = Program.valueOf("commons-cli", "commons-cli"); Revision revision = Program.valueOf("commons-cli", "commons-cli").version("1.4-SNAPSHOT"); Archive apom = revision.archive("pom", null); assertFalse(fpom.exists()); Release r = storage.release(revision); r.setBuild(10000, null); r.add("pom", null, new ByteArrayInputStream(new byte[0])); r.close(); assertTrue(fpom.isFile()); assertTrue(rpom.isFile()); }
public void testImmutable() throws Exception { File fpom = IO.getFile(local, "commons-cli/commons-cli/1.2/commons-cli-1.2.pom"); Program program = Program.valueOf("commons-cli", "commons-cli"); Revision revision = Program.valueOf("commons-cli", "commons-cli").version("1.2"); Archive apom = revision.archive("pom", null); assertFalse(fpom.exists()); Archive rapom = storage.resolveSnapshot(apom); assertTrue(rapom.isResolved()); assertEquals(rapom, apom); File f = storage.get(rapom).getValue(); assertEquals(fpom, f); assertRecent(f); f.setLastModified(10000); f = storage.get(rapom).getValue(); assertEquals(fpom, f); assertEquals(10000L, f.lastModified()); }
public void testSnapshotCaches() throws Exception { File fpom = IO.getFile(local, "commons-cli/commons-cli/1.4-SNAPSHOT/commons-cli-1.4-SNAPSHOT.pom"); Program program = Program.valueOf("commons-cli", "commons-cli"); Revision revision = Program.valueOf("commons-cli", "commons-cli").version("1.4-SNAPSHOT"); Archive apom = revision.archive("pom", null); assertFalse(fpom.exists()); assertFalse(apom.isResolved()); File f = storage.get(apom).getValue(); assertEquals(fpom.getAbsolutePath(), f.getAbsolutePath()); assertRecent(f); long flastModified = f.lastModified(); Thread.sleep(1001); f = storage.get(apom).getValue(); assertEquals(flastModified, f.lastModified()); f.setLastModified(0); assertFalse(Math.abs(System.currentTimeMillis() - f.lastModified()) <= 2000); f = storage.get(apom).getValue(); assertFalse(f.lastModified() != 0); }