Hi, 

I have tried the Junit5 / spring-boot example as well. Does not work either, 
unfortunately. 

The difference with the sample in github is that I am trying to run an actual 
webserver in my test listening on a certain port, the example is only running a 
timer router. 

I have tried to modify the example to run as a webserver, but that gives me 
problems as well. 

Regards
Evert-Jan


-----Oorspronkelijk bericht-----
Van: Claus Ibsen <claus.ib...@gmail.com> 
Verzonden: vrijdag 3 september 2021 17:09
Aan: users@camel.apache.org
Onderwerp: Re: CamelSpringBootRunner no longer working since 3.5.0?

Hi

Take a look at the camel-spring-boot example how its unit tested 
https://github.com/apache/camel-spring-boot-examples/blob/main/spring-boot/src/test/java/sample/camel/MyCamelApplicationJUnit5Test.java

You should not use @RuntWith anymore

On Fri, Sep 3, 2021 at 4:33 PM Evert-Jan de Bruin 
<evert-jan.de.br...@caci.nl.invalid> wrote:
>
> Hello,
>
>
>
> We are currently (happily) using Camel 3.4.4.
>
>
>
> When trying to upgrade to any version beyond 3.5.0 (also 3.11.1), our 
> integration tests won’t run anymore. At first it complained about the 
> @LocalServerPort annotation not working, but it turned out the spring boot 
> (including the webserver) just wasn’t loading properly.
>
>
>
> I have reduced it to a very simple testcase:
>
> @SpringBootTest(classes = StudentMain.class, webEnvironment = 
> SpringBootTest.WebEnvironment.DEFINED_PORT)
>
> @ActiveProfiles("integrationtest")
>
> @RunWith(CamelSpringBootRunner.class)
>
> public class ConfigsRouteBuilderTest  {
>
>
>
>     private int port = 8080;
>
>
>
>     @Test
>
>     public void testConfigsRoute() throws Exception {
>
>         HttpEntity<String> httpEntity = new HttpEntity<String>(new 
> HttpHeaders());
>
>         String uri = 
> String.format(http://localhost:%d/integrationtest/hello, port);
>
>         ResponseEntity<String> response = new 
> RestTemplate().exchange(uri, HttpMethod.GET, httpEntity, 
> String.class);
>
>
>
>         assertEquals("<text>hello world!</text>", response.getBody());
>
>     }
>
>
>
> }
>
>
> When I try to run this test with 3.4.4, it runs fine. When I try to run it 
> with Apache camel 3.5.0 or 3.11.1, it is simply not starting right. The 
> CampelSpringBootRunner does not seem to kick into action. There is no spring 
> boot logo, no tomcat starting and the test obviously fails with “I/O error on 
> GET request for http://localhost:8080/integrationtest/hello: Connection 
> refused”
>
> Does anyone know what I miss to get things going? Do I need to use different 
> annotations since 3.5.0?
>
> I have also tested with jUnit5 instead of 4, this didn’t make a difference.
>
> I am new to this group and not sure if this group allows attachments, but I 
> have added my pom.xml for reference and could provide a ZIP of the whole 
> testcase as well.
>
> Regards,
> Evert-Jan
>
>
>
>
>
>
>
> Evert-Jan de Bruin | Software Architect | CACI bv | De Ruijterkade 7, 
> 1013 AA Amsterdam | +31 (088) 654 35 00 | evert-jan.de.br...@caci.nl | 
> www.caci.nl
>
>



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to