Skip to content

Commit

Permalink
Fix pantheon.cli.PantheonCommandTest test on Windows (PegaSysEng#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashatyrev authored and Errorific committed Dec 7, 2018
1 parent 7459b26 commit e0d4f21
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ dependencyManagement {
dependency 'org.web3j:crypto:4.0.1'

dependency 'org.xerial.snappy:snappy-java:1.1.7.2'
dependency 'org.apache.commons:commons-text:1.6'
}
}
1 change: 1 addition & 0 deletions pantheon/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ dependencies {
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.awaitility:awaitility'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.apache.commons:commons-text'
}

task writeInfoFile(type: ProjectPropertiesFile) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

import com.google.common.collect.Lists;
import com.google.common.io.Resources;
import org.apache.commons.text.StringEscapeUtils;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
Expand Down Expand Up @@ -251,7 +252,8 @@ public void overrideDefaultValuesIfKeyIsPresentInConfigFile() throws IOException
final URL configFile = Resources.getResource("complete_config.toml");
final Path genesisFile = createFakeGenesisFile();
final String updatedConfig =
Resources.toString(configFile, UTF_8).replaceAll("~/genesis.json", genesisFile.toString());
Resources.toString(configFile, UTF_8)
.replace("~/genesis.json", escapeTomlString(genesisFile.toString()));
final Path toml = Files.createTempFile("toml", "");
Files.write(toml, updatedConfig.getBytes(UTF_8));

Expand Down Expand Up @@ -1004,4 +1006,8 @@ private Path createFakeGenesisFile() throws IOException {
private boolean isFullInstantiation() {
return !Boolean.getBoolean("pantheon.docker");
}

private static String escapeTomlString(final String s) {
return StringEscapeUtils.escapeJava(s);
}
}

0 comments on commit e0d4f21

Please sign in to comment.