Skip to content

Commit

Permalink
addressing more comments and adding more UT
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
  • Loading branch information
amitgalitz committed Mar 15, 2024
1 parent 88610c6 commit cdb6459
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient cli
}
}
} catch (Exception ex) {

Check warning on line 139 in src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java#L138-L139

Added lines #L138 - L139 were not covered by tests
RestStatus status = ex instanceof IOException ? RestStatus.BAD_REQUEST : ExceptionsHelper.status(ex);
String errorMessage = "failure parsing request body when a use case is given";
logger.error(errorMessage, ex);
throw new FlowFrameworkException(errorMessage, ExceptionsHelper.status(ex));
throw new FlowFrameworkException(errorMessage, status);
}

Check warning on line 144 in src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/flowframework/rest/RestCreateWorkflowAction.java#L141-L144

Added lines #L141 - L144 were not covered by tests

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ public static String resourceToString(String path) throws IOException {
public static void buildStringToStringMap(XContentBuilder xContentBuilder, Map<?, ?> map) throws IOException {
xContentBuilder.startObject();
for (Entry<?, ?> e : map.entrySet()) {
String key = (String) e.getKey();
String value = (String) e.getValue();
xContentBuilder.field((String) e.getKey(), (String) e.getValue());
}
xContentBuilder.endObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testConditionallySubstituteWithNoPlaceholders() {

Object result = ParseUtils.conditionallySubstitute(input, outputs, params);

assertEquals("This string has no placeholders", result, "String should remain unchanged");
assertEquals("This string has no placeholders", result);
}

public void testConditionallySubstituteWithUnmatchedPlaceholders() {
Expand All @@ -107,7 +107,7 @@ public void testConditionallySubstituteWithUnmatchedPlaceholders() {

Object result = ParseUtils.conditionallySubstitute(input, outputs, params);

assertEquals("This string has unmatched ${{placeholder}}", result, "String should remain unchanged due to unmatched placeholders");
assertEquals("This string has unmatched ${{placeholder}}", result);
}

public void testConditionallySubstituteWithOutputsSubstitution() {
Expand Down

0 comments on commit cdb6459

Please sign in to comment.