Skip to content

Commit

Permalink
Merge pull request #19116 from Sachin-Mamoru/adaptive-test-files
Browse files Browse the repository at this point in the history
Update adaptive.sh file for integration tests
  • Loading branch information
Sachin-Mamoru authored Jan 23, 2024
2 parents 64252aa + 51fb90e commit 7670805
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/distribution/src/bin/adaptive.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ rem
rem CARBON_HOME Home of WSO2 Carbon installation. If not set I will try
rem to figure it out.
rem NASHORN_VERSION OpenJDK Nashorn Version
rem ASM_VERSION ASM Util, Commons Version.
rem ASM_VERSION ASM Util, Commons, Tree Version.
rem JMS_VERSION Geronimo Spec JMS Version.
rem
rem -----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ rem
rem CARBON_HOME Home of WSO2 Carbon installation. If not set I will try
rem to figure it out.
rem NASHORN_VERSION OpenJDK Nashorn Version
rem ASM_VERSION ASM Util, Commons Version.
rem ASM_VERSION ASM Util, Commons, Tree Version.
rem JMS_VERSION Geronimo Spec Jms Version.
rem
rem -----------------------------------------------------------------------------

set NASHORN_VERSION=15.3
set ASM_VERSION=9.2
set JMS_VERSION=1.1.0.rc4-wso2v1

set SERVER_RESTART_REQUIRED="false"

Expand All @@ -49,11 +51,18 @@ goto enableAdaptiveAuth
:disableAdaptiveAuth
set LOCAL_NASHORN_VERSION=""
set LOCAL_ASM_VERSION=""
set LOCAL_JMS_VERSION=""

call :removeLibrary "Nashorn", "lib", "%CARBON_HOME%\repository\components\lib\nashorn-core-*.jar"
call :removeLibrary "Nashorn", "dropins", "%CARBON_HOME%\repository\components\dropins\nashorn_core_!LOCAL_NASHORN_VERSION!*.jar"
call :removeLibrary "Geronimo Spec Jms", "lib", "%CARBON_HOME%\repository\components\lib\geronimo-spec-jms-*.jar"
call :removeLibrary "Geronimo Spec Jms", "dropins", "%CARBON_HOME%\repository\components\dropins\geronimo_spec_jms_*.jar"
call :removeLibrary "ASM Util", "lib", "%CARBON_HOME%\repository\components\lib\asm-util-*.jar"
call :removeLibrary "ASM Util", "dropins", "%CARBON_HOME%\repository\components\dropins\asm_util_!LOCAL_ASM_VERSION!*.jar"
call :removeLibrary "ASM Commons", "lib", "%CARBON_HOME%\repository\components\lib\asm-commons-*.jar"
call :removeLibrary "ASM Commons", "dropins", "%CARBON_HOME%\repository\components\dropins\asm_commons_!LOCAL_ASM_VERSION!*.jar"
call :removeLibrary "ASM tree", "lib", "%CARBON_HOME%\repository\components\lib\asm-tree-*.jar"
call :removeLibrary "ASM tree", "dropins", "%CARBON_HOME%\repository\components\dropins\asm_tree_!LOCAL_ASM_VERSION!*.jar"

echo Adaptive authentication successfully disabled.
goto printRestartMsg
Expand Down Expand Up @@ -84,6 +93,15 @@ if exist "%file_pattern%" (
) else if "%jar_name%"=="ASM Util" (
rem extracts the a.b (i.e version) and sets it as local version.
for /f "tokens=1,2 delims=." %%l in ("!artifact_name!") do set "LOCAL_ASM_VERSION=%%l.%%m"
) else if "%jar_name%"=="ASM Commons" (
rem extracts the a.b (i.e version) and sets it as local version.
for /f "tokens=1,2 delims=." %%l in ("!artifact_name!") do set "LOCAL_ASM_VERSION=%%l.%%m"
) else if "%jar_name%"=="ASM Tree" (
rem extracts the a.b (i.e version) and sets it as local version.
for /f "tokens=1,2 delims=." %%l in ("!artifact_name!") do set "LOCAL_ASM_VERSION=%%l.%%m"
) else if "%jar_name%"=="Geronimo Spec Jms" (
rem extracts the a.b (i.e version) and sets it as local version.
for /f "tokens=1,2 delims=." %%l in ("!artifact_name!") do set "LOCAL_JMS_VERSION=%%l.%%m"
)
)

Expand Down Expand Up @@ -141,6 +159,78 @@ if exist "%CARBON_HOME%\repository\components\lib\asm-util-*.jar" (
call mvn dependency:get -Dartifact=org.ow2.asm:asm-util:%ASM_VERSION% -Ddest=%LIB_REPO%
echo ASM-Util download completed. Downloaded version : asm-util-%ASM_VERSION%
)

