Forum Discussion
#!/bin/bash
#JAVA 17
export JAVA_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.desktop/java.beans=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/javax.swing=ALL-UNNAMED --add-opens java.base/sun.net.www=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-opens java.desktop/javax.swing.plaf=ALL-UNNAMED --add-opens java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens jdk.jdi/com.sun.jdi=ALL-UNNAMED"
if [ -z ${SLM_LICENSE_SERVER+x} ]; then
# Obtaining a JProd floating license
echo "1" | java ${JAVA_OPTS} -jar ${WORKING_FOLDER}/ready-api-license-manager-${LICENSE_MANAGER_VERSION}.jar -s ${LICENSE_SERVER};
if [ $? != 0 ]; then
echo "6" | java ${JAVA_OPTS} -jar ${WORKING_FOLDER}/ready-api-license-manager-${LICENSE_MANAGER_VERSION}.jar -s ${LICENSE_SERVER};
if [ $? != 0 ]; then
exit 101;
fi
fi
else
echo "Using SLM licensing."
# Run using SLM license server
if [ -z ${API_KEY+x} ]; then
echo "API_KEY value is not specified. SLM licensing won't work!"
exit 101
else
COMMAND_LINE="${COMMAND_LINE} -K$API_KEY"
fi
if [[ ${SLM_LICENSE_SERVER,,} =~ ^(http.*)($|:([0-9]*)) ]]; then
SLM_HOST=${BASH_REMATCH[1]}
PORT=${BASH_REMATCH[3]}
COMMAND_LINE="${COMMAND_LINE} -DlicenseApiHost=${SLM_HOST}"
if [ -n ${PORT+x} ]; then
COMMAND_LINE="${COMMAND_LINE} -DlicenseApiPort=${PORT}"
fi
echo "Using SmartBear On-Premise License Manager."
else
echo "Using SmartBear License Management."
fi
fi
# Copying the project with the dependencies
if [ -d "$MOUNTED_PROJECT_FOLDER" ]; then
cp -a "$MOUNTED_PROJECT_FOLDER"/. "$PROJECT_FOLDER"
fi
# Copying the external libraries
if [ -d "$MOUNTED_EXT_FOLDER" ]; then
cp -a "$MOUNTED_EXT_FOLDER"/. "$READYAPI_FOLDER"/bin/ext
fi
# Running the project
sed -i "s|COMMAND_LINE|$COMMAND_LINE|" "$WORKING_FOLDER"/RunProject.sh
sed -i "s|%project%|$PROJECT_FOLDER|g" "$WORKING_FOLDER"/RunProject.sh
sed -i "s|%reports%|$REPORTS_FOLDER|g" "$WORKING_FOLDER"/RunProject.sh
chmod 755 "$WORKING_FOLDER"/RunProject.sh
"$WORKING_FOLDER"/RunProject.sh
# Analyzing the exit code
export EXIT_CODE=$?
if [ $EXIT_CODE -eq 1 ]; then
exit 102
fi
if [ $EXIT_CODE != 0 ]; then
exit 103
fi
exit 0
Related Content
- 3 years ago
Recent Discussions
- 22 days ago