import cloud.molberg.mgutility.plugin.*; import java.util.*; public final class PluginMarketplaceTest { public static void main(String[] args) throws Exception { PluginMarketplace marketplace = new PluginMarketplace(); final PluginRepository repo = new PluginRepository("test", "Test", "https://example.test/index.json", true, false); marketplace.addRepository(repo); marketplace.refresh(new PluginMarketplace.RepositoryClient() { public PluginRepositoryIndex fetch(PluginRepository r) { return new PluginRepositoryIndex(1, Arrays.asList(new PluginCatalogEntry("demo", "Demo", "1.0.0", "", "https://example.test/demo.apk", "", "", ""), new PluginCatalogEntry("demo", "Demo", "2.0.0", "", "https://example.test/demo.apk", "", "", ""))); } }); if (marketplace.available("1.0.0").size() != 1 || !"2.0.0".equals(marketplace.available("1.0.0").get(0).version)) throw new AssertionError("version selection"); if (!PluginSignatureVerifier.matches("hello".getBytes("UTF-8"), PluginSignatureVerifier.sha256("hello".getBytes("UTF-8")))) throw new AssertionError("checksum"); System.out.println("PluginMarketplaceTest: OK"); } }