Search in sources :

Example 1 with TestTransferDecorator

use of org.commonjava.maven.galley.cache.testutil.TestTransferDecorator in project galley by Commonjava.

the class PartyLineCacheProviderTest method setup.

@Before
public void setup() throws Exception {
    final PathGenerator pathgen = new HashedLocationPathGenerator();
    final FileEventManager events = new TestFileEventManager();
    final TransferDecorator decorator = new TestTransferDecorator();
    provider = new PartyLineCacheProvider(temp.newFolder(), pathgen, events, decorator);
}
Also used : TestTransferDecorator(org.commonjava.maven.galley.cache.testutil.TestTransferDecorator) TestFileEventManager(org.commonjava.maven.galley.cache.testutil.TestFileEventManager) FileEventManager(org.commonjava.maven.galley.spi.event.FileEventManager) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) PathGenerator(org.commonjava.maven.galley.spi.io.PathGenerator) TestFileEventManager(org.commonjava.maven.galley.cache.testutil.TestFileEventManager) TestTransferDecorator(org.commonjava.maven.galley.cache.testutil.TestTransferDecorator) TransferDecorator(org.commonjava.maven.galley.spi.io.TransferDecorator) Before(org.junit.Before)

Example 2 with TestTransferDecorator

use of org.commonjava.maven.galley.cache.testutil.TestTransferDecorator in project galley by Commonjava.

the class GridFileSystemCacheProviderTest method setup.

@Before
public void setup() throws Exception {
    final PathGenerator pathgen = new HashedLocationPathGenerator();
    final FileEventManager events = new TestFileEventManager();
    final TransferDecorator decorator = new TestTransferDecorator();
    Cache<String, byte[]> data = CACHE_MANAGER.getCache(name.getMethodName() + "-data");
    Cache<String, GridFile.Metadata> metadata = CACHE_MANAGER.getCache(name.getMethodName() + "-metadata");
    final GridFilesystem fs = new GridFilesystem(data, metadata);
    provider = new GridFileSystemCacheProvider(pathgen, events, decorator, fs);
}
Also used : TestTransferDecorator(org.commonjava.maven.galley.cache.testutil.TestTransferDecorator) GridFileSystemCacheProvider(org.commonjava.maven.galley.cache.infinispan.GridFileSystemCacheProvider) TestFileEventManager(org.commonjava.maven.galley.cache.testutil.TestFileEventManager) FileEventManager(org.commonjava.maven.galley.spi.event.FileEventManager) GridFilesystem(org.infinispan.io.GridFilesystem) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) PathGenerator(org.commonjava.maven.galley.spi.io.PathGenerator) TestFileEventManager(org.commonjava.maven.galley.cache.testutil.TestFileEventManager) TestTransferDecorator(org.commonjava.maven.galley.cache.testutil.TestTransferDecorator) TransferDecorator(org.commonjava.maven.galley.spi.io.TransferDecorator) Before(org.junit.Before)

Example 3 with TestTransferDecorator

use of org.commonjava.maven.galley.cache.testutil.TestTransferDecorator in project galley by Commonjava.

the class CacheProviderTCK method lockThenWriteViaTransferSucceedsInSameThread.

@Test
public void lockThenWriteViaTransferSucceedsInSameThread() throws Exception {
    final Location loc = new SimpleLocation("http://foo.com");
    final String path = "my/path.txt";
    final ConcreteResource res = new ConcreteResource(loc, path);
    final CacheProvider cache = getCacheProvider();
    cache.lockWrite(res);
    final Transfer txfr = new Transfer(res, cache, new TestFileEventManager(), new TestTransferDecorator());
    OutputStream out = null;
    try {
        out = txfr.openOutputStream(TransferOperation.UPLOAD);
        IOUtils.write("this is a test", out);
    } finally {
        IOUtils.closeQuietly(out);
    }
}
Also used : TestTransferDecorator(org.commonjava.maven.galley.cache.testutil.TestTransferDecorator) OutputStream(java.io.OutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ConcreteResource(org.commonjava.maven.galley.model.ConcreteResource) Transfer(org.commonjava.maven.galley.model.Transfer) SimpleLocation(org.commonjava.maven.galley.model.SimpleLocation) CacheProvider(org.commonjava.maven.galley.spi.cache.CacheProvider) TestFileEventManager(org.commonjava.maven.galley.cache.testutil.TestFileEventManager) SimpleLocation(org.commonjava.maven.galley.model.SimpleLocation) Location(org.commonjava.maven.galley.model.Location) Test(org.junit.Test)

Aggregations

TestFileEventManager (org.commonjava.maven.galley.cache.testutil.TestFileEventManager)3 TestTransferDecorator (org.commonjava.maven.galley.cache.testutil.TestTransferDecorator)3 HashedLocationPathGenerator (org.commonjava.maven.galley.io.HashedLocationPathGenerator)2 FileEventManager (org.commonjava.maven.galley.spi.event.FileEventManager)2 PathGenerator (org.commonjava.maven.galley.spi.io.PathGenerator)2 TransferDecorator (org.commonjava.maven.galley.spi.io.TransferDecorator)2 Before (org.junit.Before)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 OutputStream (java.io.OutputStream)1 GridFileSystemCacheProvider (org.commonjava.maven.galley.cache.infinispan.GridFileSystemCacheProvider)1 ConcreteResource (org.commonjava.maven.galley.model.ConcreteResource)1 Location (org.commonjava.maven.galley.model.Location)1 SimpleLocation (org.commonjava.maven.galley.model.SimpleLocation)1 Transfer (org.commonjava.maven.galley.model.Transfer)1 CacheProvider (org.commonjava.maven.galley.spi.cache.CacheProvider)1 GridFilesystem (org.infinispan.io.GridFilesystem)1 Test (org.junit.Test)1