use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionList method init.
void init() {
if (defaultEdition != null) {
return;
}
String defEditionId = targetGraal.getGraalCapabilities().get(CommonConstants.CAP_EDITION);
if (isExplicitOverride()) {
initSimple(defEditionId, overrideCatalogSpec);
return;
}
List<SoftwareChannelSource> srcs = readChannelSources(defEditionId);
if (srcs.isEmpty()) {
// no source channels defined for the editionId
srcs = readChannelSources(null);
}
if (srcs.isEmpty()) {
initSimple(defEditionId, defaultCatalogSpec);
return;
}
List<String> edList = listEditionsFromRelease();
String label;
List<SoftwareChannelSource> sources;
if (edList.contains(defEditionId)) {
edList.remove(defEditionId);
label = getEditionLabel(defEditionId);
sources = readChannelSources(defEditionId);
} else if (!edList.remove("")) {
throw new IllegalStateException("Malformed release file.");
} else {
label = getEditionLabel(null);
sources = readChannelSources(null);
}
GraalEdition ge = new GraalEdition(defEditionId, label);
ge.setSoftwareSources(sources);
registerEdition(ge, true);
for (String id : edList) {
label = getEditionLabel(id);
sources = readChannelSources(id);
ge = new GraalEdition(id, label);
ge.setSoftwareSources(sources);
registerEdition(ge, false);
}
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionList method initSimple.
/**
* Performs single-property initialization.
*
* @param defEditionId default edition's ID, as it appears (or defaults) in the release file.
* @param spec specification string.
*/
private void initSimple(String defEditionId, String spec) {
parseSimpleSpecification(defEditionId, spec);
if (editions.isEmpty()) {
String label = getEditionLabel(defEditionId);
GraalEdition ge = new GraalEdition(defEditionId, label);
defaultEdition = ge;
editions.add(ge);
}
foreignGraals.put(targetGraal, this);
ensureDefaultDefined(defEditionId);
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionListTest method testParseRelease20EEWithLabel.
@Test
public void testParseRelease20EEWithLabel() throws Exception {
// this one contains multiple
loadReleaseFile("release20ee.properties");
// substitute "ee", since that's what the DirectoryStorage does in presence of
// 'vm-enterprise' now:
storage.graalInfo.put(CommonConstants.CAP_EDITION, "ee");
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 ee for vm-enterprise", "ee", ge.getId());
assertEquals("Unqualified label should be picked up", "Enterprise Edition", ge.getDisplayName());
List<SoftwareChannelSource> sources = ge.getSoftwareSources();
assertEquals("Multiple software sources must be read", 3, sources.size());
assertEquals("Expected decreasing priority", 2, sources.get(1).getPriority());
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionListTest method checkOverrideCommon.
private void checkOverrideCommon() throws Exception {
GraalEditionList list = new GraalEditionList(this, this, getLocalRegistry());
list.setOverrideCatalogSpec("https://www.graalvm.org/component-catalog/graal-updater-component-catalog-java8x.properties");
List<GraalEdition> eds = list.editions();
assertEquals(1, eds.size());
assertEquals(list.getDefaultEdition(), eds.get(0));
GraalEdition ge = eds.get(0);
assertEquals("ce", ge.getId());
assertSame(ge, list.getEdition(null));
List<SoftwareChannelSource> channels = ge.getSoftwareSources();
assertEquals(1, channels.size());
assertTrue(channels.get(0).getLocationURL().endsWith("java8x.properties"));
}
use of org.graalvm.component.installer.model.GraalEdition in project graal by oracle.
the class GraalEditionListTest method testCheck21MultipleProperties.
@Test
public void testCheck21MultipleProperties() throws Exception {
loadReleaseFile("release21ce.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(1, eds.size());
GraalEdition ge = eds.get(0);
List<SoftwareChannelSource> sources = ge.getSoftwareSources();
assertEquals("Expected default edition", "ce", ge.getId());
assertEquals("Expected 2 sources from multiproperties", 2, sources.size());
}
Aggregations