Skip to content

feat(QTDI-113): Support Java 17 compilation (#from:936) #1061

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
java adoptopenjdk-17.0.5+8
maven 3.8.8
gradle 8.14
maven 3.9.9
trivy 0.54.1
51 changes: 32 additions & 19 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ pipeline {
string(name: 'MAVEN_VERSION',
defaultValue: 'from .tool-versions',
description: """Provided maven version will be installed with asdf
Examples: 3.8.8, 4.0.0-beta-4 """)
Examples: 3.8.8, 3.9.9, 4.0.0-beta-4
""")

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
separator(name: "DEPLOY_CONFIG", sectionHeader: "Deployment configuration",
Expand Down Expand Up @@ -168,9 +169,11 @@ pipeline {
description: 'Choose which docker image you want to build and push. Only available if DOCKER_PUSH == True.')

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
separator(name: "QUALIFIER_CONFIG", sectionHeader: "Qualifier configuration",
separator(name: "QUALIFIER_CONFIG",
sectionHeader: "Qualifier configuration",
sectionHeaderStyle: """ background-color: #AED6F1;
text-align: center; font-size: 35px !important; font-weight : bold; """)
text-align: center; font-size: 35px !important; font-weight : bold;
""")
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
string(
name: 'VERSION_QUALIFIER',
Expand All @@ -181,9 +184,11 @@ pipeline {
From "user/JIRA-12345_some_information" the qualifier will be JIRA-12345.''')

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
separator(name: "ADVANCED_CONFIG", sectionHeader: "Advanced configuration",
separator(name: "ADVANCED_CONFIG",
sectionHeader: "Advanced configuration",
sectionHeaderStyle: """ background-color: #F8C471;
text-align: center; font-size: 35px !important; font-weight : bold; """)
text-align: center; font-size: 35px !important; font-weight : bold;
""")
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
string(
name: 'EXTRA_BUILD_PARAMS',
Expand All @@ -203,9 +208,11 @@ pipeline {
description: 'Force dependencies report stage for branches.')

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
separator(name: "EXPERT_CONFIG", sectionHeader: "Expert configuration",
separator(name: "EXPERT_CONFIG",
sectionHeader: "Expert configuration",
sectionHeaderStyle: """ background-color: #A9A9A9;
text-align: center; font-size: 35px !important; font-weight : bold;""")
text-align: center; font-size: 35px !important; font-weight : bold;
""")
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
booleanParam(
name: 'TRIVY_SCAN',
Expand All @@ -223,9 +230,11 @@ pipeline {
By entering the package name, you can find out which components are affected and thus the scope of the test.
For example: org.eclipse.jetty:jetty-http, org.apache.avro:avro, org.apache.geronimo ...''')
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
separator(name: "DEBUG_CONFIG", sectionHeader: "Jenkins job debug configuration ",
separator(name: "DEBUG_CONFIG",
sectionHeader: "Jenkins job debug configuration ",
sectionHeaderStyle: """ background-color: #FF0000;
text-align: center; font-size: 35px !important; font-weight : bold;""")
text-align: center; font-size: 35px !important; font-weight : bold;
""")
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
booleanParam(
name: 'JENKINS_DEBUG',
Expand Down Expand Up @@ -253,16 +262,20 @@ pipeline {
}

///////////////////////////////////////////
// asdf install
// edit mvn and java version
///////////////////////////////////////////
script {
echo "edit asdf tool version with version from jenkins param"

String javaVersion = asdfTools.setVersion("$env.WORKSPACE/.tool-versions",
'java', params.JAVA_VERSION)
String mavenVersion = asdfTools.setVersion("$env.WORKSPACE/.tool-versions",
'maven', params.MAVEN_VERSION)
jenkinsJobTools.job_description_append("Use java $javaVersion with maven $mavenVersion ")
if (params.JAVA_VERSION != 'from .tool-versions') {
asdfTools.edit_version_in_file("$env.WORKSPACE/.tool-versions", 'java', params.JAVA_VERSION)
}
jenkinsJobTools.job_description_append("Use java version: $params.JAVA_VERSION ")

if (params.MAVEN_VERSION != 'from .tool-versions') {
asdfTools.edit_version_in_file("$env.WORKSPACE/.tool-versions", 'maven', params.MAVEN_VERSION)
}
jenkinsJobTools.job_description_append("Use maven version: $params.MAVEN_VERSION ")

println "asdf install the content of repository .tool-versions'\n"
sh 'bash .jenkins/scripts/asdf_install.sh'
Expand Down Expand Up @@ -374,7 +387,7 @@ pipeline {

// updating build description
String description = """
Version = $finalVersion - $params.ACTION Build
Version = $finalVersion - $params.ACTION Build
Disable Sonar: $params.DISABLE_SONAR
Debug: $params.JENKINS_DEBUG
Extra build args: $extraBuildParams """.stripIndent()
Expand Down Expand Up @@ -752,8 +765,8 @@ pipeline {
currentBuild.result,
prevResult,
true, // Post for success
false // Post for failure
)
true, // Post for failure
"Failure of $pomVersion $params.ACTION.")
}
recordIssues(
enabledForFailure: false,
Expand Down Expand Up @@ -878,4 +891,4 @@ private static ArrayList<String> extract_branch_info(String branch_name) {
String description = branchMatcher.group("description")

return [user, ticket, description]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javax.json.bind.annotation.JsonbPropertyOrder;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* This class is dedicated to Studio's guess schema feature.
Expand All @@ -29,6 +30,7 @@
* See me TCOMP-2342 for more details.
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonbPropertyOrder({ "localizedMessage", "message", "stackTrace", "suppressed", "possibleHandleErrorWith" })
public class DiscoverSchemaException extends RuntimeException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<version>@maven-install-plugin.version@</version>
<configuration>
<skip>true</skip>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.talend.sdk.component.runtime.beam.coder.JsonpJsonObjectCoder;

import lombok.Data;
import lombok.EqualsAndHashCode;

public class ASource extends BoundedSource<JsonObject> {

Expand Down Expand Up @@ -78,6 +79,7 @@ private static void assertClassLoader() {
}

@Data
@EqualsAndHashCode(callSuper = true)
private static class AReader extends BoundedReader<JsonObject> {

private final ASource source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,29 +47,29 @@ void coerce() {
assertEquals(new Date(1000l), MappingUtils.coerce(Date.class, 1000l, name));
// === non-matching types ===
// number classes mapping
assertEquals(shorty, MappingUtils.coerce(short.class, new Short(shorty), name));
assertEquals(shorty, MappingUtils.coerce(short.class, shorty, name));
assertEquals(shorty, MappingUtils.coerce(Short.class, shorty.shortValue(), name));
assertEquals(Byte.valueOf("123"), MappingUtils.coerce(Byte.class, 123l, name));
assertEquals(Byte.valueOf("123"), MappingUtils.coerce(byte.class, 123l, name));
assertEquals(BigDecimal.valueOf(12345.67891), MappingUtils.coerce(BigDecimal.class, 12345.67891, name));
assertEquals(shorty.intValue(), MappingUtils.coerce(Integer.class, shorty, name));
// ==== mapping primitive <-> Class ====
assertEquals(Boolean.TRUE, MappingUtils.coerce(Boolean.class, true, name));
assertEquals('c', MappingUtils.coerce(char.class, new Character('c'), name));
assertEquals(new Character('c'), MappingUtils.coerce(Character.class, 'c', name));
assertEquals(123, MappingUtils.coerce(int.class, new Integer(123), name));
assertEquals(new Integer(123), MappingUtils.coerce(Integer.class, 123, name));
assertEquals(123l, MappingUtils.coerce(long.class, new Long(123), name));
assertEquals(new Long(123), MappingUtils.coerce(Long.class, 123, name));
assertEquals(123.456f, MappingUtils.coerce(float.class, new Float(123.456), name));
assertEquals(new Float(123.456), MappingUtils.coerce(Float.class, 123.456f, name));
assertEquals(123.456, MappingUtils.coerce(double.class, new Double(123.456), name));
assertEquals(new Double(123.456), MappingUtils.coerce(Double.class, 123.456, name));
assertEquals('c', MappingUtils.coerce(char.class, 'c', name));
assertEquals('c', MappingUtils.coerce(Character.class, 'c', name));
assertEquals(123, MappingUtils.coerce(int.class, 123, name));
assertEquals(123, MappingUtils.coerce(Integer.class, 123, name));
assertEquals(123l, MappingUtils.coerce(long.class, 123l, name));
assertEquals(123l, MappingUtils.coerce(Long.class, 123l, name));
assertEquals(123.456f, MappingUtils.coerce(float.class, 123.456, name));
assertEquals(123.456f, MappingUtils.coerce(Float.class, 123.456f, name));
assertEquals(123.456, MappingUtils.coerce(double.class, 123.456, name));
assertEquals(123.456, MappingUtils.coerce(Double.class, 123.456, name));

assertEquals("1000", MappingUtils.coerce(String.class, 1000l, name));
// string mapping
assertEquals('c', MappingUtils.coerce(char.class, "c", name));
assertEquals(new Character('c'), MappingUtils.coerce(Character.class, "c", name));
assertEquals('c', MappingUtils.coerce(Character.class, "c", name));
assertEquals(Character.MIN_VALUE, MappingUtils.coerce(Character.class, "", name));
assertEquals(true, MappingUtils.coerce(Boolean.class, "true", name));
assertEquals(true, MappingUtils.coerce(boolean.class, "true", name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = PRIVATE)
// as deprecation was introduced since = "17", can ignore it for now...
@SuppressWarnings({ "deprecation", "removal" })
public final class Unsafes {

private static final Object UNSAFE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public void evaluate() throws Throwable {
new InetSocketAddress("localhost", API.getPort()))));
connection.setConnectTimeout(30000);
connection.setReadTimeout(20000);
connection.setRequestProperty("Accept", "*/*");
connection.setRequestProperty("Accept-Encoding", "gzip");
connection.setRequestProperty("Authorization", "should be filtered");
connection.setRequestProperty("ok", "yes");
Expand All @@ -127,7 +128,7 @@ public void evaluate() throws Throwable {
final String lines = String.join("\n", Files.readAllLines(output));
assertJSONEquals("[\n" + " {\n" + " \"request\":{\n" + " \"headers\":{\n"
+ " \"content-length\":\"0\",\n"
+ " \"Accept\":\"text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\",\n"
+ " \"Accept\":\"*/*\",\n"
+ " \"Accept-Encoding\":\"gzip\",\n" + " \"ok\":\"yes\",\n"
+ " \"Proxy-Connection\":\"keep-alive\"\n" + " },\n" + " \"method\":\"GET\",\n"
+ " \"uri\":\"http://localhost:" + server.getAddress().getPort() + "/supertest\"\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public void evaluate() throws Throwable {
new InetSocketAddress("localhost", API.getPort()))));
connection.setConnectTimeout(30000);
connection.setReadTimeout(20000);
connection.setRequestProperty("Accept", "*/*");
connection.setRequestProperty("Authorization", "should be filtered");
connection.setRequestProperty("ok", "yes");
assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
Expand All @@ -117,7 +118,7 @@ public void evaluate() throws Throwable {
final String lines = String.join("\n", Files.readAllLines(output));
assertJSONEquals("[\n" + " {\n" + " \"request\":{\n" + " \"headers\":{\n"
+ " \"content-length\":\"0\",\n"
+ " \"Accept\":\"text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\",\n"
+ " \"Accept\":\"*/*\",\n"
+ " \"ok\":\"yes\",\n" + " \"Proxy-Connection\":\"keep-alive\"\n" + " },\n"
+ " \"method\":\"GET\",\n" + " \"uri\":\"http://localhost:"
+ server.getAddress().getPort() + "/supertest\"\n" + " },\n" + " \"response\":{\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public void evaluate() throws Throwable {
new InetSocketAddress("localhost", API.getPort()))));
connection.setConnectTimeout(30000);
connection.setReadTimeout(20000);
connection.setRequestProperty("Accept", "*/*");
connection.setHostnameVerifier((h, s) -> true);
connection.setSSLSocketFactory(server.getHttpsConfigurator().getSSLContext().getSocketFactory());
assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
Expand All @@ -135,7 +136,7 @@ public void evaluate() throws Throwable {
final String lines = String.join("\n", Files.readAllLines(output));
assertJSONEquals("[\n" + " {\n" + " \"request\":{\n" + " \"headers\":{\n"
+ " \"content-length\":\"0\",\n"
+ " \"Accept\":\"text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\",\n"
+ " \"Accept\":\"*/*\",\n"
+ " \"Connection\":\"keep-alive\"\n" + " },\n" + " \"method\":\"GET\",\n"
+ " \"uri\":\"https://localhost:" + server.getAddress().getPort() + "/supertest\"\n"
+ " },\n" + " \"response\":{\n" + " \"headers\":{\n"
Expand Down
3 changes: 2 additions & 1 deletion component-runtime-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@

<properties>
<wagon.version>3.4.0</wagon.version>
<shrinkwrap.version>3.3.1</shrinkwrap.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<version>3.1.4</version>
<version>${shrinkwrap.version}</version>
<exclusions>
<exclusion>
<groupId>org.jsoup</groupId>
Expand Down
1 change: 0 additions & 1 deletion component-starter-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@
</scripts>
<properties>
<gradleHome>${project.build.directory}/gradle-${gradle.version}</gradleHome>
<mvnVersion>${mvn.version}</mvnVersion>
</properties>
</configuration>
<dependencies>
Expand Down
7 changes: 4 additions & 3 deletions component-starter-server/src/build/GrabMavenWrapper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ def validateWrapperFile(File baseDir, String file){
case "mvnw":
if(!from.text.contains('exec "$JAVACMD" \\\n' +
' $MAVEN_OPTS \\\n' +
' $MAVEN_DEBUG_OPTS \\\n' +
' -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \\\n' +
' "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \\\n' +
' "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \\\n' +
' ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"')){
throw new IllegalStateException("Invalid file: " + file);
}
break
case "mvnw.cmd":
if(!from.text.contains('%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*')){
if(!from.text.contains('%MAVEN_JAVA_EXE% ^')){
throw new IllegalStateException("Invalid file: " + file);
}
break
Expand All @@ -53,7 +54,7 @@ final int exit = new ProcessBuilder().inheritIO()
.directory(fakeProject)
.command(
new File(System.getProperty('maven.home'), "bin/" + mvnCommand).getAbsolutePath(),
"-N", "io.takari:maven:wrapper", "-Dmaven=" + mvnVersion)
"-N", "-Dtype=bin", "wrapper:wrapper")
.start().waitFor()
if (exit != 0) {
throw new IllegalStateException("bad exit status generating maven wrapper: " + exit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
package org.talend.sdk.component.starter.server.service.openapi.model.openapi;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class Header extends Parameter {

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@
import org.talend.sdk.component.starter.server.service.openapi.model.common.OperationBase;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* Describes a single API operation on a path.
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class Operation extends OperationBase {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import org.talend.sdk.component.starter.server.service.openapi.model.common.ParameterBase;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class Parameter extends ParameterBase {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
import org.talend.sdk.component.starter.server.service.openapi.model.openapi.Response;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class Operation extends OperationBase {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import org.talend.sdk.component.starter.server.service.openapi.model.common.ParameterBase;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class Parameter extends ParameterBase {

/**
Expand Down
5 changes: 0 additions & 5 deletions component-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Loading
Loading