Skip to content

Add camel-jackson integration test#505

Merged
essobedo merged 3 commits intoapache:mainfrom
Talend:stataru/fix/camel-jackson
Sep 27, 2024
Merged

Add camel-jackson integration test#505
essobedo merged 3 commits intoapache:mainfrom
Talend:stataru/fix/camel-jackson

Conversation

@stataru8
Copy link
Collaborator

Fixes #503: Add an integration test for camel-jackson and fix the feature if needed

@Component(
name = "karaf-camel-jackson-test",
immediate = true,
service = CamelJacksonRouteSupplier.class
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
service = CamelJacksonRouteSupplier.class
service = CamelRouteSupplier.class

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, added a small fix in our archetype for integration tests as well

@stataru8 stataru8 force-pushed the stataru/fix/camel-jackson branch from d08a84c to e503dde Compare September 26, 2024 09:13

@Override
public void configureMock(MockEndpoint mock) {
mock.expectedBodiesReceived("Jack");
Copy link
Contributor

Choose a reason for hiding this comment

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

I would more expect that you override the method getBodyToSend to send a JSon payload, in the producer you first unmarshal it, add assertions to check the values of getName and getAge, finally the producer marshals it, and the test checks that the result is the expected JSon payload (same as what has been sent?)

@stataru8 stataru8 force-pushed the stataru/fix/camel-jackson branch from e503dde to 1885380 Compare September 26, 2024 17:07
@stataru8 stataru8 force-pushed the stataru/fix/camel-jackson branch from 1885380 to 0a35359 Compare September 26, 2024 17:40
.process(ex -> {
MyData data = ex.getIn().getBody(MyData.class);
assertEquals(JSON_SAMPLE_NAME, data.getName());
assertEquals(null, data.getNikname());
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use assertNull instead

ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(data);
assertEquals(JSON_SAMPLE_NAME, jsonNode.get("name").asText());
assertEquals(null, jsonNode.get("nikname"));
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

name = "karaf-camel-${featureNameLower}-test",
immediate = true,
service = Camel${featureName}RouteSupplier.class
service = CamelRouteSupplier.class
Copy link
Contributor

@essobedo essobedo Sep 27, 2024

Choose a reason for hiding this comment

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

Could you please move this change to the other PR (#509) which is more related?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, will do it 👍

@stataru8 stataru8 force-pushed the stataru/fix/camel-jackson branch from 85c9ae0 to 32729d0 Compare September 27, 2024 09:37
@essobedo essobedo merged commit 4194d52 into apache:main Sep 27, 2024
@essobedo essobedo deleted the stataru/fix/camel-jackson branch September 27, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add camel-jackson integration test

2 participants