Skip to content
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

Fix a bug where a JSON file cannot be watched and fetched as String #511

Merged
merged 7 commits into from
Apr 20, 2020

Conversation

minwoox
Copy link
Contributor

@minwoox minwoox commented Apr 6, 2020

Motivation:
A user might want to watch and fetch a JSON file as String. Currently, it's not possible.

Modifications:

  • Add IDENTITY_TEXT and IDENTITY_JSON to QueryType.
  • Remove JSON related annotations in Query and its subclasses.
    • Query is not directly (de)serialized into JSON.
    • Remove QueryDto and NamedQueryDto which are not used.

Result:

  • You can now fetch and watch a JSON as String.

Motivation:
A user might want to watch and fetch a JSON file as String. Currently, it's not possible.

Modifications:
- Add `contetType` to `Query` which indicates the type of the file being queried.
- Remove JSON related annotations in `Query` and its subclases.
  - `Query` is not directly (de)serialized into JSON.
  - Remove `QueryDto` and `NamedQueryDto` which are not used.

Result:
- You can now fetch and watch a JSON as String.
@minwoox minwoox added the defect label Apr 6, 2020
@minwoox minwoox added this to the 0.44.9 milestone Apr 6, 2020
@minwoox minwoox requested review from ikhoon and trustin as code owners April 6, 2020 06:51
@codecov
Copy link

codecov bot commented Apr 6, 2020

Codecov Report

Merging #511 into master will increase coverage by 0.16%.
The diff coverage is 63.15%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #511      +/-   ##
============================================
+ Coverage     69.58%   69.74%   +0.16%     
- Complexity     3152     3168      +16     
============================================
  Files           327      325       -2     
  Lines         12755    12747       -8     
  Branches       1356     1362       +6     
============================================
+ Hits           8875     8891      +16     
+ Misses         3021     2994      -27     
- Partials        859      862       +3     
Impacted Files Coverage Δ Complexity Δ
...n/java/com/linecorp/centraldogma/common/Entry.java 89.79% <ø> (ø) 28.00 <0.00> (ø)
...centraldogma/server/internal/api/TokenService.java 73.68% <ø> (-0.68%) 18.00 <0.00> (ø)
...ogma/server/storage/repository/RepositoryUtil.java 86.56% <0.00%> (-1.50%) 21.00 <0.00> (+1.00) ⬇️
...internal/storage/DirectoryBasedStorageManager.java 63.75% <22.22%> (ø) 43.00 <1.00> (ø)
...ogma/client/armeria/legacy/LegacyCentralDogma.java 82.74% <35.29%> (+1.30%) 91.00 <4.00> (+3.00)
...n/java/com/linecorp/centraldogma/common/Query.java 46.15% <50.00%> (-8.40%) 5.00 <2.00> (ø)
...ntraldogma/client/armeria/ArmeriaCentralDogma.java 71.99% <76.92%> (-0.04%) 109.00 <5.00> (+5.00) ⬇️
...corp/centraldogma/internal/client/FileWatcher.java 77.77% <100.00%> (ø) 3.00 <0.00> (ø)
...p/centraldogma/internal/thrift/QueryConverter.java 76.47% <100.00%> (+7.23%) 9.00 <0.00> (+4.00)
...om/linecorp/centraldogma/common/IdentityQuery.java 89.47% <100.00%> (-1.44%) 9.00 <3.00> (-1.00)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfd055a...4d37003. Read the comment docs.

Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! @minwoox

@@ -894,7 +897,7 @@ private static Revision watchRepository(AggregatedHttpResponse res) {
return client.execute(builder.build()).aggregate()
.handle((res, cause) -> {
if (cause == null) {
return func.apply(res);
return func.apply(res, queryType);
}

if ((cause instanceof ClosedSessionException ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could remove ClosedSessionException (not related to this PR 😉)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah fixed. Thanks! 😄

@trustin trustin merged commit d63a0b2 into line:master Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants