Skip to content

Commit

Permalink
Fix classpath
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed Jan 8, 2024
1 parent 68f83de commit dede991
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private void shouldUpdateIndex(String indexName, Integer newVersion, ActionListe
* @throws IOException IOException if mapping file can't be read correctly
*/
public static String getIndexMappings(String mapping) throws IOException {
return ParseUtils.resourceToString(mapping);
return ParseUtils.resourceToString("/" + mapping);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static WorkflowValidator parse(XContentParser parser) throws IOException
* @throws IOException on failure to read and parse the json file
*/
public static WorkflowValidator parse(String file) throws IOException {
String json = ParseUtils.resourceToString(file);
String json = ParseUtils.resourceToString("/" + file);
return parse(ParseUtils.jsonToParser(json));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
public class TestHelpers {

public static Template createTemplateFromFile(String fileName) throws IOException {
String json = ParseUtils.resourceToString("template/" + fileName);
String json = ParseUtils.resourceToString("/template/" + fileName);
return Template.parse(json);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@

public class ParseUtilsTests extends OpenSearchTestCase {
public void testResourceToStringToJson() throws IOException {
String json = ParseUtils.resourceToString("template/finaltemplate.json");
String json = ParseUtils.resourceToString("/template/finaltemplate.json");
assertTrue(json.startsWith("{"));
assertTrue(json.contains("name"));
System.err.println(json);
try (XContentParser parser = ParseUtils.jsonToParser(json)) {
assertEquals(Token.FIELD_NAME, parser.currentToken());
assertEquals("name", parser.text());
assertEquals(Token.FIELD_NAME, parser.nextToken());
assertEquals("name", parser.currentName());
}
}

Expand Down

0 comments on commit dede991

Please sign in to comment.