use of org.commonjava.maven.galley.io.TransferDecoratorManager in project indy by Commonjava.
the class DefaultGalleyStorageProvider method setupTransferDecoratorPipeline.
/**
* The order is important. We put the checksum decorator at the last because some decorators may change the content.
*/
private void setupTransferDecoratorPipeline() {
List<TransferDecorator> decorators = new ArrayList<>();
decorators.add(new IOLatencyDecorator(timerProviderFunction(), meterProvider(), cumulativeTimer()));
decorators.add(new NoCacheTransferDecorator(specialPathManager));
decorators.add(new UploadMetadataGenTransferDecorator(specialPathManager, timerProviderFunction()));
for (TransferDecorator decorator : transferDecorators) {
decorators.add(decorator);
}
decorators.add(getChecksummingTransferDecorator());
if (featureConfig.getFileChangeTracking()) {
decorators.add(new FileChangeTrackingDecorator(config));
}
transferDecorator = new TransferDecoratorManager(decorators);
}
use of org.commonjava.maven.galley.io.TransferDecoratorManager in project indy by Commonjava.
the class FileChangeTrackingDecoratorTest method init.
private void init(int logSize) throws IOException {
config = new DefaultStorageProviderConfiguration();
config.setStorageRootDirectory(temp.newFolder("storage-root"));
config.setChangeTrackingRollSize(logSize);
decorator = new FileChangeTrackingDecorator(config);
cp = new FileCacheProvider(config.getStorageRootDirectory(), new HashedLocationPathGenerator(), new NoOpFileEventManager(), new TransferDecoratorManager(decorator), false);
}
use of org.commonjava.maven.galley.io.TransferDecoratorManager in project indy by Commonjava.
the class TestProvider method setup.
@PostConstruct
public void setup() {
storeDataManager = new MemoryStoreDataManager(true);
nfc = new MemoryNotFoundCache();
objectMapper = new IndyObjectMapper(false);
fileEventManager = new NoOpFileEventManager();
transferDecorator = new NoOpTransferDecorator();
transportManagerConfig = new TransportManagerConfig();
weftConfig = new DefaultWeftConfig();
globalHttpConfiguration = new GlobalHttpConfiguration();
userLifecycleManager = new AlternativeUserLifecycleManager();
temp = new TemporaryFolder();
try {
temp.create();
cacheProvider = new FileCacheProvider(temp.newFolder("storage"), indyPathGenerator, fileEventManager, new TransferDecoratorManager(transferDecorator));
} catch (IOException e) {
fail("Cannot initialize temporary directory structure");
temp.delete();
}
}
use of org.commonjava.maven.galley.io.TransferDecoratorManager in project indy by Commonjava.
the class NPMPackageMaskingTransferDecoratorTest method testDecorator2.
@Test
public void testDecorator2() throws Exception {
String path = "package.json";
KeyedLocation location = new GroupLocation(PKG_TYPE_NPM, "test");
File file = new File(temp.newFolder(location.getName()), path);
IOUtils.copy(getResourceAsStream("metadata/package-tar-fs.json"), new FileOutputStream(file));
ConcreteResource resource = new ConcreteResource(location, path);
TestCacheProvider provider = new TestCacheProvider(temp.getRoot(), new TestFileEventManager(), new TransferDecoratorManager(new NPMPackageMaskingTransferDecorator()));
Transfer transfer = provider.getTransfer(resource);
InputStream stream = transfer.openInputStream(false, new EventMetadata().set(ENTRY_POINT_BASE_URI, "http://localhost/api/content/npm"));
String ret = IOUtils.toString(stream);
String expected = IOUtils.toString(getResourceAsStream("metadata/package-tar-fs-decorated.json"));
assertEquals(expected, ret);
}
use of org.commonjava.maven.galley.io.TransferDecoratorManager in project indy by Commonjava.
the class PackageMetadataMergerTest method setup.
@Before
public void setup() throws Exception {
cacheProvider = new FileCacheProvider(temp.newFolder("cache"), new IndyPathGenerator(Collections.singleton(new NPMStoragePathCalculator(new SpecialPathManagerImpl()))), new NoOpFileEventManager(), new TransferDecoratorManager(new NoOpTransferDecorator()), false);
mapper = new IndyObjectMapper(true);
mapper.registerModule(new PackageSerializerModule());
}
Aggregations