diff --git a/runtime/tests/org.eclipse.core.tests.harness/META-INF/MANIFEST.MF b/runtime/tests/org.eclipse.core.tests.harness/META-INF/MANIFEST.MF index 4e515734337..ed67d89930b 100644 --- a/runtime/tests/org.eclipse.core.tests.harness/META-INF/MANIFEST.MF +++ b/runtime/tests/org.eclipse.core.tests.harness/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Eclipse Core Tests Harness Bundle-SymbolicName: org.eclipse.core.tests.harness;singleton:=true -Bundle-Version: 3.17.400.qualifier +Bundle-Version: 3.17.500.qualifier Bundle-Vendor: Eclipse.org Export-Package: org.eclipse.core.tests.harness;version="2.0", org.eclipse.core.tests.harness.session, diff --git a/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/CustomSessionConfiguration.java b/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/CustomSessionConfiguration.java index 9307a8d9358..3a918accf50 100644 --- a/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/CustomSessionConfiguration.java +++ b/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/CustomSessionConfiguration.java @@ -72,4 +72,15 @@ public interface CustomSessionConfiguration extends SessionCustomization { */ public CustomSessionConfiguration setReadOnly(); + /** + * Sets the given config value for the application configuration via the ini. If + * the value is null, the key will be removed from the ini. + * + * @param key the key to define + * @param value the value to set to the key or {@code null} to remove the key + * + * @return this + */ + public CustomSessionConfiguration setConfigIniValue(String key, String value); + } diff --git a/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/RemoteTestExecutor.java b/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/RemoteTestExecutor.java index 899bf5153f0..452382115ca 100644 --- a/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/RemoteTestExecutor.java +++ b/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/RemoteTestExecutor.java @@ -66,7 +66,7 @@ void executeRemotely(String testClass, String testMethod, boolean shouldFail) th throw new CoreException(status); } if (!collector.didTestFinish()) { - throw new Exception("session test did not run: " + descriptor); + throw new Exception("session test did not run: " + descriptor + "\n" + collector.stackTrace); } if (!collector.wasTestSuccessful()) { throw collector.getError(); diff --git a/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationDummy.java b/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationDummy.java index c6b7fdd692d..095d42421f6 100644 --- a/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationDummy.java +++ b/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationDummy.java @@ -63,4 +63,9 @@ public CustomSessionConfiguration addBundle(Bundle bundle) { return this; } + @Override + public CustomSessionConfiguration setConfigIniValue(String key, String value) { + return this; + } + } diff --git a/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationImpl.java b/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationImpl.java index bff7694721d..09b56296a1b 100644 --- a/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationImpl.java +++ b/runtime/tests/org.eclipse.core.tests.harness/src/org/eclipse/core/tests/harness/session/customization/CustomSessionConfigurationImpl.java @@ -20,7 +20,9 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Collection; +import java.util.HashMap; import java.util.LinkedHashSet; +import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Properties; @@ -50,6 +52,7 @@ public class CustomSessionConfigurationImpl implements CustomSessionConfiguratio private final Collection bundleReferences = new LinkedHashSet<>(); private Path configurationDirectory; + private final Map configIniValues = new HashMap<>(); private boolean readOnly = false; private boolean cascaded = false; private boolean firstExecutedSession = true; @@ -141,6 +144,16 @@ public CustomSessionConfiguration setReadOnly() { return this; } + @Override + public CustomSessionConfiguration setConfigIniValue(String key, String value) { + if (value == null) { + configIniValues.remove(key); + } else { + configIniValues.put(key, value); + } + return this; + } + @Override public CustomSessionConfiguration setConfigurationDirectory(Path configurationDirectory) { Objects.requireNonNull(configurationDirectory); @@ -212,6 +225,9 @@ private void createOrRefreshConfigIni() throws IOException { contents.put(PROP_SHARED_CONFIG_AREA, Platform.getConfigurationLocation().getURL().toExternalForm()); } contents.put(PROP_CONFIG_AREA_READ_ONLY, Boolean.valueOf(readOnly).toString()); + for (Map.Entry entry : configIniValues.entrySet()) { + contents.put(entry.getKey(), entry.getValue()); + } // save the properties Path configINI = getConfigurationDirectory().resolve("config.ini"); try (OutputStream out = Files.newOutputStream(configINI)) {