From 7b7adf50d8a42484618ae76aa0472755270113ca Mon Sep 17 00:00:00 2001
From: Joze RIHTARSIC <joze.RIHTARSIC@ext.ec.europa.eu>
Date: Thu, 26 May 2022 10:38:52 +0200
Subject: [PATCH] fix weblogic-oracle image

---
 .../weblogic-oracle/docker-compose.yml        |  3 ++-
 .../properties/db-scripts/01_create_user.sql  |  1 -
 .../compose/weblogic-oracle/runCompose.sh     | 19 +++++++++++++------
 .../status-folder/database.status             |  2 +-
 .../datasource.properties.oracle              |  6 +++---
 .../container-scripts/deploySMPToDomain.sh    |  2 +-
 smp-soapui-tests/pom.xml                      | 11 +++++++++++
 7 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/smp-docker/compose/weblogic-oracle/docker-compose.yml b/smp-docker/compose/weblogic-oracle/docker-compose.yml
index e01bd95cb..6f4f6b51f 100644
--- a/smp-docker/compose/weblogic-oracle/docker-compose.yml
+++ b/smp-docker/compose/weblogic-oracle/docker-compose.yml
@@ -1,8 +1,9 @@
 version: "3.0"
 services:
   database:
-    image: smp-oradb-19.3.0-se2:${SMP_VERSION}
+    image: smp-oradb-${ORA_VERSION}-${ORA_EDITION}:${SMP_VERSION}
     container_name: smp_oracle_db
+    hostname: wlsadmin
     environment:
       - ORACLE_CHARACTERSET=AL32UTF8 # set database encoding
       - NLS_LANG=.AL32UTF8  # set sqlplus encoding for stating up scripts
diff --git a/smp-docker/compose/weblogic-oracle/properties/db-scripts/01_create_user.sql b/smp-docker/compose/weblogic-oracle/properties/db-scripts/01_create_user.sql
index a2a865796..6cdf900b6 100644
--- a/smp-docker/compose/weblogic-oracle/properties/db-scripts/01_create_user.sql
+++ b/smp-docker/compose/weblogic-oracle/properties/db-scripts/01_create_user.sql
@@ -1,5 +1,4 @@
 
-ALTER SESSION SET CONTAINER=ORCLPDB1;
 CREATE USER smp IDENTIFIED BY "test" DEFAULT TABLESPACE users QUOTA UNLIMITED ON users; 
 GRANT CREATE SESSION TO smp;
 GRANT CREATE TABLE TO smp;
diff --git a/smp-docker/compose/weblogic-oracle/runCompose.sh b/smp-docker/compose/weblogic-oracle/runCompose.sh
index e61344359..df4be8431 100755
--- a/smp-docker/compose/weblogic-oracle/runCompose.sh
+++ b/smp-docker/compose/weblogic-oracle/runCompose.sh
@@ -2,16 +2,20 @@
 
 WORKING_DIR="$(dirname $0)"
 SMP_INIT_DATABASE="../../../smp-webapp/src/main/smp-setup/database-scripts/oracle10g.ddl"
-SMP_INIT_DATABASE_DATA="../../../smp-webapp/src/main/smp-setup/database-scripts/oracle10g-data.sql"
+#SMP_INIT_DATABASE_DATA="../../../smp-webapp/src/main/smp-setup/database-scripts/oracle10g-data.sql"
+SMP_INIT_DATABASE_DATA="../../../smp-soapui-tests/groovy/oracle-4.1_integration_test_data.sql"
 # soap ui data
 PREFIX="smp-wls-orcl"
 SMP_VERSION=
 
 
-ORA_VERSION="19.3.0"
-ORA_EDITION="se2"
-ORA_SERVICE="ORCLPDB1"
-ORACLE_PDB="ORCLPDB1"
+#ORA_VERSION="19.3.0"
+#ORA_EDITION="se2"
+#ORA_SERVICE="ORCLPDB1"
+#ORACLE_PDB="ORCLPDB1"
+ORA_VERSION="11.2.0.2"
+ORA_EDITION="xe"
+ORA_SERVICE="xe"
 
 SMP_DB_USERNAME=smp;
 SMP_DB_PASSWORD=test;