if exist "%CARBON_HOME%\repository\components\lib\asm-commons-*.jar" (
for /f "delims=" %%i in ('dir /s /b %CARBON_HOME%\repository\components\lib\asm-commons-*.jar') do set "location=%%i"
for %%j in (!location!!) do set "full_artifact_name=%%~nxj"
for /f "tokens=3 delims=-" %%k in ("!full_artifact_name!") do set "artifact_name=%%k"
for /f "tokens=1,2 delims=." %%l in ("!artifact_name!") do set "LOCAL_ASM_VERSION=%%l.%%m"

if %ASM_VERSION%==!LOCAL_ASM_VERSION! (
echo ASM-Commons library exists. No need to download.
) else (
set SERVER_RESTART_REQUIRED="true"
echo Required ASM-Commons library not found. Remove existing library : !full_artifact_name!
del !location!
call :removeLibrary "ASM Commons", "dropins", "%CARBON_HOME%\repository\components\dropins\asm_commons_!LOCAL_ASM_VERSION!*.jar"
echo Downloading required ASM-Commons library : asm-commons-%ASM_VERSION%
call mvn dependency:get -Dartifact=org.ow2.asm:asm-commons:%ASM_VERSION% -Ddest=%LIB_REPO%
echo ASM-Commons library updated.
)
) else (
set SERVER_RESTART_REQUIRED="true"
echo ASM-Commons library not found. Starting to download.....
call mvn dependency:get -Dartifact=org.ow2.asm:asm-commons:%ASM_VERSION% -Ddest=%LIB_REPO%
echo ASM-Commons download completed. Downloaded version : asm-commons-%ASM_VERSION%
)

if exist "%CARBON_HOME%\repository\components\lib\asm-tree-*.jar" (
for /f "delims=" %%i in ('dir /s /b %CARBON_HOME%\repository\components\lib\asm-tree-*.jar') do set "location=%%i"
for %%j in (!location!!) do set "full_artifact_name=%%~nxj"
for /f "tokens=3 delims=-" %%k in ("!full_artifact_name!") do set "artifact_name=%%k"
for /f "tokens=1,2 delims=." %%l in ("!artifact_name!") do set "LOCAL_ASM_VERSION=%%l.%%m"

if %ASM_VERSION%==!LOCAL_ASM_VERSION! (
echo ASM-Tree library exists. No need to download.
) else (
set SERVER_RESTART_REQUIRED="true"
echo Required ASM-Tree library not found. Remove existing library : !full_artifact_name!
del !location!
call :removeLibrary "ASM Tree", "dropins", "%CARBON_HOME%\repository\components\dropins\asm_tree_!LOCAL_ASM_VERSION!*.jar"
echo Downloading required ASM-Tree library : asm-tree-%ASM_VERSION%
call mvn dependency:get -Dartifact=org.ow2.asm:asm-tree:%ASM_VERSION% -Ddest=%LIB_REPO%
echo ASM-Tree library updated.
)
) else (
set SERVER_RESTART_REQUIRED="true"
echo ASM-Tree library not found. Starting to download.....
call mvn dependency:get -Dartifact=org.ow2.asm:asm-tree:%ASM_VERSION% -Ddest=%LIB_REPO%
echo ASM-Tree download completed. Downloaded version : asm-tree-%ASM_VERSION%
)

if exist "%CARBON_HOME%\repository\components\lib\geronimo-spec-jms-*.jar" (
for /f "delims=" %%i in ('dir /s /b %CARBON_HOME%\repository\components\lib\geronimo-spec-jms-*.jar') do set "location=%%i"
for %%j in (!location!!) do set "full_artifact_name=%%~nxj"
for /f "tokens=3 delims=-" %%k in ("!full_artifact_name!") do set "artifact_name=%%k"
for /f "tokens=1,2 delims=." %%l in ("!artifact_name!") do set "LOCAL_JMS_VERSION=%%l.%%m"

if %JMS_VERSION%==!LOCAL_JMS_VERSION! (
echo Geronimo-Spec-Jms library exists. No need to download.
) else (
set SERVER_RESTART_REQUIRED="true"
echo Required Geronimo-Spec-Jms library not found. Remove existing library : !full_artifact_name!
del !location!
call :removeLibrary "Geronimo Spec Jms", "dropins", "%CARBON_HOME%\repository\components\dropins\geronimo_spec_jms_!LOCAL_JMS_VERSION!*.jar"
echo Downloading required Geronimo-Spec-Jms library : geronimo-spec-jms-%JMS_VERSION%
call mvn dependency:get -DrepoUrl=https://dist.wso2.org/maven2/ -Dartifact=geronimo-spec/wso2:geronimo-spec-jms:%JMS_VERSION% -Ddest=%LIB_REPO%
echo Geronimo-Spec-Jms library updated.
)
) else (
set SERVER_RESTART_REQUIRED="true"
echo Geronimo-Spec-Jms library not found. Starting to download.....
call mvn dependency:get -DrepoUrl=https://dist.wso2.org/maven2/ -Dartifact=geronimo-spec/wso2:geronimo-spec-jms:%JMS_VERSION% -Ddest=%LIB_REPO%
echo Geronimo-Spec-Jms download completed. Downloaded version : geronimo-spec-jms-%JMS_VERSION%
)
echo Adaptive authentication successfully enabled.
goto printRestartMsg

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@
# to figure it out.
# NASHORN_VERSION OpenJDK Nashorn Version
#
# ASM_VERSION ASM Util, Commons Version.
# ASM_VERSION ASM Util, Commons, Tree Version.
#
# JMS_VERSION Geronimo Spec Jms Version.
#
# -----------------------------------------------------------------------------

CARBON_HOME=$1

NASHORN_VERSION=15.3;
ASM_VERSION=9.2;
JMS_VERSION=1.1.0.rc4-wso2v1;
DISABLE=$2;

LIB_REPO=$CARBON_HOME/repository/components/lib
Expand Down Expand Up @@ -70,6 +73,54 @@ if [[ "$DISABLE" == "DISABLE" || "$DISABLE" == "disable" ]]; then
rm $location
echo "ASM Util library Removed from component/dropins."
fi
if compgen -G "$CARBON_HOME/repository/components/lib/asm-commons-*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/lib/" ~+ -type f -name "asm-commons-*.jar" | head -1)
full_artifact_name=$(basename ${location})
artifact_name=$(echo "$full_artifact_name" | awk -F'-' '{print $3}')
LOCAL_ASM_VERSION=$(echo "$artifact_name" | awk -F'.' '{print $1 "." $2}')
echo "Remove existing ASM Commons library from lib folder: ${full_artifact_name}"
rm $location
echo "ASM Commons library Removed from component/lib."
fi
if compgen -G "$CARBON_HOME/repository/components/dropins/asm_commons_*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/dropins/" ~+ -type f -name "asm_commons_$LOCAL_ASM_VERSION*.jar" | head -1)
full_artifact_name=$(basename ${location})
echo "Remove existing ASM Commons library from dropins: ${full_artifact_name}"
rm $location
echo "ASM Commons library Removed from component/dropins."
fi
if compgen -G "$CARBON_HOME/repository/components/lib/asm-tree-*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/lib/" ~+ -type f -name "asm-tree-*.jar" | head -1)
full_artifact_name=$(basename ${location})
artifact_name=$(echo "$full_artifact_name" | awk -F'-' '{print $3}')
LOCAL_ASM_VERSION=$(echo "$artifact_name" | awk -F'.' '{print $1 "." $2}')
echo "Remove existing ASM Tree library from lib folder: ${full_artifact_name}"
rm $location
echo "ASM Tree library Removed from component/lib."
fi
if compgen -G "$CARBON_HOME/repository/components/dropins/asm_tree_*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/dropins/" ~+ -type f -name "asm_tree_$LOCAL_ASM_VERSION*.jar" | head -1)
full_artifact_name=$(basename ${location})
echo "Remove existing ASM Tree library from dropins: ${full_artifact_name}"
rm $location
echo "ASM Tree library Removed from component/dropins."
fi
if compgen -G "$CARBON_HOME/repository/components/lib/geronimo-spec-jms-*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/lib/" ~+ -type f -name "geronimo-spec-jms-*.jar" | head -1)
full_artifact_name=$(basename ${location})
artifact_name=$(echo "$full_artifact_name" | awk -F'-' '{print $3}')
LOCAL_JMS_VERSION=$(echo "$artifact_name" | awk -F'.' '{print $1 "." $2}')
echo "Remove existing Geronimo Spec Jms library from lib folder: ${full_artifact_name}"
rm $location
echo "Geronimo Spec Jms library Removed from component/lib."
fi
if compgen -G "$CARBON_HOME/repository/components/dropins/geronimo_spec_jms_*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/dropins/" ~+ -type f -name "geronimo_spec_jms_$LOCAL_JMS_VERSION*.jar" | head -1)
full_artifact_name=$(basename ${location})
echo "Remove existing Geronimo Spec Jms library from dropins: ${full_artifact_name}"
rm $location
echo "Geronimo Spec Jms library Removed from component/dropins."
fi
echo "Adaptive authentication successfully disabled."
else
if compgen -G "$CARBON_HOME/repository/components/lib/nashorn-core-*.jar" > /dev/null; then
Expand Down Expand Up @@ -111,5 +162,65 @@ else
mvn dependency:get -Dartifact=org.ow2.asm:asm-util:$ASM_VERSION -Ddest=$LIB_REPO
echo "ASM-Util download completed. Downloaded version : asm-util-${ASM_VERSION}"
fi

if compgen -G "$CARBON_HOME/repository/components/lib/asm-commons-*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/lib/" ~+ -type f -name "asm-commons-*.jar" | head -1)
full_artifact_name=$(basename ${location})
artifact_name=$(echo "$full_artifact_name" | awk -F'-' '{print $3}')
LOCAL_ASM_VERSION=$(echo "$artifact_name" | awk -F'.' '{print $1 "." $2}')
if [ "$ASM_VERSION" = "$LOCAL_ASM_VERSION" ]; then
echo "ASM-Commons library exists. No need to download."
else
echo "Required ASM-Commons library not found. Remove existing library : ${full_artifact_name}"
rm $location
echo "Downloading required ASM-Commons library : asm-commons-${ASM_VERSION}"
mvn dependency:get -Dartifact=org.ow2.asm:asm-commons:$ASM_VERSION -Ddest=$LIB_REPO
echo "ASM-Commons library updated."
fi
else
echo "ASM-Commons library not found. Starting to download....."
mvn dependency:get -Dartifact=org.ow2.asm:asm-commons:$ASM_VERSION -Ddest=$LIB_REPO
echo "ASM-Commons download completed. Downloaded version : asm-commons-${ASM_VERSION}"
fi

if compgen -G "$CARBON_HOME/repository/components/lib/asm-tree-*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/lib/" ~+ -type f -name "asm-tree-*.jar" | head -1)
full_artifact_name=$(basename ${location})
artifact_name=$(echo "$full_artifact_name" | awk -F'-' '{print $3}')
LOCAL_ASM_VERSION=$(echo "$artifact_name" | awk -F'.' '{print $1 "." $2}')
if [ "$ASM_VERSION" = "$LOCAL_ASM_VERSION" ]; then
echo "ASM-Tree library exists. No need to download."
else
echo "Required ASM-Tree library not found. Remove existing library : ${full_artifact_name}"
rm $location
echo "Downloading required ASM-Tree library : asm-tree-${ASM_VERSION}"
mvn dependency:get -Dartifact=org.ow2.asm:asm-tree:$ASM_VERSION -Ddest=$LIB_REPO
echo "ASM-Tree library updated."
fi
else
echo "ASM-Tree library not found. Starting to download....."
mvn dependency:get -Dartifact=org.ow2.asm:asm-tree:$ASM_VERSION -Ddest=$LIB_REPO
echo "ASM-Tree download completed. Downloaded version : asm-tree-${ASM_VERSION}"
fi

if compgen -G "$CARBON_HOME/repository/components/lib/geronimo-spec-jms-*.jar" > /dev/null; then
location=$(find "$CARBON_HOME/repository/components/lib/" ~+ -type f -name "geronimo-spec-jms-*.jar" | head -1)
full_artifact_name=$(basename ${location})
artifact_name=$(echo "$full_artifact_name" | awk -F'-' '{print $3}')
LOCAL_JMS_VERSION=$(echo "$artifact_name" | awk -F'.' '{print $1 "." $2}')
if [ "$JMS_VERSION" = "$LOCAL_JMS_VERSION" ]; then
echo "Geronimo-Spec-Jms library exists. No need to download."
else
echo "Required Geronimo-Spec-Jms library not found. Remove existing library : ${full_artifact_name}"
rm $location
echo "Downloading required Geronimo-Spec-Jms library : geronimo-spec-jms-${JMS_VERSION}"
mvn dependency:get -DrepoUrl=https://dist.wso2.org/maven2/ -Dartifact=geronimo-spec/wso2:geronimo-spec-jms:${JMS_VERSION} -Ddest=$LIB_REPO
echo "Geronimo-Spec-Jms library updated."
fi
else
echo "Geronimo-Spec-Jms library not found. Starting to download....."
mvn dependency:get -DrepoUrl=https://dist.wso2.org/maven2/ -Dartifact=geronimo-spec/wso2:geronimo-spec-jms:${JMS_VERSION} -Ddest=$LIB_REPO
echo "Geronimo-Spec-Jms download completed. Downloaded version : geronimo-spec-jms-${JMS_VERSION}"
fi
echo "Adaptive authentication successfully enabled."
fi

0 comments on commit 7670805

Please sign in to comment.