use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testExplicitCoreMetadata.
/**
* Checks that the core component registration is loaded, if present.
*/
@Test
public void testExplicitCoreMetadata() throws Exception {
Files.copy(dataFile("release_simple.properties"), graalVMPath.resolve("release"));
Files.copy(dataFile("graalvmcore.properties"), registryPath.resolve(BundleConstants.GRAAL_COMPONENT_ID + ".component"));
Set<ComponentInfo> loaded = storage.loadComponentMetadata(BundleConstants.GRAAL_COMPONENT_ID);
assertEquals(1, loaded.size());
ComponentInfo ci = loaded.iterator().next();
assertNotNull(ci);
assertEquals(StabilityLevel.Experimental, ci.getStability());
assertFalse(ci.isNativeComponent());
assertEquals(DistributionType.BUNDLED, ci.getDistributionType());
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorageTest method testStabilityLevelSaved.
/**
* Checks that the 'stability level' is saved to the registry.
*/
@Test
public void testStabilityLevelSaved() throws Exception {
ComponentInfo info = new ComponentInfo("x", "y", "2.0");
info.setStability(StabilityLevel.Experimental_Earlyadopter);
storage.saveComponent(info);
Properties props = new Properties();
try (InputStream is = Files.newInputStream(registryPath.resolve("x.component"))) {
props.load(is);
}
// check the -Level was saved, and corresponds to the enum's text
String p = props.getProperty(BundleConstants.BUNDLE_STABILITY2);
assertEquals(StabilityLevel.Experimental_Earlyadopter.toString(), p);
assertNull(props.getProperty(BundleConstants.BUNDLE_STABILITY));
// recreate the storage:
storage = new DirectoryStorage(this, registryPath, graalVMPath);
// the default assumed by most test data.
storage.setJavaVersion("8");
Set<ComponentInfo> loaded = storage.loadComponentMetadata("x");
assertEquals(1, loaded.size());
ComponentInfo compare = loaded.iterator().next();
assertEquals(info.getStability(), compare.getStability());
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class UpgradeTest method testInstallWithoutCoreUpgrade.
/**
* Checks installation without core , even though the user has specified the version. Simulates
* "gu install ruby" on 1.0.1.0 installation which ought to install 1.0.1.1
*/
@Test
public void testInstallWithoutCoreUpgrade() throws Exception {
initVersion("1.0.1.0");
ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "1.0.1.0");
storage.installed.add(ci);
helper.resetExistingComponents();
ComponentInfo info = helper.findGraalVersion(Version.fromString("1.0.1").match(Version.Match.Type.COMPATIBLE));
assertNotNull(info);
boolean inst = helper.installGraalCore(info);
assertFalse(inst);
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class UpgradeTest method testInstallIntoExistingRelease.
/**
* Fails on non-empty directory.
*/
@Test
public void testInstallIntoExistingRelease() throws Exception {
initVersion("1.0.0.0");
ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "1.0.0.0");
storage.installed.add(ci);
textParams.add("ruby");
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
helper = cmd.getProcess();
ComponentInfo info = cmd.configureProcess();
Path p = getGraalHomePath().normalize();
Path ndir = graalVMDirectory(p, "1.0.1");
Files.createDirectories(ndir);
Files.write(ndir.resolve("some-content"), Arrays.asList("Fail"));
Path toCopy = dataFile("../persist/release_simple.properties");
Files.copy(toCopy, ndir.resolve("release"));
exception.expect(FailedOperationException.class);
exception.expectMessage("UPGRADE_TargetExistsContainsGraalVM");
helper.prepareInstall(info);
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class UpgradeTest method testInstallIntoExistingNonempty.
/**
* Fails on non-empty directory.
*/
@Test
public void testInstallIntoExistingNonempty() throws Exception {
initVersion("1.0.0.0");
ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "1.0.0.0");
storage.installed.add(ci);
textParams.add("ruby");
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
helper = cmd.getProcess();
ComponentInfo info = cmd.configureProcess();
Path p = getGraalHomePath().normalize();
Path ndir = graalVMDirectory(p, "1.0.1");
Files.createDirectories(ndir);
Files.write(ndir.resolve("some-content"), Arrays.asList("Fail"));
exception.expect(FailedOperationException.class);
exception.expectMessage("UPGRADE_TargetExistsNotEmpty");
helper.prepareInstall(info);
}
Aggregations