Search in sources :

Example 6 with RemotePropertiesStorage

use of org.graalvm.component.installer.remote.RemotePropertiesStorage in project graal by oracle.

the class ListTest method assert110Components.

private void assert110Components(Version v, Version min) throws Exception {
    Path p = dataFile("../repo/catalog.properties");
    try (InputStream is = new FileInputStream(p.toFile())) {
        catalogContents.load(is);
    }
    this.remoteStorage = new RemotePropertiesStorage(this, getLocalRegistry(), catalogContents, "linux_amd64", v, new URL("http://go.to/graalvm"));
    this.registry = new CatalogContents(this, remoteStorage, localRegistry);
    AvailableCommand inst = new AvailableCommand() {

        @Override
        boolean process() {
            super.process();
            // block the actual print
            return false;
        }
    };
    textParams.add("r");
    textParams.add("ruby");
    textParams.add("python");
    inst.init(this, this.withBundle(ListInstalledCommand.class));
    inst.execute();
    Set<String> found = new HashSet<>();
    for (ComponentInfo ci : inst.getComponents()) {
        if (ci.getId().equals(BundleConstants.GRAAL_COMPONENT_ID)) {
            continue;
        }
        assertTrue(found.add(ci.getId().toLowerCase()));
        assertTrue(min.compareTo(ci.getVersion()) <= 0);
    }
    // ruby not present
    assertFalse(found.contains("org.graalvm.ruby"));
    assertTrue(found.contains("org.graalvm.r"));
    assertTrue(found.contains("org.graalvm.python"));
}
Also used : Path(java.nio.file.Path) RemotePropertiesStorage(org.graalvm.component.installer.remote.RemotePropertiesStorage) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) CatalogContents(org.graalvm.component.installer.model.CatalogContents) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) FileInputStream(java.io.FileInputStream) URL(java.net.URL) HashSet(java.util.HashSet)

Aggregations

RemotePropertiesStorage (org.graalvm.component.installer.remote.RemotePropertiesStorage)6 URL (java.net.URL)4 Path (java.nio.file.Path)4 Properties (java.util.Properties)4 Version (org.graalvm.component.installer.Version)4 InputStream (java.io.InputStream)3 FileInputStream (java.io.FileInputStream)2 CatalogContents (org.graalvm.component.installer.model.CatalogContents)2 FileDownloader (org.graalvm.component.installer.remote.FileDownloader)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ConnectException (java.net.ConnectException)1 MalformedURLException (java.net.MalformedURLException)1 NoRouteToHostException (java.net.NoRouteToHostException)1 HashSet (java.util.HashSet)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Feedback (org.graalvm.component.installer.Feedback)1 IncompatibleException (org.graalvm.component.installer.IncompatibleException)1 SoftwareChannelSource (org.graalvm.component.installer.SoftwareChannelSource)1