Repository navigation
make 0.13 tasks API backwards compatible with 0.12 (#6333) #6334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
98d131b
Replace statusCode with status (#6333)
e5c99a3
Add unit test
5908cb3
Add status param to TaskStatusPlus
6179544
Merge branch 'master' of github.com:druid-io/druid into rename-status
907837d
Add additional status member to TaskStatusPlus
36a9892
Merge branch 'master' of github.com:druid-io/druid into rename-status
4e51de7
Change TaskResponseObject to match overlord's response object
c212919
Merge branch 'master' of github.com:druid-io/druid into rename-status
4c700c0
Address PR comments
6023fb2
Merge branch 'master' of github.com:druid-io/druid into rename-status
8e0114a
address comments
39829ac
Merge branch 'master' of github.com:druid-io/druid into rename-status
668ca77
Merge branch 'master' of github.com:druid-io/druid into rename-status
d4dbbad
Add runtime exception after logging error
530285d
Merge branch 'master' of github.com:druid-io/druid into rename-status
a9bb366
Remove (deprecated)status member variable from TaskStatusPlus
46d558d
Merge branch 'master' of github.com:druid-io/druid into rename-status
08285d4
Minor change
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,45 @@ public void testSerde() throws IOException | |
| Assert.assertEquals(status, mapper.readValue(json, TaskStatusPlus.class)); | ||
| } | ||
|
|
||
| @Test | ||
| public void testJsonAttributes() throws IOException | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks!! |
||
| { | ||
| final ObjectMapper mapper = new ObjectMapper(); | ||
| mapper.registerModule( | ||
| new SimpleModule() | ||
| .addDeserializer(DateTime.class, new DateTimeDeserializer()) | ||
| .addSerializer(DateTime.class, ToStringSerializer.instance) | ||
| ); | ||
| final String json = "{\n" | ||
| + "\"id\": \"testId\",\n" | ||
| + "\"type\": \"testType\",\n" | ||
| + "\"createdTime\": \"2018-09-17T06:35:17.392Z\",\n" | ||
| + "\"queueInsertionTime\": \"2018-09-17T06:35:17.392Z\",\n" | ||
| + "\"statusCode\": \"RUNNING\",\n" | ||
| + "\"status\": \"RUNNING\",\n" | ||
| + "\"runnerStatusCode\": \"RUNNING\",\n" | ||
| + "\"duration\": 1000,\n" | ||
| + "\"location\": {\n" | ||
| + "\"host\": \"testHost\",\n" | ||
| + "\"port\": 1010,\n" | ||
| + "\"tlsPort\": -1\n" | ||
| + "},\n" | ||
| + "\"dataSource\": \"ds_test\",\n" | ||
| + "\"errorMsg\": null\n" | ||
| + "}"; | ||
| TaskStatusPlus taskStatusPlus = mapper.readValue(json, TaskStatusPlus.class); | ||
| Assert.assertNotNull(taskStatusPlus); | ||
| Assert.assertNotNull(taskStatusPlus.getStatusCode()); | ||
| Assert.assertTrue(taskStatusPlus.getStatusCode().isRunnable()); | ||
| Assert.assertNotNull(taskStatusPlus.getRunnerStatusCode()); | ||
|
|
||
| String serialized = mapper.writeValueAsString(taskStatusPlus); | ||
|
|
||
| Assert.assertTrue(serialized.contains("\"status\":")); | ||
| Assert.assertTrue(serialized.contains("\"statusCode\":")); | ||
| Assert.assertTrue(serialized.contains("\"runnerStatusCode\":")); | ||
| } | ||
|
|
||
| // Copied from org.apache.druid.jackson.JodaStuff | ||
| private static class DateTimeDeserializer extends StdDeserializer<DateTime> | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For deserialization safety, can you add something here like:
I don't think there should be a situation where new code would be trying to deserialize an old TaskStatusPlus if the rolling upgrade sequence is followed, but I think it'd be good to handle that situation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added the checks