Search in sources :

Example 11 with TrackedContentEntry

use of org.commonjava.indy.folo.model.TrackedContentEntry 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

TrackedContentEntry (org.commonjava.indy.folo.model.TrackedContentEntry)11 TrackedContent (org.commonjava.indy.folo.model.TrackedContent)5 StoreKey (org.commonjava.indy.model.core.StoreKey)5 TrackingKey (org.commonjava.indy.folo.model.TrackingKey)4 Transfer (org.commonjava.maven.galley.model.Transfer)3 Test (org.junit.Test)3 TreeSet (java.util.TreeSet)2 IndyWorkflowException (org.commonjava.indy.IndyWorkflowException)2 ContentDigest (org.commonjava.maven.galley.io.checksum.ContentDigest)2 TransferMetadata (org.commonjava.maven.galley.io.checksum.TransferMetadata)2 Logger (org.slf4j.Logger)2 MalformedURLException (java.net.MalformedURLException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 IndyDataException (org.commonjava.indy.data.IndyDataException)1 TrackedContentDTO (org.commonjava.indy.folo.dto.TrackedContentDTO)1 TrackedContentEntryDTO (org.commonjava.indy.folo.dto.TrackedContentEntryDTO)1 AccessChannel (org.commonjava.indy.model.core.AccessChannel)1 RemoteRepository (org.commonjava.indy.model.core.RemoteRepository)1 EventMetadata (org.commonjava.maven.galley.event.EventMetadata)1 Query (org.infinispan.query.dsl.Query)1