Add camel-jackson integration test#505
Conversation
| @Component( | ||
| name = "karaf-camel-jackson-test", | ||
| immediate = true, | ||
| service = CamelJacksonRouteSupplier.class |
There was a problem hiding this comment.
| service = CamelJacksonRouteSupplier.class | |
| service = CamelRouteSupplier.class |
There was a problem hiding this comment.
The expected service is CamelRouteSupplier as you can see in the examples https://github.com/apache/camel-karaf/blob/main/tests/examples/java-dsl-only/src/main/java/org/apache/karaf/camel/examples/test/CamelExampleRouteFirstSupplier.java#L27C19-L27C37
There was a problem hiding this comment.
OK, added a small fix in our archetype for integration tests as well
d08a84c to
e503dde
Compare
|
|
||
| @Override | ||
| public void configureMock(MockEndpoint mock) { | ||
| mock.expectedBodiesReceived("Jack"); |
There was a problem hiding this comment.
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?)
e503dde to
1885380
Compare
1885380 to
0a35359
Compare
| .process(ex -> { | ||
| MyData data = ex.getIn().getBody(MyData.class); | ||
| assertEquals(JSON_SAMPLE_NAME, data.getName()); | ||
| assertEquals(null, data.getNikname()); |
There was a problem hiding this comment.
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")); |
| name = "karaf-camel-${featureNameLower}-test", | ||
| immediate = true, | ||
| service = Camel${featureName}RouteSupplier.class | ||
| service = CamelRouteSupplier.class |
There was a problem hiding this comment.
Could you please move this change to the other PR (#509) which is more related?
There was a problem hiding this comment.
yes, will do it 👍
85c9ae0 to
32729d0
Compare
Fixes #503: Add an integration test for camel-jackson and fix the feature if needed