Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.8.1
-
Unknown
Description
Here are the steps to reproduce:
- Create the directory target/in.
- Put the file "file.xml" into the directory target/in. Note: the end tag in this file is not closed properly.
- Run the test.
- The test should fail.
- The file "file.xml" remains in the target/in but it should not.
FileLockedTest.java
package org.apache.camel; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; public class FileLockedTest extends CamelTestSupport { @Test public void testFileLocked() throws Exception { MockEndpoint result = getMockEndpoint("mock:result"); result.setAssertPeriod(10000); result.expectedMessageCount(1); result.assertIsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("file:target/in?delay=100&moveFailed=.error") .onException(Throwable.class) .to("mock:result") .end() .to("xslt:FileLockedTest.xsl"); } }; } }
FileLockedTest.xsl
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.computershare.ru/codex/2011/08/" version="1.0"> <xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" /> <xsl:preserve-space elements="*"/> <xsl:template match="/"> <xsl:apply-templates /> </xsl:template> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()" /> </xsl:copy> </xsl:template> </xsl:stylesheet>
file.xml; Note: the end tag is not closed properly
<root></root