davsclaus commented on code in PR #27978:
URL: https://github.com/apache/camel/pull/27978#discussion_r4299583015


##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -571,6 +571,12 @@ the integrations unsorted. A row without the value of the 
key now comes first, i
   `2`: the first showed every error, the second none. The errors of 
`--diagram` are printed on stderr, and a graphical
   `--theme` in a terminal without graphics exits with `2`.
 
+=== camel-jbang - camel version list
+
+* `camel version list` prints the `Last updated` note on stderr, so stdout has 
the table only.
+* A `--date-format` that is not a date pattern, and a `--from-date` or 
`--to-date` that is not a date such as
+  `2025-01-31`, exit with `2`: the first showed the dates unformatted, and the 
others were ignored.

Review Comment:
   Done in deb905af06e6: the sentence names the yyyy-MM-dd format, with 
2025-01-31 as the example of a valid date.
   
   _Claude Code on behalf of davsclaus_



##########
dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/version/VersionListReleasesTest.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.core.commands.version;
+
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.apache.camel.dsl.jbang.core.commands.CamelCommandBaseTestSupport;
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.common.CliException;
+import org.apache.camel.dsl.jbang.core.common.CliExitCode;
+import org.apache.camel.dsl.jbang.core.common.CommandLineHelper;
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+import org.apache.camel.util.json.Jsoner;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import picocli.CommandLine;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/**
+ * camel version list without downloads: the Camel releases the catalog knows, 
here the 4.10 to 4.12 releases, which do
+ * not change any more, filtered and formatted.
+ */
+class VersionListReleasesTest extends CamelCommandBaseTestSupport {
+
+    @TempDir
+    Path home;
+
+    private Path previousHome;
+
+    @BeforeEach
+    void useHome() {
+        // without the file that says when the list was updated
+        previousHome = CommandLineHelper.getHomeDir();
+        CommandLineHelper.useHomeDir(home.toString());
+    }
+
+    @AfterEach
+    void restoreHome() {
+        CommandLineHelper.useHomeDir(previousHome.toString());
+    }
+
+    @Test
+    void theReleasesOfTheCatalog() throws Exception {
+        assertThat(command().doCall()).isZero();
+
+        String[] lines = printer.getStdout().split(System.lineSeparator());
+        assertThat(lines[0]).contains("CAMEL VERSION", "JDK", "KIND", 
"RELEASED", "SUPPORTED UNTIL", "DAYS");
+        // 4.10.0 to 4.10.9, 4.11.0 and 4.12.0
+        assertThat(lines).hasSize(13);
+        assertThat(lines[1]).contains("4.10.0", "17,21", "LTS", "February 
2025", "February 2026");
+        assertThat(lines[11]).contains("4.11.0", "April 
2025").doesNotContain("LTS");
+        assertThat(lines[12]).contains("4.12.0", "May 2025");
+        // not part of the table
+        assertThat(printer.getStderr()).isEqualTo("Last updated: none (use 
--fresh to update list from internet)");
+    }
+
+    @Test
+    void json() throws Exception {
+        assertThat(command("--json", "--to-version=4.10.1").doCall()).isZero();
+
+        JsonArray releases = Jsoner.deserialize(printer.getStdout(), 
(JsonArray) null);
+        assertThat(releases).hasSize(1);
+        JsonObject release = releases.getMap(0);
+        assertThat(release.getString("camelVersion")).isEqualTo("4.10.0");
+        assertThat(release.getString("runtime")).isEqualTo("main");
+        assertThat(release.getString("jdkVersion")).isEqualTo("17,21");
+        assertThat(release.getString("kind")).isEqualTo("lts");
+        assertThat(release.getString("releaseDate")).isEqualTo("2025-02-11");
+        assertThat(release.getString("eolDate")).isEqualTo("2026-02-10");
+        // the JSON is the output
+        assertThat(printer.getStderr()).isEmpty();
+    }
+
+    @Test
+    void jsonWithoutReleasesIsAnEmptyArray() throws Exception {
+        assertThat(command("--json", 
"--from-date=2030-01-01").doCall()).isZero();
+
+        assertThat(printer.getStdout()).isEqualTo("[]");
+    }
+
+    @Test
+    void withoutPatchReleases() throws Exception {
+        assertThat(command("--patch=false").doCall()).isZero();
+
+        assertThat(versions()).containsExactly("4.10.0", "4.11.0", "4.12.0");
+    }
+
+    @Test
+    void ltsOnly() throws Exception {
+        assertThat(command("--lts", "--patch=false").doCall()).isZero();
+
+        assertThat(versions()).containsExactly("4.10.0");
+    }
+
+    @Test
+    void withoutTheReleasesAtTheirEndOfLife() throws Exception {
+        // the 4.10 releases are supported until February 2026; the others 
have no end of life

Review Comment:
   Done in deb905af06e6: past tense, as the 4.10 releases reached their end of 
life in February 2026.
   
   _Claude Code on behalf of davsclaus_



-- 
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]

Reply via email to