Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.12.1
-
None
-
windows 7
-
Unknown
Description
I've tried to test some route with JUnit test declared like below
@RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration(classes = CoreRouterConfiguration.class, loader = CamelSpringDelegatingTestContextLoader.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class RouteTestBase { @Produce protected ProducerTemplate producerTemplate; @Autowired protected ModelCamelContext context; }
Camel context starts and then it's beeing shutdown. It there's a FileIdempotentRepository with nonexisting path then camel contexf fails to shutdown with exception
Caused by: java.io.FileNotFoundException: .\TempData\meta\mrdf-idempotent.dat (The system cannot find the path specified) at java.io.FileOutputStream.open(Native Method) ~[na:1.7.0_40] at java.io.FileOutputStream.<init>(FileOutputStream.java:221) ~[na:1.7.0_40] at java.io.FileOutputStream.<init>(FileOutputStream.java:171) ~[na:1.7.0_40] at org.apache.camel.processor.idempotent.FileIdempotentRepository.trunkStore(FileIdempotentRepository.java:256) ~[camel-core-2.12.1.jar:2.12.1] ... 50 common frames omitted
I guess it could be fixed like in a workaround below
public class FileIdempotentRepositoryEx extends FileIdempotentRepository { @Override protected void trunkStore() { if(getFileStore().exists()){ super.trunkStore(); } } }