tmdonalds opened a new issue, #4000:
URL: https://github.com/apache/camel-quarkus/issues/4000

   The CamelContext is not cleaning up the routes across unit tests. I am 
running into an issue where the unit tests are failing because the routes were 
already created in another test. 
   
   `
   @QuarkusTest
   public class RouteTest {
       @Inject
       CamelContext camelContext;
   
       private static boolean initialized = false;
   
       @BeforeEach
       public void init() throws Exception {
   
           System.out.println("RouteTest : Initialized is : " + initialized);
   
           if(initialized) {
               return;
           }
   
           initialized = true;
   
           this.camelContext.addRoutes(new RouteBuilder() {
               @Override
               public void configure() throws Exception {
                   from("direct:prepareItems")
                           .to("mock:result");
                   from("direct:writeItemst").to("mock:outputResult");
               }
           });
   
       }
   
       @Test
       public void testRoutes(){
           this.camelContext.start();
   
           System.out.println("****** Routes ****** \n");
           camelContext.getRoutes().forEach(route -> 
System.out.println(route.getRouteId()));
           System.out.println("\n");
   
       }
   
       @Test
       public void testRoutes2(){
           this.camelContext.start();
   
           System.out.println("****** Routes ****** \n");
           camelContext.getRoutes().forEach(route -> 
System.out.println(route.getRouteId()));
           System.out.println("\n");
   
       }
   }
   `
   
   `@QuarkusTest
   public class RouteTwoTest {
       @Inject
       CamelContext camelContext;
   
       private static boolean initialized = false;
   
       @BeforeEach
       public void init() throws Exception {
   
           System.out.println("RouteTest : Initialized is : " + initialized);
   
           if(initialized) {
               return;
           }
   
           initialized = true;
   
           this.camelContext.addRoutes(new RouteBuilder() {
               @Override
               public void configure() throws Exception {
                   from("direct:prepareItems")
                           .to("mock:result");
                   from("direct:writeItemst").to("mock:outputResult");
               }
           });
   
       }
   
       @Test
       public void testRoutes(){
           this.camelContext.start();
   
           System.out.println("****** Routes ****** \n");
           camelContext.getRoutes().forEach(route -> 
System.out.println(route.getRouteId()));
           System.out.println("\n");
   
       }
   
       @Test
       public void testRoutes2(){
           this.camelContext.start();
   
           System.out.println("****** Routes ****** \n");
           camelContext.getRoutes().forEach(route -> 
System.out.println(route.getRouteId()));
           System.out.println("\n");
   
       }
   }`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to