You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2015/04/19 17:47:25 UTC

directory-fortress-core git commit: Add initial dockerfile and script to run tests

Repository: directory-fortress-core
Updated Branches:
  refs/heads/master 46a0f75a6 -> 4994cc003


Add initial dockerfile and script to run tests


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/4994cc00
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/4994cc00
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/4994cc00

Branch: refs/heads/master
Commit: 4994cc0035ef5cabd366eb0582f5571669288dd3
Parents: 46a0f75
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
Authored: Sun Apr 19 17:45:44 2015 +0200
Committer: Stefan Seelmann <ma...@stefan-seelmann.de>
Committed: Sun Apr 19 17:45:44 2015 +0200

----------------------------------------------------------------------
 docker/Dockerfile   | 45 ++++++++++++++++++++++++++++++++++++++++
 docker/README.md    | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 docker/run-tests.sh | 48 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/4994cc00/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..b46e290
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,45 @@
+#
+#   Licensed to the Apache Software Foundation (ASF) under one 
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+#   KIND, either express or implied.  See the License for the 
+#   specific language governing permissions and limitations
+#   under the License.
+#
+
+FROM java:8
+
+# Prerequisites: Fortress Quickstart downloaded from https://symas.com/downloads/
+ADD fortressBuilder-Debian-Silver-x86-64-1.0-RC39.zip /root/fortress/
+
+WORKDIR /root/fortress
+
+RUN \
+    # Fortress Quickstart README Section I
+    unzip fortressBuilder-Debian-Silver-x86-64-1.0-RC39.zip && \
+    chmod a+x -Rf * && \
+    # Fortress Quickstart README Section II
+    sed -i 's/export JAVA_HOME=.*/export JAVA_HOME=\/usr\/lib\/jvm\/java-1.8.0-openjdk-amd64\//' b.sh && \
+    ./b.sh dist && \
+    # Fortress Quickstart README Section III
+    ./b.sh init-slapd && \
+    # Cleanup: only the configured OpenLDAP server is required
+    rm -rf /root/fortress && \
+    rm -rf /root/.ivy2
+    
+WORKDIR /root
+
+EXPOSE 389
+
+CMD ["/opt/symas/lib64/slapd", "-d", "32768", "-u", "root", "-g", "root"]
+

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/4994cc00/docker/README.md
----------------------------------------------------------------------
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 0000000..0c1fa21
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,53 @@
+> Licensed to the Apache Software Foundation (ASF) under one
+> or more contributor license agreements.  See the NOTICE file
+> distributed with this work for additional information
+> regarding copyright ownership.  The ASF licenses this file
+> to you under the Apache License, Version 2.0 (the
+> "License"); you may not use this file except in compliance
+> with the License.  You may obtain a copy of the License at
+>
+>    http://www.apache.org/licenses/LICENSE-2.0
+>
+> Unless required by applicable law or agreed to in writing,
+> software distributed under the License is distributed on an
+> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+> KIND, either express or implied.  See the License for the
+> specific language governing permissions and limitations
+> under the License.
+
+
+# About
+
+A docker image with preconfigured OpenLDAP to be used for running Apache Fortress integration tests.
+
+
+## Prerequisites
+
+* Docker installation
+
+
+## Build image
+
+Download Fortress Quickstart from https://symas.com/downloads/ (fortressBuilder-Debian-Silver-x86-64-1.0-RC39.zip).
+
+    docker build -t apache-directory/openldap-for-fortress-tests .
+
+
+## Run container
+
+    CONTAINER_ID=$(docker run -d -P apache-directory/openldap-for-fortress-tests)
+    CONTAINER_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "389/tcp") 0).HostPort}}' $CONTAINER_ID)
+    echo $CONTAINER_PORT
+
+
+## Stop and delete container
+
+    docker stop $CONTAINER_ID
+    docker rm $CONTAINER_ID
+
+
+## Run fortress-core tests
+
+Run script `run-tests.sh` in FORTRESS_HOME. 
+
+

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/4994cc00/docker/run-tests.sh
----------------------------------------------------------------------
diff --git a/docker/run-tests.sh b/docker/run-tests.sh
new file mode 100755
index 0000000..8bb5de2
--- /dev/null
+++ b/docker/run-tests.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+#   Licensed to the Apache Software Foundation (ASF) under one
+#   or more contributor license agreements.  See the NOTICE file
+#   distributed with this work for additional information
+#   regarding copyright ownership.  The ASF licenses this file
+#   to you under the Apache License, Version 2.0 (the
+#   "License"); you may not use this file except in compliance
+#   with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing,
+#   software distributed under the License is distributed on an
+#   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#   KIND, either express or implied.  See the License for the
+#   specific language governing permissions and limitations
+#   under the License.
+#
+
+# startup docker container
+CONTAINER_ID=$(docker run -d -P apache-directory/openldap-for-fortress-tests)
+CONTAINER_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "389/tcp") 0).HostPort}}' $CONTAINER_ID)
+echo $CONTAINER_PORT
+
+# configure build.properties
+cp build.properties.example build.properties
+sed -i 's/^ldap\.server\.type=.*/ldap.server.type=openldap/' build.properties
+sed -i 's/^ldap\.host=.*/ldap.host=localhost/' build.properties
+sed -i 's/^ldap\.port=.*/ldap.port='${CONTAINER_PORT}'/' build.properties
+sed -i 's/^suffix\.name=.*/suffix.name=openldap/' build.properties
+sed -i 's/^suffix\.dc=.*/suffix.dc=org/' build.properties
+sed -i 's/^root\.dn=.*/root.dn=cn=Manager,${suffix}/' build.properties
+sed -i 's/^root\.pw=.*/root.pw={SSHA}pSOV2TpCxj2NMACijkcMko4fGrFopctU/' build.properties
+sed -i 's/^cfg\.root\.pw=.*/cfg.root.pw=secret/' build.properties
+
+# prepare
+mvn clean install
+mvn install -Dload.file=./ldap/setup/refreshLDAPData.xml
+mvn install -Dload.file=./ldap/setup/DelegatedAdminManagerLoad.xml
+
+# run tests
+mvn test -Dtest=FortressJUnitTest
+
+# stop and delete docker container
+docker stop $CONTAINER_ID
+docker rm $CONTAINER_ID
+