@@ -101,7 +105,10 @@ fi
 echo "Database starting" > ./status-folder/database.status
 clearOldContainers
 # start 
-export SMP_VERSION="${SMP_VERSION}"
+export SMP_VERSION
+export ORA_VERSION
+export ORA_EDITION
+
 docker-compose -p ${PREFIX} up -d --force-recreate
 
 
diff --git a/smp-docker/compose/weblogic-oracle/status-folder/database.status b/smp-docker/compose/weblogic-oracle/status-folder/database.status
index 4e22a70d0..85a548816 100644
--- a/smp-docker/compose/weblogic-oracle/status-folder/database.status
+++ b/smp-docker/compose/weblogic-oracle/status-folder/database.status
@@ -1 +1 @@
-Database stopped
+DATABASE IS READY TO USE!
diff --git a/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/datasource.properties.oracle b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/datasource.properties.oracle
index 8ec8cf756..bb1ba5c50 100644
--- a/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/datasource.properties.oracle
+++ b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/datasource.properties.oracle
@@ -1,8 +1,8 @@
-dsname=cipaeDeliveryDs
+dsname=eDeliverySmpDs
 dsdbname=default;create=true
-dsjndiname=jdbc/cipaeDeliveryDs
+dsjndiname=jdbc/eDeliverySmpDs
 dsdriver=oracle.jdbc.OracleDriver
-dsurl=jdbc:oracle:thin:@//database:1521/ORCLPDB1
+dsurl=jdbc:oracle:thin:@//database:1521/xe
 dsusername=smp
 dspassword=test
 dstestquery=SQL ISVALID
diff --git a/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/deploySMPToDomain.sh b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/deploySMPToDomain.sh
index c39ad982a..f74d954fe 100755
--- a/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/deploySMPToDomain.sh
+++ b/smp-docker/images/weblogic-12.2.1.3-smp/container-scripts/deploySMPToDomain.sh
@@ -10,7 +10,7 @@ fi
 
 # create smp property file
 echo "hibernate.dialect=org.hibernate.dialect.Oracle10gDialect" > "$DOMAIN_HOME/classes/smp.config.properties"
-echo "datasource.jndi=jdbc/cipaeDeliveryDs" >> "$DOMAIN_HOME/classes/smp.config.properties"
+echo "datasource.jndi=jdbc/eDeliverySmpDs" >> "$DOMAIN_HOME/classes/smp.config.properties"
 echo "authentication.blueCoat.enabled=true" >> "$DOMAIN_HOME/classes/smp.config.properties"
 echo "smp.truststore.password={DEC}{test123}" >> "$DOMAIN_HOME/classes/smp.config.properties"
 echo "smp.keystore.password={DEC}{test123}" >> "$DOMAIN_HOME/classes/smp.config.properties"
diff --git a/smp-soapui-tests/pom.xml b/smp-soapui-tests/pom.xml
index aa9a0be65..de2637244 100644
--- a/smp-soapui-tests/pom.xml
+++ b/smp-soapui-tests/pom.xml
@@ -112,11 +112,22 @@
                             </execution>
                         </executions>
                     </plugin>
+
+                </plugins>
+            </build>
+        </profile>
+        <!-- soap ui -->
+        <profile>
+            <id>dump-code-coverage</id>
+            <build>
+                <defaultGoal>test</defaultGoal>
+                <plugins>
                     <!-- dump jacoco report from remote agent and generate report  -->
                     <plugin>
                         <groupId>org.jacoco</groupId>
                         <artifactId>jacoco-maven-plugin</artifactId>
                         <version>${jacoco.maven.plugin.version}</version>
+
                         <configuration>
                             <classDumpDir>${project.build.outputDirectory}../target/</classDumpDir>
                         </configuration>
-- 
GitLab