Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 3ba62901 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

Add unit tests

parent 15cc3bbc
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,7 @@ while getopts v:o:s:c:p: option; do
esac
done
if [[ -z "${SMP_VERSION}" ]]; then
# get version from setup file
echo "Get version from the pom: $(pwd)"
......@@ -65,11 +66,14 @@ if [[ -z "${SMP_VERSION}" ]]; then
fi
SMP_PLUGIN_EXAMPLE="../../smp-examples/smp-spi-example/target/smp-spi-example-$SMP_VERSION.jar"
DIRNAME=$(dirname "$0")
cd "$DIRNAME"
DIRNAME="$(pwd -P)"
echo "*****************************************************************"
echo "* SMP artefact folders: $SMP_ARTEFACTS, (Clear folder after build: $SMP_ARTEFACTS_CLEAR )"
echo "* Plugin example: $SMP_PLUGIN_EXAMPLE "
echo "* Build SMP image for version $SMP_VERSION"
echo "* Oracle artefact folders: $ORACLE_ARTEFACTS"
echo "*****************************************************************"
......@@ -151,6 +155,11 @@ validateAndPrepareArtefacts() {
cp "${SMP_ARTEFACTS}/smp-${SMP_VERSION}-setup.zip" ./tomcat-mysql-smp-sml/artefacts/smp-setup.zip
fi
if [[ ! -f "${SMP_PLUGIN_EXAMPLE}" ]]; then
echo "SMP SPI plugin '${SMP_PLUGIN_EXAMPLE}' not found. Skip plugin!"
else
cp "${SMP_PLUGIN_EXAMPLE}" ./tomcat-mysql-smp-sml/artefacts/smp-spi-example.jar
fi
}
# -----------------------------------------------------------------------------
......
......@@ -132,6 +132,8 @@ RUN unzip /tmp/artefacts/smp-setup.zip -d /tmp/ \
&& mv /tmp/bdmsl-webapp-$SML_VERSION /tmp/sml-setup \
&& cp /tmp/sml-setup/encriptionPrivateKey.private /opt/smlconf/encriptionPrivateKey.private \
&& cp /tmp/sml-setup/keystore.jks /opt/smlconf/keystore.jk \
&& mkdir $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp-libs \
&& mv /tmp/artefacts/*.jar $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp-libs \
&& chmod u+x /sbin/entrypoint.sh
......
......@@ -4,12 +4,15 @@ Image uses latest version of eDelivery SMP setup on tomcat, mysql ubuntu
# Image build
docker build -t smp .
docker build -t smp .
# Run container based on smp image
docker run --name smp -it --rm -p [http-port]:8080 -v [local volume]:/data smp
docker run --name smp -it --rm -p [http-port]:8080 edelivery-docker.devops.tech.ec.europa.eu/edeliverytest/smp-sml-tomcat-mysql
example:
docker run --name smp --rm -it -p 8080:8080 -v /opt/dockerdata/smp:/data smp smp
docker run --name smp --rm -it -p 8080:8080 edelivery-docker.devops.tech.ec.europa.eu/edeliverytest/smp-sml-tomcat-mysql:4.2-SNAPSHOT
## SMP (param: -p 8080:8080 )
url: http://localhost:8080/smp
......@@ -20,9 +23,22 @@ url: jdbc:mysql://localhost:3306/smp
Username: smp
Password: smp
## Volume (-v /opt/dockerdata/sml:/data)
## Volume (-v /opt/docker-data/smp:/data)
Mysql database files and tomcat configuration (and logs) can be externalized for experimenting with different SMP settings.
docker run --name smp --rm -it -p 8080:8080 -v /opt/docker-data/smp:/data edelivery-docker.devops.tech.ec.europa.eu/edeliverytest/smp-sml-tomcat-mysql:4.2-SNAPSHOT
# Start docker with pre-init data
1. copy init sql script to folder (create folder)
./db-scripts
example:
curl -k https://ec.europa.eu/digital-building-blocks/code/projects/EDELIVERY/repos/smp/raw/smp-soapui-tests/groovy/mysql-4.1_integration_test_data.sql?at=refs%2Fheads%2Fdevelopment --output ./db-scripts/mysql5innodb-data.sql
Then start the docker as:
docker run --name smp --rm -it -p 8080:8080 -v - db-scripts:/tmp/custom-data/ edelivery-docker.devops.tech.ec.europa.eu/edeliverytest/smp-sml-tomcat-mysql:4.2-SNAPSHOT
......@@ -83,6 +83,8 @@ init_smp_properties() {
echo "[INFO] init smp properties:"
{ echo "# SMP init parameters"
echo "libraries.folder=$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp-libs"
echo "bdmsl.integration.logical.address=${SMP_LOGICAL_ADDRESS:-http://localhost:8080/smp/}"
echo "authentication.blueCoat.enabled=true"
echo "bdmsl.integration.enabled=true"
echo "bdmsl.integration.physical.address=0.0.0.0"
......@@ -202,8 +204,8 @@ addOrReplaceProperties() {
for property in "${array[@]}"; do
read -r key value <<<"$property"
# escape regex chars and remove trailing and leading spaces..
keyRE="$(printf '%s' "${key// }" | sed 's/[.[\*^$()+?{|]/\\&/g')"
propertyRE="$(printf '%s' "${property// }" | sed 's/[.[\*^$()+?{|/]/\\&/g')"
keyRE="$(printf '%s' "${key// }" | sed 's/[[\*^$()+?{|]/\\&/g')"
propertyRE="$(printf '%s' "${property// }" | sed 's/[[\*^$()+?{|/]/\\&/g')"
echo "replace or add property: [$keyRE] with value [$propertyRE]"
# replace key line and commented #key line with new property
......
......@@ -13,13 +13,10 @@
package eu.europa.ec.edelivery.smp.config;
import eu.europa.ec.edelivery.smp.exceptions.ErrorCode;
import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException;
import eu.europa.ec.edelivery.smp.logging.SMPLogger;
import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory;
import eu.europa.ec.edelivery.smp.utils.ExtLibraryClassLoader;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
......@@ -36,8 +33,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.naming.NamingException;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import java.io.File;
import java.net.MalformedURLException;
import java.util.Properties;
import static eu.europa.ec.edelivery.smp.exceptions.ErrorCode.INTERNAL_ERROR;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment