/**
* initializes an LDAP user manager instance
- * @return Manager
*/
protected function initUserManager() {
$this->userManager = new Manager(
\OC::$server->getAvatarManager(),
new \OCP\Image(),
\OC::$server->getDatabaseConnection(),
- \OC::$server->getUserManager()
+ \OC::$server->getUserManager(),
+ \OC::$server->getNotificationManager()
);
}
}
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestAccessGroupsMatchFilter($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
$groupMapper->clear();
$this->access->setGroupMapper($groupMapper);
- $userBackend = new User_LDAP($this->access, \OC::$server->getConfig());
+ $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
$userManager = \OC::$server->getUserManager();
$userManager->clearBackends();
$userManager->registerBackend($userBackend);
namespace OCA\User_LDAP\Tests\Integration\Lib;
+use OC\ServerNotAvailableException;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User_LDAP;
protected function case1() {
try {
$this->connection->getConnectionResource();
- } catch (\OC\ServerNotAvailableException $e) {
+ } catch (ServerNotAvailableException $e) {
return false;
}
return true;
'ldap_backup_port' => '32123',
]);
$this->connection->getConnectionResource();
- } catch (\OC\ServerNotAvailableException $e) {
+ } catch (ServerNotAvailableException $e) {
return true;
}
return false;
'ldap_backup_port' => '',
]);
$this->connection->getConnectionResource();
- } catch (\OC\ServerNotAvailableException $e) {
+ } catch (ServerNotAvailableException $e) {
return true;
}
return false;
}
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestBackupServer($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
require_once __DIR__ . '/../Bootstrap.php';
class IntegrationTestBatchApplyUserAttributes extends AbstractIntegrationTest {
+ /** @var UserMapping */
+ protected $mapping;
+
/**
* prepares the LDAP environment and sets up a test configuration for
* the LDAP backend.
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestBatchApplyUserAttributes($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
namespace OCA\User_LDAP\Tests\Integration\Lib;
+use OC\ServerNotAvailableException;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User_LDAP;
]);
try {
$this->connection->getConnectionResource();
- } catch (\OC\ServerNotAvailableException $e) {
+ } catch (ServerNotAvailableException $e) {
return true;
}
return false;
]);
try {
$this->connection->getConnectionResource();
- } catch (\OC\ServerNotAvailableException $e) {
+ } catch (ServerNotAvailableException $e) {
return false;
}
return true;
]);
try {
$this->connection->getConnectionResource();
- } catch (\OC\ServerNotAvailableException $e) {
+ } catch (ServerNotAvailableException $e) {
return false;
}
return true;
]);
try {
$this->connection->getConnectionResource();
- } catch (\OC\ServerNotAvailableException $e) {
+ } catch (ServerNotAvailableException $e) {
return false;
}
return true;
]);
try {
$this->connection->getConnectionResource();
- } catch (\OC\ServerNotAvailableException $e) {
+ } catch (ServerNotAvailableException $e) {
return false;
}
return true;
}
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestConnect($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
}
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestCountUsersByLoginName($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
$this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
- $this->backend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
+ $this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
}
/**
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestFetchUsersByLoginName($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
require(__DIR__ . '/../setup-scripts/createExplicitUsers.php');
parent::init();
- $this->backend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
+ $this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
}
/**
}
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestPaging($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
namespace OCA\User_LDAP\Tests\Integration\Lib;
+use OCA\User_LDAP\FilesystemHelper;
+use OCA\User_LDAP\LogWrapper;
use OCA\User_LDAP\User\Manager as LDAPUserManager;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User_LDAP;
+use OCP\Image;
require_once __DIR__ . '/../Bootstrap.php';
$this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
- $this->backend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
+ $this->backend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
}
/**
protected function initUserManager() {
$this->userManager = new LDAPUserManager(
\OC::$server->getConfig(),
- new \OCA\User_LDAP\FilesystemHelper(),
- new \OCA\User_LDAP\LogWrapper(),
+ new FilesystemHelper(),
+ new LogWrapper(),
\OC::$server->getAvatarManager(),
- new \OCP\Image(),
+ new Image(),
\OC::$server->getDatabaseConnection(),
- \OC::$server->getUserManager()
+ \OC::$server->getUserManager(),
+ \OC::$server->getNotificationManager()
);
}
}
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestUserHome($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
namespace OCA\User_LDAP\Tests\Integration\Lib\User;
+use OCA\User_LDAP\FilesystemHelper;
+use OCA\User_LDAP\LogWrapper;
+use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User\User;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
+use OCA\User_LDAP\User_LDAP;
+use OCP\Image;
require_once __DIR__ . '/../../Bootstrap.php';
$this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
- $userBackend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
+ $userBackend = new User_LDAP($this->access, \OC::$server->getConfig(), \OC::$server->getNotificationManager());
\OC_User::useBackend($userBackend);
}
}
protected function initUserManager() {
- $this->userManager = new \OCA\User_LDAP\User\Manager(
+ $this->userManager = new Manager(
\OC::$server->getConfig(),
- new \OCA\User_LDAP\FilesystemHelper(),
- new \OCA\User_LDAP\LogWrapper(),
+ new FilesystemHelper(),
+ new LogWrapper(),
\OC::$server->getAvatarManager(),
- new \OCP\Image(),
+ new Image(),
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserManager(),
\OC::$server->getNotificationManager()
}
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestUserAvatar($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
}
}
+/** @var string $host */
+/** @var int $port */
+/** @var string $adn */
+/** @var string $apwd */
+/** @var string $bdn */
$test = new IntegrationTestUserDisplayName($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();
--- /dev/null
+#!/bin/bash
+
+trigger_notification() {
+ which notify-send 1>/dev/null
+ if [[ $? == 1 ]] ; then
+ return
+ fi
+ export NOTIFY_USER=$SUDO_USER
+ export RESULT_STR=$1
+ # does not work. just pipe result into a non-sudo cmd
+ su "$NOTIFY_USER" -c "notify-send -u normal -t 43200000 -a Nextcloud -i Nextcloud \"LDAP Integration tests $RESULT_STR\""
+}
+
+FILES_ROOT=($(ls -d -p Lib/* | grep -v "/$"))
+FILES_USER=($(ls -d -p Lib/User/* | grep -v "/$"))
+# TODO: Loop through dirs (and subdirs?) once there are more
+TESTFILES=("${FILES_ROOT[@]}" "${FILES_USER[@]}")
+
+TESTCMD="./run-test.sh"
+
+echo "Running " ${#TESTFILES[@]} " tests"
+for TESTFILE in "${TESTFILES[@]}" ; do
+ echo -n "Test: $TESTFILE… "
+ STATE=`$TESTCMD "$TESTFILE" | grep -c "Tests succeeded"`
+ if [ "$STATE" -eq 0 ] ; then
+ echo "failed!"
+ trigger_notification "failed"
+ exit 1
+ fi
+ echo "succeeded"
+done
+
+echo -e "\nAll tests succeeded"
+trigger_notification "succeeded"