Skip to content

Commit

Permalink
Updating GlobalContextHandler.updateTemplate() to use toDocumentSourc…
Browse files Browse the repository at this point in the history
…e instead of toXContent()

Signed-off-by: Joshua Palis <[email protected]>
  • Loading branch information
joshpalis committed Oct 12, 2023
1 parent afeb2b6 commit bbe8eff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void updateTemplate(String documentId, Template template, ActionListener<
XContentBuilder builder = XContentFactory.jsonBuilder();
ThreadContext.StoredContext context = client.threadPool().getThreadContext().stashContext()
) {
request.source(template.toXContent(builder, ToXContent.EMPTY_PARAMS))
request.source(template.toDocumentSource(builder, ToXContent.EMPTY_PARAMS))
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
client.index(request, ActionListener.runBefore(listener, () -> context.restore()));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void testStoreResponseToGlobalContext() {
public void testUpdateTemplate() throws IOException {
Template template = mock(Template.class);
ActionListener<IndexResponse> listener = mock(ActionListener.class);
when(template.toXContent(any(XContentBuilder.class), eq(ToXContent.EMPTY_PARAMS))).thenAnswer(invocation -> {
when(template.toDocumentSource(any(XContentBuilder.class), eq(ToXContent.EMPTY_PARAMS))).thenAnswer(invocation -> {
XContentBuilder builder = invocation.getArgument(0);
return builder;
});
Expand Down

0 comments on commit bbe8eff

Please sign in to comment.