Skip to content

Commit

Permalink
Revert change back to json string
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho committed Sep 27, 2023
1 parent 9c5ffb8 commit 03aba02
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 31 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ protected void doExecute(
DataSourceMetadata dataSourceMetadata = request.getDataSourceMetadata();
dataSourceService.createDataSource(dataSourceMetadata);
String responseContent =
new JsonResponseFormatter<CreateUpdateDatasourceResponse>(PRETTY) {
new JsonResponseFormatter<String>(PRETTY) {
@Override
protected Object buildJsonObject(CreateUpdateDatasourceResponse response) {
protected Object buildJsonObject(String response) {
return response;
}
}.format(
new CreateUpdateDatasourceResponse(
"Created DataSource with name " + dataSourceMetadata.getName()));
}.format("Created DataSource with name " + dataSourceMetadata.getName());
actionListener.onResponse(new CreateDataSourceActionResponse(responseContent));
} catch (Exception e) {
actionListener.onFailure(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ protected void doExecute(
try {
dataSourceService.updateDataSource(request.getDataSourceMetadata());
String responseContent =
new JsonResponseFormatter<CreateUpdateDatasourceResponse>(PRETTY) {
new JsonResponseFormatter<String>(PRETTY) {
@Override
protected Object buildJsonObject(CreateUpdateDatasourceResponse response) {
protected Object buildJsonObject(String response) {
return response;
}
}.format(
new CreateUpdateDatasourceResponse(
"Updated DataSource with name " + request.getDataSourceMetadata().getName()));
}.format("Updated DataSource with name " + request.getDataSourceMetadata().getName());
actionListener.onResponse(new UpdateDataSourceActionResponse(responseContent));
} catch (Exception e) {
actionListener.onFailure(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,15 @@ public void testDoExecute() {
.onResponse(createDataSourceActionResponseArgumentCaptor.capture());
CreateDataSourceActionResponse createDataSourceActionResponse =
createDataSourceActionResponseArgumentCaptor.getValue();
JsonResponseFormatter<CreateUpdateDatasourceResponse> jsonResponseFormatter =
JsonResponseFormatter<String> jsonResponseFormatter =
new JsonResponseFormatter<>(JsonResponseFormatter.Style.PRETTY) {
@Override
protected Object buildJsonObject(CreateUpdateDatasourceResponse response) {
protected Object buildJsonObject(String response) {
return response;
}
};
Assertions.assertEquals(
jsonResponseFormatter.format(
new CreateUpdateDatasourceResponse("Created DataSource with name test_datasource")),
jsonResponseFormatter.format("Created DataSource with name test_datasource"),
createDataSourceActionResponse.getResult());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,16 @@ public void testDoExecute() {
.onResponse(updateDataSourceActionResponseArgumentCaptor.capture());
UpdateDataSourceActionResponse updateDataSourceActionResponse =
updateDataSourceActionResponseArgumentCaptor.getValue();

JsonResponseFormatter<CreateUpdateDatasourceResponse> jsonResponseFormatter =
JsonResponseFormatter<String> jsonResponseFormatter =
new JsonResponseFormatter<>(JsonResponseFormatter.Style.PRETTY) {
@Override
protected Object buildJsonObject(CreateUpdateDatasourceResponse response) {
protected Object buildJsonObject(String response) {
return response;
}
};

Assertions.assertEquals(
jsonResponseFormatter.format(
new CreateUpdateDatasourceResponse("Updated DataSource with name test_datasource")),
jsonResponseFormatter.format("Updated DataSource with name test_datasource"),
updateDataSourceActionResponse.getResult());
}

Expand Down

0 comments on commit 03aba02

Please sign in to comment.