davsclaus commented on code in PR #24665: URL: https://github.com/apache/camel/pull/24665#discussion_r3581351256
########## dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherWindowsExeIT.java: ########## @@ -0,0 +1,72 @@ +/* + * 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.dsl.jbang.launcher; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIfSystemProperty; +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.junit.jupiter.api.condition.OS; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Release gate for the native {@code camel.exe} packaged into the launcher distribution. Runs during {@code verify} + * when {@code -Dcamel.launcher.requireWindowsExe=true} is set on a Windows x64 host. + */ +@EnabledOnOs(OS.WINDOWS) +@EnabledIfSystemProperty(named = "camel.launcher.requireWindowsExe", matches = "true") +class CamelLauncherWindowsExeIT { + + private static final Path TARGET = Paths.get("target"); + private static final Path STAGED_EXE = TARGET.resolve("camel.exe"); + + @Test + void stagedCamelExeExists() { + assertTrue(Files.isRegularFile(STAGED_EXE), + "target/camel.exe must be present before packaging the launcher distribution"); + } + + @Test + void binArchiveIncludesCamelExe() throws IOException { Review Comment: [LOW] `archive.getEntry("bin/camel.exe")` uses an exact path, but the assembly descriptor (`bin.xml`) does not set `<includeBaseDirectory>false</includeBaseDirectory>` — Maven Assembly Plugin defaults to `true`, which prefixes entries with `camel-launcher-VERSION-bin/`. This means `getEntry("bin/camel.exe")` would return null. The CI PowerShell assertion handles this correctly with wildcard matching (`*/bin/camel.exe`). Consider iterating entries with a suffix match here as well, or setting `includeBaseDirectory` to `false` in the assembly descriptor if that's the intended layout. This test is double-gated (`@EnabledOnOs(OS.WINDOWS)` + `@EnabledIfSystemProperty`) so it doesn't affect CI, but would fail for a developer running `mvn verify -Dcamel.launcher.requireWindowsExe=true` on Windows. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
