Search in sources :

Example 6 with TrackedContent

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));
}
Also used : TrackedContent(org.commonjava.indy.folo.model.TrackedContent) TrackedContentEntry(org.commonjava.indy.folo.model.TrackedContentEntry) StoreKey(org.commonjava.indy.model.core.StoreKey) TrackingKey(org.commonjava.indy.folo.model.TrackingKey) Test(org.junit.Test)

Aggregations

TrackedContent (org.commonjava.indy.folo.model.TrackedContent)6 TrackedContentEntry (org.commonjava.indy.folo.model.TrackedContentEntry)5 TrackingKey (org.commonjava.indy.folo.model.TrackingKey)5 StoreKey (org.commonjava.indy.model.core.StoreKey)3 Test (org.junit.Test)3 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)2 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 TreeSet (java.util.TreeSet)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 ZipEntry (java.util.zip.ZipEntry)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 Transfer (org.commonjava.maven.galley.model.Transfer)1 Query (org.infinispan.query.dsl.Query)1 Logger (org.slf4j.Logger)1