use of org.commonjava.indy.folo.model.TrackedContent in project indy by Commonjava.
the class FoloRecordCacheTest method recordArtifactCreatesNewInProgressEntry.
@Test
public void recordArtifactCreatesNewInProgressEntry() throws Exception {
final TrackingKey key = newKey();
final long size = 123L;
assertThat(cache.hasRecord(key), equalTo(false));
cache.recordArtifact(new TrackedContentEntry(key, new StoreKey(StoreType.remote, "foo"), AccessChannel.MAVEN_REPO, "", "/path", StoreEffect.DOWNLOAD, size, "", "", ""));
assertThat(cache.hasRecord(key), equalTo(true));
assertThat(cache.hasInProgressRecord(key), equalTo(true));
assertThat(cache.hasSealedRecord(key), equalTo(false));
TrackedContent record = cache.seal(key);
assertThat(record, notNullValue());
assertThat(cache.hasRecord(key), equalTo(true));
assertThat(cache.hasInProgressRecord(key), equalTo(false));
assertThat(cache.hasSealedRecord(key), equalTo(true));
Set<TrackedContentEntry> downloads = cache.get(key).getDownloads();
assertThat(downloads, notNullValue());
assertThat(downloads.size(), equalTo(1));
TrackedContentEntry entry = downloads.iterator().next();
assertThat(entry.getSize(), equalTo(size));
}
Aggregations