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.
Minimum hardware requirements:
Minimum software requirements:
a. from the command line:
git clone https://gitbox.apache.org/repos/asf/directory-fortress-core.git cd directory-fortress-core
docker build -t apachedirectory/apacheds-for-apache-fortress-tests -f src/docker/apacheds-for-apache-fortress-tests/Dockerfile .
Or just pull the prebuilt image:
docker pull apachedirectory/apacheds-for-apache-fortress-tests
CONTAINER_ID=$(docker run -d -P apachedirectory/apacheds-for-apache-fortress-tests) CONTAINER_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "10389/tcp") 0).HostPort}}' $CONTAINER_ID) echo $CONTAINER_PORT
*note: make note of the port as it‘s needed later *depending on your docker setup may need to run as root or sudo priv’s.
cp build.properties.example build.properties
vi build.properties
ldap.port= port from earlier step
Save and exit
Prepare your terminal for execution of maven commands.
#!/bin/sh export M2_HOME=... export JAVA_HOME=... export PATH=$PATH:$M2_HOME/bin
mvn clean install
mvn install -Dload.file=./ldap/setup/refreshLDAPData.xml mvn install -Dload.file=./ldap/setup/DelegatedAdminManagerLoad.xml
These will build the Directory Information Tree (DIT), create the config and data policies needed for the integration test to follow.
mvn -Dtest=FortressJUnitTest test
Tests the APIs against your LDAP server.
Tests run: Failures: 0, Errors: 0, Skipped: 0 Results : Tests run: Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-antrun-plugin:1.8:run (default) @ fortress-core --- [INFO] Executing tasks fortress-load: [INFO] Executed tasks [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS
mvn -Dtest=FortressJUnitTest test
Results : Tests run: Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-antrun-plugin:1.8:run (default) @ fortress-core --- [INFO] Executing tasks fortress-load: [INFO] Executed tasks [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------
Notice more tests ran this time vs the first time, due to teardown.
Test Notes:
Here are some common commands needed to manage the Docker image.
docker build -t apachedirectory/apacheds-for-apache-fortress-tests -f src/docker/apacheds-for-apache-fortress-tests/Dockerfile .
Or just to be sure don't use cached layers:
docker build --no-cache=true -t apachedirectory/apacheds-for-apache-fortress-tests -f src/docker/apacheds-for-apache-fortress-tests/Dockerfile .
CONTAINER_ID=$(docker run -d -P apachedirectory/apacheds-for-apache-fortress-tests) CONTAINER_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "10389/tcp") 0).HostPort}}' $CONTAINER_ID) echo $CONTAINER_PORT
docker exec -it $CONTAINER_ID bash
docker restart $CONTAINER_ID
docker stop $CONTAINER_ID docker rm $CONTAINER_ID