keycloak-aplcache

Details

diff --git a/testsuite/performance/keycloak/docker-entrypoint.sh b/testsuite/performance/keycloak/docker-entrypoint.sh
index 9728f98..eb44c09 100644
--- a/testsuite/performance/keycloak/docker-entrypoint.sh
+++ b/testsuite/performance/keycloak/docker-entrypoint.sh
@@ -15,4 +15,3 @@ if [ $KEYCLOAK_USER ] && [ $KEYCLOAK_PASSWORD ]; then
 fi
 
 exec /opt/jboss/keycloak/bin/standalone.sh $PARAMS
-exit $?
diff --git a/testsuite/performance/keycloak/Dockerfile b/testsuite/performance/keycloak/Dockerfile
index 487bad9..91866e8 100644
--- a/testsuite/performance/keycloak/Dockerfile
+++ b/testsuite/performance/keycloak/Dockerfile
@@ -17,26 +17,23 @@ ADD target/keycloak configs/ ./
 ADD *.sh /usr/local/bin/
 
 USER root
-RUN chown -R jboss .; chgrp -R jboss .; 
-RUN chmod -R -v +x /usr/local/bin/
-RUN yum install -y epel-release jq iproute && yum clean all
+RUN chown -R jboss .; chgrp -R jboss .; \
+    chmod -R -v +x /usr/local/bin/ ; \
+    yum install -y epel-release jq iproute && yum clean all
 
 USER jboss
 # install mariadb JDBC driver
-RUN mkdir -p modules/system/layers/base/org/mariadb/jdbc/main; \
-    cd modules/system/layers/base/org/mariadb/jdbc/main; \
-    curl -O http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.0.3/mariadb-java-client-2.0.3.jar
+RUN curl --create-dirs --output modules/system/layers/base/org/mariadb/jdbc/main/mariadb-java-client-2.0.3.jar http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.0.3/mariadb-java-client-2.0.3.jar ; \
+    $JBOSS_HOME/bin/jboss-cli.sh --file=set-keycloak-ds.cli && \
+    $JBOSS_HOME/bin/jboss-cli.sh --file=io-worker-threads.cli && \
+    $JBOSS_HOME/bin/jboss-cli.sh --file=undertow.cli && \
+    $JBOSS_HOME/bin/jboss-cli.sh --file=distributed-cache-owners.cli && \
+    $JBOSS_HOME/bin/jboss-cli.sh --file=modcluster-simple-load-provider.cli && \
+    if [ "$REMOTE_CACHES" == "true" ]; then $JBOSS_HOME/bin/jboss-cli.sh --file=add-remote-cache-stores.cli; fi && \
+    cd $JBOSS_HOME/standalone; rm -rf configuration/standalone_xml_history log data tmp ; \
+    $JBOSS_HOME/bin/add-user.sh -u $DEBUG_USER -p $DEBUG_USER_PASSWORD
+
 ADD module.xml modules/system/layers/base/org/mariadb/jdbc/main/
-# apply configurations
-RUN $JBOSS_HOME/bin/jboss-cli.sh --file=set-keycloak-ds.cli
-RUN $JBOSS_HOME/bin/jboss-cli.sh --file=io-worker-threads.cli
-RUN $JBOSS_HOME/bin/jboss-cli.sh --file=undertow.cli
-RUN $JBOSS_HOME/bin/jboss-cli.sh --file=distributed-cache-owners.cli
-RUN $JBOSS_HOME/bin/jboss-cli.sh --file=modcluster-simple-load-provider.cli
-RUN if [ "$REMOTE_CACHES" == "true" ]; then $JBOSS_HOME/bin/jboss-cli.sh --file=add-remote-cache-stores.cli; fi
-RUN cd $JBOSS_HOME/standalone; rm -rf configuration/standalone_xml_history log data tmp
-
-RUN $JBOSS_HOME/bin/add-user.sh -u $DEBUG_USER -p $DEBUG_USER_PASSWORD
 
 EXPOSE 8080
 EXPOSE 9990
diff --git a/testsuite/performance/prepare-dump.sh b/testsuite/performance/prepare-dump.sh
index 9034e39..23bd99c 100755
--- a/testsuite/performance/prepare-dump.sh
+++ b/testsuite/performance/prepare-dump.sh
@@ -4,13 +4,7 @@ GATLING_HOME=$DIRNAME/tests
 
 if [ -z "$DATASET" ]; then
     echo "This script requires DATASET env variable to be set"
-    echo 1
-fi
-
-./prepare-data.sh $@
-if [ $? -ne 0 ]; then
-    echo "Failed! See log file for details."
-    exit $?
+    exit 1
 fi
 
 echo "Exporting dump file"
diff --git a/testsuite/performance/README.md b/testsuite/performance/README.md
index ba8cc30..3eadbcc 100644
--- a/testsuite/performance/README.md
+++ b/testsuite/performance/README.md
@@ -70,7 +70,7 @@ Provisioning/teardown is performed via `docker-compose` tool. More details in [R
 
 ### Generate Test Data
 
-Usage: `mvn verify -Pgenerate-data[,cluster] [-Ddataset=DATASET] [-D<dataset.property>=<value>]`.
+Usage: `mvn verify -Pgenerate-data[,cluster] [-Ddataset=DATASET] [-Dexport-dump] [-D<dataset.property>=<value>]`.
 
 Dataset properties are loaded from `datasets/${dataset}.properties` file. Individual properties can be overriden by specifying `-D` params.
 
@@ -85,8 +85,9 @@ Dataset data is first generated as a .json file, and then imported into Keycloak
 The data can also be exported from the database, and stored locally as `datasets/${dataset}.sql.gz`
 `DATASET=100u ./prepare-dump.sh`
 
-If there is a data dump file available then -Pimport-dump can be used to import the data directly into the database, 
-by-passing Keycloak server completely.
+To speed up dataset initialization part, it is possible to pass `-Dexport-dump` option to have the generated dataset
+exported right after it has been generated. Then, if there is a data dump file available then `-Pimport-dump` 
+can be used to import the data directly into the database, bypassing Keycloak server completely.
 
 Usage: `mvn verify -Pimport-dump [-Ddataset=DATASET]`
 
diff --git a/testsuite/performance/tests/pom.xml b/testsuite/performance/tests/pom.xml
index f0414db..8103b62 100644
--- a/testsuite/performance/tests/pom.xml
+++ b/testsuite/performance/tests/pom.xml
@@ -463,6 +463,43 @@
         </profile>
 
         <profile>
+            <id>export-dump-after-generation</id>
+
+            <activation>
+                <activeByDefault>false</activeByDefault>
+                <property>
+                    <name>export-dump</name>
+                </property>
+            </activation>
+
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>export-dump</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>exec</goal>
+                                </goals>
+                                <configuration>
+                                    <workingDirectory>${project.basedir}/..</workingDirectory>
+                                    <executable>./prepare-dump.sh</executable>
+
+                                    <environmentVariables>
+                                        <DATASET>${dataset}</DATASET>
+                                    </environmentVariables>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <profile>
             <id>import-dump</id>
             <build>
                 <plugins>