Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ public CustomSessionConfiguration addBundle(Bundle bundle) {
return this;
}

@Override
public CustomSessionConfiguration setConfigIniValue(String key, String value) {
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -50,6 +52,7 @@ public class CustomSessionConfigurationImpl implements CustomSessionConfiguratio

private final Collection<BundleReference> bundleReferences = new LinkedHashSet<>();
private Path configurationDirectory;
private final Map<String, String> configIniValues = new HashMap<>();
private boolean readOnly = false;
private boolean cascaded = false;
private boolean firstExecutedSession = true;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<String, String> entry : configIniValues.entrySet()) {
contents.put(entry.getKey(), entry.getValue());
}
// save the properties
Path configINI = getConfigurationDirectory().resolve("config.ini");
try (OutputStream out = Files.newOutputStream(configINI)) {
Expand Down
Loading