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

[Improve] add unit test #2454

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

yuluo-yx
Copy link
Contributor

@yuluo-yx yuluo-yx commented Aug 4, 2024

No description provided.

Signed-off-by: yuluo-yx <[email protected]>
@yuluo-yx
Copy link
Contributor Author

yuluo-yx commented Aug 5, 2024 via email

@yuluo-yx yuluo-yx marked this pull request as draft August 5, 2024 06:42
@yuluo-yx
Copy link
Contributor Author

yuluo-yx commented Aug 5, 2024

@tomsun28 I find question: pls see: spring-projects/spring-data-commons#2987

@yuluo-yx yuluo-yx marked this pull request as ready for review August 5, 2024 07:49
@tomsun28
Copy link
Contributor

tomsun28 commented Aug 5, 2024

@tomsun28 I find question: pls see: spring-projects/spring-data-commons#2987

👍 it seem this can fix it. spring-projects/spring-data-commons#2987 (comment) add pageModule in jackson

@yuluo-yx
Copy link
Contributor Author

yuluo-yx commented Aug 5, 2024

@tomsun28 I find question: pls see: spring-projects/spring-data-commons#2987

👍 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 new PageImpl to be safe. 🤔

@yuluo-yx yuluo-yx closed this Aug 5, 2024
@yuluo-yx yuluo-yx deleted the 0804-yuluo/tets-1 branch August 5, 2024 09:50
@tomsun28
Copy link
Contributor

tomsun28 commented Aug 5, 2024

This would be due to additional class configuration, not sure if there are other side effects, I think it's better to use new PageImpl to be safe. 🤔

hi, the root cause is the serialization problem of the page. It is recommended that we solve the problem instead of circumventing it. we has the custom jackson config here like timemodule https://github.com/apache/hertzbeat/blob/master/manager/src/main/java/org/apache/hertzbeat/manager/config/JacksonConfig.java

builder.modules(new SpringDataJacksonConfiguration.PageModule());

@yuluo-yx yuluo-yx restored the 0804-yuluo/tets-1 branch August 5, 2024 09:58
@yuluo-yx yuluo-yx reopened this Aug 5, 2024
@yuluo-yx
Copy link
Contributor Author

yuluo-yx commented Aug 5, 2024

hi, the root cause is the serialization problem of the page. It is recommended that we solve the problem instead of circumventing it. we has the custom jackson config here like timemodule https://github.com/apache/hertzbeat/blob/master/manager/src/main/java/org/apache/hertzbeat/manager/config/JacksonConfig.java

builder.modules(new SpringDataJacksonConfiguration.PageModule());

got it, let me try

@yuluo-yx
Copy link
Contributor Author

yuluo-yx commented Aug 7, 2024

@tomsun28 hi, This e2e error is probably caused by #2486, I think we can run the ci test again after the #2486 merge.

cc @crossoverJie

Comment on lines 33 to 38
public class JacksonConfiguration {

@Bean
public Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder(SpringDataJacksonConfiguration.PageModule pageModule) {

return new Jackson2ObjectMapperBuilder().modules(pageModule);
Copy link
Contributor

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

Copy link
Contributor Author

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. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

how about add builder.modules(new SpringDataJacksonConfiguration.PageModule()); in JacksonConfig like this.

image

Copy link
Contributor Author

@yuluo-yx yuluo-yx Aug 7, 2024

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 🤔

Copy link
Contributor

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]>
@yuluo-yx
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants