diff --git a/Jenkinsfile b/Jenkinsfile index 08db47009ed..b8e78c566a3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { stage('Build') { steps { echo '*#*#*#*#*#*#*#*#*#*#*#*# Building SRC *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' - sh """mvn -B -V -ff -e clean install --strict-checksums -PQuickBuild \ + sh """mvn -B -V -ff -e clean install --strict-checksums -PQuickBuild,BuildEmbedded \ -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ -Djavax.xml.accessExternalSchema=all -Dbuild.number=${payaraBuildNumber} \ -Djavadoc.skip -Dsource.skip""" @@ -42,6 +42,9 @@ pipeline { archiveArtifacts artifacts: 'appserver/distributions/payara/target/payara.zip', fingerprint: true archiveArtifacts artifacts: 'appserver/extras/payara-micro/payara-micro-distribution/target/payara-micro.jar', fingerprint: true stash name: 'payara-target', includes: 'appserver/distributions/payara/target/**', allowEmpty: true + stash name: 'payara-micro', includes: 'appserver/extras/payara-micro/payara-micro-distribution/target/**', allowEmpty: true + stash name: 'payara-embedded-all', includes: 'appserver/extras/embedded/all/target/**', allowEmpty: true + stash name: 'payara-embedded-web', includes: 'appserver/extras/embedded/web/target/**', allowEmpty: true dir('/home/ubuntu/.m2/repository/'){ stash name: 'payara-m2-repository', includes: '**', allowEmpty: true } @@ -224,6 +227,45 @@ pipeline { } } } + + stage('Payara Functional Tests') { + agent { + label 'general-purpose' + } + steps { + setupM2RepositoryOnly() + echo '*#*#*#*#*#*#*#*#*#*#*#*# Unstash Micro and Embedded *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + unstash name: 'payara-micro' + unstash name: 'payara-embedded-all' + unstash name: 'payara-embedded-web' + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Building dependencies *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """mvn -V -B -ff clean install --strict-checksums \ + -Dpayara.version=${pom.version} \ + -Djavax.net.ssl.trustStore=${env.JAVA_HOME}/lib/security/cacerts \ + -Djavax.xml.accessExternalSchema=all \ + -DskipTests \ + -f appserver/tests/payara-samples """ + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test with Payara Micro *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """mvn -V -B -ff clean install --strict-checksums -Ppayara-micro-managed,install-deps \ + -Dpayara.version=${pom.version} \ + -f appserver/tests/functional/payara-micro """ + + echo '*#*#*#*#*#*#*#*#*#*#*#*# Running test with Payara Embedded *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + sh """mvn -V -B -ff clean verify --strict-checksums -PFullProfile \ + -Dversion=${pom.version} -f appserver/tests/functional/embeddedtest """ + + sh """mvn -V -B -ff clean verify --strict-checksums -PWebProfile \ + -Dversion=${pom.version} -f appserver/tests/functional/embeddedtest """ + echo '*#*#*#*#*#*#*#*#*#*#*#*# Ran test *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + } + post { + cleanup { + processReport() + } + } + } } } } @@ -250,12 +292,23 @@ void setupDomain() { sh "${ASADMIN} start-database || true" } +void setupM2RepositoryOnly() { + echo '*#*#*#*#*#*#*#*#*#*#*#*# Unstash maven repository *#*#*#*#*#*#*#*#*#*#*#*#*#*#*#' + dir('/home/ubuntu/.m2/repository/'){ + unstash name: 'payara-m2-repository' + } +} + void processReportAndStopDomain() { junit '**/target/*-reports/*.xml' sh "${ASADMIN} stop-domain ${DOMAIN_NAME}" sh "${ASADMIN} stop-database || true" } +void processReport() { + junit '**/target/*-reports/*.xml' +} + void stopDomain() { sh "${ASADMIN} stop-domain ${DOMAIN_NAME}" sh "${ASADMIN} stop-database || true" diff --git a/appserver/tests/functional/embeddedtest/README.md b/appserver/tests/functional/embeddedtest/README.md index dbd022c365b..d8695555fce 100644 --- a/appserver/tests/functional/embeddedtest/README.md +++ b/appserver/tests/functional/embeddedtest/README.md @@ -6,6 +6,16 @@ It compiles the test with the required jar, starts payara embedded, deploy clust ## Usage +### To run the current version of Payara Embedded: + +From the location ${PAYARA_HOME}/appserver/tests/functional/embeddedtest, run the command: + +> mvn clean test -P{FullProfile/WebProfile} + +the test is designed to adapt to jdk 8, 11 and higher. + +### To run a specific version of Payara Embedded: + have the desired payara-embedded jar placed in ${PAYARA_HOME}/appserver/tests/functional/embeddedtest/lib The jar should have a name following this format: payara-embedded-{web/all}-{payara-version}.jar @@ -14,8 +24,15 @@ example: payara-embedded-all-6.2023.8.RC1.jar From the location ${PAYARA_HOME}/appserver/tests/functional/embeddedtest, run the command: -> mvn clean -P {FullProfile/WebProfile} -Dpayara.version="6.2023.8.RC1" compile test +> mvn validate -P{FullProfile/WebProfile},specificJar -Dpayara.version="6.2023.8.RC1" + +This first command installs the local jar before the compilation + +> mvn clean verify -P{FullProfile/WebProfile},specificJar -Dpayara.version="6.2023.8.RC1" + +It is also possible to specify a different location for the embedded jar: + +> mvn validate -P{FullProfile/WebProfile},specificJar -Dpayara.version="6.2023.8.RC1" -Djarlocation="/tmp/payara-embedded-all-6.2023.8.RC1.jar" -the test is designed to adapt to jdk 8, 11, or 17. +> mvn clean verify -P{FullProfile/WebProfile},specificJar -Dpayara.version="6.2023.8.RC1" -Djarlocation="/tmp/payara-embedded-all-6.2023.8.RC1.jar" -If needed, the version of jdk used to compile and run can be modified with the properties maven.compiler.source, maven.compiler.target \ No newline at end of file diff --git a/appserver/tests/functional/embeddedtest/pom.xml b/appserver/tests/functional/embeddedtest/pom.xml index f4ebf8be1c7..e17e8dbfe0a 100644 --- a/appserver/tests/functional/embeddedtest/pom.xml +++ b/appserver/tests/functional/embeddedtest/pom.xml @@ -1,4 +1,43 @@ + + diff --git a/appserver/tests/functional/payara-micro/src/test/java/fish/payara/functional/micro/ClusterHAJSPPage.java b/appserver/tests/functional/payara-micro/src/test/java/fish/payara/functional/micro/ClusterHAJSPPage.java index 9833040ec34..94d2abb3d54 100644 --- a/appserver/tests/functional/payara-micro/src/test/java/fish/payara/functional/micro/ClusterHAJSPPage.java +++ b/appserver/tests/functional/payara-micro/src/test/java/fish/payara/functional/micro/ClusterHAJSPPage.java @@ -1,3 +1,42 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2024 Payara Foundation and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://github.com/payara/Payara/blob/master/LICENSE.txt + * See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at glassfish/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * The Payara Foundation designates this particular file as subject to the "Classpath" + * exception as provided by the Payara Foundation in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ package fish.payara.functional.micro; import com.microsoft.playwright.*; diff --git a/appserver/tests/functional/payara-micro/src/test/java/fish/payara/functional/micro/DualSessionsIT.java b/appserver/tests/functional/payara-micro/src/test/java/fish/payara/functional/micro/DualSessionsIT.java index 509395caa66..4c3aeb0399a 100644 --- a/appserver/tests/functional/payara-micro/src/test/java/fish/payara/functional/micro/DualSessionsIT.java +++ b/appserver/tests/functional/payara-micro/src/test/java/fish/payara/functional/micro/DualSessionsIT.java @@ -1,3 +1,42 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2024 Payara Foundation and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://github.com/payara/Payara/blob/master/LICENSE.txt + * See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at glassfish/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * The Payara Foundation designates this particular file as subject to the "Classpath" + * exception as provided by the Payara Foundation in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ package fish.payara.functional.micro; import com.microsoft.playwright.*;