From 50d720448a946f72351f628b382b2a9fd94ed6eb Mon Sep 17 00:00:00 2001 From: Romain Grecourt Date: Fri, 17 Mar 2023 18:59:26 +0100 Subject: [PATCH] Windows GA Signed-off-by: tvallin --- .github/workflows/validate.yml | 59 +++++++++++++---- .../helidon/builder/test/CustomNamedTest.java | 9 ++- etc/scripts/github-build.bat | 24 +++++++ etc/scripts/github-compile.bat | 23 +++++++ etc/scripts/includes/pipeline-env.sh | 2 +- etc/scripts/test-archetypes.bat | 24 +++++++ etc/scripts/test-packaging-jar.bat | 48 ++++++++++++++ etc/scripts/test-packaging-jlink.bat | 63 +++++++++++++++++++ etc/scripts/test-packaging-native.bat | 56 +++++++++++++++++ .../processor/ActiveProcessorUtils.java | 11 +++- .../helidon/inject/processor/TestUtils.java | 9 ++- .../inject/tests/inject/TestUtils.java | 8 ++- .../io/helidon/inject/tools/CodeGenFiler.java | 4 ++ .../io/helidon/inject/tools/CommonUtils.java | 20 +++++- .../io/helidon/inject/tools/ModuleUtils.java | 4 +- .../OciAuthenticationDetailsProvider.java | 9 ++- .../messaging/connectors/jms/AckMpTest.java | 3 + .../connectors/kafka/KafkaSeTest.java | 3 + .../integration/oidc/CookieBasedLoginIT.java | 3 + .../integration/oidc/QueryBasedLoginIT.java | 3 + .../oidc/TenantIdentificationIT.java | 3 + .../staticcontent/CachedHandlerTest.java | 3 + .../tests/websocket/WsConversationClient.java | 2 - .../tests/websocket/WsConversationTest.java | 3 + 24 files changed, 370 insertions(+), 26 deletions(-) create mode 100644 etc/scripts/github-build.bat create mode 100644 etc/scripts/github-compile.bat create mode 100644 etc/scripts/test-archetypes.bat create mode 100644 etc/scripts/test-packaging-jar.bat create mode 100644 etc/scripts/test-packaging-jlink.bat create mode 100644 etc/scripts/test-packaging-native.bat diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 5994821ac21..355806f40e0 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,5 +1,4 @@ # Notes -# - cannot run on Windows, as we use shell scripts # - removed macos-latest from most jobs to speed up the process name: "Validate" @@ -75,7 +74,12 @@ jobs: timeout-minutes: 60 strategy: matrix: - os: [ ubuntu-20.04 ] + os: [ ubuntu-20.04, windows-2022 ] + include: + - os: ubuntu-20.04 + build_script: etc/scripts/github-build.sh + - os: windows-2022 + build_script: etc/scripts/github-build.bat runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -85,13 +89,21 @@ jobs: distribution: ${{ env.JAVA_DISTRO }} java-version: ${{ env.JAVA_VERSION }} cache: maven - - name: Maven build - run: etc/scripts/github-build.sh + - name: Maven Build + run: ${{ matrix.build_script }} + - name: Archive test results + uses: actions/upload-artifact@v3.1.2 + if: always() + with: + name: test-results + path: | + **/target/surefire-reports/*.txt + **/target/it/**/*.log examples: timeout-minutes: 30 strategy: matrix: - os: [ ubuntu-20.04, macos-latest ] + os: [ ubuntu-20.04, macos-latest, windows-2022 ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -124,10 +136,15 @@ jobs: - name: Maven build run: etc/scripts/mp-tck.sh archetypes: - timeout-minutes: 45 + timeout-minutes: 50 strategy: matrix: - os: [ ubuntu-20.04 ] + os: [ ubuntu-20.04, windows-2022 ] + include: + - os: ubuntu-20.04 + test-archetypes: etc/scripts/test-archetypes.sh + - os: windows-2022 + test-archetypes: etc/scripts/test-archetypes.bat runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -138,12 +155,28 @@ jobs: java-version: ${{ env.JAVA_VERSION }} cache: maven - name: Test archetypes - run: etc/scripts/test-archetypes.sh + run: ${{ matrix.test-archetypes }} packaging: timeout-minutes: 60 strategy: matrix: - os: [ ubuntu-20.04, macos-latest] + os: [ ubuntu-20.04, macos-latest, windows-2022 ] + include: + - os: ubuntu-20.04 + compile: etc/scripts/github-compile.sh + test-jar: etc/scripts/test-packaging-jar.sh + test-jlink: etc/scripts/test-packaging-jlink.sh + test-native: etc/scripts/test-packaging-native.sh + - os: macos-latest + compile: etc/scripts/github-compile.sh + test-jar: etc/scripts/test-packaging-jar.sh + test-jlink: etc/scripts/test-packaging-jlink.sh + test-native: etc/scripts/test-packaging-native.sh + - os: windows-2022 + compile: etc/scripts/github-compile.bat + test-jar: etc/scripts/test-packaging-jar.bat + test-jlink: etc/scripts/test-packaging-jlink.bat + test-native: etc/scripts/test-packaging-native.bat runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -155,10 +188,10 @@ jobs: native-image-job-reports: true cache: maven - name: Build Helidon - run: etc/scripts/github-compile.sh + run: ${{ matrix.compile }} - name: JAR packaging - run: etc/scripts/test-packaging-jar.sh + run: ${{ matrix.test-jar }} - name: JLink packaging - run: etc/scripts/test-packaging-jlink.sh + run: ${{ matrix.test-jlink }} - name: Native-Image packaging - run: etc/scripts/test-packaging-native.sh + run: ${{ matrix.test-native }} diff --git a/builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java b/builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java index c78354a4b47..d174ed71ee2 100644 --- a/builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java +++ b/builder/tests/builder/src/test/java/io/helidon/builder/test/CustomNamedTest.java @@ -54,7 +54,14 @@ void testIt() throws Exception { .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); DefaultPrettyPrinter printer = new DefaultPrettyPrinter(); String json = mapper.writer(printer).writeValueAsString(customNamed); - assertThat(json, equalTo("{\n" + " \"stringSet\" : [ \"b\", \"a\", \"y\" ]\n" + "}")); + assertThat(normalizeNewLines(json), equalTo("{\n" + " \"stringSet\" : [ \"b\", \"a\", \"y\" ]\n" + "}")); + } + + private String normalizeNewLines(String value) { + if (value == null) { + return null; + } + return value.replaceAll("\r\n", "\n"); } } diff --git a/etc/scripts/github-build.bat b/etc/scripts/github-build.bat new file mode 100644 index 00000000000..caadc8cd045 --- /dev/null +++ b/etc/scripts/github-build.bat @@ -0,0 +1,24 @@ +@REM +@REM Copyright (c) 2023 Oracle and/or its affiliates. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off + +cd %~dp0\..\.. + +mvn %MAVEN_ARGS% -f %cd%\pom.xml ^ + install -e ^ + -Dmaven.test.failure.ignore=false ^ + -Pjavadoc,sources,tests \ No newline at end of file diff --git a/etc/scripts/github-compile.bat b/etc/scripts/github-compile.bat new file mode 100644 index 00000000000..cc664bb72a4 --- /dev/null +++ b/etc/scripts/github-compile.bat @@ -0,0 +1,23 @@ +@REM +@REM Copyright (c) 2023 Oracle and/or its affiliates. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off +cd %~dp0\..\.. + +mvn %MAVEN_ARGS% -f %cd%\pom.xml ^ + install -e ^ + -DskipTests ^ + -Ppipeline,tests diff --git a/etc/scripts/includes/pipeline-env.sh b/etc/scripts/includes/pipeline-env.sh index 8c4029002d4..e19b26e6656 100644 --- a/etc/scripts/includes/pipeline-env.sh +++ b/etc/scripts/includes/pipeline-env.sh @@ -21,7 +21,7 @@ # Arguments: $1 - Script path # $2 - cd to Helidon root directory from script path # -# Atleast WS_DIR or both arguments must be passed. +# At least WS_DIR or both arguments must be passed. # WS_DIR variable verification. if [ -z "${WS_DIR}" ]; then diff --git a/etc/scripts/test-archetypes.bat b/etc/scripts/test-archetypes.bat new file mode 100644 index 00000000000..b1a030d7ad5 --- /dev/null +++ b/etc/scripts/test-archetypes.bat @@ -0,0 +1,24 @@ +@REM +@REM Copyright (c) 2023 Oracle and/or its affiliates. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off +cd %~dp0\..\.. + +call etc\scripts\github-compile.bat + +cd %cd%\archetypes + +mvn %MAVEN_ARGS% -e clean install diff --git a/etc/scripts/test-packaging-jar.bat b/etc/scripts/test-packaging-jar.bat new file mode 100644 index 00000000000..00d27c2ccab --- /dev/null +++ b/etc/scripts/test-packaging-jar.bat @@ -0,0 +1,48 @@ +@REM +@REM Copyright (c) 2023 Oracle and/or its affiliates. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off + +set WS_DIR=%~dp0\..\.. + +@REM Run native image tests +cd %WS_DIR%\tests\integration\native-image + +@REM Prime build all native-image tests +call mvn %MAVEN_ARGS% -e clean install + +@REM Run tests with classpath and then module path + +@REM Run MP-1 +cd %WS_DIR%\tests\integration\native-image\mp-1 + +@REM Classpath +call java -jar target\helidon-tests-native-image-mp-1.jar + +@REM Module Path +call java --module-path target\helidon-tests-native-image-mp-1.jar;target\libs ^ + --module helidon.tests.nimage.mp/io.helidon.tests.integration.nativeimage.mp1.Mp1Main + +@REM Run MP-3 (just start and stop) +cd %WS_DIR%\tests\integration\native-image\mp-3 +@REM Classpath +call java -Dexit.on.started=! -jar target\helidon-tests-native-image-mp-3.jar + +@REM Module Path +call java -Dexit.on.started=! ^ + --module-path target\helidon-tests-native-image-mp-3.jar;target\libs ^ + --add-modules helidon.tests.nimage.quickstartmp ^ + --module io.helidon.microprofile.cdi/io.helidon.microprofile.cdi.Main diff --git a/etc/scripts/test-packaging-jlink.bat b/etc/scripts/test-packaging-jlink.bat new file mode 100644 index 00000000000..4f9493c9c17 --- /dev/null +++ b/etc/scripts/test-packaging-jlink.bat @@ -0,0 +1,63 @@ +@REM +@REM Copyright (c) 2023 Oracle and/or its affiliates. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off + +set WS_DIR=%~dp0..\.. + +@REM Run native image tests +cd %WS_DIR%\tests\integration\native-image + +echo Skipping jlink tests, until we switch to Smallrye based Jandex in build tools - org.jboss fails with NPE on Java 21 +exit 0 + +@REM Prime build all native-image tests +call mvn %MAVEN_ARGS% -e clean install + +@REM Build jlink images +@REM mp-2 fails because of https://github.com/oracle/helidon-build-tools/issues/478 +cd %WS_DIR%\tests\integration\native-image\mp-1 +call mvn %MAVEN_ARGS% package -e -Pjlink-image,staging -Djlink.image.addClassDataSharingArchive=false -Djlink.image.testImage=false + +cd %WS_DIR%\tests\integration\native-image\mp-3 +call mvn %MAVEN_ARGS% package -e -Pjlink-image,staging -Djlink.image.addClassDataSharingArchive=false -Djlink.image.testImage=false + +@REM Run tests with classpath and then module path + +@REM Run MP-1 +cd %WS_DIR%\tests\integration\native-image\mp-1 +set jri_dir=%WS_DIR%\tests\integration\native-image\mp-1\target\helidon-tests-native-image-mp-1-jri + +@REM Classpath +call %jri_dir%\bin\start --jvm + +@REM Module Path +call %jri_dir%\bin\java ^ + --module-path %jri_dir%\app\helidon-tests-native-image-mp-1.jar;%jri_dir%\app\libs ^ + --module helidon.tests.nimage.mp/io.helidon.tests.integration.nativeimage.mp1.Mp1Main + +@REM Run MP-3 (just start and stop) +cd %WS_DIR%\tests\integration\native-image\mp-3 +set jri_dir=%WS_DIR%\tests\integration\native-image\mp-3\target\helidon-tests-native-image-mp-3-jri + +@REM Classpath +call %jri_dir%\bin\start --test --jvm + +@REM Module Path +call %jri_dir%\bin\java -Dexit.on.started=! ^ + --module-path %jri_dir%\app\helidon-tests-native-image-mp-3.jar;%jri_dir%\app\libs ^ + --add-modules helidon.tests.nimage.quickstartmp ^ + --module io.helidon.microprofile.cdi/io.helidon.microprofile.cdi.Main diff --git a/etc/scripts/test-packaging-native.bat b/etc/scripts/test-packaging-native.bat new file mode 100644 index 00000000000..f9659f30eb7 --- /dev/null +++ b/etc/scripts/test-packaging-native.bat @@ -0,0 +1,56 @@ +@REM +@REM Copyright (c) 2023 Oracle and/or its affiliates. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off + +set WS_DIR=%~dp0..\.. + +if "%GRAALVM_HOME%"=="" ( + echo "ERROR: GRAALVM_HOME is not set"; + exit 1 +) + +if not exist %GRAALVM_HOME%\bin\native-image.cmd ( + echo "ERROR: %GRAALVM_HOME%\bin\native-image.cmd does not exist or is not executable"; + exit 1 +) + +call mvn %MAVEN_ARGS% --version + +echo "GRAALVM_HOME=%GRAALVM_HOME%" +call %GRAALVM_HOME%\bin\native-image.cmd --version + +@REM Run native image tests +cd %WS_DIR%\tests\integration\native-image + +@REM Prime build all native-image tests +call mvn %MAVEN_ARGS% -e clean install + +@REM Build native images +for %%v in (se-1 mp-1 mp-3) do ( + echo %%v + cd %WS_DIR%\tests\integration\native-image\%%v + call mvn %MAVEN_ARGS% -e clean package -Pnative-image +) + +@REM Run this one because it has no pre-reqs and self-tests +@REM Uses relative path to read configuration +cd %WS_DIR%\tests\integration\native-image\mp-1 +call %WS_DIR%\tests\integration\native-image\mp-1\target\helidon-tests-native-image-mp-1 || true + +@REM Run se-1 exiting on started +cd %WS_DIR%\tests\integration\native-image\se-1 +call %WS_DIR%\tests\integration\native-image\se-1\target\helidon-tests-native-image-se-1 -Dexit.on.started=! || true diff --git a/inject/processor/src/main/java/io/helidon/inject/processor/ActiveProcessorUtils.java b/inject/processor/src/main/java/io/helidon/inject/processor/ActiveProcessorUtils.java index 990738d626e..afc2e6f6679 100644 --- a/inject/processor/src/main/java/io/helidon/inject/processor/ActiveProcessorUtils.java +++ b/inject/processor/src/main/java/io/helidon/inject/processor/ActiveProcessorUtils.java @@ -199,8 +199,8 @@ void roundEnv(RoundEnvironment roundEnv) { private Optional tryFindModuleInfoTheUnconventionalWayFromSourceMain( AtomicReference moduleInfoFile, AtomicReference srcPath) { - if (srcPath != null && srcPath.get() != null && srcPath.get().getPath().contains(TARGET_DIR)) { - String path = srcPath.get().getPath(); + if (srcPath != null && srcPath.get() != null && normalizePath(srcPath.get().getPath()).contains(TARGET_DIR)) { + String path = normalizePath(srcPath.get().getPath()); int pos = path.indexOf(TARGET_DIR); path = path.substring(0, pos); File srcRoot = new File(path, SRC_MAIN_JAVA_DIR); @@ -256,4 +256,11 @@ private Optional tryFindModuleInfoTheConventionalWay(Stand return Optional.empty(); } + private static String normalizePath(String value) { + if (value == null) { + return null; + } + return value.replace("\\", "/"); + } + } diff --git a/inject/processor/src/test/java/io/helidon/inject/processor/TestUtils.java b/inject/processor/src/test/java/io/helidon/inject/processor/TestUtils.java index 525727f1c59..d6b287ed5bf 100644 --- a/inject/processor/src/test/java/io/helidon/inject/processor/TestUtils.java +++ b/inject/processor/src/test/java/io/helidon/inject/processor/TestUtils.java @@ -38,11 +38,18 @@ private TestUtils() { static String loadStringFromResource(String resourceNamePath) { try { try (InputStream in = TestUtils.class.getClassLoader().getResourceAsStream(resourceNamePath)) { - return new String(in.readAllBytes(), StandardCharsets.UTF_8); + return normalizeNewLines(new String(in.readAllBytes(), StandardCharsets.UTF_8)); } } catch (Exception e) { throw new ToolsException("Failed to load: " + resourceNamePath, e); } } + private static String normalizeNewLines(String value) { + if (value == null) { + return null; + } + return value.replaceAll("\r\n", "\n"); + } + } diff --git a/inject/tests/resources-inject/src/test/java/io/helidon/inject/tests/inject/TestUtils.java b/inject/tests/resources-inject/src/test/java/io/helidon/inject/tests/inject/TestUtils.java index c1fc0a347fb..8212c129ecf 100644 --- a/inject/tests/resources-inject/src/test/java/io/helidon/inject/tests/inject/TestUtils.java +++ b/inject/tests/resources-inject/src/test/java/io/helidon/inject/tests/inject/TestUtils.java @@ -42,7 +42,7 @@ private TestUtils() { public static String loadStringFromResource(String resourceNamePath) { try { try (InputStream in = TestUtils.class.getClassLoader().getResourceAsStream(resourceNamePath)) { - return new String(in.readAllBytes(), StandardCharsets.UTF_8).trim(); + return normalizeNewLines(new String(in.readAllBytes(), StandardCharsets.UTF_8).trim()); } } catch (Exception e) { throw new ToolsException("Failed to load: " + resourceNamePath, e); @@ -67,4 +67,10 @@ public static String loadStringFromFile(String fileName) { } } + private static String normalizeNewLines(String value) { + if (value == null) { + return null; + } + return value.replaceAll("\r\n", "\n"); + } } diff --git a/inject/tools/src/main/java/io/helidon/inject/tools/CodeGenFiler.java b/inject/tools/src/main/java/io/helidon/inject/tools/CodeGenFiler.java index 8b7486bc966..c7d7b26e72c 100644 --- a/inject/tools/src/main/java/io/helidon/inject/tools/CodeGenFiler.java +++ b/inject/tools/src/main/java/io/helidon/inject/tools/CodeGenFiler.java @@ -51,6 +51,8 @@ import io.helidon.inject.api.Application; import io.helidon.inject.api.ModuleComponent; +import static io.helidon.inject.tools.CommonUtils.normalizePath; + /** * This class is used to generate the source and resources originating from either annotation processing or maven-plugin * invocation. It also provides a circuit breaker in case the filer should be disabled from actually writing out source @@ -194,6 +196,7 @@ public void codegenMetaInfServices(CodeGenPaths paths, mergedMap.put(contract, mergedSet); String outPath = new File(paths.metaInfServicesPath() .orElse(CodeGenPaths.DEFAULT_META_INF_SERVICES_PATH), contract).getPath(); + outPath = normalizePath(outPath); try { messager.debug("Reading " + outPath); FileObject f = filer.getResource(StandardLocation.CLASS_OUTPUT, "", outPath); @@ -475,6 +478,7 @@ private Filer scratchFiler() throws IOException { private Optional codegenResourceFilerOut(String outPath, String body, Optional> optFnUpdater) { + outPath = normalizePath(outPath); Messager messager = messager(); if (!filerWriterEnabled()) { messager.log("(disabled) Writing " + outPath + " with:\n" + body); diff --git a/inject/tools/src/main/java/io/helidon/inject/tools/CommonUtils.java b/inject/tools/src/main/java/io/helidon/inject/tools/CommonUtils.java index f9775fb5d5d..3286d198013 100644 --- a/inject/tools/src/main/java/io/helidon/inject/tools/CommonUtils.java +++ b/inject/tools/src/main/java/io/helidon/inject/tools/CommonUtils.java @@ -48,7 +48,7 @@ private CommonUtils() { static String loadStringFromResource(String resourceNamePath) { try { try (InputStream in = CommonUtils.class.getClassLoader().getResourceAsStream(resourceNamePath)) { - return new String(in.readAllBytes(), StandardCharsets.UTF_8); + return normalizeNewLines(new String(in.readAllBytes(), StandardCharsets.UTF_8)); } } catch (Exception e) { throw new ToolsException("Failed to load: " + resourceNamePath, e); @@ -66,7 +66,7 @@ static String loadStringFromFile(String fileName) { try { Path filePath = Path.of(fileName); String content = Files.readString(filePath); - return content; + return normalizeNewLines(content); } catch (IOException e) { throw new ToolsException("Unable to load from file: " + fileName, e); } @@ -171,7 +171,7 @@ static String trimLines(String multiLineStr) { } catch (IOException e) { throw new ToolsException("failed to read", e); } - return builder.toString().trim(); + return normalizeNewLines(builder.toString().trim()); } /** @@ -211,4 +211,18 @@ static String toFlatName(String className) { return className.replace('.', '$'); } + private static String normalizeNewLines(String value) { + if (value == null) { + return null; + } + return value.replaceAll("\r\n", "\n"); + } + + static String normalizePath(String value) { + if (value == null) { + return null; + } + return value.replace("\\", "/"); + } + } diff --git a/inject/tools/src/main/java/io/helidon/inject/tools/ModuleUtils.java b/inject/tools/src/main/java/io/helidon/inject/tools/ModuleUtils.java index 82a6bad76a9..93c94acbbe9 100644 --- a/inject/tools/src/main/java/io/helidon/inject/tools/ModuleUtils.java +++ b/inject/tools/src/main/java/io/helidon/inject/tools/ModuleUtils.java @@ -44,6 +44,7 @@ import io.helidon.inject.api.ModuleComponent; import io.helidon.inject.tools.spi.ModuleComponentNamer; +import static io.helidon.inject.tools.CommonUtils.normalizePath; import static io.helidon.inject.tools.ModuleInfoDescriptorBlueprint.DEFAULT_MODULE_NAME; /** @@ -316,7 +317,7 @@ static String inferSourceOrTest(Path basePath, Path sourcePath) { // create a relative path from the two paths URI relativePath = basePath.toUri().relativize(sourcePath.toUri()); - String path = relativePath.getPath(); + String path = normalizePath(relativePath.getPath()); if (!path.startsWith("/")) { path = "/" + path; } @@ -352,6 +353,7 @@ public static Optional toSourcePath(Path filePath, * @return the base path */ public static Path toBasePath(String sourcePath) { + sourcePath = normalizePath(sourcePath); int pos = sourcePath.lastIndexOf(SRC_MAIN_JAVA_DIR); if (pos < 0) { pos = sourcePath.lastIndexOf(SRC_TEST_JAVA_DIR); diff --git a/integrations/oci/sdk/runtime/src/main/java/io/helidon/integrations/oci/sdk/runtime/OciAuthenticationDetailsProvider.java b/integrations/oci/sdk/runtime/src/main/java/io/helidon/integrations/oci/sdk/runtime/OciAuthenticationDetailsProvider.java index 8df6c824070..7bf77fb738b 100644 --- a/integrations/oci/sdk/runtime/src/main/java/io/helidon/integrations/oci/sdk/runtime/OciAuthenticationDetailsProvider.java +++ b/integrations/oci/sdk/runtime/src/main/java/io/helidon/integrations/oci/sdk/runtime/OciAuthenticationDetailsProvider.java @@ -162,7 +162,14 @@ static boolean canReadPath(String pathName) { } static String userHomePrivateKeyPath(OciConfig ociConfig) { - return Paths.get(System.getProperty("user.home"), ".oci", ociConfig.authKeyFile()).toString(); + return normalizePath(Paths.get(System.getProperty("user.home"), ".oci", ociConfig.authKeyFile()).toString()); + } + + private static String normalizePath(String value) { + if (value == null) { + return null; + } + return value.replace("\\", "/"); } diff --git a/tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java b/tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java index fb8b9464839..e35520afab7 100644 --- a/tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java +++ b/tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java @@ -43,6 +43,8 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static java.lang.System.Logger.Level.DEBUG; @@ -106,6 +108,7 @@ void resendAckTestPart1(SeContainer cdi) { @Test @Order(2) + @DisabledOnOs(OS.WINDOWS) void resendAckTestPart2(SeContainer cdi) { MockConnector mockConnector = cdi.select(MockConnector.class, TEST_CONNECTOR_ANNOTATION).get(); diff --git a/tests/integration/kafka/src/test/java/io/helidon/messaging/connectors/kafka/KafkaSeTest.java b/tests/integration/kafka/src/test/java/io/helidon/messaging/connectors/kafka/KafkaSeTest.java index a2354a2f2e6..2960a08cc67 100644 --- a/tests/integration/kafka/src/test/java/io/helidon/messaging/connectors/kafka/KafkaSeTest.java +++ b/tests/integration/kafka/src/test/java/io/helidon/messaging/connectors/kafka/KafkaSeTest.java @@ -59,6 +59,8 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; @@ -69,6 +71,7 @@ import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; +@DisabledOnOs(OS.WINDOWS) public class KafkaSeTest extends AbstractKafkaTest { private static final Logger LOGGER = Logger.getLogger(KafkaSeTest.class.getName()); diff --git a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CookieBasedLoginIT.java b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CookieBasedLoginIT.java index 181ee4a2eda..c079b7933be 100644 --- a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CookieBasedLoginIT.java +++ b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/CookieBasedLoginIT.java @@ -23,6 +23,8 @@ import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_POST_LOGOUT_TEST_MESSAGE; import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE; @@ -30,6 +32,7 @@ import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; +@DisabledOnOs(OS.WINDOWS) class CookieBasedLoginIT extends CommonLoginBase { @Test diff --git a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/QueryBasedLoginIT.java b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/QueryBasedLoginIT.java index e3cab7e4db3..915c7018413 100644 --- a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/QueryBasedLoginIT.java +++ b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/QueryBasedLoginIT.java @@ -27,6 +27,8 @@ import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static io.helidon.tests.integration.oidc.TestResource.EXPECTED_TEST_MESSAGE; import static org.hamcrest.CoreMatchers.is; @@ -35,6 +37,7 @@ @AddConfig(key = "security.providers.1.oidc.cookie-use", value = "false") @AddConfig(key = "security.providers.1.oidc.query-param-use", value = "true") +@DisabledOnOs(OS.WINDOWS) class QueryBasedLoginIT extends CommonLoginBase { @Test diff --git a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/TenantIdentificationIT.java b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/TenantIdentificationIT.java index a161474f393..aec70e3bd66 100644 --- a/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/TenantIdentificationIT.java +++ b/tests/integration/oidc/src/test/java/io/helidon/tests/integration/oidc/TenantIdentificationIT.java @@ -34,6 +34,8 @@ import jakarta.ws.rs.core.Response; import org.glassfish.jersey.client.ClientProperties; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; @@ -44,6 +46,7 @@ @HelidonTest(resetPerTest = true) @AddBean(TestResource.class) @AddConfig(key = "security.providers.1.oidc.oidc-metadata-well-known", value = "false") +@DisabledOnOs(OS.WINDOWS) class TenantIdentificationIT { @Test diff --git a/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/CachedHandlerTest.java b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/CachedHandlerTest.java index a8b48feb129..1cff05cf696 100644 --- a/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/CachedHandlerTest.java +++ b/webserver/static-content/src/test/java/io/helidon/webserver/staticcontent/CachedHandlerTest.java @@ -38,6 +38,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; import static io.helidon.common.testing.http.junit5.HttpHeaderMatcher.hasHeader; import static io.helidon.common.testing.junit5.OptionalMatcher.optionalPresent; @@ -181,6 +183,7 @@ void testFsInMemoryCache() { } @Test + @DisabledOnOs(OS.WINDOWS) void testFsFromInMemory() throws IOException { ServerResponseHeaders responseHeaders = ServerResponseHeaders.create(); diff --git a/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java index ee8be9d9da3..4869978f961 100644 --- a/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java +++ b/webserver/tests/websocket/src/main/java/io/helidon/webserver/tests/websocket/WsConversationClient.java @@ -32,8 +32,6 @@ import static io.helidon.webserver.tests.websocket.WsAction.OperationType.TEXT; import static java.nio.charset.StandardCharsets.UTF_8; -; - /** * A websocket client that is driven by a conversation instance. */ diff --git a/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WsConversationTest.java b/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WsConversationTest.java index f56eb633fb1..12ead3b8529 100644 --- a/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WsConversationTest.java +++ b/webserver/tests/websocket/src/test/java/io/helidon/webserver/tests/websocket/WsConversationTest.java @@ -30,6 +30,8 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.condition.DisabledOnOs; +import org.junit.jupiter.api.condition.OS; @ServerTest @TestMethodOrder(MethodOrderer.MethodName.class) @@ -64,6 +66,7 @@ void testConversation100() throws Exception { } @Test + @DisabledOnOs(OS.WINDOWS) void testConversation1000() throws Exception { testConversation(WsConversation.createRandom(1000)); }