use of org.graalvm.component.installer.SoftwareChannelSource in project graal by oracle.
the class GraalEditionListTest method testParseRelease20MultiCatalogDefs.
/**
* Checks multi-property definition parsing from the release file. The default property may be
* present, but will be ignored.
*
* @throws Exception
*/
@Test
public void testParseRelease20MultiCatalogDefs() 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<GraalEdition> eds = list.editions();
assertFalse(eds.isEmpty());
assertEquals(2, eds.size());
GraalEdition ge = eds.get(0);
assertSame(list.getDefaultEdition(), ge);
assertEquals("Expected ce edition to be the default/installed", "ce", ge.getId());
assertEquals("Label from graal caps should be capitalized", "CE", ge.getDisplayName());
List<SoftwareChannelSource> sources = ge.getSoftwareSources();
assertEquals("CE edition has single source", 1, sources.size());
ge = eds.get(1);
assertEquals("Enterprise Edition must be present", "ee", ge.getId());
assertEquals("Enterprise label should be parsed out", "Enterprise Edition", ge.getDisplayName());
sources = ge.getSoftwareSources();
assertEquals("EE has more sources", 2, sources.size());
assertEquals("Expected decreasing priority", 2, sources.get(1).getPriority());
assertSame(ge, list.getEdition("ee"));
}
use of org.graalvm.component.installer.SoftwareChannelSource 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.SoftwareChannelSource 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.SoftwareChannelSource in project graal by oracle.
the class RemoteCatalogDownloaderTest method testParseCatalogOverrideParameters.
@Test
public void testParseCatalogOverrideParameters() throws Exception {
storage.graalInfo.put(CommonConstants.CAP_GRAALVM_VERSION, "0.33-dev");
String url = "test://graalv.org/test/catalog.properties";
String single = url + "?linux=a&macOS=a+b&windows=";
RemoteCatalogDownloader d = new RemoteCatalogDownloader(this, this, single);
List<SoftwareChannelSource> sources = d.getChannelSources();
assertNotNull(sources);
assertEquals(1, sources.size());
SoftwareChannelSource src = sources.get(0);
assertEquals(url, src.getLocationURL());
assertEquals("a", src.getParameter("linux"));
assertEquals("a b", src.getParameter("macOS"));
assertEquals("", src.getParameter("windows"));
}
use of org.graalvm.component.installer.SoftwareChannelSource in project graal by oracle.
the class MergeStorage method reportError.
private void reportError(Exception exc, SoftwareChannel errChannel) {
if (exc == null) {
return;
}
// the previous error is overwritten, so at least report it before it is
// forgot:
SoftwareChannelSource info = channelInfos.get(errChannel);
String l = info.getLabel();
if (l == null) {
l = info.getLocationURL();
}
feedback.error("REMOTE_CannotLoadChannel", exc, l, exc.getLocalizedMessage());
}
Aggregations