Search in sources :

Example 21 with ComponentInfo

use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.

the class InstallTest method testSkipExistingFromCatalog.

@Test
public void testSkipExistingFromCatalog() throws Exception {
    ComponentInfo fakeInfo = new ComponentInfo("ruby", "Fake ruby", "1.0");
    storage.installed.add(fakeInfo);
    URL u = new URL("test://graalvm.io/download/catalog");
    URL u2 = new URL(u, "graalvm-ruby.zip");
    Handler.bind(u.toString(), getClass().getResource("catalog"));
    Handler.bind(u2.toString(), getClass().getResource("graalvm-ruby.zip"));
    storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "0.33-dev");
    initCatalogIterable(u);
    textParams.add("ruby");
    files.clear();
    inst = new InstallCommand();
    inst.init(this, withBundle(InstallCommand.class));
    try {
        inst.execute();
    } catch (DependencyException.Conflict ex) {
        fail("Should not raise an error");
    }
    assertFalse("Should not touch the remote file", Handler.isVisited(u2));
}
Also used : ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) DependencyException(org.graalvm.component.installer.DependencyException) URL(java.net.URL) Test(org.junit.Test)

Example 22 with ComponentInfo

use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.

the class DownloadURLIterableTest method testURLParameter.

@Test
public void testURLParameter() throws Exception {
    initURLComponent("persist/data/truffleruby3.jar", "test://graalvm.io/download/truffleruby.zip");
    this.textParams.add("test://graalvm.io/download/truffleruby.zip");
    DownloadURLIterable iterable = new DownloadURLIterable(this, this);
    Iterator<ComponentParam> it = iterable.iterator();
    assertTrue(it.hasNext());
    ComponentParam p = it.next();
    assertEquals("test://graalvm.io/download/truffleruby.zip", p.getSpecification());
    MetadataLoader ldr = p.createMetaLoader();
    assertFalse(p.isComplete());
    ComponentInfo ci = ldr.getComponentInfo();
    assertTrue(p.isComplete());
    assertEquals("ruby", ci.getId());
    assertEquals("0.33-dev", ci.getVersionString());
    JarArchive jf = (JarArchive) ldr.getArchive();
    Archive.FileEntry je = jf.getJarEntry("META-INF/MANIFEST.MF");
    assertNotNull(je);
    jf.close();
}
Also used : JarArchive(org.graalvm.component.installer.jar.JarArchive) JarArchive(org.graalvm.component.installer.jar.JarArchive) MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 23 with ComponentInfo

use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.

the class InstallerTest method testFailRemoteComponentExisting.

@Test
public void testFailRemoteComponentExisting() throws IOException {
    setupComponentInstall("truffleruby2.jar");
    ComponentInfo fakeInfo = new ComponentInfo("org.graalvm.ruby", "Fake ruby", "1.0");
    storage.installed.add(fakeInfo);
    exception.expect(DependencyException.Conflict.class);
    exception.expectMessage("VERIFY_ComponentExists");
    installer.setFailOnExisting(true);
    installer.validateRequirements();
}
Also used : ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) DependencyException(org.graalvm.component.installer.DependencyException) Test(org.junit.Test)

Example 24 with ComponentInfo

use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.

the class InstallerTest method testSkipExistingComponent.

@Test
public void testSkipExistingComponent() throws IOException {
    setupComponentInstall("truffleruby2.jar");
    ComponentInfo fakeInfo = new ComponentInfo("org.graalvm.ruby", "Fake ruby", "1.0");
    storage.installed.add(fakeInfo);
    installer.setFailOnExisting(false);
    assertFalse("Must refuse installation", installer.validateAll());
}
Also used : ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 25 with ComponentInfo

use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.

the class InstallerTest method testAcceptComponentUpgrade.

@Test
public void testAcceptComponentUpgrade() throws IOException {
    setupComponentInstall("truffleruby2.jar");
    ComponentInfo fakeInfo = new ComponentInfo("org.graalvm.ruby", "Fake ruby", "0.32");
    storage.installed.add(fakeInfo);
    installer.setFailOnExisting(false);
    assertTrue("Must refuse installation", installer.validateAll());
}
Also used : ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Aggregations

ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)149 Test (org.junit.Test)94 Path (java.nio.file.Path)36 Version (org.graalvm.component.installer.Version)28 HashSet (java.util.HashSet)20 ArrayList (java.util.ArrayList)19 ComponentParam (org.graalvm.component.installer.ComponentParam)19 IOException (java.io.IOException)13 URL (java.net.URL)11 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)10 InputStream (java.io.InputStream)9 HashMap (java.util.HashMap)9 Collection (java.util.Collection)8 List (java.util.List)8 Properties (java.util.Properties)8 Map (java.util.Map)7 Set (java.util.Set)7 Collections (java.util.Collections)6 FailedOperationException (org.graalvm.component.installer.FailedOperationException)6 SystemUtils (org.graalvm.component.installer.SystemUtils)6