diff --git a/smp-docker/images/tomcat-mysql/Dockerfile b/smp-docker/images/tomcat-mysql/Dockerfile index 5d4e5bfc918ce8566dbda7db3774de125d6ce3f0..53f31b3cbc9e015d384a3f395345fab719a2a2ce 100755 --- a/smp-docker/images/tomcat-mysql/Dockerfile +++ b/smp-docker/images/tomcat-mysql/Dockerfile @@ -19,9 +19,11 @@ RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ mysql-server \ openjdk-8-jdk \ + locales\ curl \ - unzip \ + unzip \ && rm -rf /var/lib/apt/lists/* \ + && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \ # set user && addgroup mysql mysql \ # download SMP, SMP setup, tomcat mysql driver @@ -36,10 +38,11 @@ RUN apt-get update \ && rm tomcat.zip \ && mkdir -p $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/ \ && echo "export CLASSPATH=$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf" > $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/bin/setenv.sh \ - && sed -i -e "s/<\/Context>/<Resource name=\"jdbc\/eDeliverySmpDs\" auth=\"Container\" type=\"javax.sql.DataSource\" maxTotal=\"100\" maxIdle=\"30\" maxWaitMillis=\"10000\" username=\"$DB_USER\" password=\"$DB_USER\" driverClassName=\"com.mysql.jdbc.Driver\" url=\"jdbc:mysql:\/\/localhost:3306\/$DB_SCHEMA\"\/><\/Context>/g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/conf/context.xml" \ + && sed -i -e "s/<\/Context>/<Resource name=\"jdbc\/eDeliverySmpDs\" auth=\"Container\" type=\"javax.sql.DataSource\" maxTotal=\"100\" maxIdle=\"30\" maxWaitMillis=\"10000\" username=\"$DB_USER\" password=\"$DB_USER\" driverClassName=\"com.mysql.jdbc.Driver\" url=\"jdbc:mysql:\/\/localhost:3306\/$DB_SCHEMA?useSSL=false\&characterEncoding=UTF-8\&useUnicode=true\"\/><\/Context>/g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/conf/context.xml" \ && sed -i -e "s/<Connector /<Connector URIEncoding=\"UTF-8\" /g" "$SMP_HOME/apache-tomcat-$TOMCAT_VERSION/conf/server.xml" \ - && echo "datasource.jndi=java:comp/env/jdbc/eDeliverySmpDs" > $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties - + && echo "datasource.jndi=java:comp/env/jdbc/eDeliverySmpDs" > $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \ + && echo "\nAdd init parameters" >> $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties \ + && echo "\nauthentication.blueCoat.enabled=true" >> $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/smp/conf/smp.config.properties # copy application to image ADD ./artefacts /tmp/artefacts @@ -48,7 +51,9 @@ ADD ./artefacts /tmp/artefacts # install SMP RUN unzip /tmp/artefacts/smp-setup.zip -d /tmp/ \ && mv /tmp/artefacts/smp.war $SMP_HOME/apache-tomcat-$TOMCAT_VERSION/webapps/ - + +ENV LANG en_US.utf8 + VOLUME ["/data"] COPY ./entrypoint.sh /sbin/entrypoint.sh diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceGroupService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceGroupService.java index 1ff0e7f61b49a833aa632f884d728037f957c150..b57244870c9943edc7dfaa5cdb69d794fa0cb039 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceGroupService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ServiceGroupService.java @@ -106,14 +106,16 @@ public class ServiceGroupService { // normalize service group owner - String newOwnerName = defineGroupOwner(serviceGroupOwner, authenticatedUser); - Optional<DBUser> newOwner = userDao.findUserByIdentifier(newOwnerName); + String ownerName = defineGroupOwner(serviceGroupOwner, authenticatedUser); + Optional<DBUser> newOwner = userDao.findUserByIdentifier(ownerName); if (!newOwner.isPresent() && !StringUtils.isBlank(serviceGroupOwner) && serviceGroupOwner.contains(":")) { // try harder - String[] val = splitSerialFromSubject(newOwnerName); - newOwnerName = DistinguishedNamesCodingUtil.normalizeDN(val[0]) + ':' + val[1]; + String[] val = splitSerialFromSubject(ownerName); + String newOwnerName = DistinguishedNamesCodingUtil.normalizeDN(val[0]) + ':' + val[1]; + LOG.info("Owner not found: {} try with normalized owner: {}.", ownerName, newOwnerName); newOwner = userDao.findUserByIdentifier(newOwnerName); + ownerName = newOwnerName; } if (!newOwner.isPresent()) { @@ -135,7 +137,7 @@ public class ServiceGroupService { // check if user has rights to modified // test service owner DBServiceGroup sg = dbServiceGroup.get(); - validateOwnership(newOwnerName, sg); + validateOwnership(ownerName, sg); //check is domain exists Optional<DBServiceGroupDomain> sgd = sg.getServiceGroupForDomain(dmn.getDomainCode()); if (!sgd.isPresent()){ diff --git a/smp-soapui-tests/pom.xml b/smp-soapui-tests/pom.xml index 01c715871c649912553047cc3a47915edbed8441..77e301bb21cffaddf9505820a0eb116ff4624574 100644 --- a/smp-soapui-tests/pom.xml +++ b/smp-soapui-tests/pom.xml @@ -55,6 +55,7 @@ <projectFile>${project.basedir}/soapui/SMP4.0-Generic-soapui-project.xml</projectFile> <testSuite>PASSING_AUTO_BAMBOO</testSuite> <!--If you want to execute single test case <testCase>SMP001-Create ServiceGroup-Basic Flow-Admin Service Group specified</testCase>--> + <!-- testCase>SMP022-Create ServiceMetadata-Basic Flow</testCase --> <!-- testCase>SMP079-EDELIVERY-2806-Basic Flow-BlueCote UTF8 chars</testCase --> <projectProperties> <value>url=${url}</value>