use of org.commonjava.indy.test.fixture.core.TestFileEventManager 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.indy.test.fixture.core.TestFileEventManager in project indy by Commonjava.
the class NPMPackageMaskingTransferDecoratorTest method testDecorator.
@Test
public void testDecorator() 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-1.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-1-decorated.json"));
assertEquals(expected, ret);
}
Aggregations