Skip to content

Commit

Permalink
[CALCITE-1750] Make all Calcite tests pass when repository is in a di…
Browse files Browse the repository at this point in the history
…rectory with a space

Closes apache#423
  • Loading branch information
joshelser committed Apr 11, 2017
1 parent b48f634 commit 6543c0f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6877,7 +6877,8 @@ public void subTestIntervalSecondFailsValidation() {
// inUrl = "file:/home/x/calcite/core/target/test-classes/hsqldb-model.json"
String path = "hsqldb-model.json";
final URL inUrl = SqlParserTest.class.getResource("/" + path);
String x = inUrl.getFile();
// URL will convert spaces to %20, undo that
String x = inUrl.getFile().replace("%20", " ");
assert x.endsWith(path);
x = x.substring(0, x.length() - path.length());
assert x.endsWith("core/target/test-classes/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ private String jsonPath(String model) {

private String resourcePath(String path) {
final URL url = CsvTest.class.getResource("/" + path);
String s = url.toString();
// URL converts a space to %20, undo that.
String s = url.toString().replace("%20", " ");
if (s.startsWith("file:")) {
s = s.substring("file:".length());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
*/
public class PigAdapterTest extends AbstractPigTest {

// Undo the %20 replacement of a space by URL
public static final ImmutableMap<String, String> MODEL =
ImmutableMap.of("model",
PigAdapterTest.class.getResource("/model.json").getPath());
PigAdapterTest.class.getResource("/model.json").getPath().replace("%20", " "));

@Test
public void testScanAndFilter() throws Exception {
Expand Down

0 comments on commit 6543c0f

Please sign in to comment.