use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionListTest method testParseRelease20CatalogProperty.
/**
* Checks that GraalVM 20.x style single property is parsed properly. Multiple SoftwareChannel
* Sources should be created, but just one Edition, the default one.
*
* @throws Exception
*/
@Test
public void testParseRelease20CatalogProperty() throws Exception {
loadReleaseFile("release20ce.properties");
storage.graalInfo.put(CommonConstants.CAP_EDITION, "ce");
GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
list.setDefaultCatalogSpec(storage.graalInfo.get(CommonConstants.RELEASE_CATALOG_KEY));
List<GraalEdition> eds = list.editions();
assertFalse(eds.isEmpty());
assertEquals(1, eds.size());
GraalEdition ge = eds.get(0);
assertSame(list.getDefaultEdition(), ge);
assertEquals("Expected ce edition", "ce", ge.getId());
assertEquals("Label from graal caps should be capitalized", "CE", ge.getDisplayName());
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionListTest method testCheck21MultipleEditions.
@Test
public void testCheck21MultipleEditions() throws Exception {
loadReleaseFile("release21ceWithEE.properties");
storage.graalInfo.put(CommonConstants.CAP_EDITION, "ce");
GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
list.setDefaultCatalogSpec(storage.graalInfo.get(CommonConstants.RELEASE_CATALOG_KEY));
List<GraalEdition> eds = list.editions();
assertEquals(2, eds.size());
assertSame(list.getDefaultEdition(), eds.get(0));
assertSame(list.getDefaultEdition(), list.getEdition(""));
GraalEdition ge = list.getEdition("ce");
assertSame(list.getDefaultEdition(), ge);
assertSame(list.getEdition(""), ge);
assertFalse("CE".equalsIgnoreCase(ge.getDisplayName()));
List<SoftwareChannelSource> sources = ge.getSoftwareSources();
assertEquals(2, sources.size());
assertNotNull(sources.get(0).getLabel());
assertTrue(sources.get(0).getLabel().contains("CE 8"));
assertNotNull(sources.get(1).getLabel());
assertTrue(sources.get(1).getLabel().contains("CE 11"));
// check lowercasing
ge = list.getEdition("eE");
sources = ge.getSoftwareSources();
assertEquals(3, sources.size());
assertFalse("EE".equalsIgnoreCase(ge.getDisplayName()));
String u = sources.get(0).getLocationURL();
assertTrue(u.startsWith("gds:"));
assertTrue(sources.get(0).getLabel().contains("GDS"));
u = sources.get(1).getLocationURL();
assertTrue(u.contains("java8.properties"));
assertTrue(sources.get(1).getLabel().contains("Github"));
assertEquals("valueY", sources.get(1).getParameter("paramx"));
u = sources.get(2).getLocationURL();
assertTrue(u.contains("ee-extras"));
assertTrue(sources.get(2).getLabel().contains("experimental"));
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionListTest method testCheckUserUserOverride20.
/**
* Check function of the 'override' switch: the catalog software sources from Graal-20 release
* file should be ignored.
*
* @throws Exception
*/
@Test
public void testCheckUserUserOverride20() throws Exception {
// this one contains multiple
loadReleaseFile("release20ceWithEE.properties");
storage.graalInfo.put(CommonConstants.CAP_EDITION, "ce");
GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
list.setDefaultCatalogSpec(storage.graalInfo.get(CommonConstants.RELEASE_CATALOG_KEY));
list.setOverrideCatalogSpec("http://somewhere/catalog.properties|http://somewhereElse/catalog.properties");
List<GraalEdition> eds = list.editions();
assertEquals(1, eds.size());
GraalEdition ge = eds.get(0);
assertEquals("Expected default edition", "ce", ge.getId());
List<SoftwareChannelSource> sources = ge.getSoftwareSources();
assertEquals("Expected 2 sources from override", 2, sources.size());
assertTrue(sources.stream().allMatch(s -> s.getLocationURL().contains("somewhere")));
assertEquals(2, sources.get(1).getPriority());
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionListTest method testEmptyReleaseInitializesOK.
@Test
public void testEmptyReleaseInitializesOK() throws Exception {
loadReleaseFile("emptyRelease.properties");
storage.graalInfo.put(CommonConstants.CAP_EDITION, "ee");
GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
GraalEdition ge = list.getDefaultEdition();
assertNotNull(ge);
assertEquals("ee", ge.getId());
assertEquals(0, ge.getSoftwareSources().size());
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionList method getEdition.
/**
* Gets an edition with the specified ID. Throws an exception, if that edition does not exist.
*
* @param id edition id. "" or null means default edition.
* @return edition instance
* @throws FailedOperationException if no such edition is configured.
*/
public GraalEdition getEdition(String id) {
if (id == null || "".equals(id)) {
return getDefaultEdition();
} else {
init();
GraalEdition e = editionMap.get(id.toLowerCase(Locale.ENGLISH));
if (e == null) {
throw feedback.failure("ERR_NoSuchEdition", null, id);
}
return e;
}
}
Aggregations