Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(catalog-generator): Lower the required Java version to 17 #1520

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Before you start contributing, ensure that you have the following installed:

- NodeJS (>v18.x)
- yarn (>v3.x)
- Java 21+
- Java 17+

### Setting Up the Project

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Have a quick look at our online demo instance:
## Requirements
- NodeJS (v18.x or higher) [+info](https://nodejs.org/en)
- Yarn (v3.x or higher) [+info](https://yarnpkg.com/getting-started/install)
- OpenJDK (v21 or higher) [+info](https://developers.redhat.com/products/openjdk/download)
- OpenJDK (v17 or higher) [+info](https://developers.redhat.com/products/openjdk/download)

_For more information on Vite, check [Vite's documentation](https://vitejs.dev/config/)._

Expand Down
28 changes: 24 additions & 4 deletions packages/catalog-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
<description>A Camel Catalog generator for Kaoto.</description>
<url>https://kaoto.io</url>
<properties>
<compiler-plugin.version>3.13.0</compiler-plugin.version>
lordrip marked this conversation as resolved.
Show resolved Hide resolved
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<version.camel>4.8.0</version.camel>
Expand All @@ -23,6 +22,7 @@
<version.jackson>2.17.2</version.jackson>
<version.junit>5.11.0</version.junit>
<version.kubernetes-model>6.13.3</version.kubernetes-model>
<version.maven-enforcer-plugin>3.5.0</version.maven-enforcer-plugin>
<version.maven-compiler-plugin>3.13.0</version.maven-compiler-plugin>
<version.maven-surefire-plugin>3.5.0</version.maven-surefire-plugin>
</properties>
Expand Down Expand Up @@ -160,6 +160,26 @@
</classPatterns>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${version.maven-enforcer-plugin}</version>
<executions>
<execution>
<id>enforce-java-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>[17,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.maven-compiler-plugin}</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,31 @@
var entityName = entry.getKey();
var entitySchema = entry.getValue();
var entityCatalog = catalogMap.get(entityName);

switch (entityName) {
case "beans" -> processBeansParameters(entitySchema, entityCatalog);
case "from" -> processFromParameters(entitySchema, entityCatalog);
case "route" -> processRouteParameters(entitySchema, entityCatalog);
case "routeTemplate" -> processRouteTemplateParameters(entitySchema, entityCatalog);
case "templatedRoute" -> processTemplatedRouteParameters(entitySchema, entityCatalog);
case "restConfiguration" -> processRestConfigurationParameters(entitySchema, entityCatalog);
case "rest" -> processRestParameters(entitySchema, entityCatalog);
case null, default -> processEntityParameters(entityName, entitySchema, entityCatalog);
case "beans":
processBeansParameters(entitySchema, entityCatalog);
break;

Check warning on line 406 in packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java

View check run for this annotation

Codecov / codecov/patch

packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java#L405-L406

Added lines #L405 - L406 were not covered by tests
case "from":
processFromParameters(entitySchema, entityCatalog);
break;

Check warning on line 409 in packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java

View check run for this annotation

Codecov / codecov/patch

packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java#L408-L409

Added lines #L408 - L409 were not covered by tests
case "route":
processRouteParameters(entitySchema, entityCatalog);
break;

Check warning on line 412 in packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java

View check run for this annotation

Codecov / codecov/patch

packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java#L411-L412

Added lines #L411 - L412 were not covered by tests
case "routeTemplate":
processRouteTemplateParameters(entitySchema, entityCatalog);
break;

Check warning on line 415 in packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java

View check run for this annotation

Codecov / codecov/patch

packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java#L414-L415

Added lines #L414 - L415 were not covered by tests
case "templatedRoute":
processTemplatedRouteParameters(entitySchema, entityCatalog);
break;

Check warning on line 418 in packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java

View check run for this annotation

Codecov / codecov/patch

packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java#L417-L418

Added lines #L417 - L418 were not covered by tests
case "restConfiguration":
processRestConfigurationParameters(entitySchema, entityCatalog);
break;

Check warning on line 421 in packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java

View check run for this annotation

Codecov / codecov/patch

packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java#L420-L421

Added lines #L420 - L421 were not covered by tests
case "rest":
processRestParameters(entitySchema, entityCatalog);
break;

Check warning on line 424 in packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java

View check run for this annotation

Codecov / codecov/patch

packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java#L423-L424

Added lines #L423 - L424 were not covered by tests
default:
processEntityParameters(entityName, entitySchema, entityCatalog);

Check warning on line 426 in packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java

View check run for this annotation

Codecov / codecov/patch

packages/catalog-generator/src/main/java/io/kaoto/camelcatalog/generator/CamelCatalogProcessor.java#L426

Added line #L426 was not covered by tests
}
lordrip marked this conversation as resolved.
Show resolved Hide resolved

sortPropertiesAccordingToCamelCatalog(entitySchema, entityCatalog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void testGeneratorCalledWithCorrectParameters() {
})) {
generateCommand.run();

CatalogGeneratorBuilder builder = mockedBuilder.constructed().getFirst();
CatalogGeneratorBuilder builder = mockedBuilder.constructed().get(0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢


verify(builder, times(1)).withRuntime(CatalogRuntime.Main);
verify(builder, times(1)).withCamelCatalogVersion("4.8.0");
Expand Down Expand Up @@ -99,12 +99,12 @@ void testCatalogLibraryOutput() {
) {
generateCommand.run();

CatalogLibrary library = mockedLibrary.constructed().getFirst();
CatalogLibrary library = mockedLibrary.constructed().get(0);

assertEquals(library.getName(), "test-camel-catalog");
assertEquals(library.getDefinitions().size(), 1);

CatalogLibraryEntry catalogLibraryEntry = library.getDefinitions().getFirst();
CatalogLibraryEntry catalogLibraryEntry = library.getDefinitions().get(0);
assertEquals(catalogLibraryEntry.name(), "test-camel-catalog");
assertEquals(catalogLibraryEntry.version(), "4.8.0");
assertEquals(catalogLibraryEntry.runtime(), "Main");
Expand Down