This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new eb1ec1e5db3 Fix ModelParserTest on Windows (#11595)
eb1ec1e5db3 is described below
commit eb1ec1e5db32b9b372e6a71ebb0f0cb7cf4a7d8f
Author: Aurélien Pupier <[email protected]>
AuthorDate: Thu Sep 28 13:30:43 2023 +0200
Fix ModelParserTest on Windows (#11595)
Signed-off-by: Aurélien Pupier <[email protected]>
---
.../org/apache/camel/xml/in/ModelParserTest.java | 30 +++++++++-------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git
a/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java
b/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java
index e64dd499829..be4d5a5595c 100644
---
a/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java
+++
b/core/camel-xml-io/src/test/java/org/apache/camel/xml/in/ModelParserTest.java
@@ -16,13 +16,20 @@
*/
package org.apache.camel.xml.in;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
@@ -31,8 +38,6 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.w3c.dom.Document;
-
import org.apache.camel.model.FromDefinition;
import org.apache.camel.model.PropertyDefinition;
import org.apache.camel.model.RouteConfigurationDefinition;
@@ -53,14 +58,7 @@ import org.apache.camel.model.rest.RestsDefinition;
import org.apache.camel.model.rest.VerbDefinition;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertInstanceOf;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertSame;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.w3c.dom.Document;
public class ModelParserTest {
@@ -422,12 +420,8 @@ public class ModelParserTest {
}
private Path getResourceFolder() {
- String url =
getClass().getClassLoader().getResource("barInterceptorRoute.xml").toString();
- if (url.startsWith("file:")) {
- url = url.substring("file:".length(),
url.indexOf("barInterceptorRoute.xml"));
- } else if (url.startsWith("jar:file:")) {
- url = url.substring("jar:file:".length(), url.indexOf('!'));
- }
- return Paths.get(url);
+ String childFileString =
getClass().getClassLoader().getResource("barInterceptorRoute.xml").getFile();
+ File parentFile = new File(childFileString).getParentFile();
+ return parentFile.toPath();
}
}