Search in sources :

Example 6 with FailedOperationException

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

the class RemoteCatalogDownloaderTest method testSingleNonMatchingCatalogIgnored.

/**
 * Checks that if a single catalog does not correspond to graalvm version, other catalogs will
 * be read.
 *
 * @throws Exception
 */
@Test
public void testSingleNonMatchingCatalogIgnored() throws Exception {
    setupJoinedCatalog("catalogMultiPart1.properties");
    ComponentCatalog col = openCatalog(rcd);
    // need to incorporate requirements, too... they are tested in CatalogIterable
    CatalogIterable catIt = new CatalogIterable(this, this);
    catIt.setRemoteRegistry(col);
    textParams.add("r");
    textParams.add("ruby");
    textParams.add("python");
    Iterator<ComponentParam> iter = catIt.iterator();
    ComponentParam p = iter.next();
    ComponentInfo info;
    assertNotNull(p);
    info = p.createMetaLoader().getComponentInfo();
    assertEquals("1.0.0.0", info.getVersion().toString());
    p = iter.next();
    assertNotNull(p);
    info = p.createMetaLoader().getComponentInfo();
    assertEquals("1.0.0.0", info.getVersion().toString());
    // python cannot be found, an exception expected
    assertTrue(iter.hasNext());
    try {
        p = iter.next();
        fail("No python for 1.0.0");
    } catch (FailedOperationException ex) {
    }
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) FailedOperationException(org.graalvm.component.installer.FailedOperationException) ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 7 with FailedOperationException

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

the class InstallTest method testFailInstallCleanup.

@Test
public void testFailInstallCleanup() throws IOException {
    Path offending = targetPath.resolve(SystemUtils.fromCommonString("jre/bin/ruby"));
    Files.createDirectories(offending.getParent());
    Files.createFile(offending);
    inst = new InstallCommand();
    inst.init(this, withBundle(InstallCommand.class));
    try {
        inst.execute();
        fail("Exception expected");
    } catch (IOException | FailedOperationException ex) {
    // OK
    }
    Files.delete(offending);
    // jre/bin
    Files.delete(offending.getParent());
    // jre
    Files.delete(offending.getParent().getParent());
    assertFalse(Files.list(targetPath).findFirst().isPresent());
}
Also used : Path(java.nio.file.Path) FailedOperationException(org.graalvm.component.installer.FailedOperationException) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

FailedOperationException (org.graalvm.component.installer.FailedOperationException)7 IOException (java.io.IOException)4 Path (java.nio.file.Path)3 Test (org.junit.Test)3 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)2 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)1 ComponentCollection (org.graalvm.component.installer.ComponentCollection)1 ComponentParam (org.graalvm.component.installer.ComponentParam)1 IncompatibleException (org.graalvm.component.installer.IncompatibleException)1 InstallerStopException (org.graalvm.component.installer.InstallerStopException)1 SoftwareChannel (org.graalvm.component.installer.SoftwareChannel)1 Version (org.graalvm.component.installer.Version)1