blob: 9ff7af4271cf13ab2ee81f216aa1bedfb67d476d [file] [log] [blame]
#!/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 apachedirectory/openldap-for-apache-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
sed -i 's/^root\.dn=.*/root.dn=cn=Manager,${suffix}/' 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