use of org.commonjava.indy.pkg.npm.model.io.PackageSerializerModule 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());
}
use of org.commonjava.indy.pkg.npm.model.io.PackageSerializerModule in project indy by Commonjava.
the class VersionMetadataTest method customDeserializerTest.
@Test
public void customDeserializerTest() throws Exception {
final IndyObjectMapper mapper = new IndyObjectMapper(true);
mapper.registerModule(new PackageSerializerModule());
String json = IOUtils.toString(Thread.currentThread().getContextClassLoader().getResourceAsStream("test-package-tmp.json"));
final PackageMetadata result = mapper.readValue(json, PackageMetadata.class);
final VersionMetadata version = result.getVersions().get("0.0.4");
assertThat(result.getVersions().size(), equalTo(5));
assertThat(version.getName(), equalTo("tmp"));
assertThat(version.getVersion(), equalTo("0.0.4"));
assertThat(version.getRepository().getType(), equalTo("git"));
assertThat(version.getEngines().get(0).getNode(), equalTo("0.4.10"));
assertThat(version.getScripts().get("test"), equalTo("vows test/*-test.js"));
assertThat(version.getLicenses().get(0).getType(), equalTo("GPLv2"));
assertThat(version.getDist().getTarball(), equalTo("https://registry.npmjs.org/tmp/-/tmp-0.0.4.tgz"));
}
Aggregations