This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 86d954aa17e49e8ff4e0fcffa5678e0e0e8a592b Author: James Netherton <[email protected]> AuthorDate: Mon Feb 7 11:03:03 2022 +0000 Fix build on windows Fixes #1429 --- .gitattributes | 3 ++ docs/pom.xml | 4 +- .../quarkus/core/deployment/CamelProcessor.java | 3 +- .../quarkus/core/deployment/util/PathFilter.java | 4 +- .../core/deployment/util/PathFilterTest.java | 21 ++++++++- .../apache/camel/quarkus/core/util/FileUtils.java | 52 ++++++++++++++++++++++ .../csimple/deployment/CSimpleProcessor.java | 3 +- .../aws2-quarkus-client/aws2-ddb/pom.xml | 2 +- .../aws2-quarkus-client/aws2-s3/pom.xml | 2 +- .../aws2-quarkus-client/aws2-ses/pom.xml | 2 +- .../aws2-quarkus-client/aws2-sqs-sns/pom.xml | 2 +- .../aws2-quarkus-client/aws2-sqs/pom.xml | 2 +- integration-test-groups/aws2/aws2-s3/pom.xml | 2 +- integration-tests/aws2-grouped/pom.xml | 2 +- .../aws2-quarkus-client-grouped/pom.xml | 12 ++--- integration-tests/azure-grouped/pom.xml | 2 +- .../component/dataformats/json/ParamType.java | 36 --------------- .../dataformats/json/JsonComponentsTest.java | 4 +- .../quarkus/component/dozer/it/DozerTest.java | 4 +- .../camel/quarkus/component/file/it/FileTest.java | 9 +++- .../component/flatpack/it/FlatpackTest.java | 3 +- integration-tests/foundation-grouped/pom.xml | 2 +- .../camel/quarkus/component/jslt/it/JsltTest.java | 6 +++ integration-tests/mongodb-grouped/pom.xml | 2 +- .../stringtemplate/it/StringtemplateTest.java | 2 +- pom.xml | 9 ++-- poms/build-parent/pom.xml | 2 +- 27 files changed, 127 insertions(+), 70 deletions(-) diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f7163f6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.cmd text eol=crlf + diff --git a/docs/pom.xml b/docs/pom.xml index 8407d69..0c49cd4 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -44,7 +44,7 @@ </goals> <phase>validate</phase> <configuration> - <source>file://${maven.multiModuleProjectDirectory}/tooling/scripts/update-antora-config.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/update-antora-config.groovy</source> <properties> <maven.multiModuleProjectDirectory>${maven.multiModuleProjectDirectory}</maven.multiModuleProjectDirectory> </properties> @@ -57,7 +57,7 @@ </goals> <phase>validate</phase> <configuration> - <source>file://${maven.multiModuleProjectDirectory}/tooling/scripts/update-antora-yaml.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/update-antora-yaml.groovy</source> <properties> <maven.multiModuleProjectDirectory>${maven.multiModuleProjectDirectory}</maven.multiModuleProjectDirectory> </properties> diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelProcessor.java index 0440d7b..77e8eb7 100644 --- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelProcessor.java +++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelProcessor.java @@ -73,6 +73,7 @@ import org.apache.camel.quarkus.core.deployment.spi.ContainerBeansBuildItem; import org.apache.camel.quarkus.core.deployment.spi.RoutesBuilderClassExcludeBuildItem; import org.apache.camel.quarkus.core.deployment.util.CamelSupport; import org.apache.camel.quarkus.core.deployment.util.PathFilter; +import org.apache.camel.quarkus.core.util.FileUtils; import org.apache.camel.spi.TypeConverterLoader; import org.apache.camel.spi.TypeConverterRegistry; import org.jboss.jandex.AnnotationTarget; @@ -328,7 +329,7 @@ class CamelProcessor { camelServices.forEach(service -> { recorder.factoryFinderResolverEntry( builder, - service.path.toString(), + FileUtils.nixifyPath(service.path), CamelSupport.loadClass(service.type, TCCL)); }); diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/PathFilter.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/PathFilter.java index 31965b1..1333438 100644 --- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/PathFilter.java +++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/util/PathFilter.java @@ -29,6 +29,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.apache.camel.quarkus.core.util.FileUtils; import org.apache.camel.util.AntPathMatcher; import org.apache.camel.util.ObjectHelper; import org.jboss.jandex.DotName; @@ -118,6 +119,7 @@ public class PathFilter { .map(rootPath::relativize) .map(Path::toString) .map(stringPath -> stringPath.substring(0, stringPath.length() - CLASS_SUFFIX_LENGTH)) + .map(FileUtils::nixifyPath) .filter(stringPredicate) .map(slashClassName -> slashClassName.replace('/', '.')) .forEach(resultConsumer::accept); @@ -133,7 +135,7 @@ public class PathFilter { } static String sanitize(String path) { - path = path.trim(); + path = FileUtils.nixifyPath(path.trim()); return (!path.isEmpty() && path.charAt(0) == '/') ? path.substring(1) : path; diff --git a/extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/util/PathFilterTest.java b/extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/util/PathFilterTest.java index 7b7e16b..9ca7ea0 100644 --- a/extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/util/PathFilterTest.java +++ b/extensions-core/core/deployment/src/test/java/org/apache/camel/quarkus/core/deployment/util/PathFilterTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.quarkus.core.deployment.util; +import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; @@ -25,6 +26,7 @@ import java.util.TreeSet; import java.util.function.Predicate; import java.util.stream.Stream; +import org.apache.camel.util.FileUtil; import org.jboss.jandex.DotName; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -69,7 +71,24 @@ public class PathFilterTest { @Test public void pathFilter() { - Predicate<Path> predicate = new PathFilter.Builder() + PathFilter.Builder builder = new PathFilter.Builder(); + Stream.of("/foo/bar/*", "moo/mar/*") + .forEach(path -> { + if (FileUtil.isWindows()) { + path = path.replace("/", File.pathSeparator); + } + builder.include(path); + }); + + Stream.of("/foo/baz/*", "moo/maz/*") + .forEach(path -> { + if (FileUtil.isWindows()) { + path = path.replace("/", File.pathSeparator); + } + builder.exclude(path); + }); + + Predicate<Path> predicate = builder .include("/foo/bar/*") .include("moo/mar/*") .exclude("/foo/baz/*") diff --git a/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/util/FileUtils.java b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/util/FileUtils.java new file mode 100644 index 0000000..0b1133d --- /dev/null +++ b/extensions-core/core/runtime/src/main/java/org/apache/camel/quarkus/core/util/FileUtils.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.core.util; + +import java.io.File; +import java.nio.file.Path; + +import org.apache.camel.util.FileUtil; + +public final class FileUtils { + + private FileUtils() { + // Utility class + } + + /** + * Converts non-*nix path separator characters to the *nix alternative + * + * @param path The {@link java.nio.file.Path} to convert + * @return String representation of the path with *nix separators + */ + public static String nixifyPath(Path path) { + return nixifyPath(path.toString()); + } + + /** + * Converts non-*nix path separator characters to the *nix alternative + * + * @param path The path String to convert + * @return String representation of the path with *nix separators + */ + public static String nixifyPath(String path) { + if (FileUtil.isWindows()) { + return path.replace(File.separatorChar, '/'); + } + return path; + } +} diff --git a/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleProcessor.java b/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleProcessor.java index 9e5f0bd..15db109 100644 --- a/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleProcessor.java +++ b/extensions/csimple/deployment/src/main/java/org/apache/camel/quarkus/component/csimple/deployment/CSimpleProcessor.java @@ -79,6 +79,7 @@ import org.apache.camel.quarkus.core.deployment.spi.CamelBeanBuildItem; import org.apache.camel.quarkus.core.deployment.spi.CamelContextBuildItem; import org.apache.camel.quarkus.core.deployment.spi.CamelRoutesBuilderClassBuildItem; import org.apache.camel.quarkus.core.deployment.spi.CompiledCSimpleExpressionBuildItem; +import org.apache.camel.quarkus.core.util.FileUtils; import org.apache.camel.util.PropertiesHelper; import org.jboss.logging.Logger; @@ -232,7 +233,7 @@ class CSimpleProcessor { .filter(p -> p.getFileName().toString().endsWith(CLASS_EXT)) .forEach(p -> { final Path relPath = csimpleClassesDir.relativize(p); - String className = relPath.toString(); + String className = FileUtils.nixifyPath(relPath.toString()); className = className.substring(0, className.length() - CLASS_EXT.length()); try { final GeneratedClassBuildItem item = new GeneratedClassBuildItem(true, className, diff --git a/integration-test-groups/aws2-quarkus-client/aws2-ddb/pom.xml b/integration-test-groups/aws2-quarkus-client/aws2-ddb/pom.xml index f40e4ce..bff34d0 100644 --- a/integration-test-groups/aws2-quarkus-client/aws2-ddb/pom.xml +++ b/integration-test-groups/aws2-quarkus-client/aws2-ddb/pom.xml @@ -114,7 +114,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-ddb</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> diff --git a/integration-test-groups/aws2-quarkus-client/aws2-s3/pom.xml b/integration-test-groups/aws2-quarkus-client/aws2-s3/pom.xml index a16732f..d868fdd 100644 --- a/integration-test-groups/aws2-quarkus-client/aws2-s3/pom.xml +++ b/integration-test-groups/aws2-quarkus-client/aws2-s3/pom.xml @@ -118,7 +118,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-s3</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> diff --git a/integration-test-groups/aws2-quarkus-client/aws2-ses/pom.xml b/integration-test-groups/aws2-quarkus-client/aws2-ses/pom.xml index 1e765ca..33db313 100644 --- a/integration-test-groups/aws2-quarkus-client/aws2-ses/pom.xml +++ b/integration-test-groups/aws2-quarkus-client/aws2-ses/pom.xml @@ -119,7 +119,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-ses</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> diff --git a/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/pom.xml b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/pom.xml index d02f4eb..f867380 100644 --- a/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/pom.xml +++ b/integration-test-groups/aws2-quarkus-client/aws2-sqs-sns/pom.xml @@ -122,7 +122,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-sqs-sns</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> diff --git a/integration-test-groups/aws2-quarkus-client/aws2-sqs/pom.xml b/integration-test-groups/aws2-quarkus-client/aws2-sqs/pom.xml index 226a50e..1c835dc 100644 --- a/integration-test-groups/aws2-quarkus-client/aws2-sqs/pom.xml +++ b/integration-test-groups/aws2-quarkus-client/aws2-sqs/pom.xml @@ -119,7 +119,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-sqs</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> diff --git a/integration-test-groups/aws2/aws2-s3/pom.xml b/integration-test-groups/aws2/aws2-s3/pom.xml index 1e20023..ed9ca76 100644 --- a/integration-test-groups/aws2/aws2-s3/pom.xml +++ b/integration-test-groups/aws2/aws2-s3/pom.xml @@ -113,7 +113,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-s</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> diff --git a/integration-tests/aws2-grouped/pom.xml b/integration-tests/aws2-grouped/pom.xml index 691540a..8fbf248 100644 --- a/integration-tests/aws2-grouped/pom.xml +++ b/integration-tests/aws2-grouped/pom.xml @@ -170,7 +170,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> <properties> <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2</group-tests.source.dir> <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> diff --git a/integration-tests/aws2-quarkus-client-grouped/pom.xml b/integration-tests/aws2-quarkus-client-grouped/pom.xml index 18ec86f..ec3c32d 100644 --- a/integration-tests/aws2-quarkus-client-grouped/pom.xml +++ b/integration-tests/aws2-quarkus-client-grouped/pom.xml @@ -154,7 +154,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> <properties> <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2-quarkus-client</group-tests.source.dir> <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> @@ -169,7 +169,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-ses</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> @@ -184,7 +184,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-ddb</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> @@ -199,7 +199,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-s3</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> @@ -214,7 +214,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-sqs</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> @@ -229,7 +229,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/copy-tests.groovy</source> <properties> <copy-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/aws2/aws2-sqs-sns</copy-tests.source.dir> <copy-tests.dest.module.dir>${project.basedir}</copy-tests.dest.module.dir> diff --git a/integration-tests/azure-grouped/pom.xml b/integration-tests/azure-grouped/pom.xml index 949d27d..5f3b3c7 100644 --- a/integration-tests/azure-grouped/pom.xml +++ b/integration-tests/azure-grouped/pom.xml @@ -125,7 +125,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> <properties> <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/azure</group-tests.source.dir> <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> diff --git a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/ParamType.java b/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/ParamType.java index 68afb95..275ec02 100644 --- a/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/ParamType.java +++ b/integration-tests/dataformats-json/src/main/java/org/apache/camel/quarkus/component/dataformats/json/ParamType.java @@ -16,42 +16,6 @@ */ package org.apache.camel.quarkus.component.dataformats.json; -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Arrays; diff --git a/integration-tests/dataformats-json/src/test/java/org/apache/camel/quarkus/component/dataformats/json/JsonComponentsTest.java b/integration-tests/dataformats-json/src/test/java/org/apache/camel/quarkus/component/dataformats/json/JsonComponentsTest.java index a0676bc..4217f87 100644 --- a/integration-tests/dataformats-json/src/test/java/org/apache/camel/quarkus/component/dataformats/json/JsonComponentsTest.java +++ b/integration-tests/dataformats-json/src/test/java/org/apache/camel/quarkus/component/dataformats/json/JsonComponentsTest.java @@ -104,7 +104,7 @@ public class JsonComponentsTest { @Test void jacksonXml() { - final String xml = "<PojoA>\n <name>Joe</name>\n</PojoA>\n"; + final String xml = "<PojoA><name>Joe</name></PojoA>"; final String json = JsonbBuilder.create().toJson(new PojoA("Joe")); RestAssured.given() .contentType(ContentType.JSON) @@ -112,7 +112,7 @@ public class JsonComponentsTest { .post("/dataformats-json/jacksonxml/marshal") .then() .statusCode(200) - .body(equalTo(xml)); + .body("PojoA.name", equalTo("Joe")); RestAssured.given() .contentType("text/xml") diff --git a/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerTest.java b/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerTest.java index 0117fab..94512a4 100644 --- a/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerTest.java +++ b/integration-tests/dozer/src/test/java/org/apache/camel/quarkus/component/dozer/it/DozerTest.java @@ -16,6 +16,8 @@ */ package org.apache.camel.quarkus.component.dozer.it; +import java.io.File; + import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import org.junit.jupiter.api.Test; @@ -46,7 +48,7 @@ class DozerTest { "address.zip", is("12345"), "address.street", is("Camel Street"), "created", containsString("1990"), - "internalFileAsString", is("/test"), + "internalFileAsString", is(File.separator + "test"), "internalClassAsString", is("java.lang.String"), "internalUrl", is("http://customer"), "internal.text", is("hello internal")); diff --git a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java index 3a02d19..ded7443 100644 --- a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java +++ b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java @@ -33,6 +33,7 @@ import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.path.json.JsonPath; import io.restassured.response.ValidatableResponse; +import org.apache.camel.quarkus.core.util.FileUtils; import org.hamcrest.Matchers; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; @@ -275,7 +276,7 @@ class FileTest { } static String createFile(byte[] content, String path, String charset, String fileName) { - return RestAssured.given() + String createdFilePath = RestAssured.given() .urlEncodingEnabled(true) .queryParam("charset", charset) .contentType(ContentType.BINARY) @@ -287,6 +288,8 @@ class FileTest { .extract() .body() .asString(); + + return FileUtils.nixifyPath(createdFilePath); } static void startRouteAndWait(String routeId) throws InterruptedException { @@ -322,7 +325,9 @@ class FileTest { final JsonPath json = response .extract() .jsonPath(); - return file.toString().equals(json.getString("path")) && type.equals(json.getString("type")); + String expectedPath = FileUtils.nixifyPath(file); + String actualPath = json.getString("path"); + return expectedPath.equals(actualPath) && type.equals(json.getString("type")); default: throw new RuntimeException("Unexpected status code " + response.extract().statusCode()); } diff --git a/integration-tests/flatpack/src/test/java/org/apache/camel/quarkus/component/flatpack/it/FlatpackTest.java b/integration-tests/flatpack/src/test/java/org/apache/camel/quarkus/component/flatpack/it/FlatpackTest.java index 2588689..2d666f7 100644 --- a/integration-tests/flatpack/src/test/java/org/apache/camel/quarkus/component/flatpack/it/FlatpackTest.java +++ b/integration-tests/flatpack/src/test/java/org/apache/camel/quarkus/component/flatpack/it/FlatpackTest.java @@ -63,7 +63,8 @@ class FlatpackTest { secondRow.put("LAST_RECV_DT", "20040601"); data.add(secondRow); - String expected = "ITEM_DESC,IN_STOCK,PRICE,LAST_RECV_DT\nAN ENGINE,100,1000.00,20040601\n"; + String expected = "ITEM_DESC,IN_STOCK,PRICE,LAST_RECV_DT" + System.lineSeparator() + "AN ENGINE,100,1000.00,20040601" + + System.lineSeparator(); given().contentType(ContentType.JSON).body(data).when().get("/flatpack/delimited-marshal").then().statusCode(200) .body(is(expected)); } diff --git a/integration-tests/foundation-grouped/pom.xml b/integration-tests/foundation-grouped/pom.xml index d44d275..e2b7bd0 100644 --- a/integration-tests/foundation-grouped/pom.xml +++ b/integration-tests/foundation-grouped/pom.xml @@ -198,7 +198,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> <properties> <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/foundation</group-tests.source.dir> <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> diff --git a/integration-tests/jslt/src/test/java/org/apache/camel/quarkus/component/jslt/it/JsltTest.java b/integration-tests/jslt/src/test/java/org/apache/camel/quarkus/component/jslt/it/JsltTest.java index e6ac493..c7aef54 100644 --- a/integration-tests/jslt/src/test/java/org/apache/camel/quarkus/component/jslt/it/JsltTest.java +++ b/integration-tests/jslt/src/test/java/org/apache/camel/quarkus/component/jslt/it/JsltTest.java @@ -19,6 +19,7 @@ package org.apache.camel.quarkus.component.jslt.it; import java.io.IOException; import io.quarkus.test.junit.QuarkusTest; +import org.apache.camel.util.FileUtil; import org.junit.jupiter.api.Test; import static java.nio.charset.StandardCharsets.UTF_8; @@ -58,6 +59,11 @@ class JsltTest { String expected = resourceToString("/demoPlayground/outputPrettyPrint.json", UTF_8); String input = resourceToString("/demoPlayground/input.json", UTF_8); + if (FileUtil.isWindows()) { + // Jackson ObjectMapper pretty printing uses platform line endings by default + expected = expected.replace("\n", System.lineSeparator()); + } + given().when().body(input).get("/jslt/transformFromHeaderWithPrettyPrint").then().statusCode(200).body(is(expected)); } diff --git a/integration-tests/mongodb-grouped/pom.xml b/integration-tests/mongodb-grouped/pom.xml index 8080aa5..95198a3 100644 --- a/integration-tests/mongodb-grouped/pom.xml +++ b/integration-tests/mongodb-grouped/pom.xml @@ -117,7 +117,7 @@ </goals> <phase>generate-sources</phase> <configuration> - <source>file:///${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> <properties> <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/mongodb</group-tests.source.dir> <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> diff --git a/integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateTest.java b/integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateTest.java index 4b3b371..4e7d770 100644 --- a/integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateTest.java +++ b/integration-tests/stringtemplate/src/test/java/org/apache/camel/quarkus/component/stringtemplate/it/StringtemplateTest.java @@ -108,7 +108,7 @@ class StringtemplateTest { .then() .statusCode(201) .body(containsString( - text + "WORKS!\n")); + text + "WORKS!")); } @Test diff --git a/pom.xml b/pom.xml index 6bccc51..20b39be 100644 --- a/pom.xml +++ b/pom.xml @@ -516,6 +516,7 @@ <exclude>.envrc</exclude> <exclude>**/.idea/**</exclude> <exclude>**/k8s-sb/**</exclude> + <exclude>.gitattributes</exclude> </excludes> <mapping> <cli>CAMEL_PROPERTIES_STYLE</cli> @@ -692,7 +693,7 @@ </goals> <phase>process-resources</phase> <configuration> - <source>file:///${project.basedir}/tooling/scripts/validate-github-workflows.groovy</source> + <source>file:${project.basedir}/tooling/scripts/validate-github-workflows.groovy</source> </configuration> </execution> <execution> @@ -703,7 +704,7 @@ </goals> <phase>verify</phase> <configuration> - <source>file:///${project.basedir}/tooling/scripts/validate-extension-metadata.groovy</source> + <source>file:${project.basedir}/tooling/scripts/validate-extension-metadata.groovy</source> <properties> <extensionDirs>extensions-core,extensions-support,extensions</extensionDirs> </properties> @@ -1007,7 +1008,7 @@ </goals> <phase>validate</phase> <configuration> - <source>file://${maven.multiModuleProjectDirectory}/tooling/scripts/update-antora-yaml.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/update-antora-yaml.groovy</source> <properties> <maven.multiModuleProjectDirectory>${maven.multiModuleProjectDirectory}</maven.multiModuleProjectDirectory> </properties> @@ -1190,7 +1191,7 @@ </goals> <phase>verify</phase> <configuration> - <source>file:///${project.basedir}/tooling/scripts/report-build-status.groovy</source> + <source>file:${project.basedir}/tooling/scripts/report-build-status.groovy</source> </configuration> </execution> </executions> diff --git a/poms/build-parent/pom.xml b/poms/build-parent/pom.xml index 223aaa3..dee891f 100644 --- a/poms/build-parent/pom.xml +++ b/poms/build-parent/pom.xml @@ -194,7 +194,7 @@ </goals> <phase>validate</phase> <configuration> - <source>file://${maven.multiModuleProjectDirectory}/tooling/scripts/sanity-checks.groovy</source> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/sanity-checks.groovy</source> <properties> <maven.multiModuleProjectDirectory>${maven.multiModuleProjectDirectory}</maven.multiModuleProjectDirectory> </properties>
