-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Improve] add unit test #2454
base: master
Are you sure you want to change the base?
[Improve] add unit test #2454
Conversation
Signed-off-by: yuluo-yx <[email protected]>
Signed-off-by: yuluo-yx <[email protected]>
…beat into 0804-yuluo/tets-1
alerter/src/main/java/org/apache/hertzbeat/alert/controller/AlertDefinesController.java
Outdated
Show resolved
Hide resolved
yep. I think so. I am debug in my local. If has new discover, i will push.
I will mark its draft later.
tomsun28 ***@***.***>于2024年8月5日 周一12:37写道:
… ***@***.**** commented on this pull request.
------------------------------
In
alerter/src/main/java/org/apache/hertzbeat/alert/controller/AlertDefinesController.java
<#2454 (comment)>:
> - return ResponseEntity.ok(Message.success(alertDefinePage));
+
+ return ResponseEntity.ok(Message.success(
+ new PageImpl<>(
+ alertDefinePage.getContent(),
+ PageRequest.of(pageIndex, pageSize, Sort.by(new Sort.Order(Sort.Direction.fromString(order), sort))),
+ alertDefinePage.getTotalElements()))
+ );
Hi, it maybe caused by test cases or other reasons. I feel that we cannot
repeat the construction like this.
—
Reply to this email directly, view it on GitHub
<#2454 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASS2GCIP55OT2HPTIBFACADZP36RDAVCNFSM6AAAAABL6OCNHCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDEMJXHE4TGNJZGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@tomsun28 I find question: pls see: spring-projects/spring-data-commons#2987 |
Signed-off-by: yuluo-yx <[email protected]>
…beat into 0804-yuluo/tets-1
👍 it seem this can fix it. spring-projects/spring-data-commons#2987 (comment) add pageModule in jackson |
This would be due to additional class configuration, not sure if there are other side effects, I think it's better to use |
hi, the root cause is the serialization problem of the
|
got it, let me try |
Signed-off-by: yuluo-yx <[email protected]>
Signed-off-by: yuluo-yx <[email protected]>
Signed-off-by: yuluo-yx <[email protected]>
Signed-off-by: YuLuo <[email protected]>
public class JacksonConfiguration { | ||
|
||
@Bean | ||
public Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder(SpringDataJacksonConfiguration.PageModule pageModule) { | ||
|
||
return new Jackson2ObjectMapperBuilder().modules(pageModule); |
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.
hi,this will conflict with current existed JacksonConfig
class
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.
got it, The json serialization piece doesn't look easy to fix. 🤔
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.
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.
I don't think so, this would still report an error inside the unit test because the unit test is only tested against the current class. From the application level it won't.
Maybe there's another solution, let me research it and see 🤔
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.
🤔 🤔 🤔 🤔 🤔
Signed-off-by: yuluo-yx <[email protected]>
common/src/main/java/org/apache/hertzbeat/common/config/MVCConfig.java
Outdated
Show resolved
Hide resolved
Signed-off-by: yuluo-yx <[email protected]>
For this pr, the current state is that it may affect all controllers that use Page as a return value, but it does not affect front-end api calls. It only appears in e2e tests and unit tests, so this pr is in pending status, and will be updated again when there is a better solution for serializing Page objects in spring data jpa. |
No description provided.