Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/apache/directory-studio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Seelmann <mail@stefan-seelmann.de>2021-05-04 21:13:49 +0300
committerGitHub <noreply@github.com>2021-05-04 21:13:49 +0300
commit46686e54c64f67c646e806b6de9c747c3253eb34 (patch)
tree3ed4dae237d16bb9a91df3990888b030d3751c23
parent398a11e1877c46c90853624405628deb38b72621 (diff)
parent8f1a97f429308bed594caaf8f38340c747f8762a (diff)
Merge pull request #28 from apache/DIRSTUDIO-1274-rework-integration-tests
DIRSTUDIO-127: rework integration tests
-rw-r--r--Jenkinsfile13
-rw-r--r--README.md7
-rw-r--r--eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template3
-rw-r--r--plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java8
-rw-r--r--plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java8
-rw-r--r--plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java6
-rw-r--r--plugins/ldapbrowser.core/pom-first.xml9
-rwxr-xr-xplugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java15
-rw-r--r--plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java33
-rw-r--r--plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java20
-rw-r--r--plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaPT.java50
-rw-r--r--plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java13
-rw-r--r--plugins/ldifparser/pom-first.xml9
-rw-r--r--plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java11
-rw-r--r--plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java13
-rw-r--r--plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/parser/LdifParserTest.java9
-rw-r--r--plugins/openldap.acl.editor/src/test/java/org/apache/directory/studio/openldap/config/acl/model/OpenLdapAclParserTest.java91
-rw-r--r--plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java9
-rw-r--r--plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java6
-rw-r--r--plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java12
-rw-r--r--plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java8
-rw-r--r--plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java10
-rw-r--r--plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java10
-rw-r--r--plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java8
-rw-r--r--plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java8
-rw-r--r--plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java6
-rw-r--r--plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java6
-rw-r--r--plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java6
-rw-r--r--plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java6
-rw-r--r--plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java6
-rw-r--r--plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java8
-rw-r--r--plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java12
-rw-r--r--plugins/pom.xml31
-rw-r--r--plugins/schemaeditor/pom-first.xml9
-rw-r--r--plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java19
-rw-r--r--plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java66
-rw-r--r--plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java9
-rw-r--r--plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java52
-rw-r--r--plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java5
-rw-r--r--plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java12
-rw-r--r--plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java28
-rw-r--r--pom.xml5
-rw-r--r--tests/test.integration.core/pom-first.xml20
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/ComputeDiffTest.java21
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java681
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java16
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java145
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/Constants.java (renamed from tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/Constants.java)2
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/Fedora389dsLdapServer.java55
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServerType.java45
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServersArgumentsProvider.java90
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServersSource.java56
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/OpenLdapServer.java84
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/SkipTestIfLdapServerIsNotAvailableInterceptor.java53
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java246
-rw-r--r--tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestLdapServer.java208
-rw-r--r--tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif61
-rw-r--r--tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/OpenLdapConfig.ldif (renamed from tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/OpenLdapConfig.ldif)0
-rw-r--r--tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif460
-rw-r--r--tests/test.integration.ui/pom-first.xml13
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java121
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java45
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java747
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CertificateValidationTest.java251
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java77
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java312
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java539
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java179
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java218
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/Fedora389dsTest.java422
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java91
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java592
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java34
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/MoveEntryTest.java108
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java160
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java304
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/OpenLdapTest.java703
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PerformanceTest.java80
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java81
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ProgressViewTest.java51
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java39
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java250
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryTest.java196
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaBrowserTest.java91
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java103
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java293
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java86
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java173
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSConfigurationEditorBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java4
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java22
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java15
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DeleteDialogBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java4
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/GeneratedPasswordDialogBot.java37
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/MoveEntriesDialogBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewConnectionWizardBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ReferralDialogBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchResultEditorBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyDepthDialogBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyStrategyBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java7
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/FrameworkRunnerWithScreenshotCaptureListener.java54
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ApacheDsUtils.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDsUtils.java)4
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Assertions.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/Assertions.java)4
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Characters.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/Characters.java)5
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Constants.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/Constants.java)2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ContextMenuHelper.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ContextMenuHelper.java)2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/JobWatcher.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/JobWatcher.java)4
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ResourceUtils.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ResourceUtils.java)5
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/SWTBotUtils.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java)2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/StudioSystemUtils.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/StudioSystemUtils.java)2
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/TreeBot.java (renamed from tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/TreeBot.java)2
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif298
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif2
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/EntryEditorTest.ldif102
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/Fedora389dsTest.ldif226
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest.ldif53
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif83
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_User1to8.ldif (renamed from tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_ImportDontUpdateUI.ldif)16
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/OpenLdapTest.ldif221
-rw-r--r--tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif48
131 files changed, 5209 insertions, 5326 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 30b6b01e9..352e7fac5 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -37,9 +37,9 @@ pipeline {
}
steps {
script {
- docker.image('osixia/openldap:1.3.0').withRun() { openldap ->
+ docker.image('osixia/openldap:1.3.0').withRun('-e LDAP_TLS_VERIFY_CLIENT=never') { openldap ->
docker.image('389ds/dirsrv').withRun('-e DS_DM_PASSWORD=admin', 'bash -c "set -m; /usr/lib/dirsrv/dscontainer -r & while ! /usr/lib/dirsrv/dscontainer -H; do sleep 5; done; sleep 5; /usr/sbin/dsconf localhost backend create --suffix dc=example,dc=org --be-name example; fg"') { fedora389ds ->
- docker.image('apachedirectory/maven-build:jdk-8').inside("--link=${openldap.id}:openldap -e OPENLDAP_HOST=openldap -e OPENLDAP_PORT=389 --link=${fedora389ds.id}:fedora389ds -e FEDORA_389DS_HOST=fedora389ds -e FEDORA_389DS_PORT=3389") {
+ docker.image('apachedirectory/maven-build:jdk-8').inside("--link=${openldap.id}:openldap -e OPENLDAP_HOST=openldap -e OPENLDAP_PORT=389 -e OPENLDAP_PORT_SSL=636 --link=${fedora389ds.id}:fedora389ds -e FEDORA_389DS_HOST=fedora389ds -e FEDORA_389DS_PORT=3389 -e FEDORA_389DS_PORT_SSL=3636") {
sh 'export DISPLAY=:99; env; ps aux'
}
}
@@ -64,9 +64,9 @@ pipeline {
}
steps {
script {
- docker.image('osixia/openldap:1.3.0').withRun() { openldap ->
+ docker.image('osixia/openldap:1.3.0').withRun('-e LDAP_TLS_VERIFY_CLIENT=never') { openldap ->
docker.image('389ds/dirsrv').withRun('-e DS_DM_PASSWORD=admin', 'bash -c "set -m; /usr/lib/dirsrv/dscontainer -r & while ! /usr/lib/dirsrv/dscontainer -H; do sleep 5; done; sleep 5; /usr/sbin/dsconf localhost backend create --suffix dc=example,dc=org --be-name example; fg"') { fedora389ds ->
- docker.image('apachedirectory/maven-build:jdk-11').inside("--link=${openldap.id}:openldap -e OPENLDAP_HOST=openldap -e OPENLDAP_PORT=389 --link=${fedora389ds.id}:fedora389ds -e FEDORA_389DS_HOST=fedora389ds -e FEDORA_389DS_PORT=3389") {
+ docker.image('apachedirectory/maven-build:jdk-11').inside("--link=${openldap.id}:openldap -e OPENLDAP_HOST=openldap -e OPENLDAP_PORT=389 -e OPENLDAP_PORT_SSL=636 --link=${fedora389ds.id}:fedora389ds -e FEDORA_389DS_HOST=fedora389ds -e FEDORA_389DS_PORT=3389 -e FEDORA_389DS_PORT_SSL=3636") {
sh 'export DISPLAY=:99; mvn -V -U -f pom-first.xml clean install && mvn -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests'
}
}
@@ -91,9 +91,9 @@ pipeline {
}
steps {
script {
- docker.image('osixia/openldap:1.3.0').withRun() { openldap ->
+ docker.image('osixia/openldap:1.3.0').withRun('-e LDAP_TLS_VERIFY_CLIENT=never') { openldap ->
docker.image('389ds/dirsrv').withRun('-e DS_DM_PASSWORD=admin', 'bash -c "set -m; /usr/lib/dirsrv/dscontainer -r & while ! /usr/lib/dirsrv/dscontainer -H; do sleep 5; done; sleep 5; /usr/sbin/dsconf localhost backend create --suffix dc=example,dc=org --be-name example; fg"') { fedora389ds ->
- docker.image('apachedirectory/maven-build:jdk-15').inside("--link=${openldap.id}:openldap -e OPENLDAP_HOST=openldap -e OPENLDAP_PORT=389 --link=${fedora389ds.id}:fedora389ds -e FEDORA_389DS_HOST=fedora389ds -e FEDORA_389DS_PORT=3389") {
+ docker.image('apachedirectory/maven-build:jdk-15').inside("--link=${openldap.id}:openldap -e OPENLDAP_HOST=openldap -e OPENLDAP_PORT=389 -e OPENLDAP_PORT_SSL=636 --link=${fedora389ds.id}:fedora389ds -e FEDORA_389DS_HOST=fedora389ds -e FEDORA_389DS_PORT=3389 -e FEDORA_389DS_PORT_SSL=3636") {
sh 'export DISPLAY=:99; mvn -V -U -f pom-first.xml clean install && mvn -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests'
}
}
@@ -118,6 +118,7 @@ pipeline {
}
steps {
bat '''
+ rem rmdir /S /Q F:\\hudson\\m2_repository\\p2\\osgi\\bundle\\org.apache.directory.api.ldap.model
set JAVA_HOME=F:\\jenkins\\tools\\java\\latest11
set MAVEN_OPTS="-Xmx512m"
call F:\\jenkins\\tools\\maven\\latest3\\bin\\mvn -V -U -f pom-first.xml clean install
diff --git a/README.md b/README.md
index 23a1aef89..da9b5b820 100644
--- a/README.md
+++ b/README.md
@@ -62,10 +62,11 @@ or on Windows :
export DISPLAY=:99
Xvfb :99 -screen 0 1024x768x16 &
-* Some UI integration tests expect a running OpenLDAP server and are skipped otherwise:
-
- docker run -it --rm -p 20389:389 -p 20636:636 --name openldap osixia/openldap:1.3.0
+* The core and UI integration tests run against ApacheDS, OpenLDAP, and 389ds. The ApacheDS is always started in embedded mode. The others are expected to run, e.g. with the following commands, otherwise those tests are skipped.
+ docker run -it --rm -p 20389:389 -p 20636:636 --name openldap -e LDAP_TLS_VERIFY_CLIENT=never osixia/openldap:1.3.0
+ docker run -it --rm -p 21389:3389 -p 21636:3636 --name fedora389ds -e DS_DM_PASSWORD=admin 389ds/dirsrv bash -c "set -m; /usr/lib/dirsrv/dscontainer -r & while ! /usr/lib/dirsrv/dscontainer -H; do sleep 5; done; sleep 5; /usr/sbin/dsconf localhost backend create --suffix dc=example,dc=org --be-name example; fg"
+
### Build issues
Tycho doesn't handle snapshot dependencies well. The first time a snapshot dependency is used within the build it is cached in `~/.m2/repository/p2`. Afterwards any change in the dependency (e.g. ApacheDS or LDAP API) is not considered unless it is deleted from the cache.
diff --git a/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template b/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template
index 457ecd5a0..5fdc2f5fc 100644
--- a/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template
+++ b/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template
@@ -19,7 +19,7 @@
@author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
-->
<?pde version="3.8"?>
-<target name="Apache Directory Studio Platform" sequenceNumber="463">
+<target name="Apache Directory Studio Platform" sequenceNumber="465">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
@@ -131,6 +131,7 @@
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.swtbot.eclipse.feature.group" version="3.0.0.202006031738"/>
+ <unit id="org.eclipse.swtbot.junit5.feature.group" version="3.0.0.202006031738"/>
<unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/>
<unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
<unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
diff --git a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java
index 59aad892f..c39e9433c 100644
--- a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java
+++ b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetSorterTest.java
@@ -22,14 +22,14 @@ package org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry;
import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
@@ -45,7 +45,7 @@ public class EntryEditorWidgetSorterTest
private Value empytValue2;
- @Before
+ @BeforeEach
public void setup()
{
sorter = new EntryEditorWidgetSorter( null );
diff --git a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java
index ca63891d7..5fa6e18ae 100644
--- a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java
+++ b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/ReturningAttributesWidgetTest.java
@@ -21,11 +21,11 @@
package org.apache.directory.studio.ldapbrowser.common.widgets.search;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java
index 275b0b825..bf1656541 100644
--- a/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java
+++ b/plugins/ldapbrowser.common/src/test/java/org/apache/directory/studio/valueeditors/ValueEditorUtilsTest.java
@@ -21,12 +21,12 @@
package org.apache.directory.studio.valueeditors;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.nio.charset.StandardCharsets;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/ldapbrowser.core/pom-first.xml b/plugins/ldapbrowser.core/pom-first.xml
index cece9aba1..bb34e8da9 100644
--- a/plugins/ldapbrowser.core/pom-first.xml
+++ b/plugins/ldapbrowser.core/pom-first.xml
@@ -32,15 +32,6 @@
<description/>
<packaging>bundle</packaging>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
<build>
<plugins>
<!-- Embedded artifacts -->
diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java
index efaedd7bf..132b2bd9d 100755
--- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java
+++ b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserErrorTolerantTest.java
@@ -21,7 +21,11 @@
package org.apache.directory.studio.ldapbrowser.core.model;
-import junit.framework.TestCase;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilter;
import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterComponent;
@@ -29,17 +33,19 @@ import org.apache.directory.studio.ldapbrowser.core.model.filter.LdapFilterItemC
import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterToken;
+import org.junit.jupiter.api.Test;
+
/**
* Tests the filter parser for error tolerance.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LdapFilterParserErrorTolerantTest extends TestCase
+public class LdapFilterParserErrorTolerantTest
{
private LdapFilterParser parser = new LdapFilterParser();
-
+ @Test
public void testLpar()
{
parser.parse( "(" ); //$NON-NLS-1$
@@ -62,6 +68,7 @@ public class LdapFilterParserErrorTolerantTest extends TestCase
}
+ @Test
public void testLparAttr()
{
parser.parse( "(objectClass" ); //$NON-NLS-1$
@@ -94,6 +101,7 @@ public class LdapFilterParserErrorTolerantTest extends TestCase
}
+ @Test
public void testLparAttrEquals()
{
parser.parse( "(objectClass=" ); //$NON-NLS-1$
@@ -132,6 +140,7 @@ public class LdapFilterParserErrorTolerantTest extends TestCase
}
+ @Test
public void testLparAttrEqualsRpar()
{
parser.parse( "(objectClass=)" ); //$NON-NLS-1$
diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java
index 23f551f4a..897f6dcfb 100644
--- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java
+++ b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/LdapFilterParserTest.java
@@ -21,17 +21,21 @@
package org.apache.directory.studio.ldapbrowser.core.model;
-import junit.framework.TestCase;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.ldapbrowser.core.model.filter.parser.LdapFilterParser;
+import org.junit.jupiter.api.Test;
+
/**
* Tests the filter parser.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LdapFilterParserTest extends TestCase
+public class LdapFilterParserTest
{
private LdapFilterParser parser = new LdapFilterParser();
@@ -39,6 +43,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an equals filter
*/
+ @Test
public void testEqualsFilter()
{
parser.parse( "(cn=test)" ); //$NON-NLS-1$
@@ -51,6 +56,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an greater equals filter
*/
+ @Test
public void testGreaterEqualsFilter()
{
parser.parse( "(cn>=test)" ); //$NON-NLS-1$
@@ -63,6 +69,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an less equals filter
*/
+ @Test
public void testLessEqualsFilter()
{
parser.parse( "(cn<=test)" ); //$NON-NLS-1$
@@ -75,6 +82,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an aprox filter
*/
+ @Test
public void testAproxFilter()
{
parser.parse( "(cn~=test)" ); //$NON-NLS-1$
@@ -87,6 +95,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an substring filter
*/
+ @Test
public void testSubstringFilter()
{
parser.parse( "(cn=te*st)" ); //$NON-NLS-1$
@@ -99,6 +108,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an present filter
*/
+ @Test
public void testPresentFilter()
{
parser.parse( "(cn=*)" ); //$NON-NLS-1$
@@ -111,6 +121,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an simple filter
*/
+ @Test
public void testRFC4515_1()
{
parser.parse( "(cn=Babs Jensen)" ); //$NON-NLS-1$
@@ -123,6 +134,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an not filter
*/
+ @Test
public void testRFC4515_2()
{
parser.parse( "(!(cn=Tim Howes))" ); //$NON-NLS-1$
@@ -135,6 +147,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an and/or filter
*/
+ @Test
public void testRFC4515_3()
{
parser.parse( "(&(objectClass=Person)(|(sn=Jensen)(cn=Babs J*)))" ); //$NON-NLS-1$
@@ -147,6 +160,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an substring filter
*/
+ @Test
public void testRFC4515_4()
{
parser.parse( "(o=univ*of*mich*)" ); //$NON-NLS-1$
@@ -159,6 +173,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Tests an empty assertion value
*/
+ @Test
public void testRFC4515_5()
{
parser.parse( "(seeAlso=)" ); //$NON-NLS-1$
@@ -175,6 +190,7 @@ public class LdapFilterParserTest extends TestCase
* The first example shows the use of the escaping mechanism to
* represent parenthesis characters.
*/
+ @Test
public void testEscapeRFC4515_1()
{
parser.parse( "(o=Parens R Us \\28for all your parenthetical needs\\29)" ); //$NON-NLS-1$
@@ -193,6 +209,7 @@ public class LdapFilterParserTest extends TestCase
* a "*" in an assertion value, preventing it from being interpreted as
* a substring indicator.
*/
+ @Test
public void testEscapeRFC4515_2()
{
parser.parse( "(cn=*\\2A*)" ); //$NON-NLS-1$
@@ -208,6 +225,7 @@ public class LdapFilterParserTest extends TestCase
* From RFC4515:
* The third illustrates the escaping of the backslash character.
*/
+ @Test
public void testEscapeRFC4515_3()
{
parser.parse( "(filename=C:\\5cMyFile)" ); //$NON-NLS-1$
@@ -225,6 +243,7 @@ public class LdapFilterParserTest extends TestCase
* 00 00 00 04 (hex), illustrating the use of the escaping mechanism to
* represent arbitrary data, including NUL characters.
*/
+ @Test
public void testEscapeRFC4515_4()
{
parser.parse( "(bin=\\00\\00\\00\\04)" ); //$NON-NLS-1$
@@ -245,6 +264,7 @@ public class LdapFilterParserTest extends TestCase
* SMALL LETTER C WITH CARON (U+010D), LATIN SMALL LETTER I (U+0069),
* and LATIN SMALL LETTER C WITH ACUTE (U+0107).
*/
+ @Test
public void testEscapeRFC4515_5()
{
parser.parse( "(sn=Lu\\c4\\8di\\c4\\87)" ); //$NON-NLS-1$
@@ -261,6 +281,7 @@ public class LdapFilterParserTest extends TestCase
* The sixth and final example demonstrates assertion of a BER-encoded
* value.
*/
+ @Test
public void testEscapeRFC4515_6()
{
parser.parse( "(1.3.6.1.4.1.1466.0=\\04\\02\\48\\69)" ); //$NON-NLS-1$
@@ -276,6 +297,7 @@ public class LdapFilterParserTest extends TestCase
* From RFC4515:
* The first example shows use of the matching rule "caseExactMatch."
*/
+ @Test
public void testExtensibleFilterRFC4515_1()
{
parser.parse( "(cn:caseExactMatch:=Fred Flintstone)" ); //$NON-NLS-1$
@@ -292,6 +314,7 @@ public class LdapFilterParserTest extends TestCase
* The second example demonstrates use of a MatchingRuleAssertion form
* without a matchingRule.
*/
+ @Test
public void testExtensibleFilterRFC4515_2()
{
parser.parse( "(cn:=Betty Rubble)" ); //$NON-NLS-1$
@@ -311,6 +334,7 @@ public class LdapFilterParserTest extends TestCase
* entry's distinguished name should be considered part of the entry
* when evaluating the match (indicated by the use of ":dn").
*/
+ @Test
public void testExtensibleFilterRFC4515_3()
{
parser.parse( "(sn:dn:2.4.6.8.10:=Barney Rubble)" ); //$NON-NLS-1$
@@ -328,6 +352,7 @@ public class LdapFilterParserTest extends TestCase
* components should be considered part of the entry when doing the
* match.
*/
+ @Test
public void testExtensibleFilterRFC4515_4()
{
parser.parse( "(o:dn:=Ace Industry)" ); //$NON-NLS-1$
@@ -345,6 +370,7 @@ public class LdapFilterParserTest extends TestCase
* supporting the matching rule given (since the &lt;attr> has been
* omitted).
*/
+ @Test
public void testExtensibleFilterRFC4515_5()
{
parser.parse( "(:1.2.3:=Wilma Flintstone)" ); //$NON-NLS-1$
@@ -363,6 +389,7 @@ public class LdapFilterParserTest extends TestCase
* supporting the matching rule contained in the Dn should also be
* considered.
*/
+ @Test
public void testExtensibleFilterRFC4515_6()
{
parser.parse( "(:Dn:2.4.6.8.10:=Dino)" ); //$NON-NLS-1$
@@ -375,6 +402,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Test for DIRSTUIO-210.
*/
+ @Test
public void testDIRSTUDIO210()
{
parser.parse( "(objectClass>=z*) " ); //$NON-NLS-1$
@@ -387,6 +415,7 @@ public class LdapFilterParserTest extends TestCase
/**
* Test for DIRSTUIO-279.
*/
+ @Test
public void testDIRSTUDIO279()
{
parser.parse( " (&\n (objectClass=person)\n (cn=a*)\n) " ); //$NON-NLS-1$
diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java
index 13f94a1eb..2e6522f38 100644
--- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java
+++ b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java
@@ -21,7 +21,11 @@
package org.apache.directory.studio.ldapbrowser.core.model;
-import junit.framework.TestCase;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import org.junit.jupiter.api.Test;
/**
@@ -29,11 +33,12 @@ import junit.framework.TestCase;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class PasswordTest extends TestCase
+public class PasswordTest
{
/**
* Null Password should not be accepted
*/
+ @Test
public void testNullPassword()
{
try
@@ -51,6 +56,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordSHAEncrypted()
{
Password password = new Password( "{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ=" ); //$NON-NLS-1$
@@ -62,6 +68,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordSHAEncryptedLowercase()
{
Password password = new Password( "{sha}5en6G6MezRroT3XKqkdPOmY/BfQ=" ); //$NON-NLS-1$
@@ -73,6 +80,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordSSHAEncrypted()
{
Password password = new Password( "{SSHA}mjVVxasFkk59wMW4L1Ldt+YCblfhULHs03WW7g==" ); //$NON-NLS-1$
@@ -84,6 +92,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordSSHAEncryptedLowercase()
{
Password password = new Password( "{ssha}mjVVxasFkk59wMW4L1Ldt+YCblfhULHs03WW7g==" ); //$NON-NLS-1$
@@ -95,6 +104,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordMD5Encrypted()
{
Password password = new Password( "{MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ==" ); //$NON-NLS-1$
@@ -106,6 +116,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordMD5EncryptedLowercase()
{
Password password = new Password( "{md5}Xr4ilOzQ4PCOq3aQ0qbuaQ==" ); //$NON-NLS-1$
@@ -117,6 +128,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordSMD5Encrypted()
{
Password password = new Password( "{SMD5}tQ9wo/VBuKsqBtylMMCcORbnYOJFMyDJ" ); //$NON-NLS-1$
@@ -128,6 +140,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordSMD5EncryptedLowercase()
{
Password password = new Password( "{smd5}tQ9wo/VBuKsqBtylMMCcORbnYOJFMyDJ" ); //$NON-NLS-1$
@@ -139,6 +152,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordCRYPTEncrypted()
{
Password password = new Password( "{CRYPT}qFkH8Z1woBlXw" ); //$NON-NLS-1$
@@ -150,6 +164,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordCRYPTEncryptedLowercase()
{
Password password = new Password( "{crypt}qFkH8Z1woBlXw" ); //$NON-NLS-1$
@@ -161,6 +176,7 @@ public class PasswordTest extends TestCase
/**
*
*/
+ @Test
public void testPasswordBadAlgorithm()
{
Password password = new Password( "{CRYPTE}qFkH8Z1woBlXw" ); //$NON-NLS-1$
diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaPT.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaPT.java
deleted file mode 100644
index ad525da91..000000000
--- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaPT.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- *
- */
-package org.apache.directory.studio.ldapbrowser.core.model.schema;
-
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import org.junit.Test;
-
-
-/**
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class SchemaPT
-{
-
- @Test
- public void testLoadSchemaFromLdifPerformance() throws Exception
- {
- Schema schema = null;
- for ( int i = 0; i < 100; i++ )
- {
- InputStream stream = SchemaPT.class.getResourceAsStream( "/default_schema.ldif" );
- Reader reader = new InputStreamReader( stream );
- schema = new Schema();
- schema.loadFromLdif( reader );
- }
- System.out.println( schema.getDn() );
- }
-
-}
diff --git a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java
index aab0ece2c..26d17f88b 100644
--- a/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java
+++ b/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/AttributeComparatorTest.java
@@ -20,8 +20,8 @@
package org.apache.directory.studio.ldapbrowser.core.utils;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
@@ -38,8 +38,8 @@ import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
import org.apache.directory.studio.ldifparser.model.container.LdifContentRecord;
import org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine;
import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class AttributeComparatorTest
@@ -63,8 +63,7 @@ public class AttributeComparatorTest
private AttributeComparator comparator;
-
- @Before
+ @BeforeEach
public void setup() throws Exception
{
ConnectionEventRegistry.suspendEventFiringInCurrentThread();
@@ -139,10 +138,10 @@ public class AttributeComparatorTest
assertEquals( 0, less + greater );
}
-
// TODO: objectclass, may, operational
// TODO: objectclass < must < may < operational
+
@Test
public void testValuesDiffer()
{
diff --git a/plugins/ldifparser/pom-first.xml b/plugins/ldifparser/pom-first.xml
index 5e1885ba5..70e0ed53a 100644
--- a/plugins/ldifparser/pom-first.xml
+++ b/plugins/ldifparser/pom-first.xml
@@ -32,15 +32,6 @@
<description/>
<packaging>bundle</packaging>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
<build>
<!-- MANIFEST.MF Generation -->
<plugins>
diff --git a/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java b/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java
index 2cedf49a5..06b229f83 100644
--- a/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java
+++ b/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifAttrValLineTest.java
@@ -21,14 +21,17 @@
package org.apache.directory.studio.ldifparser.model.lines;
-import junit.framework.TestCase;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.directory.studio.ldifparser.LdifFormatParameters;
+import org.junit.jupiter.api.Test;
-public class LdifAttrValLineTest extends TestCase
+
+public class LdifAttrValLineTest
{
+ @Test
public void testToFormattedStringSimple()
{
LdifAttrValLine line = LdifAttrValLine.create( "cn", "abc" ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -38,6 +41,7 @@ public class LdifAttrValLineTest extends TestCase
}
+ @Test
public void testToFormattedStringLineWrap()
{
LdifAttrValLine line = LdifAttrValLine.create( "cn", //$NON-NLS-1$
@@ -49,6 +53,7 @@ public class LdifAttrValLineTest extends TestCase
}
+ @Test
public void testToFormattedStringNoSpaceAfterColon()
{
LdifAttrValLine line = LdifAttrValLine.create( "cn", "abc" ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -58,6 +63,7 @@ public class LdifAttrValLineTest extends TestCase
}
+ @Test
public void testToFormattedStringBase64()
{
LdifAttrValLine line = LdifAttrValLine.create( "cn", "\u00e4\u00f6\u00fc" ); //$NON-NLS-1$ //$NON-NLS-2$
@@ -67,6 +73,7 @@ public class LdifAttrValLineTest extends TestCase
}
+ @Test
public void testToFormattedString_DIRSERVER_285()
{
LdifAttrValLine line = LdifAttrValLine.create( "cn", "abc::def:<ghi" ); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java b/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java
index 47c4ec875..eaa19bfcd 100644
--- a/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java
+++ b/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/model/lines/LdifDnLineTest.java
@@ -21,14 +21,18 @@
package org.apache.directory.studio.ldifparser.model.lines;
-import junit.framework.TestCase;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.ldifparser.LdifFormatParameters;
+import org.junit.jupiter.api.Test;
-public class LdifDnLineTest extends TestCase
+
+public class LdifDnLineTest
{
+ @Test
public void testToFormattedStringSimple()
{
LdifDnLine dnLine = LdifDnLine.create( "cn=abc,ou=department,o=org,dc=example,dc=com" ); //$NON-NLS-1$
@@ -38,6 +42,7 @@ public class LdifDnLineTest extends TestCase
}
+ @Test
public void testToFormattedStringNewline()
{
LdifDnLine dnLine = LdifDnLine.create( "cn=abc,ou=department,o=org,dc=example,dc=com" ); //$NON-NLS-1$
@@ -47,6 +52,7 @@ public class LdifDnLineTest extends TestCase
}
+ @Test
public void testToFormattedStringLineWrap()
{
LdifDnLine dnLine = LdifDnLine
@@ -58,6 +64,7 @@ public class LdifDnLineTest extends TestCase
}
+ @Test
public void testToFormattedStringNoSpaceAfterColon()
{
LdifDnLine dnLine = LdifDnLine.create( "cn=abc,ou=department,o=org,dc=example,dc=com" ); //$NON-NLS-1$
@@ -67,6 +74,7 @@ public class LdifDnLineTest extends TestCase
}
+ @Test
public void testToFormattedStringBase64()
{
LdifDnLine dnLine = LdifDnLine.create( "cn=\u00e4\u00f6\u00fc,ou=department,o=org,dc=example,dc=com" ); //$NON-NLS-1$
@@ -80,6 +88,7 @@ public class LdifDnLineTest extends TestCase
* Test for DIRSTUDIO-598
* (Base64 encoded Dn marked as invalid in LDIF editor)
*/
+ @Test
public void testIsValid()
{
LdifDnLine dnLine = LdifDnLine.create( "cn=\\#\\\\\\+\\, \\\"\u00f6\u00e9\\\",ou=users,ou=system" ); //$NON-NLS-1$
diff --git a/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/parser/LdifParserTest.java b/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/parser/LdifParserTest.java
index 7f290009a..f1c80ac3a 100644
--- a/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/parser/LdifParserTest.java
+++ b/plugins/ldifparser/src/test/java/org/apache/directory/studio/ldifparser/parser/LdifParserTest.java
@@ -21,15 +21,18 @@
package org.apache.directory.studio.ldifparser.parser;
-import junit.framework.TestCase;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.directory.studio.ldifparser.LdifFormatParameters;
import org.apache.directory.studio.ldifparser.model.LdifFile;
+import org.junit.jupiter.api.Test;
-public class LdifParserTest extends TestCase
+
+public class LdifParserTest
{
+ @Test
public void testLdifNull()
{
String ldif = null;
@@ -41,6 +44,7 @@ public class LdifParserTest extends TestCase
}
+ @Test
public void testParseAndFormatWithLdifWindowsLineBreak()
{
String ldif = ""
@@ -62,6 +66,7 @@ public class LdifParserTest extends TestCase
}
+ @Test
public void testParseAndFormatWithLdifUnixLineBreak()
{
String ldif = ""
diff --git a/plugins/openldap.acl.editor/src/test/java/org/apache/directory/studio/openldap/config/acl/model/OpenLdapAclParserTest.java b/plugins/openldap.acl.editor/src/test/java/org/apache/directory/studio/openldap/config/acl/model/OpenLdapAclParserTest.java
index 2a96427b8..ed7aa256e 100644
--- a/plugins/openldap.acl.editor/src/test/java/org/apache/directory/studio/openldap/config/acl/model/OpenLdapAclParserTest.java
+++ b/plugins/openldap.acl.editor/src/test/java/org/apache/directory/studio/openldap/config/acl/model/OpenLdapAclParserTest.java
@@ -20,13 +20,13 @@
package org.apache.directory.studio.openldap.config.acl.model;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@@ -34,23 +34,22 @@ import java.util.List;
import antlr.RecognitionException;
import org.apache.directory.studio.openldap.config.acl.model.AclAttribute;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+//assertThrows(ParseException.class, () -> parser.parse( "" ));
/**
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class OpenLdapAclParserTest
{
- @Test( expected = ParseException.class )
+ @Test
public void testEmpty() throws Exception
{
System.out.println( "\n--> testEmpty" );
OpenLdapAclParser parser = new OpenLdapAclParser();
- parser.parse( "" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "" ));
}
@@ -134,14 +133,12 @@ public class OpenLdapAclParserTest
}
- @Test( expected = ParseException.class )
+ @Test
public void testWhatTwoStars() throws Exception
{
System.out.println( "\n--> testWhatTwoStars" );
OpenLdapAclParser parser = new OpenLdapAclParser();
- parser.parse( "to * * by *" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "to * * by *" ));
}
@@ -172,7 +169,7 @@ public class OpenLdapAclParserTest
}
- @Test( expected = ParseException.class )
+ @Test
public void testWhatDnStar() throws Exception
{
System.out.println( "\n--> testWhatDnStar" );
@@ -180,13 +177,11 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to dn=* by *" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn=* by *" ));
}
- @Test( expected=ParseException.class)
+ @Test
public void testWhatDnValidDnNoQuote() throws Exception
{
System.out.println( "\n--> testWhatDnValidDnNoQuote" );
@@ -196,13 +191,11 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to dn=" + dnPattern + "\n by *" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn=" + dnPattern + "\n by *" ));
}
- @Ignore
- @Test ( expected=ParseException.class)
+ @Disabled
+ @Test
public void testWhatDnBadDn() throws Exception
{
System.out.println( "\n--> testWhatDnBadDn" );
@@ -212,9 +205,7 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to dn=\"" + dnPattern + "\"\n by *" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn=\"" + dnPattern + "\"\n by *" ));
}
@@ -248,7 +239,7 @@ public class OpenLdapAclParserTest
}
- @Test ( expected=ParseException.class)
+ @Test
public void testWhatDnBasicDnExactNoQuote() throws Exception
{
System.out.println( "\n--> testWhatDnBasicDnExactNoQuote" );
@@ -258,13 +249,11 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to dn.exact=" + dnPattern + " by *" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn.exact=" + dnPattern + " by *" ));
}
- @Test ( expected=ParseException.class)
+ @Test
public void testWhatDnBasicDnExactBadDn() throws Exception
{
System.out.println( "\n--> testWhatDnBasicDnExactBadDn" );
@@ -274,9 +263,7 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to dn.exact=" + dnPattern + " by *" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn.exact=" + dnPattern + " by *" ));
}
@@ -310,7 +297,7 @@ public class OpenLdapAclParserTest
}
- @Test( expected=ParseException.class)
+ @Test
public void testWhatDnBasicDnRegexNoQuote() throws Exception
{
System.out.println( "\n--> testWhatDnBasicDnRegexNoQuote" );
@@ -320,9 +307,7 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- AclItem aclItem = parser.parse( "access to dn.regex=" + dnPattern + " by *" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn.regex=" + dnPattern + " by *" ));
}
@@ -544,7 +529,7 @@ public class OpenLdapAclParserTest
}
- @Test( expected=ParseException.class)
+ @Test
public void testWhatDnScopeOneNoQuotedDn() throws Exception
{
System.out.println( "\n--> testWhatDnScopeOneNoQuotedDn" );
@@ -554,11 +539,11 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to dn.one=" + dnPattern + " by *" );
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn.one=" + dnPattern + " by *" ));
}
- @Test( expected=ParseException.class)
+ @Test
public void testWhatDnScopeOneNoDn() throws Exception
{
System.out.println( "\n--> testWhatDnScopeOneNoDn" );
@@ -567,11 +552,11 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to dn.one= by *" );
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn.one= by *" ));
}
- @Test( expected=ParseException.class)
+ @Test
public void testWhatDnScopeOneStar() throws Exception
{
System.out.println( "\n--> testWhatDnScopeOneStar" );
@@ -580,7 +565,7 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to dn.one=* by *" );
+ assertThrows(ParseException.class, () -> parser.parse( "access to dn.one=* by *" ));
}
@@ -641,7 +626,7 @@ public class OpenLdapAclParserTest
}
- @Test( expected=ParseException.class)
+ @Test
public void testWhatFilterWrongSimple() throws Exception
{
System.out.println( "\n--> testWhatFilterWrongSimple" );
@@ -651,15 +636,13 @@ public class OpenLdapAclParserTest
OpenLdapAclParser parser = new OpenLdapAclParser();
// Testing the ACL item
- parser.parse( "access to filter=" + filter + " by *" );
-
- fail();
+ assertThrows(ParseException.class, () -> parser.parse( "access to filter=" + filter + " by *" ));
}
- @Ignore
+ @Disabled
@Test
public void testFail() throws Exception
{
@@ -3853,7 +3836,7 @@ public class OpenLdapAclParserTest
@Test
- @Ignore
+ @Disabled
public void testWhoAccessLevelSelfPrivMinusMWRSCX() throws Exception
{
// Create parser
diff --git a/plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java b/plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java
index d0fe1ff69..c1cc03979 100644
--- a/plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java
+++ b/plugins/openldap.common.ui/src/test/java/org/apache/directory/studio/openldap/common/ui/dialogs/UnixPermissionsTest.java
@@ -20,12 +20,13 @@
package org.apache.directory.studio.openldap.common.ui.dialogs;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
import org.apache.directory.studio.openldap.common.ui.model.UnixPermissions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class UnixPermissionsTest
diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java
index 4363d0a53..a14ac792e 100644
--- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java
+++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/editor/dialogs/PurgeTimeSpanTest.java
@@ -20,12 +20,12 @@
package org.apache.directory.studio.openldap.config.editor.dialogs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import java.text.ParseException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java
index 515e6ed96..45f368528 100644
--- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java
+++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/model/overlay/OlcValSortValueParserTest.java
@@ -20,14 +20,14 @@
package org.apache.directory.studio.openldap.config.model.overlay;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.api.ldap.model.name.Dn;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java
index 125269b28..beb4a0e4a 100644
--- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java
+++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/DbIndexWrapperTest.java
@@ -19,13 +19,13 @@
*/
package org.apache.directory.studio.openldap.config.wrappers;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.openldap.config.editor.wrappers.DbIndexWrapper;
import org.apache.directory.studio.openldap.common.ui.model.DbIndexTypeEnum;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* A test for the DbIndexWrapper class
diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java
index c871cbb6f..8edbaafda 100644
--- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java
+++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/LimitsWrapperTest.java
@@ -19,10 +19,10 @@
*/
package org.apache.directory.studio.openldap.config.wrappers;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.openldap.common.ui.model.DnSpecStyleEnum;
import org.apache.directory.studio.openldap.common.ui.model.DnSpecTypeEnum;
@@ -31,7 +31,7 @@ import org.apache.directory.studio.openldap.config.editor.wrappers.LimitWrapper;
import org.apache.directory.studio.openldap.config.editor.wrappers.LimitsWrapper;
import org.apache.directory.studio.openldap.config.editor.wrappers.TimeLimitWrapper;
import org.apache.directory.studio.openldap.config.editor.wrappers.SizeLimitWrapper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.List;
/**
diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java
index 216275999..55c4a5e6a 100644
--- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java
+++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SaslSecPropsWrapperTest.java
@@ -19,14 +19,14 @@
*/
package org.apache.directory.studio.openldap.config.wrappers;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.openldap.common.ui.model.SaslSecPropEnum;
import org.apache.directory.studio.openldap.config.editor.wrappers.SaslSecPropsWrapper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* A test for the SaslSecPropsWrapper class
diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java
index 67fa599ff..de51e80c8 100644
--- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java
+++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SizeLimitWrapperTest.java
@@ -19,12 +19,12 @@
*/
package org.apache.directory.studio.openldap.config.wrappers;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.openldap.config.editor.wrappers.SizeLimitWrapper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* A test for the SizeLimitWrapper class
diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java
index 64333abb9..85689d70e 100644
--- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java
+++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/SsfWrapperTest.java
@@ -19,13 +19,13 @@
*/
package org.apache.directory.studio.openldap.config.wrappers;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.openldap.common.ui.model.SsfFeatureEnum;
import org.apache.directory.studio.openldap.config.editor.wrappers.SsfWrapper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* A test for the SsfWrapper class
diff --git a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java
index 1910ec3af..ce0e2dfbe 100644
--- a/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java
+++ b/plugins/openldap.config.editor/src/test/java/org/apache/directory/studio/openldap/config/wrappers/TimeLimitWrapperTest.java
@@ -19,11 +19,11 @@
*/
package org.apache.directory.studio.openldap.config.wrappers;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.openldap.config.editor.wrappers.TimeLimitWrapper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
* A test for the TimeLimitWrapper class
diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java
index 90c16def5..4da9d453d 100644
--- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java
+++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/IntervalTest.java
@@ -20,10 +20,10 @@
package org.apache.directory.studio.openldap.syncrepl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java
index 69d78d6ec..b0e011552 100644
--- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java
+++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/KeepAliveTest.java
@@ -20,10 +20,10 @@
package org.apache.directory.studio.openldap.syncrepl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java
index 220f732ee..c2e6cde51 100644
--- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java
+++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/ProviderTest.java
@@ -20,10 +20,10 @@
package org.apache.directory.studio.openldap.syncrepl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java
index 7ab713552..4ab030ff9 100644
--- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java
+++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryPairTest.java
@@ -20,10 +20,10 @@
package org.apache.directory.studio.openldap.syncrepl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java
index 8cf9c9170..ebbf1105a 100644
--- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java
+++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/RetryTest.java
@@ -20,11 +20,11 @@
package org.apache.directory.studio.openldap.syncrepl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java
index 36c1ebb5f..ac99ff35a 100644
--- a/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java
+++ b/plugins/openldap.syncrepl/src/test/java/com/iktek/studio/openldap/syncrepl/SyncReplParserTest.java
@@ -20,13 +20,13 @@
package org.apache.directory.studio.openldap.syncrepl;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
/**
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 2eee71664..575f92970 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -144,11 +144,34 @@
<dependencies>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.platform</groupId>
+ <artifactId>junit-platform-runner</artifactId>
+ <version>${junit.platform.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
-
</project>
diff --git a/plugins/schemaeditor/pom-first.xml b/plugins/schemaeditor/pom-first.xml
index d32627b34..c4170c39e 100644
--- a/plugins/schemaeditor/pom-first.xml
+++ b/plugins/schemaeditor/pom-first.xml
@@ -32,15 +32,6 @@
<description/>
<packaging>bundle</packaging>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
<build>
<!-- MANIFEST.MF Generation -->
<plugins>
diff --git a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java
index f79cc9386..69066fa32 100644
--- a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java
+++ b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/alias/AliasesStringParserTest.java
@@ -20,9 +20,11 @@
package org.apache.directory.studio.schemaeditor.model.alias;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
/**
@@ -30,8 +32,9 @@ import junit.framework.TestCase;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class AliasesStringParserTest extends TestCase
+public class AliasesStringParserTest
{
+ @Test
public void testNoAlias() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -42,6 +45,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testOneAlias() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -53,6 +57,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testTwoAliases() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -65,6 +70,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testThreeAliases() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -78,6 +84,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testMultipleCommasNoAlias() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -88,6 +95,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testMultipleCommasAndWhiteSpacesNoAlias() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -98,6 +106,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testTwoAliasesMultipleCommas() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -110,6 +119,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testOneAliasWithStartError() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -122,6 +132,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testOneAliasWithStartError2() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -134,6 +145,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testOneAliasWithPartError() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -146,6 +158,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testOneAliasWithPartError2() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -158,6 +171,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testOneAliasWithPartErrorAndOneAliasWithStartError() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
@@ -172,6 +186,7 @@ public class AliasesStringParserTest extends TestCase
}
+ @Test
public void testOneAliasWithPartErrorAndOneAliasWithStartError2() throws Exception
{
AliasesStringParser parser = new AliasesStringParser();
diff --git a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java
index 1988468da..d4365c16b 100644
--- a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java
+++ b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/difference/DifferenceEngineTest.java
@@ -20,29 +20,34 @@
package org.apache.directory.studio.schemaeditor.model.difference;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
-
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.ObjectClass;
import org.apache.directory.api.ldap.model.schema.ObjectClassTypeEnum;
import org.apache.directory.api.ldap.model.schema.UsageEnum;
+import org.junit.jupiter.api.Test;
+
/**
* This class tests the DifferenceEngine class.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class DifferenceEngineTest extends TestCase
+public class DifferenceEngineTest
{
/**
* Tests the AddAliasDifference.
*
* @throws Exception
*/
+ @Test
public void testAddAliasDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -70,6 +75,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddDescriptionDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -97,6 +103,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddEqualityDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -123,6 +130,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddMandatoryATDifference() throws Exception
{
ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
@@ -151,6 +159,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddOptionalATDifference() throws Exception
{
ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
@@ -164,7 +173,8 @@ public class DifferenceEngineTest extends TestCase
Difference difference = differences.get( 0 );
- if ( !( difference instanceof OptionalATDifference ) || ( !difference.getType().equals( DifferenceType.ADDED ) ) )
+ if ( !( difference instanceof OptionalATDifference )
+ || ( !difference.getType().equals( DifferenceType.ADDED ) ) )
{
fail();
}
@@ -178,6 +188,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddOrderingDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -204,6 +215,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddSubstringDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -216,7 +228,8 @@ public class DifferenceEngineTest extends TestCase
Difference difference = differences.get( 0 );
- if ( !( difference instanceof SubstringDifference ) || ( !difference.getType().equals( DifferenceType.ADDED ) ) )
+ if ( !( difference instanceof SubstringDifference )
+ || ( !difference.getType().equals( DifferenceType.ADDED ) ) )
{
fail();
}
@@ -230,6 +243,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddSuperiorATDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -242,7 +256,8 @@ public class DifferenceEngineTest extends TestCase
Difference difference = differences.get( 0 );
- if ( !( difference instanceof SuperiorATDifference ) || ( !difference.getType().equals( DifferenceType.ADDED ) ) )
+ if ( !( difference instanceof SuperiorATDifference )
+ || ( !difference.getType().equals( DifferenceType.ADDED ) ) )
{
fail();
}
@@ -256,6 +271,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddSuperiorOCDifference() throws Exception
{
ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
@@ -269,7 +285,8 @@ public class DifferenceEngineTest extends TestCase
Difference difference = differences.get( 0 );
- if ( !( difference instanceof SuperiorOCDifference ) || ( !difference.getType().equals( DifferenceType.ADDED ) ) )
+ if ( !( difference instanceof SuperiorOCDifference )
+ || ( !difference.getType().equals( DifferenceType.ADDED ) ) )
{
fail();
}
@@ -283,6 +300,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddSyntaxDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -309,6 +327,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testAddSyntaxLengthDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -336,6 +355,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifyClassTypeDifference() throws Exception
{
ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
@@ -365,6 +385,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifyCollectiveDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -394,6 +415,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifyDescriptionDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -423,6 +445,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifyEqualityDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -452,6 +475,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifyNoUserModificationDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -481,6 +505,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifyObsoleteDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -510,6 +535,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifyOrderingDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -539,6 +565,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifySingleValueDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -568,6 +595,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifySubstringDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -597,6 +625,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifySuperiorATDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -626,6 +655,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifySyntaxDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -639,7 +669,8 @@ public class DifferenceEngineTest extends TestCase
Difference difference = differences.get( 0 );
- if ( !( difference instanceof SyntaxDifference ) || ( !difference.getType().equals( DifferenceType.MODIFIED ) ) )
+ if ( !( difference instanceof SyntaxDifference )
+ || ( !difference.getType().equals( DifferenceType.MODIFIED ) ) )
{
fail();
}
@@ -654,6 +685,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifySyntaxLengthDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -683,6 +715,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testModifyUsageDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -711,6 +744,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveAliasDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -741,6 +775,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveDescriptionDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -769,6 +804,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveEqualityDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -781,7 +817,8 @@ public class DifferenceEngineTest extends TestCase
Difference difference = differences.get( 0 );
- if ( !( difference instanceof EqualityDifference ) || ( !difference.getType().equals( DifferenceType.REMOVED ) ) )
+ if ( !( difference instanceof EqualityDifference )
+ || ( !difference.getType().equals( DifferenceType.REMOVED ) ) )
{
fail();
}
@@ -796,6 +833,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveMandatoryATDifference() throws Exception
{
ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
@@ -827,6 +865,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveOptionalATDifference() throws Exception
{
ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
@@ -858,6 +897,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveOrderingDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -870,7 +910,8 @@ public class DifferenceEngineTest extends TestCase
Difference difference = differences.get( 0 );
- if ( !( difference instanceof OrderingDifference ) || ( !difference.getType().equals( DifferenceType.REMOVED ) ) )
+ if ( !( difference instanceof OrderingDifference )
+ || ( !difference.getType().equals( DifferenceType.REMOVED ) ) )
{
fail();
}
@@ -885,6 +926,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveSubstringDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -913,6 +955,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveSuperiorATDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -941,6 +984,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveSuperiorOCDifference() throws Exception
{
ObjectClass o1 = new ObjectClass( "1.2.3.4" ); //$NON-NLS-1$
@@ -972,6 +1016,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveSyntaxDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
@@ -999,6 +1044,7 @@ public class DifferenceEngineTest extends TestCase
*
* @throws Exception
*/
+ @Test
public void testRemoveSyntaxLengthDifference() throws Exception
{
AttributeType o1 = new AttributeType( "1.2.3.4" ); //$NON-NLS-1$
diff --git a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java
index 8495a0b37..bd8cc1ff3 100644
--- a/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java
+++ b/plugins/schemaeditor/src/test/java/org/apache/directory/studio/schemaeditor/model/io/OpenLdapSchemaFileExporterTest.java
@@ -20,7 +20,7 @@
package org.apache.directory.studio.schemaeditor.model.io;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.Collections;
@@ -29,9 +29,8 @@ import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.ObjectClass;
import org.apache.directory.api.ldap.model.schema.ObjectClassTypeEnum;
import org.apache.directory.api.ldap.model.schema.UsageEnum;
-import org.junit.Before;
-import org.junit.Test;
-
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -45,7 +44,7 @@ public class OpenLdapSchemaFileExporterTest
private AttributeType attributeTypeSimple;
private AttributeType attributeTypeComplex;
- @Before
+ @BeforeEach
public void setUp()
{
objectClassSimple = new ObjectClass( "1.2.3.4" );
diff --git a/plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java b/plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java
index fd284ce99..04f1e04d8 100644
--- a/plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java
+++ b/plugins/templateeditor/src/test/java/org/apache/directory/studio/templateeditor/model/parser/TemplateIOTest.java
@@ -20,7 +20,14 @@
package org.apache.directory.studio.templateeditor.model.parser;
-import junit.framework.TestCase;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import org.junit.jupiter.api.Test;
import org.apache.directory.studio.templateeditor.model.FileTemplate;
import org.apache.directory.studio.templateeditor.model.parser.TemplateIO;
@@ -47,11 +54,12 @@ import org.apache.directory.studio.templateeditor.model.widgets.ValueItem;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class TemplateIOTest extends TestCase
+public class TemplateIOTest
{
/**
* Tests the parser with a minimal template file.
*/
+ @Test
public void testReadTemplateMinimalTest()
{
FileTemplate template = null;
@@ -92,6 +100,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a minimal template file.
*/
+ @Test
public void testReadTemplateMinimalWithCompositeTest()
{
FileTemplate template = null;
@@ -135,6 +144,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a section with a
* 'columns' attribute.
*/
+ @Test
public void testReadTemplateSectionColumnsAttributeTest()
{
FileTemplate template = null;
@@ -167,6 +177,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a section with a
* 'columns' attribute.
*/
+ @Test
public void testReadTemplateSectionDescriptionAttributeTest()
{
FileTemplate template = null;
@@ -199,6 +210,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a section with a
* 'columns' attribute.
*/
+ @Test
public void testReadTemplateSectionTitleAttributeTest()
{
FileTemplate template = null;
@@ -231,6 +243,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a section with a wrong
* 'columns' attribute.
*/
+ @Test
public void testReadTemplateSectionWrongColumnsAttributeTest() throws Exception
{
testParsingFail( "template_section_with_wrong_columns_attribute.xml" ); //$NON-NLS-1$
@@ -241,6 +254,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a checkbox with a
* value for the 'attributeType' attribute.
*/
+ @Test
public void testReadTemplateCheckboxAttributetypeValueTest()
{
FileTemplate template = null;
@@ -282,6 +296,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a checkbox with a
* value for the 'checkedValue' attribute.
*/
+ @Test
public void testReadTemplateCheckboxCheckedValueTest()
{
FileTemplate template = null;
@@ -323,6 +338,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a checkbox with a
* value for the 'uncheckedValue' attribute.
*/
+ @Test
public void testReadTemplateCheckboxUncheckedValueTest()
{
FileTemplate template = null;
@@ -364,6 +380,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a checkbox with a
* value for the 'uncheckedValue' attribute.
*/
+ @Test
public void testReadTemplateCheckboxCheckedAndUnheckedValuesTest()
{
FileTemplate template = null;
@@ -405,6 +422,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a file chooser with
* only value for the 'attributeType' attribute.
*/
+ @Test
public void testReadTemplateFileChooserAttributeTypeValueTest()
{
FileTemplate template = null;
@@ -448,6 +466,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a file chooser with all
* values.
*/
+ @Test
public void testReadTemplateFileChooserAllValuesTest()
{
FileTemplate template = null;
@@ -491,6 +510,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing an image with only the
* value for the 'attributeType' attribute.
*/
+ @Test
public void testReadTemplateImageAttributeTypeValueTest()
{
FileTemplate template = null;
@@ -535,6 +555,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing an image with all
* values.
*/
+ @Test
public void testReadTemplateImageAllValuesTest()
{
FileTemplate template = null;
@@ -579,6 +600,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a label with only the
* value for the 'attributeType' attribute.
*/
+ @Test
public void testReadTemplateLabelAttributeTypeValueTest()
{
FileTemplate template = null;
@@ -618,6 +640,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a label with a value
* for the 'value' attribute.
*/
+ @Test
public void testReadTemplateLabelValueValueTest()
{
FileTemplate template = null;
@@ -657,6 +680,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a link with only the
* value for the 'attributeType' attribute.
*/
+ @Test
public void testReadTemplateLinkAttributeTypeValueTest()
{
FileTemplate template = null;
@@ -696,6 +720,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a link with a value
* for the 'value' attribute.
*/
+ @Test
public void testReadTemplateLinkValueValueTest()
{
FileTemplate template = null;
@@ -735,6 +760,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a listbox with the
* minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplateListboxMinimalTest()
{
FileTemplate template = null;
@@ -777,6 +803,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a listbox with the
* minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplateListboxSingleSelectionTest()
{
FileTemplate template = null;
@@ -819,6 +846,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a listbox with
* multiple items.
*/
+ @Test
public void testReadTemplateListboxMultipleItemsTest()
{
FileTemplate template = null;
@@ -863,6 +891,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a password with the
* minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplatePasswordMinimalTest()
{
FileTemplate template = null;
@@ -903,6 +932,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a password with the
* minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplatePasswordNotHiddenTest()
{
FileTemplate template = null;
@@ -943,6 +973,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a password with the
* minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplatePasswordNotShowChangeButtonTest()
{
FileTemplate template = null;
@@ -983,6 +1014,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a radio buttons with
* the minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplateRadioButtonsMinimalTest()
{
FileTemplate template = null;
@@ -1024,6 +1056,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a radio buttons with
* multiple buttons.
*/
+ @Test
public void testReadTemplateRadioButtonsMultipleButtonsTest()
{
FileTemplate template = null;
@@ -1067,6 +1100,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a spinner with the
* minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplateSpinnerMinimalTest()
{
FileTemplate template = null;
@@ -1110,6 +1144,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a spinner with all the
* values for its attributes.
*/
+ @Test
public void testReadTemplateSpinnerAllValuesTest()
{
FileTemplate template = null;
@@ -1152,6 +1187,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a template file containing a table.
*/
+ @Test
public void testReadTemplateTableTest()
{
FileTemplate template = null;
@@ -1189,6 +1225,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a text field with the
* minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplateTextFieldMinimalTest()
{
FileTemplate template = null;
@@ -1229,6 +1266,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a text field with the
* minimal set of elements and attributes.
*/
+ @Test
public void testReadTemplateTextFieldAllValuesTest()
{
FileTemplate template = null;
@@ -1268,6 +1306,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a template containing a wrong root element.
*/
+ @Test
public void testReadTemplateWrongRootElementTest() throws Exception
{
testParsingFail( "template_wrong_root_element.xml" ); //$NON-NLS-1$
@@ -1277,6 +1316,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a template containing no 'id' attribute.
*/
+ @Test
public void testReadTemplateNoIdAttributeTest() throws Exception
{
testParsingFail( "template_no_id_attribute.xml" ); //$NON-NLS-1$
@@ -1286,6 +1326,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a template containing no 'title' attribute.
*/
+ @Test
public void testReadTemplateNoTitleAttributeTest() throws Exception
{
testParsingFail( "template_no_title_attribute.xml" ); //$NON-NLS-1$
@@ -1295,6 +1336,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a template containing no 'objectClasses' element.
*/
+ @Test
public void testReadTemplateNoObjectClassesElementTest() throws Exception
{
testParsingFail( "template_no_objectClasses_element.xml" ); //$NON-NLS-1$
@@ -1304,6 +1346,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a template containing no 'structural' element.
*/
+ @Test
public void testReadTemplateNoObjectClassElementTest() throws Exception
{
testParsingFail( "template_no_structural_element.xml" ); //$NON-NLS-1$
@@ -1313,6 +1356,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a template containing no 'form' element.
*/
+ @Test
public void testReadTemplateNoFormElementTest() throws Exception
{
testParsingFail( "template_no_form_element.xml" ); //$NON-NLS-1$
@@ -1322,6 +1366,7 @@ public class TemplateIOTest extends TestCase
/**
* Tests the parser with a template containing no 'section' element.
*/
+ @Test
public void testReadTemplateNoSectionElementTest() throws Exception
{
testParsingFail( "template_no_section_element.xml" ); //$NON-NLS-1$
@@ -1344,7 +1389,7 @@ public class TemplateIOTest extends TestCase
}
catch ( TemplateIOException e )
{
- assertTrue( e.getMessage(), true );
+ assertTrue( true, e.getMessage() );
return;
}
fail();
@@ -1355,6 +1400,7 @@ public class TemplateIOTest extends TestCase
* Tests the parser with a template file containing a section with a
* 'columns' attribute.
*/
+ @Test
public void testReadTemplateCompositeColumnsAttributeTest()
{
FileTemplate template = null;
diff --git a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java
index 7bd20c7d6..d6764a9ca 100644
--- a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java
+++ b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectGuidValueEditorTest.java
@@ -21,10 +21,11 @@
package org.apache.directory.studio.valueeditors.msad;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.directory.api.util.Strings;
-import org.junit.Test;
+
+import org.junit.jupiter.api.Test;
public class InPlaceMsAdObjectGuidValueEditorTest
diff --git a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java
index 78f4f813c..e86c5dd53 100644
--- a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java
+++ b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/msad/InPlaceMsAdObjectSidValueEditorTest.java
@@ -21,9 +21,9 @@
package org.apache.directory.studio.valueeditors.msad;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class InPlaceMsAdObjectSidValueEditorTest
@@ -48,7 +48,7 @@ public class InPlaceMsAdObjectSidValueEditorTest
( byte ) 0x00,
( byte ) 0x00,
( byte ) 0x00 //
- };
+ };
String displayValue = editor.convertToString( bytes );
assertEquals( "S-1-5-4", displayValue ); //$NON-NLS-1$
}
@@ -77,7 +77,7 @@ public class InPlaceMsAdObjectSidValueEditorTest
( byte ) 0x02,
( byte ) 0x00,
( byte ) 0x00 //
- };
+ };
String displayValue = editor.convertToString( bytes );
assertEquals( "S-1-5-32-549", displayValue ); //$NON-NLS-1$
}
@@ -119,7 +119,7 @@ public class InPlaceMsAdObjectSidValueEditorTest
( byte ) 0x01,
( byte ) 0x00,
( byte ) 0x00 //
- };
+ };
String displayValue = editor.convertToString( bytes );
assertEquals( "S-1-5-21-666267311-2692216076-1860112551-500", displayValue ); //$NON-NLS-1$
}
@@ -206,7 +206,7 @@ public class InPlaceMsAdObjectSidValueEditorTest
( byte ) 0x00,
( byte ) 0x00,
( byte ) 0x00 //
- };
+ };
String displayValue3 = editor.convertToString( bytes3 );
assertEquals( Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ), displayValue3 ); //$NON-NLS-1$
}
diff --git a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java
index a31ac1d94..a5ac129de 100644
--- a/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java
+++ b/plugins/valueeditors/src/test/java/org/apache/directory/studio/valueeditors/uuid/InPlaceUuidValueEditorTest.java
@@ -21,10 +21,11 @@
package org.apache.directory.studio.valueeditors.uuid;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.directory.api.util.Strings;
-import org.junit.Test;
+
+import org.junit.jupiter.api.Test;
public class InPlaceUuidValueEditorTest
@@ -99,9 +100,26 @@ public class InPlaceUuidValueEditorTest
// test too long
byte[] bytes2 = new byte[]
- { ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00,
- ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00,
- ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x00,
+ {
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
+ ( byte ) 0x00,
( byte ) 0x00, };
String displayValue2 = editor.convertToString( bytes2 );
assertEquals( Messages.getString( "InPlaceUuidValueEditor.InvalidUuid" ), displayValue2 ); //$NON-NLS-1$
diff --git a/pom.xml b/pom.xml
index 4bbda5d98..cd56d329a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,12 +69,13 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
- <tycho.version>1.7.0</tycho.version>
+ <tycho.version>2.3.0</tycho.version>
<!-- Set versions for dependencies -->
<antlr.version>2.7.7</antlr.version>
<antlr.bundleversion>2.7.7</antlr.bundleversion>
- <junit.version>4.11</junit.version>
+ <junit.platform.version>1.7.1</junit.platform.version>
+ <junit.jupiter.version>5.7.1</junit.jupiter.version>
<log4j.log4j.version>1.2.17</log4j.log4j.version>
<log4j.log4j.bundleversion>1.2.17</log4j.log4j.bundleversion>
<com.github.ben-manes.caffeine.version>2.7.0</com.github.ben-manes.caffeine.version>
diff --git a/tests/test.integration.core/pom-first.xml b/tests/test.integration.core/pom-first.xml
index 9a1a9ad83..00979367f 100644
--- a/tests/test.integration.core/pom-first.xml
+++ b/tests/test.integration.core/pom-first.xml
@@ -47,23 +47,35 @@
<Eclipse-LazyStart>true</Eclipse-LazyStart>
<Bundle-Activator>org.apache.directory.studio.test.integration.core.Activator</Bundle-Activator>
- <Require-Bundle>org.junit;bundle-version="4.11.0",
- org.hamcrest.library;bundle-version="1.3.0",
+ <Export-Package>org.apache.directory.studio.test.integration.junit5</Export-Package>
+
+ <Require-Bundle>org.hamcrest.library;bundle-version="1.3.0",
+ org.junit.jupiter.api;bundle-version="5.7.0",
+ org.junit.jupiter.params;bundle-version="5.7.0",
+ org.opentest4j;bundle-version="1.2.0",
+
org.apache.directory.server.apacheds-test-framework;bundle-version="${org.apache.directory.server.version}",
org.apache.directory.server.annotations;bundle-version="${org.apache.directory.server.version}",
- org.apache.directory.server.xdbm.partition;bundle-version="${org.apache.directory.server.version}",
- org.apache.directory.server.jdbm.partition;bundle-version="${org.apache.directory.server.version}",
org.apache.directory.server.core.annotations;bundle-version="${org.apache.directory.server.version}",
org.apache.directory.server.core.api;bundle-version="${org.apache.directory.server.version}",
+ org.apache.directory.server.core;bundle-version="${org.apache.directory.server.version}",
org.apache.directory.server.protocol.ldap;bundle-version="${org.apache.directory.server.version}",
+ org.apache.directory.server.protocol.shared;bundle-version="${org.apache.directory.server.version}",
+ org.apache.directory.server.jdbm.partition;bundle-version="${org.apache.directory.server.version}",
+ org.apache.directory.server.xdbm.partition;bundle-version="${org.apache.directory.server.version}",
+
org.apache.directory.api.asn1.api;bundle-version="${org.apache.directory.api.bundleversion}",
org.apache.directory.api.ldap.client.api;bundle-version="${org.apache.directory.api.bundleversion}",
org.apache.directory.api.ldap.codec.core;bundle-version="${org.apache.directory.api.bundleversion}",
+ org.apache.directory.api.ldap.extras.codec;bundle-version="${org.apache.directory.api.bundleversion}",
org.apache.directory.api.ldap.extras.codec.api;bundle-version="${org.apache.directory.api.bundleversion}",
org.apache.directory.api.ldap.model;bundle-version="${org.apache.directory.api.bundleversion}",
org.apache.directory.api.ldap.net.mina;bundle-version="${org.apache.directory.api.bundleversion}",
+ org.apache.directory.api.ldap.schema;bundle-version="${org.apache.directory.api.bundleversion}",
+ org.apache.directory.api.ldap.schema.converter;bundle-version="${org.apache.directory.api.bundleversion}",
org.apache.directory.api.util;bundle-version="${org.apache.directory.api.bundleversion}",
org.apache.mina.core;bundle-version="${org.apache.mina.bundleversion}",
+
org.apache.directory.studio.connection.core,
org.apache.directory.studio.common.core,
org.apache.directory.studio.ldapbrowser.core,
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/ComputeDiffTest.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/ComputeDiffTest.java
index 1f7cc8edf..99f032d44 100644
--- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/ComputeDiffTest.java
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/ComputeDiffTest.java
@@ -25,7 +25,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
-import static org.junit.Assert.assertNull;
+import static org.hamcrest.Matchers.nullValue;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
@@ -41,8 +41,8 @@ import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
import org.apache.directory.studio.ldifparser.LdifParserConstants;
import org.apache.directory.studio.ldifparser.model.LdifFile;
import org.apache.directory.studio.ldifparser.model.container.LdifChangeModifyRecord;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class ComputeDiffTest
@@ -90,7 +90,7 @@ public class ComputeDiffTest
}
- @Before
+ @BeforeEach
public void setup() throws Exception
{
ConnectionEventRegistry.suspendEventFiringInCurrentThread();
@@ -104,18 +104,18 @@ public class ComputeDiffTest
public void shouldReturnNullForEqualEntries()
{
// entries without attribute
- assertNull( Utils.computeDiff( oldEntry, newEntry ) );
- assertNull( Utils.computeDiff( oldEntry, oldEntry ) );
- assertNull( Utils.computeDiff( newEntry, newEntry ) );
+ assertThat( Utils.computeDiff( oldEntry, newEntry ), nullValue() );
+ assertThat( Utils.computeDiff( oldEntry, oldEntry ), nullValue() );
+ assertThat( Utils.computeDiff( newEntry, newEntry ), nullValue() );
// entries with attributes
addAttribute( oldEntry, "cn", "1" );
addAttribute( oldEntry, "member", "cn=1", "cn=2", "cn=3" );
addAttribute( newEntry, "cn", "1" );
addAttribute( newEntry, "member", "cn=1", "cn=2", "cn=3" );
- assertNull( Utils.computeDiff( oldEntry, newEntry ) );
- assertNull( Utils.computeDiff( oldEntry, oldEntry ) );
- assertNull( Utils.computeDiff( newEntry, newEntry ) );
+ assertThat( Utils.computeDiff( oldEntry, newEntry ), nullValue() );
+ assertThat( Utils.computeDiff( oldEntry, oldEntry ), nullValue() );
+ assertThat( Utils.computeDiff( newEntry, newEntry ), nullValue() );
}
@@ -291,7 +291,6 @@ public class ComputeDiffTest
private void assertChangeModify( LdifFile diff, String... lines )
{
- // System.out.println( diff.toRawString() );
assertThat( diff.isChangeType(), equalTo( true ) );
assertThat( diff.getContainers(), hasSize( 1 ) );
assertThat( diff.getLastContainer(), instanceOf( LdifChangeModifyRecord.class ) );
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java
index 25209d944..6ebf8fcf3 100644
--- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java
@@ -21,18 +21,29 @@
package org.apache.directory.studio.test.integration.core;
-import static org.apache.directory.studio.test.integration.core.Constants.LOCALHOST;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.CONTEXT_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRALS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_LOOP_1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_LOOP_2_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_REFERRALS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_REFERRAL_TO_USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER8_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
import static org.hamcrest.CoreMatchers.hasItems;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.net.ConnectException;
import java.nio.channels.UnresolvedAddressException;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -69,24 +80,15 @@ import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.util.Strings;
import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.core.integ.FrameworkRunner;
-//import org.apache.directory.server.ldap.handlers.extended.EndTransactionHandler;
-import org.apache.directory.server.ldap.handlers.extended.PwdModifyHandler;
-//import org.apache.directory.server.ldap.handlers.extended.StartTransactionHandler;
-import org.apache.directory.server.ldap.handlers.extended.WhoAmIHandler;
import org.apache.directory.studio.common.core.jobs.StudioProgressMonitor;
import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
import org.apache.directory.studio.connection.core.ConnectionParameter;
-import org.apache.directory.studio.connection.core.IReferralHandler;
import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
+import org.apache.directory.studio.connection.core.IReferralHandler;
import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
import org.apache.directory.studio.connection.core.io.ConnectionWrapper;
import org.apache.directory.studio.connection.core.io.StudioLdapException;
@@ -95,13 +97,19 @@ import org.apache.directory.studio.connection.core.io.api.StudioSearchResult;
import org.apache.directory.studio.connection.core.io.api.StudioSearchResultEnumeration;
import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeRootDSERunnable;
import org.apache.directory.studio.ldapbrowser.core.model.impl.BrowserConnection;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.SkipTestIfLdapServerIsNotAvailableInterceptor;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
import org.apache.mina.util.AvailablePortFinder;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -110,67 +118,27 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunner.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") }, extendedOpHandlers =
- { PwdModifyHandler.class, WhoAmIHandler.class })
-@ApplyLdifFiles(clazz = DirectoryApiConnectionWrapperTest.class, value = "org/apache/directory/studio/test/integration/core/TestData.ldif")
-public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
+@ExtendWith(SkipTestIfLdapServerIsNotAvailableInterceptor.class)
+public class DirectoryApiConnectionWrapperTest
{
protected ConnectionWrapper connectionWrapper;
- @Before
- public void setUp() throws Exception
+ @BeforeAll
+ public static void suspendEventFiringInCurrentThread()
{
- // create referral entries
- Entry referralsOu = new DefaultEntry( getService().getSchemaManager() );
- referralsOu.setDn( new Dn( "ou=referrals,ou=system" ) );
- referralsOu.add( "objectClass", "top", "organizationalUnit" );
- referralsOu.add( "ou", "referrals" );
- service.getAdminSession().add( referralsOu );
-
- // direct referral
- Entry r1 = new DefaultEntry( getService().getSchemaManager() );
- r1.setDn( new Dn( "cn=referral1,ou=referrals,ou=system" ) );
- r1.add( "objectClass", "top", "referral", "extensibleObject" );
- r1.add( "cn", "referral1" );
- r1.add( "ref", "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/ou=users,ou=system" );
- service.getAdminSession().add( r1 );
-
- // referral via another immediate referral
- Entry r2 = new DefaultEntry( getService().getSchemaManager() );
- r2.setDn( new Dn( "cn=referral2,ou=referrals,ou=system" ) );
- r2.add( "objectClass", "top", "referral", "extensibleObject" );
- r2.add( "cn", "referral2" );
- r2.add( "ref", "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/cn=referral1,ou=referrals,ou=system" );
- service.getAdminSession().add( r2 );
-
- // referral to parent which contains this referral
- Entry r3 = new DefaultEntry( getService().getSchemaManager() );
- r3.setDn( new Dn( "cn=referral3,ou=referrals,ou=system" ) );
- r3.add( "objectClass", "top", "referral", "extensibleObject" );
- r3.add( "cn", "referral3" );
- r3.add( "ref", "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/ou=referrals,ou=system" );
- service.getAdminSession().add( r3 );
-
- // referrals pointing to each other (loop)
- Entry r4a = new DefaultEntry( getService().getSchemaManager() );
- r4a.setDn( new Dn( "cn=referral4a,ou=referrals,ou=system" ) );
- r4a.add( "objectClass", "top", "referral", "extensibleObject" );
- r4a.add( "cn", "referral4a" );
- r4a.add( "ref", "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/cn=referral4b,ou=referrals,ou=system" );
- service.getAdminSession().add( r4a );
- Entry r4b = new DefaultEntry( getService().getSchemaManager() );
- r4b.setDn( new Dn( "cn=referral4b,ou=referrals,ou=system" ) );
- r4b.add( "objectClass", "top", "referral", "extensibleObject" );
- r4b.add( "cn", "referral4b" );
- r4b.add( "ref", "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/cn=referral4a,ou=referrals,ou=system" );
- service.getAdminSession().add( r4b );
+ ConnectionEventRegistry.suspendEventFiringInCurrentThread();
}
- @After
+ @AfterAll
+ public static void resumeEventFiringInCurrentThread()
+ {
+ ConnectionEventRegistry.resumeEventFiringInCurrentThread();
+ }
+
+
+ @AfterEach
public void tearDown() throws Exception
{
if ( connectionWrapper != null )
@@ -183,12 +151,14 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
/**
* Tests connecting to the server.
*/
- @Test
- public void testConnect()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testConnect( TestLdapServer ldapServer )
{
StudioProgressMonitor monitor = getProgressMonitor();
- ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
- EncryptionMethod.NONE, AuthenticationMethod.NONE, null, null, null, true, null, 30000L );
+ ConnectionParameter connectionParameter = new ConnectionParameter( null, ldapServer.getHost(),
+ ldapServer.getPort(), EncryptionMethod.NONE, AuthenticationMethod.NONE, null, null, null, true, null,
+ 30000L );
Connection connection = new Connection( connectionParameter );
ConnectionWrapper connectionWrapper = connection.getConnectionWrapper();
@@ -208,8 +178,9 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
/**
* Test failed connections to the server.
*/
- @Test
- public void testConnectFailures()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testConnectFailures( TestLdapServer ldapServer )
{
StudioProgressMonitor monitor = null;
ConnectionParameter connectionParameter = null;
@@ -218,8 +189,9 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
// invalid port
monitor = getProgressMonitor();
- connectionParameter = new ConnectionParameter( null, LOCALHOST, AvailablePortFinder.getNextAvailable(),
- EncryptionMethod.NONE, AuthenticationMethod.NONE, null, null, null, true, null, 30000L );
+ connectionParameter = new ConnectionParameter( null, ldapServer.getHost(),
+ AvailablePortFinder.getNextAvailable(), EncryptionMethod.NONE, AuthenticationMethod.NONE, null, null, null,
+ true, null, 30000L );
connection = new Connection( connectionParameter );
connectionWrapper = connection.getConnectionWrapper();
connectionWrapper.connect( monitor );
@@ -253,13 +225,14 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
/**
* Test binding to the server.
*/
- @Test
- public void testBind()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBind( TestLdapServer ldapServer )
{
StudioProgressMonitor monitor = getProgressMonitor();
- ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
- EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "secret", null, true,
- null, 30000L );
+ ConnectionParameter connectionParameter = new ConnectionParameter( null, ldapServer.getHost(),
+ ldapServer.getPort(), EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, ldapServer.getAdminDn(),
+ ldapServer.getAdminPassword(), null, true, null, 30000L );
Connection connection = new Connection( connectionParameter );
ConnectionWrapper connectionWrapper = connection.getConnectionWrapper();
@@ -279,18 +252,20 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
/**
* Test failed binds to the server.
*/
- @Test
- public void testBindFailures()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBindFailures( TestLdapServer ldapServer )
{
StudioProgressMonitor monitor = null;
ConnectionParameter connectionParameter = null;
Connection connection = null;
ConnectionWrapper connectionWrapper = null;
- // simple auth without principal and credential
+ // simple auth with invalid user
monitor = getProgressMonitor();
- connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(), EncryptionMethod.NONE,
- AuthenticationMethod.SIMPLE, "uid=admin", "invalid", null, true, null, 30000L );
+ connectionParameter = new ConnectionParameter( null, ldapServer.getHost(), ldapServer.getPort(),
+ EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, "cn=invalid," + USERS_DN, "invalid", null, true,
+ null, 30000L );
connection = new Connection( connectionParameter );
connectionWrapper = connection.getConnectionWrapper();
connectionWrapper.connect( monitor );
@@ -299,14 +274,18 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
assertNotNull( monitor.getException() );
assertTrue( monitor.getException() instanceof StudioLdapException );
assertTrue( monitor.getException().getMessage().contains( "[LDAP result code 49 - invalidCredentials]" ) );
- assertTrue( monitor.getException().getMessage().contains( "INVALID_CREDENTIALS" ) );
assertTrue( monitor.getException().getCause() instanceof LdapAuthenticationException );
- assertTrue( monitor.getException().getCause().getMessage().contains( "INVALID_CREDENTIALS" ) );
+ if ( ldapServer.getType() == LdapServerType.ApacheDS )
+ {
+ assertTrue( monitor.getException().getMessage().contains( "INVALID_CREDENTIALS" ) );
+ assertTrue( monitor.getException().getCause().getMessage().contains( "INVALID_CREDENTIALS" ) );
+ }
- // simple auth with invalid principal and credential
+ // simple auth with invalid password
monitor = getProgressMonitor();
- connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(), EncryptionMethod.NONE,
- AuthenticationMethod.SIMPLE, "uid=admin,ou=system", "bar", null, true, null, 30000L );
+ connectionParameter = new ConnectionParameter( null, ldapServer.getHost(), ldapServer.getPort(),
+ EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, ldapServer.getAdminDn(), "invalid", null, true, null,
+ 30000L );
connection = new Connection( connectionParameter );
connectionWrapper = connection.getConnectionWrapper();
connectionWrapper.connect( monitor );
@@ -315,22 +294,27 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
assertNotNull( monitor.getException() );
assertTrue( monitor.getException() instanceof StudioLdapException );
assertTrue( monitor.getException().getMessage().contains( "[LDAP result code 49 - invalidCredentials]" ) );
- assertTrue( monitor.getException().getMessage().contains( "INVALID_CREDENTIALS" ) );
assertTrue( monitor.getException().getCause() instanceof LdapAuthenticationException );
- assertTrue( monitor.getException().getCause().getMessage().contains( "INVALID_CREDENTIALS" ) );
+ if ( ldapServer.getType() == LdapServerType.ApacheDS )
+ {
+ assertTrue( monitor.getException().getMessage().contains( "INVALID_CREDENTIALS" ) );
+ assertTrue( monitor.getException().getCause().getMessage().contains( "INVALID_CREDENTIALS" ) );
+ }
}
/**
* Test searching.
*/
- @Test
- public void testSearch() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearch( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
SearchControls searchControls = new SearchControls();
- StudioSearchResultEnumeration result = getConnectionWrapper( monitor ).search( "ou=system", "(objectClass=*)",
- searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, null, monitor, null );
+ StudioSearchResultEnumeration result = getConnectionWrapper( monitor, ldapServer ).search( CONTEXT_DN.getName(),
+ "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, null,
+ monitor, null );
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
@@ -343,15 +327,16 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
/**
* Test binary attributes.
*/
- @Test
- public void testSearchBinaryAttributes() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchBinaryAttributes( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.OBJECT_SCOPE );
- StudioSearchResultEnumeration result = getConnectionWrapper( monitor ).search( "uid=admin,ou=system",
- "(objectClass=*)",
- searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, null, monitor, null );
+ StudioSearchResultEnumeration result = getConnectionWrapper( monitor, ldapServer ).search(
+ "uid=user.1,ou=users,dc=example,dc=org", "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
+ ReferralHandlingMethod.IGNORE, null, monitor, null );
assertNotNull( result );
assertTrue( result.hasMore() );
@@ -360,77 +345,94 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
Object userPasswordValue = entry.getEntry().get( "userPassword" ).getBytes();
assertEquals( byte[].class, userPasswordValue.getClass() );
- assertEquals( "secret", new String( ( byte[] ) userPasswordValue, StandardCharsets.UTF_8 ) );
}
- @Test
- public void testSearchContinuation_Follow_DirectReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchContinuation_Follow_DirectReferral( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
SearchControls searchControls = new SearchControls();
- StudioSearchResultEnumeration result = getConnectionWrapper( monitor ).search(
- "cn=referral1,ou=referrals,ou=system", "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
+ StudioSearchResultEnumeration result = getConnectionWrapper( monitor, ldapServer ).search(
+ REFERRAL_TO_USERS_DN.getName(), "(objectClass=*)", searchControls,
+ AliasDereferencingMethod.NEVER,
ReferralHandlingMethod.FOLLOW, null, monitor, null );
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
assertNotNull( result );
- List<String> dns = consume( result, sr -> sr.getDn().getName() );
- assertEquals( 1, dns.size() );
- assertEquals( "uid=user.1,ou=users,ou=system", dns.get( 0 ) );
+ List<Dn> dns = consume( result, sr -> sr.getDn() );
+ if ( ldapServer.getType() != LdapServerType.Fedora389ds )
+ {
+ // TODO: check why 389ds returns ou=users
+ assertEquals( 8, dns.size() );
+ assertThat( dns, hasItems( USER1_DN, USER8_DN ) );
+ }
}
- @Test
- public void testSearchContinuation_Follow_IntermediateReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchContinuation_Follow_IntermediateReferral( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- StudioSearchResultEnumeration result = getConnectionWrapper( monitor ).search(
- "cn=referral2,ou=referrals,ou=system", "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
+ StudioSearchResultEnumeration result = getConnectionWrapper( monitor, ldapServer ).search(
+ REFERRAL_TO_REFERRAL_TO_USERS_DN.getName(), "(objectClass=*)", searchControls,
+ AliasDereferencingMethod.NEVER,
ReferralHandlingMethod.FOLLOW, null, monitor, null );
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
assertNotNull( result );
- List<String> dns = consume( result, sr -> sr.getDn().getName() );
- assertEquals( 2, dns.size() );
- assertThat( dns, hasItems( "ou=users,ou=system", "uid=user.1,ou=users,ou=system" ) );
+ List<Dn> dns = consume( result, sr -> sr.getDn() );
+ if ( ldapServer.getType() != LdapServerType.Fedora389ds )
+ {
+ // TODO: check why 389ds returns ou=users only
+ assertEquals( 9, dns.size() );
+ assertThat( dns, hasItems( USERS_DN, USER1_DN, USER8_DN ) );
+ }
}
- @Test
- public void testSearchContinuation_Follow_ReferralToParent() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchContinuation_Follow_ReferralToParent( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
SearchControls searchControls = new SearchControls();
- searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- StudioSearchResultEnumeration result = getConnectionWrapper( monitor ).search(
- "cn=referral3,ou=referrals,ou=system", "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
+ searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ StudioSearchResultEnumeration result = getConnectionWrapper( monitor, ldapServer ).search(
+ REFERRAL_TO_REFERRALS_DN.getName(), "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
ReferralHandlingMethod.FOLLOW, null, monitor, null );
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
assertNotNull( result );
- List<String> dns = consume( result, sr -> sr.getDn().getName() );
- assertEquals( 3, dns.size() );
- assertThat( dns, hasItems( "ou=referrals,ou=system", "ou=users,ou=system", "uid=user.1,ou=users,ou=system" ) );
+ List<Dn> dns = consume( result, sr -> sr.getDn() );
+ if ( ldapServer.getType() != LdapServerType.Fedora389ds )
+ {
+ // TODO: check why 389ds returns nothing
+ assertEquals( 5, dns.size() );
+ assertThat( dns, hasItems( REFERRALS_DN, USERS_DN, USER1_DN, MISC_DN ) );
+ }
}
- @Test
- public void testSearchContinuation_Follow_ReferralLoop() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchContinuation_Follow_ReferralLoop( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- StudioSearchResultEnumeration result = getConnectionWrapper( monitor ).search(
- "cn=referral4a,ou=referrals,ou=system", "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
+ StudioSearchResultEnumeration result = getConnectionWrapper( monitor, ldapServer ).search(
+ REFERRAL_LOOP_1_DN.getName(), "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
ReferralHandlingMethod.FOLLOW, null, monitor, null );
assertFalse( monitor.isCanceled() );
@@ -442,15 +444,16 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
}
- @Test
- public void testSearchContinuationFollowManually() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchContinuationFollowManually( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- ConnectionWrapper connectionWrapper = getConnectionWrapper( monitor );
+ ConnectionWrapper connectionWrapper = getConnectionWrapper( monitor, ldapServer );
ConnectionCorePlugin.getDefault().setReferralHandler( null );
- StudioSearchResultEnumeration result = connectionWrapper.search( "ou=referrals,ou=system", "(objectClass=*)",
+ StudioSearchResultEnumeration result = connectionWrapper.search( REFERRALS_DN.getName(), "(objectClass=*)",
searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.FOLLOW_MANUALLY, null, monitor,
null );
@@ -458,31 +461,52 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
assertFalse( monitor.errorsReported() );
assertNotNull( result );
- List<String> dns = consume( result, sr -> sr.getDn().getName() );
- assertEquals( 6, dns.size() );
- assertThat( dns,
- hasItems( "ou=referrals,ou=system", "ou=users,ou=system", "cn=referral1,ou=referrals,ou=system",
- "cn=referral4a,ou=referrals,ou=system", "cn=referral4b,ou=referrals,ou=system" ) );
+ List<Dn> dns = consume( result, sr -> sr.getDn() );
+ assertEquals( 8, dns.size() );
+ assertThat( dns, hasItems( REFERRALS_DN, USER1_DN, USERS_DN, REFERRAL_TO_USERS_DN, REFERRAL_LOOP_1_DN,
+ REFERRAL_LOOP_2_DN, MISC_DN ) );
}
- @Test
- public void testSearchContinuationIgnore() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchContinuationIgnore( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- StudioSearchResultEnumeration result = getConnectionWrapper( monitor ).search( "ou=referrals,ou=system",
- "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, null,
- monitor, null );
+ StudioSearchResultEnumeration result = getConnectionWrapper( monitor, ldapServer ).search(
+ REFERRALS_DN.getName(), "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
+ ReferralHandlingMethod.IGNORE, null, monitor, null );
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
assertNotNull( result );
- List<String> dns = consume( result, sr -> sr.getDn().getName() );
+ List<Dn> dns = consume( result, sr -> sr.getDn() );
assertEquals( 1, dns.size() );
- assertThat( dns, hasItems( "ou=referrals,ou=system" ) );
+ assertThat( dns, hasItems( REFERRALS_DN ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchContinuationFollowParent( TestLdapServer ldapServer ) throws Exception
+ {
+ StudioProgressMonitor monitor = getProgressMonitor();
+ SearchControls searchControls = new SearchControls();
+ searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ StudioSearchResultEnumeration result = getConnectionWrapper( monitor, ldapServer ).search(
+ REFERRALS_DN.getName(), "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER,
+ ReferralHandlingMethod.FOLLOW, null, monitor, null );
+
+ assertFalse( monitor.isCanceled() );
+ assertFalse( monitor.errorsReported() );
+ assertNotNull( result );
+
+ List<Dn> dns = consume( result, sr -> sr.getDn() );
+ assertEquals( 5, dns.size() );
+ assertThat( dns, hasItems( REFERRALS_DN, USERS_DN, USER1_DN, MISC_DN ) );
}
@@ -499,67 +523,71 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
}
- @Test
- public void testAdd() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testAdd( TestLdapServer ldapServer ) throws Exception
{
- String dn = "uid=user.X,ou=users,ou=system";
+ String dn = "uid=user.X," + USERS_DN;
StudioProgressMonitor monitor = getProgressMonitor();
Entry entry = new DefaultEntry( dn, "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" );
- getConnectionWrapper( monitor ).createEntry( entry, null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).createEntry( entry, null, monitor, null );
// should have created entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- assertTrue( service.getAdminSession().exists( dn ) );
+ assertTrue( ldapServer.withAdminConnectionAndGet( connection -> connection.exists( dn ) ) );
}
- @Test
- public void testAddFollowsReferral_DirectReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testAddFollowsReferral_DirectReferral( TestLdapServer ldapServer ) throws Exception
{
- String targetDn = "uid=user.X,ou=users,ou=system";
- String referralDn = "uid=user.X,cn=referral1,ou=referrals,ou=system";
+ Dn targetDn = dn( "uid=user.X", USERS_DN );
+ Dn referralDn = dn( "uid=user.X", REFERRAL_TO_USERS_DN );
// create entry under referral
StudioProgressMonitor monitor = getProgressMonitor();
Entry entry = new DefaultEntry( referralDn, "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" );
- getConnectionWrapper( monitor ).createEntry( entry, null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).createEntry( entry, null, monitor, null );
// should have created target entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- assertTrue( service.getAdminSession().exists( targetDn ) );
+ assertTrue( ldapServer.withAdminConnectionAndGet( connection -> connection.exists( targetDn ) ) );
}
- @Test
- public void testAddFollowsReferral_IntermediateReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testAddFollowsReferral_IntermediateReferral( TestLdapServer ldapServer ) throws Exception
{
- String targetDn = "uid=user.X,ou=users,ou=system";
- String referralDn = "uid=user.X,cn=referral2,ou=referrals,ou=system";
+ Dn targetDn = dn( "uid=user.X", USERS_DN );
+ Dn referralDn = dn( "uid=user.X", REFERRAL_TO_REFERRAL_TO_USERS_DN );
// create entry under referral
StudioProgressMonitor monitor = getProgressMonitor();
Entry entry = new DefaultEntry( referralDn, "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" );
- getConnectionWrapper( monitor ).createEntry( entry, null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).createEntry( entry, null, monitor, null );
// should have created target entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- assertTrue( service.getAdminSession().exists( targetDn ) );
+ assertTrue( ldapServer.withAdminConnectionAndGet( connection -> connection.exists( targetDn ) ) );
}
- @Test
- public void testAddFollowsReferral_ReferralLoop() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testAddFollowsReferral_ReferralLoop( TestLdapServer ldapServer ) throws Exception
{
- String referralDn = "uid=user.X,cn=referral4a,ou=referrals,ou=system";
+ Dn referralDn = dn( "uid=user.X", REFERRAL_LOOP_1_DN );
// create entry under referral
StudioProgressMonitor monitor = getProgressMonitor();
Entry entry = new DefaultEntry( referralDn, "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" );
- getConnectionWrapper( monitor ).createEntry( entry, null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).createEntry( entry, null, monitor, null );
// should not have created target entry
assertFalse( monitor.isCanceled() );
@@ -572,96 +600,103 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
}
- @Test
- public void testModify() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testModify( TestLdapServer ldapServer ) throws Exception
{
- String dn = "uid=user.X,ou=users,ou=system";
+ String dn = "uid=user.X," + USERS_DN;
// create entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), dn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) );
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( dn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) ) );
// modify entry
StudioProgressMonitor monitor = getProgressMonitor();
List<Modification> modifications = Collections.singletonList(
new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
new DefaultAttribute( "sn", "modified" ) ) );
- getConnectionWrapper( monitor ).modifyEntry( new Dn( dn ), modifications, null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).modifyEntry( new Dn( dn ), modifications, null, monitor, null );
// should have modified the entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- Entry entry = service.getAdminSession().lookup( new Dn( dn ) );
+ Entry entry = ldapServer.withAdminConnectionAndGet( connection -> connection.lookup( new Dn( dn ) ) );
assertEquals( "modified", entry.get( "sn" ).getString() );
}
- @Test
- public void testModifyFollowsReferral_DirectReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testModifyFollowsReferral_DirectReferral( TestLdapServer ldapServer ) throws Exception
{
- String targetDn = "uid=user.X,ou=users,ou=system";
- String referralDn = "uid=user.X,cn=referral1,ou=referrals,ou=system";
+ Dn targetDn = dn( "uid=user.X", USERS_DN );
+ Dn referralDn = dn( "uid=user.X", REFERRAL_TO_USERS_DN );
// create target entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), targetDn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) );
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( targetDn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) ) );
// modify referral entry
StudioProgressMonitor monitor = getProgressMonitor();
List<Modification> modifications = Collections.singletonList(
new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
new DefaultAttribute( "sn", "modified" ) ) );
- getConnectionWrapper( monitor ).modifyEntry( new Dn( referralDn ), modifications, null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).modifyEntry( referralDn, modifications, null, monitor,
+ null );
// should have modified the target entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- Entry entry = service.getAdminSession().lookup( new Dn( targetDn ) );
+ Entry entry = ldapServer.withAdminConnectionAndGet( connection -> connection.lookup( targetDn ) );
assertEquals( "modified", entry.get( "sn" ).getString() );
}
- @Test
- public void testModifyFollowsReferral_IntermediateReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testModifyFollowsReferral_IntermediateReferral( TestLdapServer ldapServer ) throws Exception
{
- String targetDn = "uid=user.X,ou=users,ou=system";
- String referralDn = "uid=user.X,cn=referral2,ou=referrals,ou=system";
+ Dn targetDn = dn( "uid=user.X", USERS_DN );
+ Dn referralDn = dn( "uid=user.X", REFERRAL_TO_REFERRAL_TO_USERS_DN );
// create target entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), targetDn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) );
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( targetDn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) ) );
// modify referral entry
StudioProgressMonitor monitor = getProgressMonitor();
List<Modification> modifications = Collections.singletonList(
new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
new DefaultAttribute( "sn", "modified" ) ) );
- getConnectionWrapper( monitor ).modifyEntry( new Dn( referralDn ), modifications, null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).modifyEntry( referralDn, modifications, null, monitor,
+ null );
// should have modified the target entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- Entry entry = service.getAdminSession().lookup( new Dn( targetDn ) );
+ Entry entry = ldapServer.withAdminConnectionAndGet( connection -> connection.lookup( targetDn ) );
assertEquals( "modified", entry.get( "sn" ).getString() );
}
- @Test
- public void testModifyFollowsReferral_ReferralLoop() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testModifyFollowsReferral_ReferralLoop( TestLdapServer ldapServer ) throws Exception
{
- String targetDn = "uid=user.X,ou=users,ou=system";
- String referralDn = "uid=user.X,cn=referral4a,ou=referrals,ou=system";
+ Dn targetDn = dn( "uid=user.X", USERS_DN );
+ Dn referralDn = dn( "uid=user.X", REFERRAL_LOOP_1_DN );
// create target entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), targetDn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) );
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( targetDn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) ) );
// modify referral entry
StudioProgressMonitor monitor = getProgressMonitor();
List<Modification> modifications = Collections.singletonList(
new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
new DefaultAttribute( "sn", "modified" ) ) );
- getConnectionWrapper( monitor ).modifyEntry( new Dn( referralDn ), modifications, null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).modifyEntry( referralDn, modifications, null, monitor,
+ null );
// should not have modified the target entry
assertFalse( monitor.isCanceled() );
@@ -674,81 +709,85 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
}
- @Test
- public void testDelete() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDelete( TestLdapServer ldapServer ) throws Exception
{
- String dn = "uid=user.X,ou=users,ou=system";
+ String dn = "uid=user.X," + USERS_DN;
// create entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), dn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) );
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( dn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) ) );
// delete entry
StudioProgressMonitor monitor = getProgressMonitor();
- getConnectionWrapper( monitor ).deleteEntry( new Dn( dn ), null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).deleteEntry( new Dn( dn ), null, monitor, null );
// should have deleted the entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- assertFalse( service.getAdminSession().exists( dn ) );
+ assertFalse( ldapServer.withAdminConnectionAndGet( connection -> connection.exists( dn ) ) );
}
- @Test
- public void testDeleteFollowsReferral_DirectReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteFollowsReferral_DirectReferral( TestLdapServer ldapServer ) throws Exception
{
- String targetDn = "uid=user.X,ou=users,ou=system";
- String referralDn = "uid=user.X,cn=referral1,ou=referrals,ou=system";
+ Dn targetDn = dn( "uid=user.X", USERS_DN );
+ Dn referralDn = dn( "uid=user.X", REFERRAL_TO_USERS_DN );
// create target entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), targetDn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) );
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( targetDn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) ) );
// delete referral entry
StudioProgressMonitor monitor = getProgressMonitor();
- getConnectionWrapper( monitor ).deleteEntry( new Dn( referralDn ), null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).deleteEntry( referralDn, null, monitor, null );
// should have deleted the target entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- assertFalse( service.getAdminSession().exists( targetDn ) );
+ assertFalse( ldapServer.withAdminConnectionAndGet( connection -> connection.exists( targetDn ) ) );
}
- @Test
- public void testDeleteFollowsReferral_IntermediateReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteFollowsReferral_IntermediateReferral( TestLdapServer ldapServer ) throws Exception
{
- String targetDn = "uid=user.X,ou=users,ou=system";
- String referralDn = "uid=user.X,cn=referral2,ou=referrals,ou=system";
+ Dn targetDn = dn( "uid=user.X", USERS_DN );
+ Dn referralDn = dn( "uid=user.X", REFERRAL_TO_REFERRAL_TO_USERS_DN );
// create target entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), targetDn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) );
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( targetDn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) ) );
// delete referral entry
StudioProgressMonitor monitor = getProgressMonitor();
- getConnectionWrapper( monitor ).deleteEntry( new Dn( referralDn ), null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).deleteEntry( referralDn, null, monitor, null );
// should have deleted the target entry
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
- assertFalse( service.getAdminSession().exists( targetDn ) );
+ assertFalse( ldapServer.withAdminConnectionAndGet( connection -> connection.exists( targetDn ) ) );
}
- @Test
- public void testDeleteFollowsReferral_ReferralLoop() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteFollowsReferral_ReferralLoop( TestLdapServer ldapServer ) throws Exception
{
- String targetDn = "uid=user.X,ou=users,ou=system";
- String referralDn = "uid=user.X,cn=referral4a,ou=referrals,ou=system";
+ Dn targetDn = dn( "uid=user.X", USERS_DN );
+ Dn referralDn = dn( "uid=user.X", REFERRAL_LOOP_1_DN );
// create target entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), targetDn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) );
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( targetDn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X" ) ) );
// delete referral entry
StudioProgressMonitor monitor = getProgressMonitor();
- getConnectionWrapper( monitor ).deleteEntry( new Dn( referralDn ), null, monitor, null );
+ getConnectionWrapper( monitor, ldapServer ).deleteEntry( referralDn, null, monitor, null );
// should not have deleted the target entry
assertFalse( monitor.isCanceled() );
@@ -758,41 +797,21 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
assertTrue( monitor.getException().getMessage().contains( "[LDAP result code 54 - loopDetect]" ) );
assertTrue( monitor.getException().getMessage().contains( "already processed" ) );
assertTrue( monitor.getException().getCause() instanceof LdapLoopDetectedException );
- assertTrue( service.getAdminSession().exists( targetDn ) );
- }
-
-
- @Test
- public void testSearchContinuationFollowParent() throws Exception
- {
- StudioProgressMonitor monitor = getProgressMonitor();
- SearchControls searchControls = new SearchControls();
- searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- StudioSearchResultEnumeration result = getConnectionWrapper( monitor ).search( "ou=referrals,ou=system",
- "(objectClass=*)", searchControls, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.FOLLOW, null,
- monitor, null );
-
- assertFalse( monitor.isCanceled() );
- assertFalse( monitor.errorsReported() );
- assertNotNull( result );
-
- List<String> dns = consume( result, sr -> sr.getDn().getName() );
- assertEquals( 4, dns.size() );
- assertThat( dns, hasItems( "ou=referrals,ou=system", "ou=referrals,ou=system", "ou=users,ou=system",
- "uid=user.1,ou=users,ou=system" ) );
+ assertTrue( ldapServer.withAdminConnectionAndGet( connection -> connection.exists( targetDn ) ) );
}
/**
* Test initializing of Root DSE.
*/
- @Test
- public void testInitializeAttributesRunnable() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testInitializeAttributesRunnable( TestLdapServer ldapServer ) throws Exception
{
StudioProgressMonitor monitor = getProgressMonitor();
- ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
- EncryptionMethod.NONE, AuthenticationMethod.SIMPLE,
- "uid=admin,ou=system", "secret", null, true, null, 30000L );
+ ConnectionParameter connectionParameter = new ConnectionParameter( null, ldapServer.getHost(),
+ ldapServer.getPort(), EncryptionMethod.NONE, AuthenticationMethod.SIMPLE,
+ ldapServer.getAdminDn(), ldapServer.getAdminPassword(), null, true, null, 30000L );
Connection connection = new Connection( connectionParameter );
BrowserConnection browserConnection = new BrowserConnection( connection );
@@ -807,14 +826,16 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
/**
* DIRSTUDIO-1039
*/
- @Ignore
- @Test
- public void testConcurrentUseAndCloseOfConnection() throws Exception
+ @Disabled("Flaky test")
+ @ParameterizedTest
+ @LdapServersSource
+ public void testConcurrentUseAndCloseOfConnection( TestLdapServer ldapServer ) throws Exception
{
final StudioProgressMonitor monitor = getProgressMonitor();
- final ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
+ final ConnectionParameter connectionParameter = new ConnectionParameter( null, ldapServer.getHost(),
+ ldapServer.getPort(),
EncryptionMethod.NONE, AuthenticationMethod.SIMPLE,
- "uid=admin,ou=system", "secret", null, true, null, 30000L );
+ ldapServer.getAdminDn(), ldapServer.getAdminPassword(), null, true, null, 30000L );
final Connection connection = new Connection( connectionParameter );
final BrowserConnection browserConnection = new BrowserConnection( connection );
@@ -876,14 +897,20 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
}
- @Test
- public void testPasswordModifyRequestExtendedOperation_AdminChangesUserPassword() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testPasswordModifyRequestExtendedOperation_AdminChangesUserPassword( TestLdapServer ldapServer )
+ throws Exception
{
- String dn = "uid=user.X,ou=users,ou=system";
+ String dn = "uid=user.X," + USERS_DN;
// create target entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), dn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X", "userPassword: secret" ) );
+ String password0 = "{SSHA}VHg6ewDaPUmVWw3efXL5NF6bVuRHGWhrCRH1xA==";
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( dn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X",
+ "userPassword: " + password0 ) ) );
+ Entry entry0 = ldapServer.withAdminConnectionAndGet( connection -> connection.lookup( new Dn( dn ) ) );
+ assertEquals( password0, Strings.utf8ToString( entry0.get( "userPassword" ).getBytes() ) );
// modify password
LdapApiService ldapApiService = LdapApiServiceFactory.getSingleton();
@@ -892,42 +919,65 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
request.setUserIdentity( Strings.getBytesUtf8( dn ) );
request.setNewPassword( Strings.getBytesUtf8( "s3cre3t" ) );
StudioProgressMonitor monitor = getProgressMonitor();
- ExtendedResponse response = getConnectionWrapper( monitor ).extended( request, monitor );
+ ExtendedResponse response = getConnectionWrapper( monitor, ldapServer ).extended( request, monitor );
- // should have modified password of the target entry
- assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
- assertFalse( monitor.isCanceled() );
- assertFalse( monitor.errorsReported() );
- Entry entry = service.getAdminSession().lookup( new Dn( dn ) );
- assertEquals( "s3cre3t", Strings.utf8ToString( entry.get( "userPassword" ).getBytes() ) );
+ if ( ldapServer.getType() == LdapServerType.Fedora389ds )
+ {
+ assertEquals( ResultCodeEnum.CONFIDENTIALITY_REQUIRED, response.getLdapResult().getResultCode() );
+ assertFalse( monitor.isCanceled() );
+ assertTrue( monitor.errorsReported() );
+ }
+ else
+ {
+ // should have modified password of the target entry
+ assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
+ assertFalse( monitor.isCanceled() );
+ assertFalse( monitor.errorsReported() );
+ Entry entry = ldapServer.withAdminConnectionAndGet( connection -> connection.lookup( new Dn( dn ) ) );
+ assertNotEquals( password0, Strings.utf8ToString( entry.get( "userPassword" ).getBytes() ) );
+ }
}
- @Test
- public void testPasswordModifyRequestExtendedOperation_UserChangesOwnPassword() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All, except = LdapServerType.Fedora389ds, reason = "389ds requires secure connection")
+ public void testPasswordModifyRequestExtendedOperation_UserChangesOwnPassword( TestLdapServer ldapServer )
+ throws Exception
{
- LdapApiService ldapApiService = LdapApiServiceFactory.getSingleton();
- String dn = "uid=user.X,ou=users,ou=system";
+ String dn = "uid=user.X," + USERS_DN;
// create target entry
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), dn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X", "userPassword: secret" ) );
+ String password0 = "{SSHA}VHg6ewDaPUmVWw3efXL5NF6bVuRHGWhrCRH1xA==";
+ ldapServer.withAdminConnection( connection -> connection.add( new DefaultEntry( dn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: user.X",
+ "userPassword: " + password0 ) ) );
+ Entry entry0 = ldapServer.withAdminConnectionAndGet( connection -> connection.lookup( new Dn( dn ) ) );
+ assertEquals( password0, Strings.utf8ToString( entry0.get( "userPassword" ).getBytes() ) );
// modify password with wrong old password
+ LdapApiService ldapApiService = LdapApiServiceFactory.getSingleton();
PasswordModifyRequest request1 = ( PasswordModifyRequest ) ldapApiService.getExtendedRequestFactories()
.get( PasswordModifyRequest.EXTENSION_OID ).newRequest();
request1.setUserIdentity( Strings.getBytesUtf8( dn ) );
request1.setOldPassword( Strings.getBytesUtf8( "wrong" ) );
request1.setNewPassword( Strings.getBytesUtf8( "s3cre3t" ) );
StudioProgressMonitor monitor1 = getProgressMonitor();
- ExtendedResponse response1 = getConnectionWrapper( monitor1, dn, "secret" ).extended( request1, monitor1 );
+ ExtendedResponse response1 = getConnectionWrapper( monitor1, ldapServer, dn, "secret" ).extended( request1,
+ monitor1 );
// should not have modified password of the target entry
- assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, response1.getLdapResult().getResultCode() );
+ if ( ldapServer.getType() == LdapServerType.OpenLdap )
+ {
+ assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, response1.getLdapResult().getResultCode() );
+ }
+ else
+ {
+ assertEquals( ResultCodeEnum.INVALID_CREDENTIALS, response1.getLdapResult().getResultCode() );
+ }
assertFalse( monitor1.isCanceled() );
assertTrue( monitor1.errorsReported() );
- Entry entry1 = service.getAdminSession().lookup( new Dn( dn ) );
- assertEquals( "secret", Strings.utf8ToString( entry1.get( "userPassword" ).getBytes() ) );
+ Entry entry1 = ldapServer.withAdminConnectionAndGet( connection -> connection.lookup( new Dn( dn ) ) );
+ assertEquals( password0, Strings.utf8ToString( entry1.get( "userPassword" ).getBytes() ) );
// modify password with correct old password
PasswordModifyRequest request2 = ( PasswordModifyRequest ) ldapApiService.getExtendedRequestFactories()
@@ -936,38 +986,40 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
request2.setOldPassword( Strings.getBytesUtf8( "secret" ) );
request2.setNewPassword( Strings.getBytesUtf8( "s3cre3t" ) );
StudioProgressMonitor monitor2 = getProgressMonitor();
- ExtendedResponse response2 = getConnectionWrapper( monitor2, dn, "secret" ).extended( request2, monitor2 );
+ ExtendedResponse response2 = getConnectionWrapper( monitor2, ldapServer, dn, "secret" ).extended( request2,
+ monitor2 );
// should have modified password of the target entry
assertEquals( ResultCodeEnum.SUCCESS, response2.getLdapResult().getResultCode() );
assertFalse( monitor2.isCanceled() );
assertFalse( monitor2.errorsReported() );
- Entry entry2 = service.getAdminSession().lookup( new Dn( dn ) );
- assertEquals( "s3cre3t", Strings.utf8ToString( entry2.get( "userPassword" ).getBytes() ) );
+ Entry entry2 = ldapServer.withAdminConnectionAndGet( connection -> connection.lookup( new Dn( dn ) ) );
+ assertNotEquals( password0, Strings.utf8ToString( entry2.get( "userPassword" ).getBytes() ) );
}
- @Ignore
- @Test
- public void testWhoAmIExtendedOperation() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(except = LdapServerType.ApacheDS, reason = "OSGi issue when using WhoAmI extended operation in ApacheDS")
+ public void testWhoAmIExtendedOperation( TestLdapServer ldapServer ) throws Exception
{
LdapApiService ldapApiService = LdapApiServiceFactory.getSingleton();
WhoAmIRequest request = ( WhoAmIRequest ) ldapApiService.getExtendedRequestFactories()
.get( WhoAmIRequest.EXTENSION_OID ).newRequest();
StudioProgressMonitor monitor = getProgressMonitor();
- WhoAmIResponse response = ( WhoAmIResponse ) getConnectionWrapper( monitor ).extended( request, monitor );
+ WhoAmIResponse response = ( WhoAmIResponse ) getConnectionWrapper( monitor, ldapServer ).extended( request,
+ monitor );
assertEquals( ResultCodeEnum.SUCCESS, response.getLdapResult().getResultCode() );
assertFalse( monitor.isCanceled() );
assertFalse( monitor.errorsReported() );
assertTrue( response.isDnAuthzId() );
- assertEquals( "uid=admin,ou=system", response.getDn().toString() );
+ assertEquals( ldapServer.getAdminDn().toLowerCase(), response.getDn().toString().toLowerCase().trim() );
}
/*
@Ignore
@Test
- public void testStartEndTransactionExtendedOperation() throws Exception
+ public void testStartEndTransactionExtendedOperation( TestLdapServer ldapServer ) throws Exception
{
LdapApiService ldapApiService = LdapApiServiceFactory.getSingleton();
@@ -1003,17 +1055,40 @@ public class DirectoryApiConnectionWrapperTest extends AbstractLdapTestUnit
}
- protected ConnectionWrapper getConnectionWrapper( StudioProgressMonitor monitor )
+ protected ConnectionWrapper getConnectionWrapper( StudioProgressMonitor monitor, TestLdapServer ldapServer,
+ String dn, String password )
{
- return getConnectionWrapper( monitor, "uid=admin,ou=system", "secret" );
+ // simple auth without principal and credential
+ ConnectionParameter connectionParameter = new ConnectionParameter( null, ldapServer.getHost(),
+ ldapServer.getPort(), EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, dn, password, null, false, null,
+ 30000L );
+
+ Connection connection = new Connection( connectionParameter );
+
+ connectionWrapper = connection.getConnectionWrapper();
+ connectionWrapper.connect( monitor );
+ connectionWrapper.bind( monitor );
+
+ assertTrue( connectionWrapper.isConnected() );
+
+ IReferralHandler referralHandler = referralUrls -> {
+ return connection;
+ };
+ ConnectionCorePlugin.getDefault().setReferralHandler( referralHandler );
+
+ assertTrue( connectionWrapper.isConnected() );
+ assertNull( monitor.getException() );
+
+ return connectionWrapper;
}
- protected ConnectionWrapper getConnectionWrapper( StudioProgressMonitor monitor, String dn, String password )
+ protected ConnectionWrapper getConnectionWrapper( StudioProgressMonitor monitor, TestLdapServer ldapServer )
{
// simple auth without principal and credential
- ConnectionParameter connectionParameter = new ConnectionParameter( null, LOCALHOST, ldapServer.getPort(),
- EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, dn, password, null, false, null, 30000L );
+ ConnectionParameter connectionParameter = new ConnectionParameter( null, ldapServer.getHost(),
+ ldapServer.getPort(), EncryptionMethod.NONE, AuthenticationMethod.SIMPLE, ldapServer.getAdminDn(),
+ ldapServer.getAdminPassword(), null, false, null, 30000L );
Connection connection = new Connection( connectionParameter );
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java
index a77980411..ed2c87241 100644
--- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/SchemaTest.java
@@ -21,20 +21,15 @@
package org.apache.directory.studio.test.integration.core;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Collection;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.ObjectClass;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.core.integ.FrameworkRunner;
import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
/**
@@ -42,10 +37,7 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(FrameworkRunner.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
-public class SchemaTest extends AbstractLdapTestUnit
+public class SchemaTest
{
/**
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java
new file mode 100644
index 000000000..d9f94e5da
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/ApacheDirectoryServer.java
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+import static org.apache.directory.studio.test.integration.junit5.Constants.LOCALHOST;
+
+import java.io.File;
+
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.partition.Partition;
+import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
+import org.apache.directory.server.core.security.CertificateUtil;
+import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.ldap.handlers.extended.PwdModifyHandler;
+import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
+import org.apache.directory.server.ldap.handlers.extended.WhoAmIHandler;
+import org.apache.directory.server.protocol.shared.transport.TcpTransport;
+import org.apache.directory.server.protocol.shared.transport.Transport;
+import org.apache.mina.util.AvailablePortFinder;
+
+
+/**
+ * An ApacheDS implementation of a test LDAP server.
+ *
+ * This implementation starts an embedded ApacheDS and adds a partition dc=example,dc=org.
+ */
+public class ApacheDirectoryServer extends TestLdapServer
+{
+
+ private static ApacheDirectoryServer instance;
+
+ private DirectoryService service;
+ private LdapServer server;
+ private String defaultKeyStoreFile;
+
+ public static synchronized ApacheDirectoryServer getInstance()
+ {
+ if ( instance == null )
+ {
+ int port = AvailablePortFinder.getNextAvailable( 1024 );
+ int portSSL = AvailablePortFinder.getNextAvailable( port + 1 );
+ instance = new ApacheDirectoryServer( port, portSSL );
+ instance.startServer();
+ }
+ return instance;
+ }
+
+
+ private void startServer()
+ {
+ try
+ {
+ DefaultDirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
+ factory.init( "test" );
+ service = factory.getDirectoryService();
+ Partition partition = factory.getPartitionFactory().createPartition( service.getSchemaManager(),
+ service.getDnFactory(), "example.org", "dc=example,dc=org", 1024,
+ new File( service.getInstanceLayout().getPartitionsDirectory(), "example.org" ) );
+ partition.initialize();
+ service.addPartition( partition );
+ service.getSchemaManager().enable( "nis", "krb5kdc" );
+
+ server = new LdapServer();
+ server.setDirectoryService( service );
+ Transport ldap = new TcpTransport( port );
+ server.addTransports( ldap );
+ Transport ldaps = new TcpTransport( portSSL );
+ ldaps.setEnableSSL( true );
+ server.addTransports( ldaps );
+ server.addExtendedOperationHandler( new StartTlsHandler() );
+ server.addExtendedOperationHandler( new PwdModifyHandler() );
+ server.addExtendedOperationHandler( new WhoAmIHandler() );
+
+ defaultKeyStoreFile = CertificateUtil.createTempKeyStore( "testStore", "changeit".toCharArray() )
+ .getAbsolutePath();
+ server.setKeystoreFile( defaultKeyStoreFile );
+ server.setCertificatePassword( "changeit" );
+
+ server.start();
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+
+
+ @Override
+ public void prepare()
+ {
+ super.prepare();
+
+ try
+ {
+ if ( !defaultKeyStoreFile.equals( server.getKeystoreFile() ) )
+ {
+ server.setKeystoreFile( defaultKeyStoreFile );
+ server.reloadSslContext();
+ }
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+
+
+ public void setKeystore( String keystorePath ) throws Exception
+ {
+ server.setKeystoreFile( keystorePath );
+ server.reloadSslContext();
+ }
+
+
+ public DirectoryService getService()
+ {
+ return service;
+ }
+
+
+ private ApacheDirectoryServer( int port, int portSSL )
+ {
+ super( LdapServerType.ApacheDS, LOCALHOST, port, portSSL, "uid=admin,ou=system", "secret" );
+ }
+
+}
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/Constants.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/Constants.java
index d7b4332cb..6c7e879a7 100644
--- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/Constants.java
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/Constants.java
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.core;
+package org.apache.directory.studio.test.integration.junit5;
import org.apache.directory.api.util.Network;
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/Fedora389dsLdapServer.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/Fedora389dsLdapServer.java
new file mode 100644
index 000000000..b856ee563
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/Fedora389dsLdapServer.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+import static org.apache.directory.studio.test.integration.junit5.Constants.LOCALHOST;
+
+
+/**
+ * An 389ds implementation of a test LDAP server.
+ *
+ * This implementation expects that an existing 389ds server is running
+ * and connection parameters are provided via environment variables.
+ */
+public class Fedora389dsLdapServer extends TestLdapServer
+{
+ private static final String FEDORA_389DS_HOST = getEnvOrDefault( "FEDORA_389DS_HOST", LOCALHOST );
+ private static final int FEDORA_389DS_PORT = Integer.parseInt( getEnvOrDefault( "FEDORA_389DS_PORT", "21389" ) );
+ private static final int FEDORA_389DS_PORT_SSL = Integer
+ .parseInt( getEnvOrDefault( "FEDORA_389DS_PORT_SSL", "21636" ) );
+ private static final String FEDORA_389DS_ADMIN_DN = getEnvOrDefault( "FEDORA_389DS_ADMIN_DN",
+ "cn=Directory Manager" );
+ private static final String FEDORA_389DS_ADMIN_PASSWORD = getEnvOrDefault( "FEDORA_389DS_ADMIN_PASSWORD", "admin" );
+
+ public static Fedora389dsLdapServer getInstance()
+ {
+ return new Fedora389dsLdapServer();
+ }
+
+
+ private Fedora389dsLdapServer()
+ {
+ super( LdapServerType.Fedora389ds, FEDORA_389DS_HOST, FEDORA_389DS_PORT, FEDORA_389DS_PORT_SSL,
+ FEDORA_389DS_ADMIN_DN, FEDORA_389DS_ADMIN_PASSWORD );
+ }
+
+}
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServerType.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServerType.java
new file mode 100644
index 000000000..0ffe045b4
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServerType.java
@@ -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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+public enum LdapServerType
+{
+ ApacheDS,
+ OpenLdap,
+ Fedora389ds,
+ ;
+
+ public TestLdapServer getLdapServer()
+ {
+ switch ( this )
+ {
+ case ApacheDS:
+ return ApacheDirectoryServer.getInstance();
+ case OpenLdap:
+ return OpenLdapServer.getInstance();
+ case Fedora389ds:
+ return Fedora389dsLdapServer.getInstance();
+ default:
+ throw new IllegalArgumentException( "Unknown LDAP server type " + this );
+ }
+ }
+}
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServersArgumentsProvider.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServersArgumentsProvider.java
new file mode 100644
index 000000000..2ffb5cdb4
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServersArgumentsProvider.java
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.ArgumentsProvider;
+
+
+public class LdapServersArgumentsProvider implements ArgumentsProvider
+{
+
+ @Override
+ public Stream<Arguments> provideArguments( ExtensionContext context ) throws Exception
+ {
+ // Determine possible server types by checking only/except annotation attributes
+ LdapServersSource annotation = context.getTestMethod().get().getAnnotation( LdapServersSource.class );
+ List<LdapServerType> types = new ArrayList<>();
+ types.addAll( Arrays.asList( annotation.only() ) );
+ if ( types.isEmpty() )
+ {
+ types.addAll( Arrays.asList( LdapServerType.values() ) );
+ }
+ types.removeAll( Arrays.asList( annotation.except() ) );
+
+ // Filter available server types
+ List<LdapServerType> available = types.stream().filter( type -> type.getLdapServer().isAvailable() )
+ .collect( Collectors.toList() );
+
+ if ( !available.isEmpty() )
+ {
+ // Pick a random one
+ if ( annotation.mode() == Mode.One )
+ {
+ available = Collections.singletonList( available.get( new Random().nextInt( available.size() ) ) );
+ }
+
+ // Prepare the available servers
+ for ( LdapServerType type : available )
+ {
+ try
+ {
+ type.getLdapServer().prepare();
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Prepare failed for LDAP server type " + type, e );
+ }
+ }
+
+ // Return the available/picked servers
+ return available.stream().map( LdapServerType::getLdapServer ).map( Arguments::of );
+ }
+ else
+ {
+ // Return all types even if not available, will be skipped in SkipTestIfLdapServerIsNotAvailableInterceptor
+ return types.stream().map( LdapServerType::getLdapServer ).map( Arguments::of );
+ }
+
+ }
+
+}
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServersSource.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServersSource.java
new file mode 100644
index 000000000..1261137ec
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/LdapServersSource.java
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.junit.jupiter.params.provider.ArgumentsSource;
+
+
+@Documented
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@ArgumentsSource(LdapServersArgumentsProvider.class)
+public @interface LdapServersSource
+{
+ Mode mode() default Mode.One;
+
+
+ LdapServerType[] only() default
+ {};
+
+
+ LdapServerType[] except() default
+ {};
+
+
+ String reason() default "";
+
+ enum Mode
+ {
+ One, All;
+ }
+}
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/OpenLdapServer.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/OpenLdapServer.java
new file mode 100644
index 000000000..23c64951a
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/OpenLdapServer.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+import static org.apache.directory.studio.test.integration.junit5.Constants.LOCALHOST;
+
+import org.apache.directory.api.ldap.model.entry.Modification;
+import org.apache.directory.api.ldap.model.ldif.LdifEntry;
+import org.apache.directory.api.ldap.model.ldif.LdifReader;
+import org.apache.directory.ldap.client.api.LdapNetworkConnection;
+
+
+/**
+ * An OpenLDAP implementation of a test LDAP server.
+ *
+ * This implementation expects that an existing OpenLDAP server is running
+ * and connection parameters are provided via environment variables.
+ */
+public class OpenLdapServer extends TestLdapServer
+{
+ private static final String OPENLDAP_HOST = getEnvOrDefault( "OPENLDAP_HOST", LOCALHOST );
+ private static final int OPENLDAP_PORT = Integer.parseInt( getEnvOrDefault( "OPENLDAP_PORT", "20389" ) );
+ private static final int OPENLDAP_PORT_SSL = Integer.parseInt( getEnvOrDefault( "OPENLDAP_PORT_SSL", "20636" ) );
+ private static final String OPENLDAP_ADMIN_DN = getEnvOrDefault( "OPENLDAP_ADMIN_DN",
+ "cn=admin,dc=example,dc=org" );
+ private static final String OPENLDAP_ADMIN_PASSWORD = getEnvOrDefault( "OPENLDAP_ADMIN_PASSWORD", "admin" );
+ private static final String OPENLDAP_CONFIG_DN = getEnvOrDefault( "OPENLDAP_CONFIG_DN", "cn=admin,cn=config" );
+ private static final String OPENLDAP_CONFIG_PASSWORD = getEnvOrDefault( "OPENLDAP_CONFIG_PASSWORD", "config" );
+
+ public static OpenLdapServer getInstance()
+ {
+ return new OpenLdapServer();
+ }
+
+
+ private OpenLdapServer()
+ {
+ super( LdapServerType.OpenLdap, OPENLDAP_HOST, OPENLDAP_PORT, OPENLDAP_PORT_SSL, OPENLDAP_ADMIN_DN,
+ OPENLDAP_ADMIN_PASSWORD );
+ }
+
+
+ public void prepare()
+ {
+ super.prepare();
+
+ try ( LdapNetworkConnection connection = new LdapNetworkConnection( OPENLDAP_HOST, OPENLDAP_PORT );
+ LdifReader ldifReader = new LdifReader( TestFixture.class.getResourceAsStream( "OpenLdapConfig.ldif" ) ) )
+ {
+ connection.bind( OPENLDAP_CONFIG_DN, OPENLDAP_CONFIG_PASSWORD );
+ for ( LdifEntry entry : ldifReader )
+ {
+ for ( Modification modification : entry.getModifications() )
+ {
+ connection.modify( entry.getDn(), modification );
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Unexpected exception: " + e, e );
+ }
+ }
+
+}
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/SkipTestIfLdapServerIsNotAvailableInterceptor.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/SkipTestIfLdapServerIsNotAvailableInterceptor.java
new file mode 100644
index 000000000..95fe2f911
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/SkipTestIfLdapServerIsNotAvailableInterceptor.java
@@ -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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+import java.lang.reflect.Method;
+
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.InvocationInterceptor;
+import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
+
+
+public class SkipTestIfLdapServerIsNotAvailableInterceptor implements InvocationInterceptor
+{
+
+ @Override
+ public void interceptTestTemplateMethod( Invocation<Void> invocation,
+ ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext ) throws Throwable
+ {
+ invocationContext.getArguments().stream()
+ .filter( TestLdapServer.class::isInstance )
+ .map( TestLdapServer.class::cast )
+ .forEach( server -> {
+ if ( !server.isAvailable() )
+ {
+ invocation.skip();
+ Assumptions.assumeTrue( false,
+ "Skip test because server " + server.getType() + " is not available" );
+ }
+ } );
+ invocation.proceed();
+ }
+
+}
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
new file mode 100644
index 000000000..879a894c9
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestFixture.java
@@ -0,0 +1,246 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.directory.api.ldap.model.cursor.EntryCursor;
+import org.apache.directory.api.ldap.model.cursor.SearchCursor;
+import org.apache.directory.api.ldap.model.entry.Attribute;
+import org.apache.directory.api.ldap.model.entry.DefaultEntry;
+import org.apache.directory.api.ldap.model.entry.Entry;
+import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
+import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.api.ldap.model.ldif.LdifEntry;
+import org.apache.directory.api.ldap.model.ldif.LdifReader;
+import org.apache.directory.api.ldap.model.message.AliasDerefMode;
+import org.apache.directory.api.ldap.model.message.Control;
+import org.apache.directory.api.ldap.model.message.DeleteRequest;
+import org.apache.directory.api.ldap.model.message.DeleteRequestImpl;
+import org.apache.directory.api.ldap.model.message.SearchRequest;
+import org.apache.directory.api.ldap.model.message.SearchRequestImpl;
+import org.apache.directory.api.ldap.model.message.SearchScope;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.name.Rdn;
+import org.apache.directory.api.ldap.model.schema.comparators.DnComparator;
+import org.apache.directory.ldap.client.api.EntryCursorImpl;
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.studio.connection.core.Controls;
+
+
+/**
+ * A unified test fixture that defines the DIT structure for all tests and for all test LDAP servers.
+ */
+public class TestFixture
+{
+
+ public static Dn dn( String dn )
+ {
+ try
+ {
+ return new Dn( dn );
+ }
+ catch ( LdapInvalidDnException e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+
+
+ public static Dn dn( Rdn rdn, Dn dn )
+ {
+ try
+ {
+ return dn.add( rdn );
+ }
+ catch ( LdapInvalidDnException e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+
+
+ public static Dn dn( String rdn, Dn dn )
+ {
+ try
+ {
+ return dn.add( rdn );
+ }
+ catch ( LdapInvalidDnException e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+
+ public static final String OBJECT_CLASS_ALL_FILTER = "(objectClass=*)";
+
+ public static final String TEST_FIXTURE_LDIF = "TestFixture.ldif";
+
+ public static final Dn CONTEXT_DN = dn( "dc=example,dc=org" );
+
+ public static final Dn MISC_DN = dn( "ou=misc", CONTEXT_DN );
+ public static final Dn MISC1_DN = dn( "ou=misc.1", MISC_DN );
+ public static final Dn MISC11_DN = dn( "ou=misc.1.1", MISC1_DN );
+ public static final Dn MISC111_DN = dn( "ou=misc.1.1.1", MISC11_DN );
+ public static final Dn BJENSEN_DN = dn( "cn=Barbara Jensen", MISC_DN );
+ public static final Dn HNELSON_DN = dn( "uid=hnelson", MISC_DN );
+ public static final Dn GERMAN_UMLAUT_DN = dn( "cn=Wolfgang K\u00f6lbel", MISC_DN );
+ public static final Dn MULTI_VALUED_RDN_DN = dn( "cn=Barbara Jensen+uid=bjensen", MISC_DN );
+ public static final Dn DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED = dn( "cn=\\#123456", MISC_DN );
+ public static final Dn DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED = dn( "cn=\\23123456", MISC_DN );
+ public static final Dn DN_WITH_ESCAPED_CHARACTERS_BACKSLASH_PREFIXED = dn( "cn=\\\"\\+\\,\\;\\<\\>\\\\", MISC_DN );
+ public static final Dn DN_WITH_ESCAPED_CHARACTERS_HEX_PAIR_ESCAPED = dn( "cn=\\22\\2B\\2C\\3B\\3C\\3E\\5C",
+ MISC_DN );
+ public static final Dn DN_WITH_TRAILING_EQUALS_CHARACTER = dn( "cn=trailing=", MISC_DN );
+ public static final Dn DN_WITH_TRAILING_EQUALS_CHARACTER_HEX_PAIR_ESCAPED = dn( "cn=trailing\\3D", MISC_DN );
+ public static final Dn DN_WITH_IP_HOST_NUMBER = dn( "cn=loopback+ipHostNumber=127.0.0.1", MISC_DN );
+ public static final Dn ALIAS_DN = dn( "cn=alias", MISC_DN );
+ public static final Dn SUBENTRY_DN = dn( "cn=subentry", MISC_DN );
+
+ public static final Dn USERS_DN = dn( "ou=users", CONTEXT_DN );
+ public static final Dn USER1_DN = dn( "uid=user.1", USERS_DN );
+ public static final Dn USER2_DN = dn( "uid=user.2", USERS_DN );
+ public static final Dn USER3_DN = dn( "uid=user.3", USERS_DN );
+ public static final Dn USER8_DN = dn( "uid=user.8", USERS_DN );
+
+ public static final Dn GROUPS_DN = dn( "ou=groups", CONTEXT_DN );
+ public static final Dn GROUP1_DN = dn( "cn=group.1", GROUPS_DN );
+
+ public static final Dn TARGET_DN = dn( "ou=target", CONTEXT_DN );
+
+ public static final Dn REFERRALS_DN = dn( "ou=referrals", CONTEXT_DN );
+ public static final Dn REFERRAL_TO_USERS_DN = dn( "cn=referral-to-users", REFERRALS_DN );
+ public static final Dn REFERRAL_TO_USER1_DN = dn( "cn=referral-to-user.1", REFERRALS_DN );
+ public static final Dn REFERRAL_TO_REFERRAL_TO_USERS_DN = dn( "cn=referral-to-referral-to-users", REFERRALS_DN );
+ public static final Dn REFERRAL_TO_REFERRALS_DN = dn( "cn=referral-to-referrals", REFERRALS_DN );
+ public static final Dn REFERRAL_LOOP_1_DN = dn( "cn=referral-loop-1", REFERRALS_DN );
+ public static final Dn REFERRAL_LOOP_2_DN = dn( "cn=referral-loop-2", REFERRALS_DN );
+ public static final Dn REFERRAL_TO_MISC_DN = dn( "cn=referral-to-misc", REFERRALS_DN );
+
+ /**
+ * Creates the context entry "dc=example,dc=org" if it doesn't exist yet.
+ */
+ public static void createContextEntry( TestLdapServer ldapServer )
+ {
+ ldapServer.withAdminConnection( connection -> {
+ if ( !connection.exists( CONTEXT_DN ) )
+ {
+ connection.add(
+ new DefaultEntry( CONTEXT_DN, "objectClass", "top", "objectClass", "domain", "dc", "example" ) );
+ }
+ } );
+ }
+
+
+ public static void importData( TestLdapServer ldapServer )
+ {
+ ldapServer.withAdminConnection( connection -> {
+ try ( LdifReader ldifReader = new LdifReader( TestFixture.class.getResourceAsStream( TEST_FIXTURE_LDIF ) ) )
+ {
+ ldifReader.setSchemaManager( connection.getSchemaManager() );
+ for ( LdifEntry entry : ldifReader )
+ {
+ replaceRefLdapUrl( ldapServer, entry );
+ connection.add( entry.getEntry() );
+ }
+ }
+ } );
+ }
+
+
+ private static void replaceRefLdapUrl( TestLdapServer ldapServer, LdifEntry entry )
+ throws LdapInvalidAttributeValueException
+ {
+ Attribute ref = entry.get( "ref" );
+ if ( ref != null )
+ {
+ String oldRefLdapUrl = ref.getString();
+ String newRefLdapUrl = oldRefLdapUrl.replace( "replace-with-host-port",
+ ldapServer.getHost() + ":" + ldapServer.getPort() );
+ ref.remove( oldRefLdapUrl );
+ ref.add( newRefLdapUrl );
+ }
+ }
+
+
+ /**
+ * Cleans all test data.
+ */
+ public static void cleanup( TestLdapServer ldapServer )
+ {
+ ldapServer.withAdminConnection( connection -> {
+ // skip cleanup if context entry doesn't exist yet
+ if ( !connection.exists( CONTEXT_DN ) )
+ {
+ return;
+ }
+
+ // delete ou=referrals
+ deleteTree( connection, REFERRALS_DN, Optional.empty() );
+ // delete ou=groups
+ deleteTree( connection, GROUPS_DN, Optional.empty() );
+ // delete ou=users
+ deleteTree( connection, USERS_DN, Optional.empty() );
+ // delete ou=misc
+ deleteTree( connection, MISC_DN, Optional.of( Controls.SUBENTRIES_CONTROL ) );
+ deleteTree( connection, MISC_DN, Optional.empty() );
+ // delete ou=target
+ deleteTree( connection, TARGET_DN, Optional.of( Controls.SUBENTRIES_CONTROL ) );
+ deleteTree( connection, TARGET_DN, Optional.empty() );
+ } );
+ }
+
+
+ private static void deleteTree( LdapConnection connection, Dn baseDn, Optional<Control> control )
+ throws Exception
+ {
+ SearchRequest searchRequest = new SearchRequestImpl();
+ searchRequest.setBase( baseDn );
+ searchRequest.setFilter( OBJECT_CLASS_ALL_FILTER );
+ searchRequest.setScope( SearchScope.SUBTREE );
+ searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
+ searchRequest.addControl( Controls.MANAGEDSAIT_CONTROL );
+ control.ifPresent( c -> searchRequest.addControl( c ) );
+
+ try ( SearchCursor searchCursor = connection.search( searchRequest );
+ EntryCursor entryCursor = new EntryCursorImpl( searchCursor ) )
+ {
+ List<Dn> dns = new ArrayList<>();
+ for ( Entry entry : entryCursor )
+ {
+ dns.add( entry.getDn() );
+ }
+ dns.sort( new DnComparator( "1.1" ) );
+ for ( Dn dn : dns )
+ {
+ DeleteRequest deleteRequest = new DeleteRequestImpl();
+ deleteRequest.setName( dn );
+ deleteRequest.addControl( Controls.MANAGEDSAIT_CONTROL );
+ control.ifPresent( c -> deleteRequest.addControl( c ) );
+ connection.delete( deleteRequest );
+ }
+ }
+ }
+
+}
diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestLdapServer.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestLdapServer.java
new file mode 100644
index 000000000..9caa587f3
--- /dev/null
+++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/junit5/TestLdapServer.java
@@ -0,0 +1,208 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.directory.studio.test.integration.junit5;
+
+
+import org.apache.directory.api.ldap.model.exception.LdapAuthenticationException;
+import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.ldif.LdifEntry;
+import org.apache.directory.api.ldap.model.ldif.LdifReader;
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.LdapNetworkConnection;
+import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
+
+
+/**
+ * An abstraction around an LDAP server that can be used for testing.
+ * Provides the LDAP server type and connection parameters.
+ */
+public abstract class TestLdapServer
+{
+ public static String getEnvOrDefault( String key, String defaultValue )
+ {
+ return System.getenv().getOrDefault( key, defaultValue );
+ }
+
+ protected final LdapServerType type;
+ protected final String host;
+ protected final int port;
+ protected final int portSSL;
+ protected final String adminDn;
+ protected final String adminPassword;
+
+ protected TestLdapServer( LdapServerType type, String host, int port, int portSSL, String adminDn,
+ String adminPassword )
+ {
+ this.type = type;
+ this.host = host;
+ this.port = port;
+ this.portSSL = portSSL;
+ this.adminDn = adminDn;
+ this.adminPassword = adminPassword;
+ }
+
+
+ public boolean isAvailable()
+ {
+ try ( LdapConnection connection = openAdminConnection() )
+ {
+ }
+ catch ( InvalidConnectionException e )
+ {
+ return false;
+ }
+ catch ( LdapAuthenticationException e )
+ {
+ return false;
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Unexpected exception: " + e, e );
+ }
+ return true;
+ }
+
+
+ public LdapConnection openAdminConnection() throws LdapException
+ {
+ LdapConnection connection = new LdapNetworkConnection( host, port );
+ connection.connect();
+ connection.bind( adminDn, adminPassword );
+ return connection;
+ }
+
+
+ public void withAdminConnection( LdapConnectionConsumer consumer )
+ {
+ try ( LdapConnection connection = openAdminConnection() )
+ {
+ consumer.accept( connection );
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Unexpected exception: " + e, e );
+ }
+ }
+
+ public static interface LdapConnectionConsumer
+ {
+ void accept( LdapConnection connection ) throws Exception;
+ }
+
+ public <T> T withAdminConnectionAndGet( LdapConnectionFunction<T> function )
+ {
+ try ( LdapConnection connection = openAdminConnection() )
+ {
+ return function.apply( connection );
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Unexpected exception: " + e, e );
+ }
+ }
+
+ public static interface LdapConnectionFunction<T>
+ {
+ T apply( LdapConnection connection ) throws Exception;
+ }
+
+ public void prepare()
+ {
+ TestFixture.createContextEntry( this );
+ TestFixture.cleanup( this );
+ TestFixture.importData( this );
+
+ String serverSpecificLdif = getType().name() + ".ldif";
+ if ( TestFixture.class.getResource( serverSpecificLdif ) != null )
+ {
+ withAdminConnection( connection -> {
+ try ( LdifReader ldifReader = new LdifReader(
+ TestFixture.class.getResourceAsStream( serverSpecificLdif ) ) )
+ {
+ for ( LdifEntry entry : ldifReader )
+ {
+ if ( entry.isChangeModify() )
+ {
+ connection.modify( entry.getDn(), entry.getModificationArray() );
+ }
+ if ( entry.isChangeAdd() )
+ {
+ connection.add( entry.getEntry() );
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Unexpected exception: " + e, e );
+ }
+ } );
+ }
+ }
+
+
+ public LdapServerType getType()
+ {
+ return type;
+ }
+
+
+ public String getHost()
+ {
+ return host;
+ }
+
+
+ public int getPort()
+ {
+ return port;
+ }
+
+
+ public int getPortSSL()
+ {
+ return portSSL;
+ }
+
+
+ public String getLdapUrl()
+ {
+ return "ldap://" + host + ":" + port;
+ }
+
+
+ public String getAdminDn()
+ {
+ return adminDn;
+ }
+
+
+ public String getAdminPassword()
+ {
+ return adminPassword;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return type.name();
+ }
+}
diff --git a/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif
new file mode 100644
index 000000000..e96163d61
--- /dev/null
+++ b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/ApacheDS.ldif
@@ -0,0 +1,61 @@
+# 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.
+#
+
+dn: ou=misc,dc=example,dc=org
+changetype: modify
+add: administrativeRole
+administrativeRole: accessControlSpecificArea
+-
+
+dn: ou=target,dc=example,dc=org
+changetype: modify
+add: administrativeRole
+administrativeRole: accessControlSpecificArea
+-
+
+dn: cn=subentry,ou=misc,dc=example,dc=org
+changetype: add
+objectClass: top
+objectClass: subentry
+cn: subentry
+subtreeSpecification: {}
+
+dn: uid=hnelson,ou=misc,dc=example,dc=org
+changetype: modify
+add: subtreeSpecification
+subtreeSpecification: {}
+-
+add: entryACI
+entryACI: { identificationTag "test", precedence 1, authenticationLevel none,
+ itemOrUserFirst userFirst: { userClasses { subtree { { base "dc=example,dc=co
+ m", minimum 1, maximum 2, specificExclusions { chopBefore: "dc=example,dc=com
+ " } } }, allUsers, userGroup { "dc=example,dc=com" } }, userPermissions { { p
+ recedence 2, protectedItems { allUserAttributeTypes, attributeValue {userpass
+ word=* }, maxImmSub 2, entry, maxValueCount {{ type userPassword, maxCount 2
+ }} }, grantsAndDenials { denyRemove, grantReturnDN, denyModify, denyAdd, deny
+ Rename, grantFilterMatch, grantBrowse, grantRead, grantCompare } } } } }
+-
+add: prescriptiveACI
+prescriptiveACI: { identificationTag "allUsersACI", precedence 10, authenticat
+ ionLevel simple, itemOrUserFirst userFirst: { userClasses { allUsers }, userP
+ ermissions { { protectedItems { allUserAttributeTypesAndValues, entry }, gran
+ tsAndDenials { grantReturnDN, grantCompare, grantRead, grantDiscloseOnError,
+ grantFilterMatch, grantBrowse } }, { protectedItems { attributeType { userPas
+ sword } }, grantsAndDenials { denyCompare, denyRead, denyFilterMatch } } } }
+ }
+-
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/OpenLdapConfig.ldif b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/OpenLdapConfig.ldif
index f28f33888..f28f33888 100644
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/OpenLdapConfig.ldif
+++ b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/OpenLdapConfig.ldif
diff --git a/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif
new file mode 100644
index 000000000..8b18c6dc2
--- /dev/null
+++ b/tests/test.integration.core/src/main/resources/org/apache/directory/studio/test/integration/junit5/TestFixture.ldif
@@ -0,0 +1,460 @@
+# 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.
+#
+
+#
+# ou=misc
+# Entries for specific test scenarios. Other tests should not rely on the number or structure of this ou.
+# Add here new specific entries for specific test scenarios.
+#
+
+dn: ou=misc,dc=example,dc=org
+objectClass: top
+objectClass: organizationalUnit
+ou: misc
+
+dn: cn=Barbara Jensen,ou=misc,dc=example,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Barbara Jensen
+sn: Jensen
+givenName: Barbara
+uid: bjensen
+
+dn: uid=hnelson,ou=misc,dc=example,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+objectClass: extensibleObject
+cn: Horatio Nelson
+sn: Nelson
+uid: hnelson
+description:: QSDDqSDigqwg0K8gzrsg16kg2Lkg4ruhIA==
+userPassword:: e1NTSEE1MTJ9aUlyTG1uR0MxdTNaTGFPWmRvSjZUMjBKdG9XQ05wWjArWGFLRnN
+ 5bEVEdFpYK3I3bUZrcjRwYTNKMXE3VWpSZ3ZFV2lCd1FNUjZadjBoYnRsYnRqSTQ2TmR6WVRDdG9G
+jpegPhoto:: /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw
+ 8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRw
+ hMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAB
+ AAEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEA
+ wUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKS
+ o0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqK
+ jpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QA
+ HwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEB
+ SExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSE
+ lKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba
+ 3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD3+iii
+ gD//2Q==
+userSMIMECertificate:: AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJyg
+ pKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFi
+ Y2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbn
+ J2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1d
+ bX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==
+userSMIMECertificate:: AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJyg
+ pKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFi
+ Y2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbn
+ J2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1d
+ bX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/wA=
+userSMIMECertificate:: AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJyg
+ pKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFi
+ Y2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbn
+ J2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1d
+ bX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+
+
+dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT1taXNjLGRjPWV4YW1wbGUsZGM9b3Jn
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+objectClass: top
+cn:: V29sZmdhbmcgS8O2bGJlbA==
+sn:: S8O2bGJlbA==
+description: =1+1
+
+# Multi-valued RDN
+dn: cn=Barbara Jensen+uid=bjensen,ou=misc,dc=example,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Barbara Jensen
+sn: Jensen
+givenName: Barbara
+uid: bjensen
+
+# DN with escaped characters: '"', '+', ',', ';', '<', '>', or '\'
+dn: cn=\"\+\,\;\<\>\\,ou=misc,dc=example,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: "+,;<>\
+sn: "+,;<>\
+
+# DN with leading sharp/hash/pound/number sign
+dn: cn=\#123456,ou=misc,dc=example,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: #123456
+sn: #123456
+givenName: #123456
+uid: #123456
+
+# DN with trailing equals character =
+dn: cn=trailing=,ou=misc,dc=example,dc=org
+objectClass: top
+objectClass: person
+cn: trailing=
+sn: trailing=
+
+# Multi-valued RDN with IP address
+dn: cn=loopback+ipHostNumber=127.0.0.1,ou=misc,dc=example,dc=org
+objectClass: top
+objectClass: device
+objectClass: ipHost
+cn: loopback
+ipHostNumber: 127.0.0.1
+
+dn: ou=misc.1,ou=misc,dc=example,dc=org
+objectClass: top
+objectClass: organizationalUnit
+ou: misc.1
+
+dn: cn=alias,ou=misc,dc=example,dc=org
+objectClass: alias
+objectClass: top
+objectClass: extensibleObject
+cn: alias
+aliasedObjectName: ou=misc,dc=example,dc=org
+
+dn: ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
+objectClass: top
+objectClass: organizationalUnit
+ou: misc.1.1
+
+dn: ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
+objectClass: top
+objectClass: organizationalUnit
+ou: misc.1.1.1
+
+
+#
+# ou=users
+# Fixed number of users used by severals search tests that expect a fixed entry set.
+# Avoid add or modify those entries if not required as many tests need to be adjusted otherwise.
+#
+
+dn: ou=users,dc=example,dc=org
+objectClass: top
+objectClass: organizationalUnit
+ou: users
+
+dn: uid=user.1,ou=users,dc=example,dc=org
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aaccf
+sn: Amar
+cn: Aaccf Amar
+initials: AA
+uid: user.1
+mail: user.1@null
+userPassword: password
+telephoneNumber: 976-893-3312
+homePhone: 337-310-0727
+pager: 185-156-4071
+mobile: 626-188-0934
+employeeNumber: 1
+street: 27919 Broadway Street
+l: Tallahassee
+st: DE
+postalCode: 67698
+postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE 67698
+description: This is the description for Aaccf Amar.
+roomNumber: 1388
+
+dn: uid=user.2,ou=users,dc=example,dc=org
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aaren
+sn: Atp
+cn: Aaren Atp
+initials: AA
+uid: user.2
+mail: user.2@null
+userPassword: password
+telephoneNumber: 147-953-0396
+homePhone: 174-439-5329
+pager: 617-443-8449
+mobile: 045-464-2512
+employeeNumber: 2
+street: 36109 Center Street
+l: Harlingen
+st: CO
+postalCode: 21733
+postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO 21733
+description: This is the description for Aaren Atp.
+roomNumber: 1198
+
+dn: uid=user.3,ou=users,dc=example,dc=org
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aarika
+sn: Atpco
+cn: Aarika Atpco
+initials: AA
+uid: user.3
+mail: user.3@null
+userPassword: password
+telephoneNumber: 925-356-4943
+homePhone: 099-983-0308
+pager: 806-672-7363
+mobile: 425-493-8009
+employeeNumber: 3
+street: 14730 Fourteenth Street
+l: Evansville
+st: ND
+postalCode: 95526
+postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND 95526
+description: This is the description for Aarika Atpco.
+roomNumber: 1135
+
+dn: uid=user.4,ou=users,dc=example,dc=org
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aaron
+sn: Atrc
+cn: Aaron Atrc
+initials: AA
+uid: user.4
+mail: user.4@null
+userPassword: password
+telephoneNumber: 696-981-0488
+homePhone: 854-401-1330
+pager: 389-028-9518
+mobile: 117-882-4912
+employeeNumber: 4
+street: 98495 Fifteenth Street
+l: Miami
+st: PA
+postalCode: 16887
+postalAddress: Aaron Atrc$98495 Fifteenth Street$Miami, PA 16887
+description: This is the description for Aaron Atrc.
+roomNumber: 1311
+
+dn: uid=user.5,ou=users,dc=example,dc=org
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Aartjan
+sn: Aalders
+cn: Aartjan Aalders
+initials: AA
+uid: user.5
+mail: user.5@null
+userPassword: password
+telephoneNumber: 657-627-9753
+homePhone: 109-158-4533
+pager: 801-392-0010
+mobile: 763-973-0947
+employeeNumber: 5
+street: 52408 Ridge Street
+l: Omaha
+st: AR
+postalCode: 08015
+postalAddress: Aartjan Aalders$52408 Ridge Street$Omaha, AR 08015
+description: This is the description for Aartjan Aalders.
+roomNumber: 1090
+
+dn: uid=user.6,ou=users,dc=example,dc=org
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Abagael
+sn: Aasen
+cn: Abagael Aasen
+initials: AA
+uid: user.6
+mail: user.6@null
+userPassword: password
+telephoneNumber: 600-556-9017
+homePhone: 543-731-7797
+pager: 349-743-6572
+mobile: 042-921-9717
+employeeNumber: 6
+street: 87514 Dogwood Street
+l: Bloomington
+st: ID
+postalCode: 56762
+postalAddress: Abagael Aasen$87514 Dogwood Street$Bloomington, ID 56762
+description: This is the description for Abagael Aasen.
+roomNumber: 1449
+
+dn: uid=user.7,ou=users,dc=example,dc=org
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Abagail
+sn: Abadines
+cn: Abagail Abadines
+initials: AA
+uid: user.7
+mail: user.7@null
+userPassword: password
+telephoneNumber: 628-294-0713
+homePhone: 313-764-3970
+pager: 118-541-2978
+mobile: 111-360-9243
+employeeNumber: 7
+street: 60751 Main Street
+l: Macon
+st: MI
+postalCode: 38755
+postalAddress: Abagail Abadines$60751 Main Street$Macon, MI 38755
+description: This is the description for Abagail Abadines.
+roomNumber: 1312
+
+dn: uid=user.8,ou=users,dc=example,dc=org
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+givenName: Abahri
+sn: Abazari
+cn: Abahri Abazari
+initials: AA
+uid: user.8
+mail: user.8@null
+userPassword: password
+telephoneNumber: 760-373-5805
+homePhone: 856-861-3648
+pager: 271-218-0027
+mobile: 957-465-6928
+employeeNumber: 8
+street: 81023 River Street
+l: Monroe
+st: SD
+postalCode: 51865
+postalAddress: Abahri Abazari$81023 River Street$Monroe, SD 51865
+description: This is the description for Abahri Abazari.
+roomNumber: 1963
+
+#
+# ou=groups
+# Group entries
+#
+
+dn: ou=groups,dc=example,dc=org
+objectClass: organizationalUnit
+objectClass: top
+ou: groups
+
+dn: cn=group.1,ou=groups,dc=example,dc=org
+objectClass: groupOfNames
+objectClass: top
+cn: group.1
+member: uid=user.1,ou=users,dc=example,dc=org
+member: uid=user.2,ou=users,dc=example,dc=org
+member: uid=user.3,ou=users,dc=example,dc=org
+member: uid=user.4,ou=users,dc=example,dc=org
+member: uid=user.5,ou=users,dc=example,dc=org
+member: uid=user.6,ou=users,dc=example,dc=org
+member: uid=user.7,ou=users,dc=example,dc=org
+member: uid=user.8,ou=users,dc=example,dc=org
+member: cn=\#123456,ou=misc,dc=example,dc=org
+
+#
+# ou=target
+#
+
+dn: ou=target,dc=example,dc=org
+objectClass: organizationalUnit
+objectClass: top
+ou: target
+
+#
+# ou=referrals
+# Entries for referral specific test scenarios.
+#
+
+dn: ou=referrals,dc=example,dc=org
+objectClass: organizationalUnit
+objectClass: top
+ou: referrals
+
+dn: cn=referral-to-user.1,ou=referrals,dc=example,dc=org
+objectClass: top
+objectClass: referral
+objectClass: extensibleObject
+cn: referral-to-user.1
+ref: ldap://replace-with-host-port/uid=user.1,ou=users,dc=example,dc=org
+
+dn: cn=referral-to-users,ou=referrals,dc=example,dc=org
+objectClass: top
+objectClass: referral
+objectClass: extensibleObject
+cn: referral-to-users
+ref: ldap://replace-with-host-port/ou=users,dc=example,dc=org
+
+dn: cn=referral-to-referral-to-users,ou=referrals,dc=example,dc=org
+objectClass: top
+objectClass: referral
+objectClass: extensibleObject
+cn: referral-to-referral-to-users
+ref: ldap://replace-with-host-port/cn=referral-to-users,ou=referrals,dc=example,dc=org
+
+dn: cn=referral-to-referrals,ou=referrals,dc=example,dc=org
+objectClass: top
+objectClass: referral
+objectClass: extensibleObject
+cn: referral-to-referrals
+ref: ldap://replace-with-host-port/ou=referrals,dc=example,dc=org
+
+dn: cn=referral-loop-1,ou=referrals,dc=example,dc=org
+objectClass: top
+objectClass: referral
+objectClass: extensibleObject
+cn: referral-loop-1
+ref: ldap://replace-with-host-port/cn=referral-loop-2,ou=referrals,dc=example,dc=org
+
+dn: cn=referral-loop-2,ou=referrals,dc=example,dc=org
+objectClass: top
+objectClass: referral
+objectClass: extensibleObject
+cn: referral-loop-2
+ref: ldap://replace-with-host-port/cn=referral-loop-1,ou=referrals,dc=example,dc=org
+
+dn: cn=referral-to-misc,ou=referrals,dc=example,dc=org
+objectClass: top
+objectClass: referral
+objectClass: extensibleObject
+cn: referral-to-misc
+ref: ldap://replace-with-host-port/ou=misc,dc=example,dc=org
+
diff --git a/tests/test.integration.ui/pom-first.xml b/tests/test.integration.ui/pom-first.xml
index 907955006..9e9159380 100644
--- a/tests/test.integration.ui/pom-first.xml
+++ b/tests/test.integration.ui/pom-first.xml
@@ -47,12 +47,14 @@
<Eclipse-LazyStart>true</Eclipse-LazyStart>
<Bundle-Activator>org.apache.directory.studio.test.integration.ui.Activator</Bundle-Activator>
- <Require-Bundle>org.junit;bundle-version="4.11.0",
+ <Require-Bundle>org.junit.jupiter.api;bundle-version="5.7.0",
+ org.junit.jupiter.params;bundle-version="5.7.0",
+ org.opentest4j;bundle-version="1.2.0",
org.hamcrest.library;bundle-version="1.3.0",
- org.eclipse.swtbot.eclipse.finder;bundle-version="2.2.1",
- org.eclipse.swtbot.eclipse.core;bundle-version="2.2.1",
- org.eclipse.swtbot.forms.finder;bundle-version="2.2.1",
- org.eclipse.swtbot.junit4_x;bundle-version="2.2.1",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="3.0.0",
+ org.eclipse.swtbot.eclipse.core;bundle-version="3.0.0",
+ org.eclipse.swtbot.forms.finder;bundle-version="3.0.0",
+ org.eclipse.swtbot.junit5_x;bundle-version="3.0.0",
org.apache.directory.server.apacheds-test-framework;bundle-version="${org.apache.directory.server.version}",
org.apache.directory.server.annotations;bundle-version="${org.apache.directory.server.version}",
@@ -100,6 +102,7 @@
org.apache.directory.studio.schemaeditor,
org.apache.directory.studio.schemaeditor.help,
org.apache.directory.studio.valueeditors,
+ org.apache.directory.studio.test.integration.core,
org.eclipse.core.runtime,
org.eclipse.e4.ui.css.swt.theme,
org.eclipse.ui</Require-Bundle>
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java
new file mode 100644
index 000000000..0f77145cc
--- /dev/null
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java
@@ -0,0 +1,121 @@
+package org.apache.directory.studio.test.integration.ui;
+
+
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.CONTEXT_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRALS_DN;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.name.Rdn;
+import org.apache.directory.studio.test.integration.junit5.SkipTestIfLdapServerIsNotAvailableInterceptor;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.ui.bots.ApacheDSServersViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.SearchLogsViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
+import org.apache.directory.studio.test.integration.ui.utils.Assertions;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.junit5.SWTBotJunit5Extension;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+
+@ExtendWith(
+ { SWTBotJunit5Extension.class, SkipTestIfLdapServerIsNotAvailableInterceptor.class })
+public class AbstractTestBase
+{
+
+ protected SWTWorkbenchBot bot;
+ protected StudioBot studioBot;
+ protected ConnectionsViewBot connectionsViewBot;
+ protected BrowserViewBot browserViewBot;
+ protected SearchLogsViewBot searchLogsViewBot;
+ protected ModificationLogsViewBot modificationLogsViewBot;
+ protected ApacheDSServersViewBot serversViewBot;
+
+ @BeforeEach
+ final void setUpBase() throws Exception
+ {
+ bot = new SWTWorkbenchBot();
+ studioBot = new StudioBot();
+ studioBot.resetLdapPerspective();
+ connectionsViewBot = studioBot.getConnectionView();
+ browserViewBot = studioBot.getBrowserView();
+ searchLogsViewBot = studioBot.getSearchLogsViewBot();
+ modificationLogsViewBot = studioBot.getModificationLogsViewBot();
+ serversViewBot = studioBot.getApacheDSServersViewBot();
+ }
+
+
+ @AfterEach
+ final void tearDownBase() throws Exception
+ {
+ connectionsViewBot.deleteTestConnections();
+ serversViewBot.deleteTestServers();
+ Assertions.genericTearDownAssertions();
+ }
+
+ public static final String[] ROOT_DSE_PATH =
+ { "DIT", "Root DSE" };
+ public static final String[] CONTEXT_PATH = path( ROOT_DSE_PATH, CONTEXT_DN.getName() );
+
+ public static String[] path( String[] parents, String leaf )
+ {
+ return ArrayUtils.addAll( parents, leaf );
+ }
+
+
+ /**
+ * Gets the path to the DN in the LDAP browser tree.
+ * The path starts with "DIT", "Root DSE", and the context entry.
+ */
+ public static String[] path( Dn dn )
+ {
+ List<String> l = new ArrayList<>();
+
+ l.addAll( Arrays.asList( CONTEXT_PATH ) );
+
+ List<Rdn> rdns = dn.getRdns();
+ for ( int i = rdns.size() - 3; i >= 0; i-- )
+ {
+ l.add( rdns.get( i ).getName() );
+ }
+
+ return l.toArray( new String[0] );
+ }
+
+
+ /**
+ * Gets the path to the RDN below the DN in the LDAP browser tree.
+ * The path starts with "DIT", "Root DSE", and the context entry.
+ */
+ public static String[] path( Dn dn, Rdn rdn )
+ {
+ return path( dn, rdn.getName() );
+ }
+
+
+ /**
+ * Gets the path to the leaf below the DN in the LDAP browser tree.
+ * The path starts with "DIT", "Root DSE", and the context entry.
+ */
+ public static String[] path( Dn dn, String... leaf )
+ {
+ return ArrayUtils.addAll( path( dn ), leaf );
+ }
+
+
+ public static String[] pathWithRefLdapUrl( TestLdapServer ldapServer, Dn dn )
+ {
+ String leaf = ldapServer.getLdapUrl() + "/" + dn.getName();
+ return path( REFERRALS_DN, leaf );
+ }
+
+}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java
index 019199ebf..6b627c8cb 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDSPluginTest.java
@@ -23,9 +23,9 @@ package org.apache.directory.studio.test.integration.ui;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
@@ -34,22 +34,15 @@ import org.apache.directory.studio.connection.core.ConnectionFolderManager;
import org.apache.directory.studio.connection.core.ConnectionManager;
import org.apache.directory.studio.ldapservers.LdapServersManager;
import org.apache.directory.studio.test.integration.ui.bots.ApacheDSConfigurationEditorBot;
-import org.apache.directory.studio.test.integration.ui.bots.ApacheDSServersViewBot;
import org.apache.directory.studio.test.integration.ui.bots.BotUtils;
import org.apache.directory.studio.test.integration.ui.bots.ConnectionFromServerDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.ConsoleViewBot;
import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.NewApacheDSServerWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
/**
@@ -58,35 +51,17 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-public class ApacheDSPluginTest
+public class ApacheDSPluginTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ApacheDSServersViewBot serversViewBot;
- private ConnectionsViewBot connectionsViewBot;
- private ConsoleViewBot consoleViewBot;
+ protected ConsoleViewBot consoleViewBot;
-
- @Before
- public void setUp() throws Exception
+ @BeforeEach
+ void setUp() throws Exception
{
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- serversViewBot = studioBot.getApacheDSServersViewBot();
- connectionsViewBot = studioBot.getConnectionView();
consoleViewBot = studioBot.getConsoleView();
}
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- serversViewBot.deleteTestServers();
- Assertions.genericTearDownAssertions();
- }
-
-
/**
* Run the following tests:
* <ul>
@@ -417,7 +392,7 @@ public class ApacheDSPluginTest
// Repair the server
serversViewBot.repairServer( serverName );
- consoleViewBot.waitForConsoleText("Database repaired");
+ consoleViewBot.waitForConsoleText( "Database repaired" );
serversViewBot.waitForServerStop( serverName );
// Wait a bit more after repair, another weird race condition...
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
index 3a6c9adb6..615173f40 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
@@ -21,11 +21,26 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST_ADDRESS;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.ALIAS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.CONTEXT_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_ESCAPED_CHARACTERS_BACKSLASH_PREFIXED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_ESCAPED_CHARACTERS_HEX_PAIR_ESCAPED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_IP_HOST_NUMBER;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_TRAILING_EQUALS_CHARACTER;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_TRAILING_EQUALS_CHARACTER_HEX_PAIR_ESCAPED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MULTI_VALUED_RDN_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER2_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER3_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@@ -34,10 +49,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
@@ -49,27 +60,21 @@ import org.apache.directory.studio.ldapbrowser.core.model.impl.Bookmark;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
import org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.ReferralDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.SearchLogsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.PlatformUI;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -78,70 +83,37 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-@ApplyLdifFiles(clazz = BrowserTest.class, value = "org/apache/directory/studio/test/integration/ui/BrowserTest.ldif")
-public class BrowserTest extends AbstractLdapTestUnit
+public class BrowserTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private SearchLogsViewBot searchLogsViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- private Connection connection;
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "BrowserTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- searchLogsViewBot = studioBot.getSearchLogsViewBot();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-463.
*
* When expanding an entry in the browser only one search request
* should be send to the server
- *
- * @throws Exception
*/
- @Test
- public void testOnlyOneSearchRequestWhenExpandingEntry() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testOnlyOneSearchRequestWhenExpandingEntry( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
// get number of search requests before expanding the entry
String text = searchLogsViewBot.getSearchLogsText();
int countMatchesBefore = StringUtils.countMatches( text, "#!SEARCH REQUEST" );
// expand
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system" );
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.expandEntry( path( CONTEXT_DN ) );
+ browserViewBot.waitForEntry( path( USERS_DN ) );
// get number of search requests after expanding the entry
text = searchLogsViewBot.getSearchLogsText();
int countMatchesAfter = StringUtils.countMatches( text, "#!SEARCH REQUEST" );
- assertEquals( "Expected exactly 1 search request", 1, countMatchesAfter - countMatchesBefore );
+ assertEquals( 1, countMatchesAfter - countMatchesBefore, "Expected exactly 1 search request" );
- assertEquals( "No modification expected", "", modificationLogsViewBot.getModificationLogsText() );
+ assertEquals( "", modificationLogsViewBot.getModificationLogsText(), "No modification expected" );
}
@@ -149,14 +121,14 @@ public class BrowserTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-512.
*
* Verify minimum UI updates when deleting multiple entries.
- *
- * @throws Exception
*/
- @Test
- public void testDeleteDontUpdateUI() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteDoesNotUpdateUI( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USERS_DN ) );
+ browserViewBot.expandEntry( path( USERS_DN ) );
long fireCount0 = EventRegistry.getFireCount();
@@ -171,16 +143,16 @@ public class BrowserTest extends AbstractLdapTestUnit
"uid=user.6",
"uid=user.7",
"uid=user.8" };
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectChildrenOfEntry( children, path( USERS_DN ) );
DeleteDialogBot deleteDialog = browserViewBot.openDeleteDialog();
deleteDialog.clickOkButton();
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
long fireCount1 = EventRegistry.getFireCount();
// verify that only two events were fired during deletion
long fireCount = fireCount1 - fireCount0;
- assertEquals( "Only 2 event firings expected when deleting multiple entries.", 2, fireCount );
+ assertEquals( 2, fireCount, "Only 2 event firings expected when deleting multiple entries." );
}
@@ -189,30 +161,30 @@ public class BrowserTest extends AbstractLdapTestUnit
*
* When opening a bookmark the entry editor should be opened and the
* bookmark entry's attributes should be displayed.
- *
- * @throws Exception
*/
- @Test
- public void testBookmark() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBookmark( TestLdapServer server ) throws Exception
{
// create a bookmark
+ Connection connection = connectionsViewBot.createTestConnection( server );
IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
.getBrowserConnection( connection );
browserConnection.getBookmarkManager().addBookmark(
- new Bookmark( browserConnection, new Dn( "uid=user.1,ou=users,ou=system" ), "Existing Bookmark" ) );
+ new Bookmark( browserConnection, USER1_DN, "Existing Bookmark" ) );
// select the bookmark
browserViewBot.selectEntry( "Bookmarks", "Existing Bookmark" );
// check that entry editor was opened and attributes are visible
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
String dn = entryEditorBot.getDnText();
- assertEquals( "DN: uid=user.1,ou=users,ou=system", dn );
+ assertEquals( "DN: " + USER1_DN.getName(), dn );
List<String> attributeValues = entryEditorBot.getAttributeValues();
assertEquals( 23, attributeValues.size() );
assertTrue( attributeValues.contains( "uid: user.1" ) );
- assertEquals( "No modification expected", "", modificationLogsViewBot.getModificationLogsText() );
+ assertEquals( "", modificationLogsViewBot.getModificationLogsText(), "No modification expected" );
}
@@ -220,49 +192,54 @@ public class BrowserTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-481.
*
* Check proper operation of refresh action.
- *
- * @throws Exception
*/
- @Test
- public void testRefreshParent() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRefreshParent( TestLdapServer server ) throws Exception
{
// check the entry doesn't exist yet
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ Dn refreshDn = dn( "cn=refresh", MISC_DN );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
// add the entry directly in the server
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "cn=refresh,ou=users,ou=system" ) );
- entry.add( "objectClass", "top", "person" );
- entry.add( "cn", "refresh" );
- entry.add( "sn", "refresh" );
- ldapServer.getDirectoryService().getAdminSession().add( entry );
+ server.withAdminConnection( conn -> {
+ Entry entry = new DefaultEntry( conn.getSchemaManager() );
+ entry.setDn( refreshDn );
+ entry.add( "objectClass", "top", "person" );
+ entry.add( "cn", "refresh" );
+ entry.add( "sn", "refresh" );
+ conn.add( entry );
+ } );
// check the entry still isn't visible in the tree
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
// refresh parent
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( MISC_DN ) );
browserViewBot.refresh();
// check the entry exists now
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ assertTrue( browserViewBot.existsEntry( path( refreshDn ) ) );
+ browserViewBot.selectEntry( path( refreshDn ) );
// delete the entry directly in the server
- ldapServer.getDirectoryService().getAdminSession().delete( new Dn( "cn=refresh,ou=users,ou=system" ) );
+ server.withAdminConnection( conn -> {
+ conn.delete( refreshDn );
+ } );
- // check the entry still is now visible in the tree
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ // check the entry still is visible in the tree
+ assertTrue( browserViewBot.existsEntry( path( refreshDn ) ) );
// refresh parent
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( MISC_DN ) );
browserViewBot.refresh();
// check the entry doesn't exist now
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
}
@@ -273,46 +250,53 @@ public class BrowserTest extends AbstractLdapTestUnit
*
* @throws Exception
*/
- @Test
- public void testRefreshContextEntry() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRefreshContextEntry( TestLdapServer server ) throws Exception
{
// check the entry doesn't exist yet
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ Dn refreshDn = dn( "cn=refresh", MISC_DN );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
// add the entry directly in the server
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "cn=refresh,ou=users,ou=system" ) );
- entry.add( "objectClass", "top", "person" );
- entry.add( "cn", "refresh" );
- entry.add( "sn", "refresh" );
- ldapServer.getDirectoryService().getAdminSession().add( entry );
+ server.withAdminConnection( conn -> {
+ Entry entry = new DefaultEntry( conn.getSchemaManager() );
+ entry.setDn( refreshDn );
+ entry.add( "objectClass", "top", "person" );
+ entry.add( "cn", "refresh" );
+ entry.add( "sn", "refresh" );
+ conn.add( entry );
+ } );
// check the entry still isn't visible in the tree
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
// refresh context entry
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
browserViewBot.refresh();
// check the entry exists now
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ assertTrue( browserViewBot.existsEntry( path( refreshDn ) ) );
+ browserViewBot.selectEntry( path( refreshDn ) );
// delete the entry directly in the server
- ldapServer.getDirectoryService().getAdminSession().delete( new Dn( "cn=refresh,ou=users,ou=system" ) );
+ server.withAdminConnection( connection -> {
+ connection.delete( refreshDn );
+ } );
- // check the entry still is now visible in the tree
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ // check the entry still is visible in the tree
+ assertTrue( browserViewBot.existsEntry( path( refreshDn ) ) );
// refresh context entry
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
browserViewBot.refresh();
// check the entry doesn't exist now
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
}
@@ -320,49 +304,54 @@ public class BrowserTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-481.
*
* Check proper operation of refresh action.
- *
- * @throws Exception
*/
- @Test
- public void testRefreshRootDSE() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRefreshRootDSE( TestLdapServer server ) throws Exception
{
// check the entry doesn't exist yet
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ Dn refreshDn = dn( "cn=refresh", MISC_DN );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
// add the entry directly in the server
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "cn=refresh,ou=users,ou=system" ) );
- entry.add( "objectClass", "top", "person" );
- entry.add( "cn", "refresh" );
- entry.add( "sn", "refresh" );
- ldapServer.getDirectoryService().getAdminSession().add( entry );
+ server.withAdminConnection( connection -> {
+ Entry entry = new DefaultEntry( connection.getSchemaManager() );
+ entry.setDn( refreshDn );
+ entry.add( "objectClass", "top", "person" );
+ entry.add( "cn", "refresh" );
+ entry.add( "sn", "refresh" );
+ connection.add( entry );
+ } );
// check the entry still isn't visible in the tree
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
// refresh Root DSE
- browserViewBot.selectEntry( "DIT", "Root DSE" );
+ browserViewBot.selectEntry( ROOT_DSE_PATH );
browserViewBot.refresh();
// check the entry exists now
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ assertTrue( browserViewBot.existsEntry( path( refreshDn ) ) );
+ browserViewBot.selectEntry( path( refreshDn ) );
// delete the entry directly in the server
- ldapServer.getDirectoryService().getAdminSession().delete( new Dn( "cn=refresh,ou=users,ou=system" ) );
+ server.withAdminConnection( connection -> {
+ connection.delete( refreshDn );
+ } );
// check the entry still is now visible in the tree
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ assertTrue( browserViewBot.existsEntry( path( refreshDn ) ) );
// refresh Root DSE
- browserViewBot.selectEntry( "DIT", "Root DSE" );
+ browserViewBot.selectEntry( ROOT_DSE_PATH );
browserViewBot.refresh();
// check the entry doesn't exist now
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=refresh" ) );
+ browserViewBot.expandEntry( path( MISC_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( refreshDn ) ) );
}
@@ -370,116 +359,162 @@ public class BrowserTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-481.
*
* Check proper operation of refresh action.
- *
- * @throws Exception
*/
- @Test
- public void testRefreshSearchContinuation() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRefreshSearchContinuation( TestLdapServer server ) throws Exception
{
- // preparation: add referral entry and set referral handling
- String url = "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/ou=users,ou=system";
- Entry refEntry = new DefaultEntry( service.getSchemaManager() );
- refEntry.setDn( new Dn( "cn=referral,ou=system" ) );
- refEntry.add( "objectClass", "top", "referral", "extensibleObject" );
- refEntry.add( "cn", "referral" );
- refEntry.add( "ref", url );
- ldapServer.getDirectoryService().getAdminSession().add( refEntry );
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ Dn refreshDn = dn( "cn=refresh", MISC_DN );
+ String[] pathToReferral = pathWithRefLdapUrl( server, MISC_DN );
+ String[] pathToRefreshViaReferral = path( pathToReferral, "cn=refresh" );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
ReferralHandlingMethod.FOLLOW_MANUALLY.ordinal() );
- browserViewBot.selectEntry( "DIT", "Root DSE" );
+ browserViewBot.selectEntry( ROOT_DSE_PATH );
browserViewBot.refresh();
// check the entry doesn't exist yet
- ReferralDialogBot refDialog = browserViewBot.expandEntryExpectingReferralDialog( "DIT", "Root DSE",
- "ou=system", url );
+ ReferralDialogBot refDialog = browserViewBot.expandEntryExpectingReferralDialog( pathToReferral );
refDialog.clickOkButton();
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh" ) );
+ assertFalse( browserViewBot.existsEntry( pathToRefreshViaReferral ) );
// add the entry directly in the server
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "cn=refresh,ou=users,ou=system" ) );
- entry.add( "objectClass", "top", "person" );
- entry.add( "cn", "refresh" );
- entry.add( "sn", "refresh" );
- ldapServer.getDirectoryService().getAdminSession().add( entry );
+ server.withAdminConnection( conn -> {
+ Entry entry = new DefaultEntry( conn.getSchemaManager() );
+ entry.setDn( refreshDn );
+ entry.add( "objectClass", "top", "person" );
+ entry.add( "cn", "refresh" );
+ entry.add( "sn", "refresh" );
+ conn.add( entry );
+ } );
// check the entry still isn't visible in the tree
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh" ) );
+ assertFalse( browserViewBot.existsEntry( pathToRefreshViaReferral ) );
// refresh search continuation
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", url );
+ browserViewBot.selectEntry( pathToReferral );
browserViewBot.refresh();
// check the entry exists now
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", url );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh" );
+ browserViewBot.expandEntry( pathToReferral );
+ assertTrue( browserViewBot.existsEntry( pathToRefreshViaReferral ) );
+ browserViewBot.selectEntry( pathToRefreshViaReferral );
// delete the entry directly in the server
- ldapServer.getDirectoryService().getAdminSession().delete( new Dn( "cn=refresh,ou=users,ou=system" ) );
+ server.withAdminConnection( conn -> {
+ conn.delete( refreshDn );
+ } );
- // check the entry still is now visible in the tree
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh" ) );
+ // check the entry still is visible in the tree
+ assertTrue( browserViewBot.existsEntry( pathToRefreshViaReferral ) );
// refresh search continuation
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", url );
+ browserViewBot.selectEntry( pathToReferral );
browserViewBot.refresh();
// check the entry doesn't exist now
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", url );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", url, "cn=refresh" ) );
+ browserViewBot.expandEntry( pathToReferral );
+ assertFalse( browserViewBot.existsEntry( pathToRefreshViaReferral ) );
}
/**
* Test for DIRSTUDIO-591.
* (Error reading objects with # in DN)
- *
- * @throws Exception
*/
- @Test
- public void testBrowseDnWithSharpAndHexSequence() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testBrowseDnWithSharpAndHexSequence( TestLdapServer server ) throws Exception
{
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=\\#ACL_AD-Projects_Author" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#ACL_AD-Projects_Author" );
+ Dn dn = DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ dn = DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+ }
- assertEquals( "No modification expected", "", modificationLogsViewBot.getModificationLogsText() );
+ connectionsViewBot.createTestConnection( server );
+ assertTrue( browserViewBot.existsEntry( path( dn ) ) );
+ browserViewBot.selectEntry( path( dn ) );
+
+ assertEquals( "", modificationLogsViewBot.getModificationLogsText(), "No modification expected" );
+ }
+
+
+ /**
+ * Test for DIRSTUDIO-1172: Studio doesn't display entries with trailing =.
+ */
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testBrowseDnWithTrailingEqualsCharacter( TestLdapServer server ) throws Exception
+ {
+ Dn dn = DN_WITH_TRAILING_EQUALS_CHARACTER;
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ dn = DN_WITH_TRAILING_EQUALS_CHARACTER_HEX_PAIR_ESCAPED;
+ }
+
+ connectionsViewBot.createTestConnection( server );
+
+ assertTrue( browserViewBot.existsEntry( path( dn ) ) );
+ browserViewBot.selectEntry( path( dn ) );
}
/**
* Test for DIRSTUDIO-1172: Studio doesn't display entries with trailing =.
*/
- @Test
- public void testBrowseDnWithTrailingEqualsCharacter() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(except =
+ {
+ LdapServerType.OpenLdap,
+ LdapServerType.Fedora389ds }, reason = "Empty RDN value is not supported by OpenLDAP and 389ds")
+ public void testBrowseDnWithEmptyRdnValue( TestLdapServer server ) throws Exception
{
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=nghZwwtHgxgyvVbTQCYyeY\\+O4cc=" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=nghZwwtHgxgyvVbTQCYyeY\\+O4cc=" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=nghZwwtHgxgyvVbTQCYyeY+email=" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=nghZwwtHgxgyvVbTQCYyeY+email=" );
+ Dn dn = dn( "cn=nghZwwtHgxgyvVbTQCYyeY+email=", MISC_DN );
+
+ server.withAdminConnection( connection -> {
+ Entry entry = new DefaultEntry( connection.getSchemaManager() );
+ entry.setDn( dn );
+ entry.add( "objectClass", "top", "person", "extensibleObject" );
+ entry.add( "cn", "nghZwwtHgxgyvVbTQCYyeY" );
+ entry.add( "sn", "nghZwwtHgxgyvVbTQCYyeY" );
+ entry.add( "email", "" );
+ connection.add( entry );
+ } );
+
+ connectionsViewBot.createTestConnection( server );
+
+ assertTrue( browserViewBot.existsEntry( path( dn ) ) );
+ browserViewBot.selectEntry( path( dn ) );
}
/**
* Test for DIRSTUDIO-1151: DN with backslash not displayed
*/
- @Test
- public void testBrowseDnWithBackslash() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testBrowseDnWithBackslash( TestLdapServer server ) throws Exception
{
+ Dn dn = DN_WITH_ESCAPED_CHARACTERS_BACKSLASH_PREFIXED;
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ dn = DN_WITH_ESCAPED_CHARACTERS_HEX_PAIR_ESCAPED;
+ }
+
+ connectionsViewBot.createTestConnection( server );
+
// expand parent and verify entry is visible
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.0\\,foo" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.0\\,foo" );
+ browserViewBot.expandEntry( path( dn.getParent() ) );
+ assertTrue( browserViewBot.existsEntry( path( dn ) ) );
+ browserViewBot.selectEntry( path( dn ) );
// refresh entry and verify child is still visible
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( dn.getParent() ) );
browserViewBot.refresh();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.0\\,foo" ) );
+ assertTrue( browserViewBot.existsEntry( path( dn ) ) );
}
@@ -489,9 +524,12 @@ public class BrowserTest extends AbstractLdapTestUnit
*
* @throws Exception
*/
- @Test
- public void testNoModificationWhileBrowsingAndRefreshing() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testNoModificationWhileBrowsingAndRefreshing( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
+
boolean errorDialogAutomatedMode = ErrorDialog.AUTOMATED_MODE;
ErrorDialog.AUTOMATED_MODE = false;
@@ -500,18 +538,16 @@ public class BrowserTest extends AbstractLdapTestUnit
try
{
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=\\#ACL_AD-Projects_Author" ) );
+ assertTrue( browserViewBot.existsEntry( path( MULTI_VALUED_RDN_DN ) ) );
for ( int i = 0; i < 5; i++ )
{
// select entry and refresh
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=\\#ACL_AD-Projects_Author" );
+ browserViewBot.selectEntry( path( MULTI_VALUED_RDN_DN ) );
browserViewBot.refresh();
// select parent and refresh
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( MULTI_VALUED_RDN_DN.getParent() ) );
browserViewBot.refresh();
}
}
@@ -523,7 +559,7 @@ public class BrowserTest extends AbstractLdapTestUnit
// check that modification logs is still empty
// to ensure that no modification was sent to the server
- assertEquals( "No modification expected", "", modificationLogsViewBot.getModificationLogsText() );
+ assertEquals( "", modificationLogsViewBot.getModificationLogsText(), "No modification expected" );
}
@@ -531,53 +567,43 @@ public class BrowserTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-603, DIRSHARED-41.
* (Error browsing/entering rfc2307 compliant host entry.)
*/
- @Test
- public void testBrowseDnWithIpHostNumber() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseDnWithIpHostNumber( TestLdapServer server ) throws Exception
{
- ApacheDsUtils.enableSchema( ldapServer, "nis" );
-
- // create entry with multi-valued RDN containing an IP address value
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "cn=loopback+ipHostNumber=" + LOCALHOST_ADDRESS + ",ou=users,ou=system" ) );
- entry.add( "objectClass", "top", "device", "ipHost" );
- entry.add( "cn", "loopback" );
- entry.add( "ipHostNumber", LOCALHOST_ADDRESS );
- ldapServer.getDirectoryService().getAdminSession().add( entry );
-
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=loopback+ipHostNumber=" + LOCALHOST_ADDRESS ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=loopback+ipHostNumber=" + LOCALHOST_ADDRESS );
+ connectionsViewBot.createTestConnection( server );
+
+ assertTrue( browserViewBot.existsEntry( path( DN_WITH_IP_HOST_NUMBER ) ) );
+ browserViewBot.selectEntry( path( DN_WITH_IP_HOST_NUMBER ) );
}
/**
* DIRSTUDIO-637: copy/paste of attributes no longer works.
* Test copy/paste of a value to a bookmark.
- *
- * @throws Exception
- * the exception
*/
- @Test
- public void testCopyPasteValueToBookmark() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteValueToBookmark( TestLdapServer server ) throws Exception
{
// create a bookmark
+ Connection connection = connectionsViewBot.createTestConnection( server );
IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
.getBrowserConnection( connection );
browserConnection.getBookmarkManager().addBookmark(
- new Bookmark( browserConnection, new Dn( "uid=user.2,ou=users,ou=system" ), "My Bookmark" ) );
+ new Bookmark( browserConnection, MULTI_VALUED_RDN_DN, "My Bookmark" ) );
// copy a value
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
entryEditorBot.copyValue( "uid", "user.1" );
// select the bookmark
browserViewBot.selectEntry( "Bookmarks", "My Bookmark" );
- entryEditorBot = studioBot.getEntryEditorBot( "uid=user.2,ou=users,ou=system" );
+ entryEditorBot = studioBot.getEntryEditorBot( MULTI_VALUED_RDN_DN.getName() );
entryEditorBot.activate();
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
+ assertEquals( 8, entryEditorBot.getAttributeValues().size() );
// paste the value
JobWatcher watcher = new JobWatcher( BrowserCoreMessages.jobs__execute_ldif_name );
@@ -585,13 +611,14 @@ public class BrowserTest extends AbstractLdapTestUnit
watcher.waitUntilDone();
// assert pasted value visible in editor
- assertEquals( 24, entryEditorBot.getAttributeValues().size() );
+ assertEquals( 9, entryEditorBot.getAttributeValues().size() );
entryEditorBot.getAttributeValues().contains( "uid: user.1" );
// assert pasted value was written to directory
- Entry entry = ldapServer.getDirectoryService().getAdminSession().lookup(
- new Dn( "uid=user.2,ou=users,ou=system" ) );
- assertTrue( entry.contains( "uid", "user.1" ) );
+ server.withAdminConnection( conn -> {
+ Entry entry = conn.lookup( MULTI_VALUED_RDN_DN );
+ assertTrue( entry.contains( "uid", "user.1" ) );
+ } );
}
@@ -600,16 +627,18 @@ public class BrowserTest extends AbstractLdapTestUnit
*
* Verify input is set only once when entry is selected.
*/
- @Test
- public void testSetInputOnlyOnce() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSetInputOnlyOnce( TestLdapServer server ) throws Exception
{
/*
* This test fails on Jenkins Windows Server, to be investigated...
*/
// Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
+ connectionsViewBot.createTestConnection( server );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
+ browserViewBot.expandEntry( path( USERS_DN ) );
// verify link-with-editor is enabled
assertTrue( BrowserUIPlugin.getDefault().getPreferenceStore()
@@ -645,31 +674,31 @@ public class BrowserTest extends AbstractLdapTestUnit
} );
// select 3 different entries, select one twice should not set the input again
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.2" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.2" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.3" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.3" );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.selectEntry( path( USER2_DN ) );
+ browserViewBot.selectEntry( path( USER2_DN ) );
+ browserViewBot.selectEntry( path( USER3_DN ) );
+ browserViewBot.selectEntry( path( USER3_DN ) );
// verify that input was only set 3 times.
- assertEquals( "Only 3 input changes expected.", 3, counter.get() );
+ assertEquals( 3, counter.get(), "Only 3 input changes expected." );
// reset counter
counter.set( 0 );
// use navigation history to go back and forth, each step should set input only once
studioBot.navigationHistoryBack();
- browserViewBot.waitUntilEntryIsSelected( "uid=user.2" );
+ browserViewBot.waitUntilEntryIsSelected( USER2_DN.getRdn().getName() );
studioBot.navigationHistoryBack();
- browserViewBot.waitUntilEntryIsSelected( "uid=user.1" );
+ browserViewBot.waitUntilEntryIsSelected( USER1_DN.getRdn().getName() );
studioBot.navigationHistoryForward();
- browserViewBot.waitUntilEntryIsSelected( "uid=user.2" );
+ browserViewBot.waitUntilEntryIsSelected( USER2_DN.getRdn().getName() );
studioBot.navigationHistoryForward();
- browserViewBot.waitUntilEntryIsSelected( "uid=user.3" );
+ browserViewBot.waitUntilEntryIsSelected( USER3_DN.getRdn().getName() );
// verify that input was only set 4 times.
- assertEquals( "Only 4 input changes expected.", 4, counter.get() );
+ assertEquals( 4, counter.get(), "Only 4 input changes expected." );
}
@@ -677,149 +706,181 @@ public class BrowserTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-987, DIRSTUDIO-271.
*
* Browse and refresh entry with multi-valued RDN with same attribute type.
- *
- * @throws Exception
*/
- @Test
- public void testBrowseAndRefreshEntryWithMvRdn() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(except = LdapServerType.OpenLdap, reason = "Multi-valued RDN with same attribute is not supported by OpenLDAP")
+ public void testBrowseAndRefreshEntryWithMvRdn( TestLdapServer server ) throws Exception
{
+ Dn entryDn = dn( "l=Berlin+l=Brandenburger Tor+l=de+l=eu", MISC_DN );
+ Dn childDn = dn( "cn=A", entryDn );
+
+ server.withAdminConnection( connection -> {
+ Entry entry1 = new DefaultEntry( connection.getSchemaManager() );
+ entry1.setDn( entryDn );
+ entry1.add( "objectClass", "top", "locality" );
+ entry1.add( "l", "eu", "de", "Berlin", "Brandenburger Tor" );
+ connection.add( entry1 );
+
+ Entry entry2 = new DefaultEntry( connection.getSchemaManager() );
+ entry2.setDn( childDn );
+ entry2.add( "objectClass", "top", "person" );
+ entry2.add( "cn", "A" );
+ entry2.add( "sn", "A" );
+ connection.add( entry2 );
+ } );
+
+ String[] pathToParent = path( entryDn.getParent() );
+ String[] pathToEntry = path( entryDn );
+ String[] pathToChild = path( childDn );
+
+ connectionsViewBot.createTestConnection( server );
+
// expand parent and verify entry is visible
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" );
+ browserViewBot.expandEntry( pathToParent );
+ assertTrue( browserViewBot.existsEntry( pathToEntry ) );
+ browserViewBot.selectEntry( pathToEntry );
// expand entry and verify child is visible
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "cn=A" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "cn=A" );
+ browserViewBot.expandEntry( pathToEntry );
+ assertTrue( browserViewBot.existsEntry( pathToChild ) );
+ browserViewBot.selectEntry( pathToChild );
// refresh entry and verify child is still visible
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" );
+ browserViewBot.selectEntry( pathToEntry );
browserViewBot.refresh();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "cn=A" ) );
+ assertTrue( browserViewBot.existsEntry( pathToChild ) );
// refresh parent and verify entry is still visible
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( pathToParent );
browserViewBot.refresh();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" ) );
+ assertTrue( browserViewBot.existsEntry( pathToEntry ) );
// expand entry and verify child is visible
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "cn=A" ) );
+ browserViewBot.expandEntry( pathToEntry );
+ assertTrue( browserViewBot.existsEntry( pathToChild ) );
}
- @Test
- public void testBrowseAliasEntry()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseAliasEntry( TestLdapServer server ) throws Exception
{
// disable alias dereferencing
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
+ browserViewBot.expandEntry( path( ALIAS_DN.getParent() ) );
+ assertTrue( browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+ browserViewBot.selectEntry( path( ALIAS_DN ) );
}
- @Test
- public void testBrowseReferralEntry()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseReferralEntry( TestLdapServer server ) throws Exception
{
// enable ManageDsaIT control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
+ browserViewBot.expandEntry( path( REFERRAL_TO_USERS_DN.getParent() ) );
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_USERS_DN ) ) );
+ browserViewBot.selectEntry( path( REFERRAL_TO_USERS_DN ) );
}
- @Test
- public void testBrowseSubEntry()
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testBrowseSubEntry( TestLdapServer server ) throws Exception
{
+ Dn subentryDn = dn( "cn=subentry", MISC_DN );
+
// enable Subentries control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ browserViewBot.expandEntry( path( subentryDn.getParent() ) );
+ assertTrue( browserViewBot.existsEntry( path( subentryDn ) ) );
+ browserViewBot.selectEntry( path( subentryDn ) );
}
- @Test
- public void testBrowseWithPagingWithScrollMode()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseWithPagingWithScrollMode( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USERS_DN ) );
// enable Simple Paged Results control
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH, true );
connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE, 5 );
+ IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE, 3 );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SCROLL_MODE, true );
// 1st page
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Next Page ---" ) );
+ browserViewBot.expandEntry( path( USERS_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( USERS_DN, "--- Top Page ---" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( USERS_DN, "--- Next Page ---" ) ) );
// next page
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Next Page ---" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Next Page ---" ) );
+ browserViewBot.selectEntry( path( USERS_DN, "--- Next Page ---" ) );
+ assertTrue( browserViewBot.existsEntry( path( USERS_DN, "--- Top Page ---" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( USERS_DN, "--- Next Page ---" ) ) );
// last page
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Next Page ---" );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Top Page ---" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Next Page ---" ) );
+ browserViewBot.selectEntry( path( USERS_DN, "--- Next Page ---" ) );
+ assertTrue( browserViewBot.existsEntry( path( USERS_DN, "--- Top Page ---" ) ) );
+ assertFalse( browserViewBot.existsEntry( path( USERS_DN, "--- Next Page ---" ) ) );
// back to top
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Top Page ---" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Next Page ---" ) );
+ browserViewBot.selectEntry( path( USERS_DN, "--- Top Page ---" ) );
+ assertFalse( browserViewBot.existsEntry( path( USERS_DN, "--- Top Page ---" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( USERS_DN, "--- Next Page ---" ) ) );
}
- @Test
- public void testBrowseWithPagingWithoutScrollMode()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseWithPagingWithoutScrollMode( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USERS_DN ) );
// enable Simple Paged Results control
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH, true );
connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE, 5 );
+ IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE, 3 );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SCROLL_MODE, false );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Top Page ---" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "--- Next Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users (13)" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.8" ) );
+ browserViewBot.expandEntry( path( USERS_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( USERS_DN, "--- Top Page ---" ) ) );
+ assertFalse( browserViewBot.existsEntry( path( USERS_DN, "--- Next Page ---" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( USERS_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( path( USERS_DN, "uid=user.1" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( USERS_DN, "uid=user.8" ) ) );
}
- @Test
- public void testDeleteClearsEntryCache() throws Exception
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void x( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ connectionsViewBot.createTestConnection( server );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
+ browserViewBot.expandEntry( path( USERS_DN ) );
+
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
List<String> attributeValues = entryEditorBot.getAttributeValues();
assertEquals( 23, attributeValues.size() );
assertTrue( attributeValues.contains( "uid: user.1" ) );
@@ -827,24 +888,26 @@ public class BrowserTest extends AbstractLdapTestUnit
DeleteDialogBot deleteDialog = browserViewBot.openDeleteDialog();
deleteDialog.clickOkButton();
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" ) );
-
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "uid=user.1,ou=users,ou=system" ) );
- entry.add( "objectClass", "top", "person", "organizationalPerson", "inetOrgPerson" );
- entry.add( "uid", "user.1" );
- entry.add( "givenName", "Foo" );
- entry.add( "sn", "Bar" );
- entry.add( "cn", "Foo Bar" );
- entry.add( "initials", "FB" );
- service.getAdminSession().add( entry );
+ browserViewBot.selectEntry( path( USERS_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( USER1_DN ) ) );
+
+ server.withAdminConnection( conn -> {
+ Entry entry = new DefaultEntry( conn.getSchemaManager() );
+ entry.setDn( USER1_DN );
+ entry.add( "objectClass", "top", "person", "organizationalPerson", "inetOrgPerson" );
+ entry.add( "uid", "user.1" );
+ entry.add( "givenName", "Foo" );
+ entry.add( "sn", "Bar" );
+ entry.add( "cn", "Foo Bar" );
+ entry.add( "initials", "FB" );
+ conn.add( entry );
+ } );
browserViewBot.refresh();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" ) );
+ assertTrue( browserViewBot.existsEntry( path( USER1_DN ) ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
attributeValues = entryEditorBot.getAttributeValues();
assertEquals( 9, attributeValues.size() );
assertTrue( attributeValues.contains( "uid: user.1" ) );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CertificateValidationTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CertificateValidationTest.java
index 305f4ad35..c6bdd7bd3 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CertificateValidationTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CertificateValidationTest.java
@@ -21,16 +21,17 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
+import static org.apache.directory.studio.test.integration.ui.utils.Constants.LOCALHOST;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.FileOutputStream;
+import java.lang.reflect.Method;
import java.math.BigInteger;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
@@ -50,35 +51,29 @@ import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.security.TlsKeyGenerator;
-import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.test.integration.junit5.ApacheDirectoryServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.CertificateTrustDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.CertificateValidationPreferencePageBot;
import org.apache.directory.studio.test.integration.ui.bots.CheckAuthenticationDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.ErrorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.NewConnectionWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.PreferencesBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.bouncycastle.asn1.x509.ExtendedKeyUsage;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.asn1.x509.KeyPurposeId;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.x509.X509V3CertificateGenerator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -87,34 +82,18 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-//@CreateDS(allowAnonAccess = true, name = "KeyStoreIT-class")
-public class CertificateValidationTest extends AbstractLdapTestUnit
+public class CertificateValidationTest extends AbstractTestBase
{
static final long YEAR_MILLIS = 365L * 24L * 3600L * 1000L;
- @Rule
- public TestName name = new TestName();
+ private TestInfo testInfo;
- private static StudioBot studioBot;
- private static ConnectionsViewBot connectionsViewBot;
private static NewConnectionWizardBot wizardBot;
-
- @BeforeClass
- public static void setUpClass() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- // ErrorDialog.AUTOMATED_MODE = false;
- }
-
-
- @Before
- public void setUp() throws Exception
+ @BeforeEach
+ public void setUp( TestInfo testInfo ) throws Exception
{
- studioBot.resetLdapPerspective();
+ this.testInfo = testInfo;
// let Java use the key store
System.setProperty( "javax.net.ssl.trustStore", ROOT_CA_KEYSTORE_PATH );
@@ -124,11 +103,9 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
}
- @After
+ @AfterEach
public void tearDown() throws Exception
{
- connectionsViewBot.deleteTestConnections();
-
// delete custom trust stores
X509Certificate[] permanentCertificates = ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager()
.getCertificates();
@@ -148,8 +125,6 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
System.clearProperty( "javax.net.ssl.trustStorePassword" );
System.clearProperty( "javax.net.ssl.keyStore" );
System.clearProperty( "javax.net.ssl.keyStorePassword" );
-
- Assertions.genericTearDownAssertions();
}
private static final String KEYSTORE_PW = "changeit";
@@ -175,8 +150,7 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
private static final String MULTIPLE_ISSUES_KEYSTORE_PATH = "target/classes/multiple-issues-keystore.ks";
-
- @BeforeClass
+ @BeforeAll
public static void installKeyStoreWithCertificate() throws Exception
{
String issuerDn = "CN=trusted-root-ca";
@@ -227,7 +201,8 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
UNTRUSTED_ROOT_CA_KEYSTORE_PATH );
PrivateKey untrustedRootCaPrivateKey = ( PrivateKey ) ROOT_CA_KEYSTORE.getKey( "apacheds",
KEYSTORE_PW.toCharArray() );
- createKeyStore( subjectDn, untrustedRootCaIssuerDn, startDate, expiryDate, keyAlgo, keySize, untrustedRootCaPrivateKey,
+ createKeyStore( subjectDn, untrustedRootCaIssuerDn, startDate, expiryDate, keyAlgo, keySize,
+ untrustedRootCaPrivateKey,
UNTRUSTED_KEYSTORE_PATH );
// generate a certificate with multiple issues: expired, wrong hostname, self-signed
@@ -345,22 +320,24 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
private String getConnectionName()
{
- return "NewConnectionWizardTest." + name.getMethodName();
+ return testInfo.getTestMethod().map( Method::getName ).orElse( "null" ) + " "
+ + testInfo.getDisplayName();
}
/**
* Tests ldaps:// with a valid certificate.
*/
- @CreateLdapServer(keyStore = VALID_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testLdapsCertificateValidationOK() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testLdapsCertificateValidationOK( ApacheDirectoryServer server ) throws Exception
{
- wizardBotWithLdaps();
+ server.setKeystore( VALID_KEYSTORE_PATH );
+ wizardBotWithLdaps( server );
// check the certificate, should be OK
String result = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK, valid and trusted certificate", result );
+ assertNull( result, "Expected OK, valid and trusted certificate" );
wizardBot.clickCancelButton();
}
@@ -369,11 +346,12 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
/**
* Tests ldaps:// with an expired certificate.
*/
- @CreateLdapServer(keyStore = EXPIRED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testLdapsCertificateValidationExpired() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testLdapsCertificateValidationExpired( ApacheDirectoryServer server ) throws Exception
{
- wizardBotWithLdaps();
+ server.setKeystore( EXPIRED_KEYSTORE_PATH );
+ wizardBotWithLdaps( server );
// check the certificate, expecting the trust dialog
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -396,11 +374,11 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
* Tests that when selecting "Don't trust" the certificate is not trusted
* and not added to any key store.
*/
- @CreateLdapServer(keyStore = EXPIRED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testLdapsCertificateDoNotTrust() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testLdapsCertificateDoNotTrust( TestLdapServer server ) throws Exception
{
- wizardBotWithLdaps();
+ wizardBotWithLdaps( server );
// check trust, expect trust dialog, select don't trust
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -441,11 +419,11 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
* Tests that when selecting "Trust temporary" the certificate is trusted
* and added to the session key store.
*/
- @CreateLdapServer(keyStore = EXPIRED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testLdapsCertificateTrustTemporary() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testLdapsCertificateTrustTemporary( TestLdapServer server ) throws Exception
{
- wizardBotWithLdaps();
+ wizardBotWithLdaps( server );
// check trust, expect trust dialog, select trust temporary
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -464,7 +442,7 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
// check trust again, now the certificate is already trusted
wizardBot.activate();
String result = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK, valid and trusted certificate", result );
+ assertNull( result, "Expected OK, valid and trusted certificate" );
wizardBot.clickCancelButton();
}
@@ -474,11 +452,11 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
* Tests that when selecting "Trust permanent" the certificate is trusted
* and added to the permanent key store.
*/
- @CreateLdapServer(keyStore = EXPIRED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testLdapsCertificateTrustPermanent() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testLdapsCertificateTrustPermanent( TestLdapServer server ) throws Exception
{
- wizardBotWithLdaps();
+ wizardBotWithLdaps( server );
// check trust, expect trust dialog, select trust temporary
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -497,7 +475,7 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
// check trust again, now the certificate is already trusted
wizardBot.activate();
String result = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK, valid and trusted certificate", result );
+ assertNull( result, "Expected OK, valid and trusted certificate" );
wizardBot.clickCancelButton();
}
@@ -507,20 +485,22 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
* Tests StartTLS with an valid certificate. This is simulated
* by putting the root certificate into a temporary key store.
*/
- @Test
- @CreateLdapServer(keyStore = VALID_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW, extendedOpHandlers = StartTlsHandler.class)
- public void testStartTlsCertificateValidationOK() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testStartTlsCertificateValidationOK( ApacheDirectoryServer server ) throws Exception
{
+ server.setKeystore( VALID_KEYSTORE_PATH );
+
// enter connection parameter
wizardBot = connectionsViewBot.openNewConnectionWizard();
wizardBot.typeConnectionName( getConnectionName() );
wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typePort( server.getPort() );
wizardBot.selectStartTlsEncryption();
// check the certificate, should be OK
String result = wizardBot.clickCheckNetworkParameterButton();
- assertNull( "Expected OK, valid and trusted certificate", result );
+ assertNull( result, "Expected OK, valid and trusted certificate" );
// enter correct authentication parameter
wizardBot.clickNextButton();
@@ -529,7 +509,7 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
// check the certificate again, should be OK
String result2 = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK, valid and trusted certificate", result2 );
+ assertNull( result2, "Expected OK, valid and trusted certificate" );
wizardBot.clickCancelButton();
}
@@ -538,11 +518,12 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
/**
* DIRSTUDIO-1205: SSL/TLS with small key size is not working.
*/
- @CreateLdapServer(keyStore = SMALL_KEYSIZE_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW, extendedOpHandlers = StartTlsHandler.class)
- @Test
- public void testStartTlsCertificateValidationSmallKeysizeError() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testStartTlsCertificateValidationSmallKeysizeError( ApacheDirectoryServer server ) throws Exception
{
- wizardBotWithStartTls();
+ server.setKeystore( SMALL_KEYSIZE_KEYSTORE_PATH );
+ wizardBotWithStartTls( server );
// check the certificate, expecting the trust dialog
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -564,11 +545,12 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
/**
* Tests StartTLS with an expired certificate.
*/
- @CreateLdapServer(keyStore = EXPIRED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW, extendedOpHandlers = StartTlsHandler.class)
- @Test
- public void testStartTlsCertificateValidationExpired() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testStartTlsCertificateValidationExpired( ApacheDirectoryServer server ) throws Exception
{
- wizardBotWithStartTls();
+ server.setKeystore( EXPIRED_KEYSTORE_PATH );
+ wizardBotWithStartTls( server );
// check the certificate, expecting the trust dialog
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -588,11 +570,12 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
/**
* Tests StartTLS with an not yet valid certificate.
*/
- @CreateLdapServer(keyStore = NOT_YET_VALID_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW, extendedOpHandlers = StartTlsHandler.class)
- @Test
- public void testStartTlsCertificateValidationNotYetValid() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testStartTlsCertificateValidationNotYetValid( ApacheDirectoryServer server ) throws Exception
{
- wizardBotWithStartTls();
+ server.setKeystore( NOT_YET_VALID_KEYSTORE_PATH );
+ wizardBotWithStartTls( server );
// check the certificate, expecting the trust dialog
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -613,11 +596,12 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
* Tests StartTLS with a certificate where the certificate's host name
* doesn't match the server's host name (localhost)
*/
- @CreateLdapServer(keyStore = WRONG_HOSTNAME_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW, extendedOpHandlers = StartTlsHandler.class)
- @Test
- public void testStartTlsCertificateValidationHostnameMismatch() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testStartTlsCertificateValidationHostnameMismatch( ApacheDirectoryServer server ) throws Exception
{
- wizardBotWithStartTls();
+ server.setKeystore( WRONG_HOSTNAME_KEYSTORE_PATH );
+ wizardBotWithStartTls( server );
// check the certificate, expecting the trust dialog
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -637,11 +621,13 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
/**
* Tests StartTLS with a certificate without valid certification path.
*/
- @CreateLdapServer(keyStore = UNTRUSTED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW, extendedOpHandlers = StartTlsHandler.class)
- @Test
- public void testStartTlsCertificateValidationNoValidCertificationPath() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testStartTlsCertificateValidationNoValidCertificationPath( ApacheDirectoryServer server )
+ throws Exception
{
- wizardBotWithStartTls();
+ server.setKeystore( UNTRUSTED_KEYSTORE_PATH );
+ wizardBotWithStartTls( server );
// check the certificate, expecting the trust dialog
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -662,11 +648,12 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
/**
* Tests StartTLS with a self-signed certificate.
*/
- @CreateLdapServer(extendedOpHandlers = StartTlsHandler.class, keyStore = SELF_SIGNED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testStartTlsCertificateValidationSelfSigned() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testStartTlsCertificateValidationSelfSigned( ApacheDirectoryServer server ) throws Exception
{
- wizardBotWithStartTls();
+ server.setKeystore( SELF_SIGNED_KEYSTORE_PATH );
+ wizardBotWithStartTls( server );
// check the certificate, expecting the trust dialog
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -687,11 +674,13 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
/**
* Tests StartTLS with a certificate with multiple issues.
*/
- @CreateLdapServer(extendedOpHandlers = StartTlsHandler.class, keyStore = MULTIPLE_ISSUES_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testStartTlsCertificateValidationExpiredAndWrongHostnameAndSelfSigned() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "Update of keystore only implemented for ApacheDS")
+ public void testStartTlsCertificateValidationExpiredAndWrongHostnameAndSelfSigned( ApacheDirectoryServer server )
+ throws Exception
{
- wizardBotWithStartTls();
+ server.setKeystore( MULTIPLE_ISSUES_KEYSTORE_PATH );
+ wizardBotWithStartTls( server );
// check the certificate, expecting the trust dialog
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -712,11 +701,11 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
* Tests that when selecting "Don't trust" the certificate is not trusted
* and not added to any key store.
*/
- @CreateLdapServer(transports = @CreateTransport(protocol = "LDAP"), extendedOpHandlers = StartTlsHandler.class, keyStore = EXPIRED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testStartTlsCertificateDoNotTrust() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testStartTlsCertificateDoNotTrust( TestLdapServer server ) throws Exception
{
- wizardBotWithStartTls();
+ wizardBotWithStartTls( server );
// check trust, expect trust dialog, select don't trust
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -767,11 +756,11 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
* Tests that when selecting "Trust temporary" the certificate is trusted
* and added to the session key store.
*/
- @CreateLdapServer(transports = @CreateTransport(protocol = "LDAP"), extendedOpHandlers = StartTlsHandler.class, keyStore = EXPIRED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testStartTlsCertificateTrustTemporary() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testStartTlsCertificateTrustTemporary( TestLdapServer server ) throws Exception
{
- wizardBotWithStartTls();
+ wizardBotWithStartTls( server );
// check trust, expect trust dialog, select trust temporary
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -790,7 +779,7 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
// check trust again, now the certificate is already trusted
wizardBot.activate();
String result = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK, valid and trusted certificate", result );
+ assertNull( result, "Expected OK, valid and trusted certificate" );
wizardBot.clickCancelButton();
@@ -809,11 +798,11 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
* Tests that when selecting "Trust permanent" the certificate is trusted
* and added to the permanent key store.
*/
- @CreateLdapServer(transports = @CreateTransport(protocol = "LDAP"), extendedOpHandlers = StartTlsHandler.class, keyStore = EXPIRED_KEYSTORE_PATH, certificatePassword = KEYSTORE_PW)
- @Test
- public void testStartTlsCertificateTrustPermanent() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testStartTlsCertificateTrustPermanent( TestLdapServer server ) throws Exception
{
- wizardBotWithStartTls();
+ wizardBotWithStartTls( server );
// check trust, expect trust dialog, select trust temporary
CertificateTrustDialogBot trustDialogBot = wizardBot
@@ -832,7 +821,7 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
// check trust again, now the certificate is already trusted
wizardBot.activate();
String result = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK, valid and trusted certificate", result );
+ assertNull( result, "Expected OK, valid and trusted certificate" );
wizardBot.clickCancelButton();
@@ -847,31 +836,31 @@ public class CertificateValidationTest extends AbstractLdapTestUnit
}
- private void wizardBotWithLdaps()
+ private void wizardBotWithLdaps( TestLdapServer server )
{
// enter connection parameter and authentication parameter
wizardBot = connectionsViewBot.openNewConnectionWizard();
wizardBot.typeConnectionName( getConnectionName() );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPortSSL() );
+ wizardBot.typeHost( server.getHost() );
+ wizardBot.typePort( server.getPortSSL() );
wizardBot.selectLdapsEncryption();
wizardBot.clickNextButton();
- wizardBot.typeUser( "uid=admin,ou=system" );
- wizardBot.typePassword( "secret" );
+ wizardBot.typeUser( server.getAdminDn() );
+ wizardBot.typePassword( server.getAdminPassword() );
}
- private void wizardBotWithStartTls()
+ private void wizardBotWithStartTls( TestLdapServer server )
{
// enter connection parameter and authentication parameter
wizardBot = connectionsViewBot.openNewConnectionWizard();
wizardBot.typeConnectionName( getConnectionName() );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( server.getHost() );
+ wizardBot.typePort( server.getPort() );
wizardBot.selectStartTlsEncryption();
wizardBot.clickNextButton();
- wizardBot.typeUser( "uid=admin,ou=system" );
- wizardBot.typePassword( "secret" );
+ wizardBot.typeUser( server.getAdminDn() );
+ wizardBot.typePassword( server.getAdminPassword() );
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java
index 44642673e..af91b22ae 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ConnectionViewTest.java
@@ -21,27 +21,18 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.net.URL;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.ExportConnectionsWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.ImportConnectionsWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.NewConnectionFolderDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.NewConnectionWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.eclipse.core.runtime.Platform;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -50,36 +41,15 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class ConnectionViewTest extends AbstractLdapTestUnit
+public class ConnectionViewTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
-
- @Test
- public void testCreateAndDeleteConnections()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateAndDeleteConnections( TestLdapServer server )
{
String connectionName = "Test connection 1";
- createConnection( connectionName );
+ createConnection( connectionName, server );
// ensure connection is visible in Connections view
assertEquals( 1, connectionsViewBot.getCount() );
@@ -93,8 +63,9 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
}
- @Test
- public void testCreateAndDeleteConnectionFolders()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateAndDeleteConnectionFolders( TestLdapServer server )
{
String folderName = "Connection folder 1";
String subFolder1Name = "Connection folder 2";
@@ -131,8 +102,9 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
}
- @Test
- public void testExportImportConnections() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportConnections( TestLdapServer server ) throws Exception
{
String connection1Name = "Test connection 1";
String connection2Name = "Test connection 2";
@@ -142,14 +114,14 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
String subFolder2Name = "Connection folder 3";
// create connections and folders
- createConnection( connection1Name );
+ createConnection( connection1Name, server );
createConnectionFolder( folderName );
connectionsViewBot.select( folderName );
- createConnection( connection2Name );
+ createConnection( connection2Name, server );
connectionsViewBot.select( folderName );
createConnectionFolder( subFolder1Name );
connectionsViewBot.select( folderName, subFolder1Name );
- createConnection( connection3Name );
+ createConnection( connection3Name, server );
connectionsViewBot.select( folderName );
createConnectionFolder( subFolder2Name );
@@ -164,7 +136,7 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
// export connections and folders
URL url = Platform.getInstanceLocation().getURL();
- final String file = url.getFile() + "ImportExportConnections.zip";
+ final String file = url.getFile() + "ImportExportConnections" + server.getType() + ".zip";
ExportConnectionsWizardBot exportConnectionsWizardBot = connectionsViewBot.openExportConnectionsWizard();
exportConnectionsWizardBot.typeFile( file );
exportConnectionsWizardBot.clickFinishButton();
@@ -189,25 +161,24 @@ public class ConnectionViewTest extends AbstractLdapTestUnit
}
- private void createConnection( String connectionName )
+ private void createConnection( String connectionName, TestLdapServer server )
{
NewConnectionWizardBot wizardBot = connectionsViewBot.openNewConnectionWizard();
// enter connection parameter
wizardBot.typeConnectionName( connectionName );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( server.getHost() );
+ wizardBot.typePort( server.getPort() );
// jump to auth page
wizardBot.clickNextButton();
// enter authentication parameters
- wizardBot.typeUser( "uid=admin,ou=system" );
- wizardBot.typePassword( "secret" );
+ wizardBot.typeUser( server.getAdminDn() );
+ wizardBot.typePassword( server.getAdminPassword() );
// finish dialog
wizardBot.clickFinishButton( true );
- // connectionsViewBot.waitForConnection( connectionName );
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
index a83bed1e8..73b56793e 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
@@ -21,31 +21,31 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.ALIAS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.CONTEXT_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.TARGET_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.SUBENTRY_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.apache.directory.studio.ldifparser.LdifParserConstants;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.SelectCopyDepthDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SelectCopyStrategyBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -54,92 +54,67 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-@ApplyLdifFiles(clazz = CopyEntryTest.class, value = "org/apache/directory/studio/test/integration/ui/BrowserTest.ldif")
-public class CopyEntryTest extends AbstractLdapTestUnit
+public class CopyEntryTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
- private Connection connection;
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "CopyEntryTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
- @After
- public void tearDown() throws Exception
+ @AfterEach
+ public void resetPreferences()
{
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
// DIRSERVER-2133: reset check for children preference
BrowserCorePlugin.getDefault()
.getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, true );
}
- @Test
- public void testCopyPasteSingleEntryWithoutCopyDepthDialog() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteSingleEntryWithoutCopyDepthDialog( TestLdapServer server ) throws Exception
{
+ Dn newDn = dn( USER1_DN.getRdn(), TARGET_DN );
+
// expand the entry to avoid copy depth dialog
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.expandEntry( path( USER1_DN ) );
// copy an entry
browserViewBot.copy();
// select the parent entry where the copied entry should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" ) );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( newDn ) ) );
// paste the entry
browserViewBot.pasteEntry();
// verify the entry was copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" );
+ assertTrue( browserViewBot.existsEntry( path( newDn ) ) );
+ browserViewBot.selectEntry( path( newDn ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.1,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + newDn.getName(), "changetype: add" );
}
- @Test
- public void testCopyPasteMultipleEntriesWithCopyDepthDialogObjectOnly() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteMultipleEntriesWithCopyDepthDialogObjectOnly( TestLdapServer server ) throws Exception
{
// DIRSERVER-2133: disable check for children for this test
BrowserCorePlugin.getDefault()
.getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, false );
// select and copy multiple entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.expandEntry( path( USERS_DN ) );
String[] children =
{ "uid=user.1", "uid=user.2", "uid=user.3", "uid=user.4" };
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectChildrenOfEntry( children, path( USERS_DN ) );
browserViewBot.copy();
// select the parent entry where the copied entries should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" ) );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( TARGET_DN, "uid=user.1" ) ) );
// paste the entry
SelectCopyDepthDialogBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyDepthDialog( 4 );
@@ -147,41 +122,35 @@ public class CopyEntryTest extends AbstractLdapTestUnit
dialog.clickOkButton();
// verify the entries were copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.2" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.3" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "uid=user.4" ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "uid=user.1" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "uid=user.2" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "uid=user.3" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "uid=user.4" ) ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.1,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.2,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.3,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk(
- "dn: uid=user.4,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=system", "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "uid=user.1", TARGET_DN ), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "uid=user.2", TARGET_DN ), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "uid=user.3", TARGET_DN ), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "uid=user.4", TARGET_DN ), "changetype: add" );
}
- @Test
- public void testCopyPasteMultipleEntriesWithCopyDepthDialogSubtree() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteMultipleEntriesWithCopyDepthDialogSubtree( TestLdapServer server ) throws Exception
{
// select and copy multiple entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.expandEntry( path( CONTEXT_DN ) );
String[] children =
{ "ou=users", "ou=groups" };
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectChildrenOfEntry( children, path( CONTEXT_DN ) );
browserViewBot.copy();
// select the parent entry where the copied entries should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=target" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=groups" ) );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( TARGET_DN, "ou=users" ) ) );
+ assertFalse( browserViewBot.existsEntry( path( TARGET_DN, "ou=groups" ) ) );
// paste the entry
SelectCopyDepthDialogBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyDepthDialog( 2 );
@@ -189,40 +158,32 @@ public class CopyEntryTest extends AbstractLdapTestUnit
dialog.clickOkButton();
// verify the entries were copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users", "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users",
- "cn=\\#ACL_AD-Projects_Author" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=users",
- "l=eu + l=de + l=Berlin + l=Brandenburger Tor", "cn=A" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=groups" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "ou=groups",
- "cn=Administrators" ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "ou=users" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "ou=users", "uid=user.1" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "ou=users", "uid=user.8" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "ou=groups" ) ) );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "ou=groups", "cn=group.1" ) ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsOk( "dn: ou=users,ou=target,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk(
- "dn: cn=A,l=eu + l=de + l=Berlin + l=Brandenburger Tor,ou=users,ou=target,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: ou=groups,ou=target,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: cn=Administrators,ou=groups,ou=target,ou=system",
- "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "ou=users", TARGET_DN ), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( "ou=groups", TARGET_DN ), "changetype: add" );
}
- @Test
- public void testCopyPasteSingleEntryOverwrite() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteSingleEntryOverwrite( TestLdapServer server ) throws Exception
{
// expand the entry to avoid copy depth dialog
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.expandEntry( path( USER1_DN ) );
// copy an entry
browserViewBot.copy();
// select the parent entry where the copied entry should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
// paste the entry
SelectCopyStrategyBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyStrategy();
@@ -230,91 +191,134 @@ public class CopyEntryTest extends AbstractLdapTestUnit
dialog.clickOkButton();
// verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]", "dn: uid=user.1,ou=users,ou=system",
- "changetype: add", "uid: user.1" );
- modificationLogsViewBot.assertContainsOk( "dn: uid=user.1,ou=users,ou=system", "changetype: modify",
- "replace: uid" + LdifParserConstants.LINE_SEPARATOR + "uid: user.1" + LdifParserConstants.LINE_SEPARATOR
- + "-",
- "replace: objectclass" );
+ modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]",
+ "dn: " + USER1_DN.getName(), "changetype: add", "uid: user.1" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + USER1_DN.getName(), "changetype: modify", "replace: uid"
+ + LdifParserConstants.LINE_SEPARATOR + "uid: user.1" + LdifParserConstants.LINE_SEPARATOR + "-",
+ "replace: objectClass" );
}
- @Test
- public void testCopyPasteSingleEntryRename() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteSingleEntryRename( TestLdapServer server ) throws Exception
{
// expand the entry to avoid copy depth dialog
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.expandEntry( path( USER1_DN ) );
// copy an entry
browserViewBot.copy();
// select the parent entry where the copied entry should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
// paste the entry
+ Dn renamedDn = dn( "uid=user.renamed", USERS_DN );
SelectCopyStrategyBot dialog = browserViewBot.pasteEntriesExpectingSelectCopyStrategy();
dialog.selectRenameEntryAndContinue();
dialog.setRdnValue( 1, "user.renamed" );
dialog.clickOkButton();
// verify the entry was copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.renamed" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.renamed" );
+ assertTrue( browserViewBot.existsEntry( path( renamedDn ) ) );
+ browserViewBot.selectEntry( path( renamedDn ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]", "dn: uid=user.1,ou=users,ou=system",
- "changetype: add", "uid: user.1" );
- modificationLogsViewBot.assertContainsOk( "dn: uid=user.renamed,ou=users,ou=system", "changetype: add",
+ modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]",
+ "dn: " + USER1_DN.getName(), "changetype: add", "uid: user.1" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + renamedDn.getName(), "changetype: add",
"uid: user.renamed" );
}
- @Test
- public void testCopyPasteSpecialEntries() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteAliasEntry( TestLdapServer server ) throws Exception
{
// disable alias dereferencing
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
+
+ // expand the entry to avoid copy depth dialog
+ browserViewBot.expandEntry( path( ALIAS_DN ) );
+ browserViewBot.selectEntry( path( ALIAS_DN ) );
+ browserViewBot.copy();
+
+ // select the parent entry where the copied entry should be pasted to
+ browserViewBot.selectEntry( path( TARGET_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( TARGET_DN, ALIAS_DN.getRdn() ) ) );
+
+ // paste the entry
+ browserViewBot.pasteEntries( 1 );
+
+ // verify the entyr was copied
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, ALIAS_DN.getRdn() ) ) );
+
+ // verify in modification logs
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( ALIAS_DN.getRdn(), TARGET_DN ), "changetype: add" );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteReferralEntry( TestLdapServer server ) throws Exception
+ {
// enable ManageDsaIT control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
+
+ // expand the entry to avoid copy depth dialog
+ browserViewBot.expandEntry( path( REFERRAL_TO_USER1_DN ) );
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN ) );
+ browserViewBot.copy();
+
+ // select the parent entry where the copied entry should be pasted to
+ browserViewBot.selectEntry( path( TARGET_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( TARGET_DN, REFERRAL_TO_USER1_DN.getRdn() ) ) );
+
+ // paste the entry
+ browserViewBot.pasteEntries( 1 );
+
+ // verify the entry was copied
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, REFERRAL_TO_USER1_DN.getRdn() ) ) );
+
+ // verify in modification logs
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( REFERRAL_TO_USER1_DN.getRdn(), TARGET_DN ),
+ "changetype: add" );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testCopyPasteSubentry( TestLdapServer server ) throws Exception
+ {
// enable Subentries control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
- // expand the entries to avoid copy depth dialog
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" );
-
- // select and copy the entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
- String[] children =
- { "cn=alias", "cn=referral", "cn=subentry" };
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
+ // expand the entry to avoid copy depth dialog
+ browserViewBot.expandEntry( path( SUBENTRY_DN ) );
+ browserViewBot.selectEntry( path( SUBENTRY_DN ) );
browserViewBot.copy();
- // select the parent entry where the copied entries should be pasted to
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=target" );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=alias" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=referral" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=subentry" ) );
+ // select the parent entry where the copied entry should be pasted to
+ browserViewBot.selectEntry( path( TARGET_DN ) );
+ assertFalse( browserViewBot.existsEntry( path( TARGET_DN, SUBENTRY_DN.getRdn() ) ) );
- // paste the entries
- browserViewBot.pasteEntries( 3 );
+ // paste the entry
+ browserViewBot.pasteEntries( 1 );
- // verify the entries were copied
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=alias" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=referral" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=target", "cn=subentry" ) );
+ // verify the entry was copied
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, SUBENTRY_DN.getRdn() ) ) );
// verify in modification logs
- modificationLogsViewBot.assertContainsOk( "dn: cn=alias,ou=target,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: cn=referral,ou=target,ou=system",
- "control: 2.16.840.1.113730.3.4.2 false", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: cn=subentry,ou=target,ou=system", "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn( SUBENTRY_DN.getRdn(), TARGET_DN ), "changetype: add" );
}
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
index 756509956..6c38518cf 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java
@@ -21,53 +21,55 @@
package org.apache.directory.studio.test.integration.ui;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.BJENSEN_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.GROUP1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.HNELSON_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MULTI_VALUED_RDN_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.api.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.password.PasswordUtil;
import org.apache.directory.api.util.Strings;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ModifyMode;
import org.apache.directory.studio.ldifparser.LdifFormatParameters;
import org.apache.directory.studio.ldifparser.LdifParserConstants;
import org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
import org.apache.directory.studio.test.integration.ui.bots.AciItemEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
import org.apache.directory.studio.test.integration.ui.bots.CertificateEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.DnEditorDialogBot;
+import org.apache.directory.studio.test.integration.ui.bots.EditAttributeWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.HexEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.ImageEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.NewAttributeWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.PasswordEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SelectDnDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
import org.apache.directory.studio.test.integration.ui.bots.SubtreeSpecificationEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.TextEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Characters;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.Characters;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.ResourceUtils;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -76,50 +78,23 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-@ApplyLdifFiles(clazz = EntryEditorTest.class, value =
- { "org/apache/directory/studio/test/integration/ui/EntryEditorTest.ldif" })
-public class EntryEditorTest extends AbstractLdapTestUnit
+public class EntryEditorTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connectionsViewBot.createTestConnection( "EntryEditorTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test adding, editing and deleting of attributes in the entry editor.
*/
- @Test
- public void testAddEditDeleteAttribute() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testAddEditDeleteAttribute( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( BJENSEN_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( BJENSEN_DN.getName() );
entryEditorBot.activate();
String dn = entryEditorBot.getDnText();
- assertEquals( "DN: cn=Barbara Jensen,ou=users,ou=system", dn );
+ assertEquals( "DN: " + BJENSEN_DN.getName(), dn );
assertEquals( 8, entryEditorBot.getAttributeValues().size() );
assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
@@ -175,23 +150,33 @@ public class EntryEditorTest extends AbstractLdapTestUnit
assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the final description." ) );
modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the final description.\n-" );
- assertEquals( "Expected 6 modifications.", 6,
- StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ) );
+ assertEquals( 6, StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ),
+ "Expected 6 modifications." );
}
/**
* Test adding, editing and deleting of attributes without equality matching rule in the entry editor.
*/
- @Test
- public void testAddEditDeleteAttributeWithoutEqualityMatchingRule() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testAddEditDeleteAttributeWithoutEqualityMatchingRule( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen" );
+ Connection connection = connectionsViewBot.createTestConnection( server );
+
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+ .getBrowserConnection( connection );
+ browserConnection.setModifyModeNoEMR( ModifyMode.REPLACE );
+ }
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system" );
+ browserViewBot.selectEntry( path( BJENSEN_DN ) );
+
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( BJENSEN_DN.getName() );
entryEditorBot.activate();
String dn = entryEditorBot.getDnText();
- assertEquals( "DN: cn=Barbara Jensen,ou=users,ou=system", dn );
+ assertEquals( "DN: " + BJENSEN_DN.getName(), dn );
assertEquals( 8, entryEditorBot.getAttributeValues().size() );
assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
@@ -204,8 +189,18 @@ public class EntryEditorTest extends AbstractLdapTestUnit
entryEditorBot.typeValueAndFinish( "+1 234 567 890" );
assertEquals( 9, entryEditorBot.getAttributeValues().size() );
assertTrue( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: +1 234 567 890" ) );
- modificationLogsViewBot
- .waitForText( "add: facsimileTelephoneNumber\nfacsimileTelephoneNumber: +1 234 567 890" );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ modificationLogsViewBot
+ .waitForText( "replace: facsimileTelephoneNumber\nfacsimileTelephoneNumber: +1 234 567 890" );
+
+ }
+ else
+ {
+ modificationLogsViewBot
+ .waitForText( "add: facsimileTelephoneNumber\nfacsimileTelephoneNumber: +1 234 567 890" );
+
+ }
// edit value
entryEditorBot.editValue( "facsimileTelephoneNumber", "+1 234 567 890" );
@@ -213,38 +208,105 @@ public class EntryEditorTest extends AbstractLdapTestUnit
assertEquals( 9, entryEditorBot.getAttributeValues().size() );
assertFalse( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: +1 234 567 890" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: 000000000000" ) );
- modificationLogsViewBot
- .waitForText( "delete: facsimileTelephoneNumber\nfacsimileTelephoneNumber: +1 234 567 890" );
- modificationLogsViewBot.waitForText( "add: facsimileTelephoneNumber\nfacsimileTelephoneNumber: 000000000000" );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ modificationLogsViewBot
+ .waitForText( "replace: facsimileTelephoneNumber\nfacsimileTelephoneNumber: 000000000000" );
+
+ }
+ else
+ {
+ modificationLogsViewBot
+ .waitForText( "delete: facsimileTelephoneNumber\nfacsimileTelephoneNumber: +1 234 567 890" );
+ modificationLogsViewBot
+ .waitForText( "add: facsimileTelephoneNumber\nfacsimileTelephoneNumber: 000000000000" );
+ }
// delete 1st value/attribute
entryEditorBot.deleteValue( "facsimileTelephoneNumber", "000000000000" );
assertEquals( 8, entryEditorBot.getAttributeValues().size() );
assertFalse( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: 000000000000" ) );
- modificationLogsViewBot
- .waitForText( "delete: facsimileTelephoneNumber\nfacsimileTelephoneNumber: 000000000000\n-" );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ modificationLogsViewBot.waitForText( "replace: facsimileTelephoneNumber\n-" );
- assertEquals( "Expected 3 modifications.", 3,
- StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ) );
+ }
+ else
+ {
+ modificationLogsViewBot
+ .waitForText( "delete: facsimileTelephoneNumber\nfacsimileTelephoneNumber: 000000000000\n-" );
+ }
+
+ assertEquals( 3, StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ),
+ "Expected 3 modifications." );
+ }
+
+
+ /**
+ * DIRSTUDIO-1267:Test adding, editing and deleting of attributes with language tag in the entry editor.
+ */
+ @ParameterizedTest
+ @LdapServersSource(except = LdapServerType.ApacheDS, reason = "Language tags not yet supported by ApacheDS")
+ public void testAddEditDeleteAttributeWithLanguageTag( TestLdapServer server ) throws Exception
+ {
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
+ entryEditorBot.activate();
+
+ // add attribute description;lang-en
+ entryEditorBot.activate();
+ NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
+ assertTrue( wizardBot.isVisible() );
+ wizardBot.typeAttributeType( "description" );
+ wizardBot.clickNextButton();
+ wizardBot.setLanguageTag( "en", "" );
+ wizardBot.clickFinishButton();
+ entryEditorBot.typeValueAndFinish( "English" );
+ modificationLogsViewBot.waitForText( "add: description;lang-en\ndescription;lang-en: English\n-" );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-en: English" ) );
+
+ // edit the attribute to description;lang-en
+ EditAttributeWizardBot editWizardBot = entryEditorBot.editAttribute( "description;lang-en", "English" );
+ editWizardBot.clickNextButton();
+ editWizardBot.setLanguageTag( "en", "us" );
+ editWizardBot.clickFinishButton();
+ modificationLogsViewBot.waitForText( "delete: description;lang-en\ndescription;lang-en: English\n-" );
+ modificationLogsViewBot.waitForText( "add: description;lang-en-us\ndescription;lang-en-us: English\n-" );
+ assertFalse( entryEditorBot.getAttributeValues().contains( "description;lang-en: English" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-en-us: English" ) );
+
+ // edit the value
+ entryEditorBot.editValue( "description;lang-en-us", "English" );
+ entryEditorBot.typeValueAndFinish( "English US" );
+ modificationLogsViewBot.waitForText( "delete: description;lang-en-us\ndescription;lang-en-us: English\n-" );
+ modificationLogsViewBot.waitForText( "add: description;lang-en-us\ndescription;lang-en-us: English US\n-" );
+ assertFalse( entryEditorBot.getAttributeValues().contains( "description;lang-en-us: English" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-en-us: English US" ) );
+
+ // delete the attribute
+ entryEditorBot.deleteValue( "description;lang-en-us", "English US" );
+ modificationLogsViewBot.waitForText( "delete: description;lang-en-us\ndescription;lang-en-us: English US\n-" );
+ assertFalse( entryEditorBot.getAttributeValues().contains( "description;lang-en-us: English US" ) );
}
/**
* DIRSTUDIO-483: DN Editor escapes all non-ascii characters
- *
- * @throws Exception
- * the exception
*/
- @Test
- public void testDnValueEditor() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDnValueEditor( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=groups", "cn=My Group" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( GROUP1_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=My Group,ou=groups,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( GROUP1_DN.getName() );
entryEditorBot.activate();
String dn = entryEditorBot.getDnText();
- assertEquals( "DN: cn=My Group,ou=groups,ou=system", dn );
- assertEquals( 4, entryEditorBot.getAttributeValues().size() );
+ assertEquals( "DN: " + GROUP1_DN.getName(), dn );
+ assertEquals( 12, entryEditorBot.getAttributeValues().size() );
// add member attribute
NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
@@ -254,50 +316,46 @@ public class EntryEditorTest extends AbstractLdapTestUnit
assertTrue( dnEditorBot.isVisible() );
SelectDnDialogBot selectDnBot = dnEditorBot.clickBrowseButtonExpectingSelectDnDialog();
assertTrue( selectDnBot.isVisible() );
- selectDnBot.selectEntry( "Root DSE", "ou=system", "ou=users", "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"" );
+ selectDnBot.selectEntry( ArrayUtils.remove( path( MULTI_VALUED_RDN_DN ), 0 ) );
selectDnBot.clickOkButton();
- assertEquals( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system", dnEditorBot.getDnText() );
+ assertEquals( MULTI_VALUED_RDN_DN.getName(), dnEditorBot.getDnText() );
dnEditorBot.clickOkButton();
// assert value after saved and reloaded from server
SWTUtils.sleep( 1000 );
- assertEquals( 5, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains(
- "member: cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system" ) );
- dnEditorBot = entryEditorBot.editValueExpectingDnEditor( "member",
- "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system" );
- assertEquals( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system", dnEditorBot.getDnText() );
+ assertEquals( 13, entryEditorBot.getAttributeValues().size() );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "member: " + MULTI_VALUED_RDN_DN.getName() ) );
+ dnEditorBot = entryEditorBot.editValueExpectingDnEditor( "member", MULTI_VALUED_RDN_DN.getName() );
+ assertEquals( MULTI_VALUED_RDN_DN.getName(), dnEditorBot.getDnText() );
dnEditorBot.clickCancelButton();
modificationLogsViewBot.waitForText( "#!RESULT OK" );
- assertEquals( "Expected 1 modification.", 1,
- StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ) );
+ assertEquals( 1, StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ),
+ "Expected 1 modification." );
}
/**
* DIRSTUDIO-637: copy/paste of attributes no longer works.
* Test copy/paste within entry editor.
- *
- * @throws Exception
- * the exception
*/
- @Test
- public void testCopyPasteStringValue() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteStringValue( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( BJENSEN_DN ) );
// copy a value
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( BJENSEN_DN.getName() );
entryEditorBot.activate();
entryEditorBot.copyValue( "uid", "bjensen" );
// go to another entry
- browserViewBot
- .selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"" );
- entryEditorBot = studioBot.getEntryEditorBot( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system" );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
- assertEquals( 8, entryEditorBot.getAttributeValues().size() );
+ assertEquals( 23, entryEditorBot.getAttributeValues().size() );
// paste value, wait till job is done
JobWatcher watcher = new JobWatcher( BrowserCoreMessages.jobs__execute_ldif_name );
@@ -305,33 +363,36 @@ public class EntryEditorTest extends AbstractLdapTestUnit
watcher.waitUntilDone();
// assert pasted value visible in editor
- assertEquals( 9, entryEditorBot.getAttributeValues().size() );
- assertTrue( "Should contain uid=bjensen: " + entryEditorBot.getAttributeValues(),
- entryEditorBot.getAttributeValues().contains( "uid: bjensen" ) );
+ assertEquals( 24, entryEditorBot.getAttributeValues().size() );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "uid: bjensen" ),
+ "Should contain uid=bjensen: " + entryEditorBot.getAttributeValues() );
// assert pasted value was written to directory
- Entry entry = service.getAdminSession()
- .lookup( new Dn( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system" ) );
- assertTrue( "Should contain uid=bjensen: " + entry, entry.contains( "uid", "bjensen" ) );
+ server.withAdminConnection( conn -> {
+ Entry entry = conn.lookup( USER1_DN );
+ assertTrue( entry.contains( "uid", "bjensen" ), "Should contain uid=bjensen: " + entry );
+
+ } );
}
- @Test
- public void testCopyPasteMultipleStringAndBinaryValues() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteMultipleStringAndBinaryValues( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=hnelson" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( HNELSON_DN ) );
// copy the values
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=hnelson,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( HNELSON_DN.getName() );
entryEditorBot.activate();
- entryEditorBot.copyValues( "userpassword", "uid", "description", "jpegphoto" );
+ entryEditorBot.copyValues( "userPassword", "uid", "description", "jpegPhoto" );
// go to another entry
- browserViewBot
- .selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"" );
- entryEditorBot = studioBot.getEntryEditorBot( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system" );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
- assertEquals( 8, entryEditorBot.getAttributeValues().size() );
+ assertEquals( 23, entryEditorBot.getAttributeValues().size() );
// paste values, wait till job is done
JobWatcher watcher = new JobWatcher( BrowserCoreMessages.jobs__execute_ldif_name );
@@ -340,34 +401,37 @@ public class EntryEditorTest extends AbstractLdapTestUnit
// assert pasted values are visible in editor
SWTUtils.sleep( 1000 );
- assertEquals( 12, entryEditorBot.getAttributeValues().size() );
+ assertEquals( 27, entryEditorBot.getAttributeValues().size() );
assertTrue( entryEditorBot.getAttributeValues().contains( "uid: hnelson" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "description: " + Characters.ALL ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "jpegPhoto: JPEG-Image (1x1 Pixel, 631 Bytes)" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "userPassword: SSHA-512 hashed password" ) );
// assert pasted values were written to directory
- Entry entry = service.getAdminSession()
- .lookup( new Dn( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system" ) );
- assertTrue( "Should contain uid=hnelson: " + entry, entry.contains( "uid", "hnelson" ) );
- assertTrue( "Should contain description: " + entry, entry.contains( "description", Characters.ALL ) );
- assertTrue( "Should contain userPassword: " + entry, entry.containsAttribute( "userPassword" ) );
- assertTrue( "Should contain jpegPhoto: " + entry, entry.containsAttribute( "jpegPhoto" ) );
+ server.withAdminConnection( conn -> {
+ Entry entry = conn.lookup( USER1_DN );
+ assertTrue( entry.contains( "uid", "hnelson" ), "Should contain uid=hnelson: " + entry );
+ assertTrue( entry.contains( "description", Characters.ALL ), "Should contain description: " + entry );
+ assertTrue( entry.containsAttribute( "userPassword" ), "Should contain userPassword: " + entry );
+ assertTrue( entry.containsAttribute( "jpegPhoto" ), "Should contain jpegPhoto: " + entry );
+ } );
}
/**
* DIRSTUDIO-738: Add support for modular crypt format password
*/
- @Test
- public void testPasswordValueEditor() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testPasswordValueEditor( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( BJENSEN_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( BJENSEN_DN.getName() );
entryEditorBot.activate();
String dn = entryEditorBot.getDnText();
- assertEquals( "DN: cn=Barbara Jensen,ou=users,ou=system", dn );
+ assertEquals( "DN: " + BJENSEN_DN.getName(), dn );
assertEquals( 8, entryEditorBot.getAttributeValues().size() );
assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
@@ -467,15 +531,17 @@ public class EntryEditorTest extends AbstractLdapTestUnit
/**
* DIRSTUDIO-1157: Values cannot be modified by text editor
*/
- @Test
- public void testTextValueEditor() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testTextValueEditor( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( BJENSEN_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( BJENSEN_DN.getName() );
entryEditorBot.activate();
String dn = entryEditorBot.getDnText();
- assertEquals( "DN: cn=Barbara Jensen,ou=users,ou=system", dn );
+ assertEquals( "DN: " + BJENSEN_DN.getName(), dn );
assertEquals( 8, entryEditorBot.getAttributeValues().size() );
assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
@@ -508,47 +574,110 @@ public class EntryEditorTest extends AbstractLdapTestUnit
/**
- * DIRSTUDIO-1199, DIRSTUDIO-1204, DIRSTUDIO-1267: Binary attributes
+ * DIRSTUDIO-1199, DIRSTUDIO-1204, DIRSTUDIO-1267: Binary attributes.
+ * Test adding, editing and deleting of attributes with binary option in the entry editor.
*/
- @Test
- public void testCertificateValueEditor() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testCertificateValueEditor( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String certFile = ResourceUtils.prepareInputFile( "rfc5280_cert2.cer" );
+ String cert3File = ResourceUtils.prepareInputFile( "rfc5280_cert3.cer" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen" );
+ browserViewBot.selectEntry( path( BJENSEN_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( BJENSEN_DN.getName() );
entryEditorBot.activate();
+ // add userCertificate;binary
NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
assertTrue( wizardBot.isVisible() );
wizardBot.typeAttributeType( "userCertificate" );
wizardBot.clickNextButton();
wizardBot.selectBinaryOption();
CertificateEditorDialogBot certEditorBot = wizardBot.clickFinishButtonExpectingCertificateEditor();
-
assertTrue( certEditorBot.isVisible() );
certEditorBot.typeFile( certFile );
+ certEditorBot.clickOkButton();
+ modificationLogsViewBot.waitForText( "add: userCertificate;binary\nuserCertificate;binary:: " );
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate;binary: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ }
+ else
+ {
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ }
+ // edit userCertificate;binary
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ certEditorBot = entryEditorBot.editValueExpectingCertificateEditor( "userCertificate;binary",
+ "X.509v3: CN=End Entity,DC=example,DC=com" );
+ }
+ else
+ {
+ certEditorBot = entryEditorBot.editValueExpectingCertificateEditor( "userCertificate",
+ "X.509v3: CN=End Entity,DC=example,DC=com" );
+ }
+ assertTrue( certEditorBot.isVisible() );
+ certEditorBot.typeFile( cert3File );
certEditorBot.clickOkButton();
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ modificationLogsViewBot
+ .waitForText( "delete: userCertificate;binary\nuserCertificate;binary:: MIICcTCCAdqg" );
+ modificationLogsViewBot.waitForText( "add: userCertificate;binary\nuserCertificate;binary:: MIIDjjCCA06g" );
+ assertFalse( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate;binary: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate;binary: X.509v3: CN=DSA End Entity,DC=example,DC=com" ) );
+ }
+ else
+ {
+ modificationLogsViewBot.waitForText( "delete: userCertificate\nuserCertificate:: MIICcTCCAdqg" );
+ modificationLogsViewBot.waitForText( "add: userCertificate\nuserCertificate:: MIIDjjCCA06g" );
+ assertFalse( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate: X.509v3: CN=DSA End Entity,DC=example,DC=com" ) );
+ }
- modificationLogsViewBot.waitForText( "add: userCertificate;binary\nuserCertificate;binary:: " );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "userCertificate: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ // delete userCertificate;binary
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ entryEditorBot.deleteValue( "userCertificate;binary", "X.509v3: CN=DSA End Entity,DC=example,DC=com" );
+ modificationLogsViewBot
+ .waitForText( "delete: userCertificate;binary\nuserCertificate;binary:: MIIDjjCCA06g" );
+ assertFalse( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate;binary: X.509v3: CN=DSA End Entity,DC=example,DC=com" ) );
+ }
+ else
+ {
+ entryEditorBot.deleteValue( "userCertificate", "X.509v3: CN=DSA End Entity,DC=example,DC=com" );
+ modificationLogsViewBot.waitForText( "delete: userCertificate\nuserCertificate:: MIIDjjCCA06g" );
+ assertFalse( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate: X.509v3: CN=DSA End Entity,DC=example,DC=com" ) );
+ }
}
/**
* DIRSTUDIO-1199, DIRSTUDIO-1204: Binary attributes
*/
- @Test
- public void testImageValueEditor() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testImageValueEditor( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String imgFile = ResourceUtils.prepareInputFile( "studio_64x64.jpg" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen" );
+ browserViewBot.selectEntry( path( BJENSEN_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Barbara Jensen,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( BJENSEN_DN.getName() );
entryEditorBot.activate();
// add image
@@ -566,18 +695,20 @@ public class EntryEditorTest extends AbstractLdapTestUnit
}
- @Test
- public void testAciItemEditorAllOptions() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testAciItemEditorAllOptions( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=hnelson" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( HNELSON_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=hnelson,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( HNELSON_DN.getName() );
entryEditorBot.activate();
entryEditorBot.fetchOperationalAttributes();
SWTUtils.sleep( 1000 );
entryEditorBot.activate();
- AciItemEditorDialogBot aciItemEditor = entryEditorBot.editValueExpectingAciItemEditor( "entryaci", null );
+ AciItemEditorDialogBot aciItemEditor = entryEditorBot.editValueExpectingAciItemEditor( "entryACI", null );
aciItemEditor.activateSourceTab();
aciItemEditor.activateVisualEditorTab();
@@ -641,18 +772,20 @@ public class EntryEditorTest extends AbstractLdapTestUnit
/**
* Test for DIRSTUDIO-1135
*/
- @Test
- public void testAllAttributesValuesParser() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testAciItemEditorAllAttributesValuesParser( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=hnelson" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( HNELSON_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=hnelson,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( HNELSON_DN.getName() );
entryEditorBot.activate();
entryEditorBot.fetchOperationalAttributes();
SWTUtils.sleep( 1000 );
entryEditorBot.activate();
- AciItemEditorDialogBot aciItemEditor = entryEditorBot.editValueExpectingAciItemEditor( "entryaci", null );
+ AciItemEditorDialogBot aciItemEditor = entryEditorBot.editValueExpectingAciItemEditor( "entryACI", null );
aciItemEditor.activateSourceTab();
aciItemEditor.setSource(
@@ -671,23 +804,25 @@ public class EntryEditorTest extends AbstractLdapTestUnit
aciItemEditor.clickOkButton();
SWTUtils.sleep( 1000 );
- modificationLogsViewBot.waitForText( "delete: entryaci\n" );
- modificationLogsViewBot.waitForText( "add: entryaci\n" );
+ modificationLogsViewBot.waitForText( "delete: entryACI\n" );
+ modificationLogsViewBot.waitForText( "add: entryACI\n" );
}
- @Test
- public void testAciItemEditorEntryAci() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testAciItemEditorEntryAci( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=hnelson" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( HNELSON_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=hnelson,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( HNELSON_DN.getName() );
entryEditorBot.activate();
entryEditorBot.fetchOperationalAttributes();
SWTUtils.sleep( 1000 );
entryEditorBot.activate();
- AciItemEditorDialogBot aciItemEditor = entryEditorBot.editValueExpectingAciItemEditor( "entryaci", null );
+ AciItemEditorDialogBot aciItemEditor = entryEditorBot.editValueExpectingAciItemEditor( "entryACI", null );
aciItemEditor.activateSourceTab();
aciItemEditor.clickCheckSyntaxButtonOk();
@@ -711,23 +846,25 @@ public class EntryEditorTest extends AbstractLdapTestUnit
aciItemEditor.clickOkButton();
SWTUtils.sleep( 1000 );
- modificationLogsViewBot.waitForText( "delete: entryaci\n" );
- modificationLogsViewBot.waitForText( "add: entryaci\n" );
+ modificationLogsViewBot.waitForText( "delete: entryACI\n" );
+ modificationLogsViewBot.waitForText( "add: entryACI\n" );
}
- @Test
- public void testAciItemEditorPrescriptiveAci() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testAciItemEditorPrescriptiveAci( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=hnelson" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( HNELSON_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=hnelson,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( HNELSON_DN.getName() );
entryEditorBot.activate();
entryEditorBot.fetchOperationalAttributes();
SWTUtils.sleep( 1000 );
entryEditorBot.activate();
- AciItemEditorDialogBot aciItemEditor = entryEditorBot.editValueExpectingAciItemEditor( "prescriptiveaci",
+ AciItemEditorDialogBot aciItemEditor = entryEditorBot.editValueExpectingAciItemEditor( "prescriptiveACI",
null );
aciItemEditor.activateSourceTab();
@@ -740,24 +877,26 @@ public class EntryEditorTest extends AbstractLdapTestUnit
aciItemEditor.clickOkButton();
SWTUtils.sleep( 1000 );
- modificationLogsViewBot.waitForText( "delete: prescriptiveaci\n" );
- modificationLogsViewBot.waitForText( "add: prescriptiveaci\n" );
+ modificationLogsViewBot.waitForText( "delete: prescriptiveACI\n" );
+ modificationLogsViewBot.waitForText( "add: prescriptiveACI\n" );
}
- @Test
- public void testSubtreeSpecificationEditor() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testSubtreeSpecificationEditor( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=hnelson" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( HNELSON_DN ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=hnelson,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( HNELSON_DN.getName() );
entryEditorBot.activate();
entryEditorBot.fetchOperationalAttributes();
SWTUtils.sleep( 1000 );
entryEditorBot.activate();
SubtreeSpecificationEditorDialogBot subtreeEditorBot = entryEditorBot
- .editValueExpectingSubtreeSpecificationEditor( "subtreespecification",
+ .editValueExpectingSubtreeSpecificationEditor( "subtreeSpecification",
null );
subtreeEditorBot.clickOkButton();
@@ -767,18 +906,26 @@ public class EntryEditorTest extends AbstractLdapTestUnit
/**
* Test for DIRSTUDIO-1249, DIRSTUDIO-1267: userSMIMECertificate is a binary attribute.
*/
- @Test
- public void testHexEditor() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testHexEditor( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=hnelson" );
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+ .getBrowserConnection( connection );
+ browserConnection.setModifyModeNoEMR( ModifyMode.REPLACE );
+ }
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=hnelson,ou=users,ou=system" );
+ browserViewBot.selectEntry( path( HNELSON_DN ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( HNELSON_DN.getName() );
entryEditorBot.activate();
- assertTrue( entryEditorBot.getAttributeValues().contains( "usersmimecertificate: Binary Data (255 Bytes)" ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "usersmimecertificate: Binary Data (256 Bytes)" ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "usersmimecertificate: Binary Data (257 Bytes)" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "userSMIMECertificate: Binary Data (255 Bytes)" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "userSMIMECertificate: Binary Data (256 Bytes)" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "userSMIMECertificate: Binary Data (257 Bytes)" ) );
- HexEditorDialogBot hexEditorDialogBot = entryEditorBot.editValueExpectingHexEditor( "usersmimecertificate",
+ HexEditorDialogBot hexEditorDialogBot = entryEditorBot.editValueExpectingHexEditor( "userSMIMECertificate",
"Binary Data (256 Bytes)" );
String hexText = hexEditorDialogBot.getHexText();
assertTrue( hexText.contains( "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ........ ........" ) );
@@ -787,13 +934,13 @@ public class EntryEditorTest extends AbstractLdapTestUnit
assertTrue( hexText.contains( "f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff ........ ........" ) );
hexEditorDialogBot.clickCancelButton();
- hexEditorDialogBot = entryEditorBot.editValueExpectingHexEditor( "usersmimecertificate",
+ hexEditorDialogBot = entryEditorBot.editValueExpectingHexEditor( "userSMIMECertificate",
"Binary Data (255 Bytes)" );
hexText = hexEditorDialogBot.getHexText();
assertTrue( hexText.contains( "f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ........ ......." ) );
hexEditorDialogBot.clickCancelButton();
- hexEditorDialogBot = entryEditorBot.editValueExpectingHexEditor( "usersmimecertificate",
+ hexEditorDialogBot = entryEditorBot.editValueExpectingHexEditor( "userSMIMECertificate",
"Binary Data (257 Bytes)" );
hexText = hexEditorDialogBot.getHexText();
assertTrue( hexText.contains( "f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff ........ ........" ) );
@@ -807,7 +954,6 @@ public class EntryEditorTest extends AbstractLdapTestUnit
assertTrue( wizardBot.isVisible() );
wizardBot.typeAttributeType( "userSMIMECertificate" );
wizardBot.clickNextButton();
- wizardBot.selectBinaryOption();
HexEditorDialogBot hexEditorBot = wizardBot.clickFinishButtonExpectingHexEditor();
assertTrue( hexEditorBot.isVisible() );
@@ -815,9 +961,18 @@ public class EntryEditorTest extends AbstractLdapTestUnit
hexEditorBot.clickOkButton();
- modificationLogsViewBot.waitForText( "add: userSMIMECertificate;binary\nuserSMIMECertificate;binary:: " );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "usersmimecertificate: Binary Data (629 Bytes)" ) );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ modificationLogsViewBot.waitForText( "replace: userSMIMECertificate\nuserSMIMECertificate:: " );
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userSMIMECertificate: Binary Data (629 Bytes)" ) );
+ }
+ else
+ {
+ modificationLogsViewBot.waitForText( "add: userSMIMECertificate\nuserSMIMECertificate:: " );
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userSMIMECertificate: Binary Data (629 Bytes)" ) );
+ }
}
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java
index 6b302a841..29a8a64cf 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ErrorHandlingTest.java
@@ -21,29 +21,20 @@
package org.apache.directory.studio.test.integration.ui;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.ldap.handlers.extended.PwdModifyHandler;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.ErrorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -52,41 +43,14 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") }, extendedOpHandlers =
- { PwdModifyHandler.class })
-@ApplyLdifFiles(clazz = ErrorHandlingTest.class, value = "org/apache/directory/studio/test/integration/ui/BrowserTest.ldif")
-public class ErrorHandlingTest extends AbstractLdapTestUnit
+public class ErrorHandlingTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connectionsViewBot.createTestConnection( "BrowserTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
-
- @Test
- public void testDeleteObjectClassTopSchemaEntryShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testDeleteObjectClassTopSchemaEntryShouldFail( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
browserViewBot.selectEntry( "DIT", "Root DSE", "ou=schema", "cn=system", "ou=objectClasses", "m-oid=2.5.6.0" );
browserViewBot.expandEntry( "DIT", "Root DSE", "ou=schema", "cn=system", "ou=objectClasses", "m-oid=2.5.6.0" );
DeleteDialogBot deleteDialog = browserViewBot.openDeleteDialog();
@@ -102,48 +66,65 @@ public class ErrorHandlingTest extends AbstractLdapTestUnit
}
- @Test
- public void testDeleteObjectClassAttributeShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testDeleteObjectClassAttributeShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
- ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "objectclass",
+ ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "objectClass",
"inetOrgPerson (structural)" );
+ String expectedError = "65 - objectClassViolation";
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ expectedError = "69 - objectClassModsProhibited";
+ }
+
// verify message in error dialog
- assertThat( errorDialog.getErrorMessage(), containsString( "[LDAP result code 65 - objectClassViolation]" ) );
+ assertThat( errorDialog.getErrorMessage(), containsString( "[LDAP result code " + expectedError + "]" ) );
errorDialog.clickOkButton();
- // verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 65 - objectClassViolation]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify" );
+ modificationLogsViewBot.assertContainsError( "[LDAP result code " + expectedError + "]",
+ "dn: " + USER1_DN.getName(), "changetype: modify" );
}
- @Test
- public void testDeleteRdnAttributeShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testDeleteRdnAttributeShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "uid", "user.1" );
+ String expectedError = "67 - notAllowedOnRDN";
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ expectedError = "64 - namingViolation";
+ }
+
// verify message in error dialog
- assertThat( errorDialog.getErrorMessage(), containsString( "[LDAP result code 67 - notAllowedOnRDN]" ) );
+ assertThat( errorDialog.getErrorMessage(), containsString( "[LDAP result code " + expectedError + "]" ) );
errorDialog.clickOkButton();
// verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 67 - notAllowedOnRDN]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify", "delete: uid" );
+ modificationLogsViewBot.assertContainsError( "[LDAP result code " + expectedError + "]",
+ "dn: " + USER1_DN.getName(), "changetype: modify", "delete: uid" );
}
- @Test
- public void testDeleteMustAttributeShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDeleteMustAttributeShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "sn", "Amar" );
@@ -153,40 +134,54 @@ public class ErrorHandlingTest extends AbstractLdapTestUnit
// verify in modification logs
modificationLogsViewBot.assertContainsError( "[LDAP result code 65 - objectClassViolation]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify", "delete: sn" );
+ "dn: " + USER1_DN.getName(), "changetype: modify", "delete: sn" );
}
- @Test
- public void testDeleteOperationalAttributeShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testDeleteOperationalAttributeShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
entryEditorBot.fetchOperationalAttributes();
SWTUtils.sleep( 1000 );
entryEditorBot.activate();
- ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "nbChildren", "0" );
+ ErrorDialogBot errorDialog = entryEditorBot.deleteValueExpectingErrorDialog( "creatorsName", null );
+
+ String expectedError = "50 - insufficientAccessRights";
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ expectedError = "19 - constraintViolation";
+ }
+ if ( server.getType() == LdapServerType.Fedora389ds )
+ {
+ expectedError = "53 - unwillingToPerform";
+ }
// verify message in error dialog
assertThat( errorDialog.getErrorMessage(),
- containsString( "[LDAP result code 50 - insufficientAccessRights]" ) );
+ containsString( "[LDAP result code " + expectedError + "]" ) );
errorDialog.clickOkButton();
// verify in modification logs
- modificationLogsViewBot.assertContainsError( "[LDAP result code 50 - insufficientAccessRights]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify", "delete: nbChildren" );
+ modificationLogsViewBot.assertContainsError( "[LDAP result code " + expectedError + "]",
+ "dn: " + USER1_DN.getName(), "changetype: modify", "delete: creatorsName" );
}
- @Test
- public void testModifyInvalidSyntaxShouldFail() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testModifyInvalidSyntaxShouldFail( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( ( USER1_DN ) ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
- entryEditorBot.editValue( "telephonenumber", "976-893-3312" );
- ErrorDialogBot errorDialog = entryEditorBot.typeValueAndFinishAndExpectErrorDialog( "Invalid phone number" );
+ entryEditorBot.editValue( "mail", null );
+ ErrorDialogBot errorDialog = entryEditorBot.typeValueAndFinishAndExpectErrorDialog( "äöüß" );
// verify message in error dialog
assertThat( errorDialog.getErrorMessage(),
@@ -195,22 +190,22 @@ public class ErrorHandlingTest extends AbstractLdapTestUnit
// verify in modification logs
modificationLogsViewBot.assertContainsError( "[LDAP result code 21 - invalidAttributeSyntax]",
- "dn: uid=user.1,ou=users,ou=system", "changetype: modify", "delete: telephonenumber",
- "telephonenumber: 976-893-3312", "-", "add: telephonenumber",
- "telephonenumber: Invalid phone number" );
+ "dn: " + USER1_DN.getName(), "changetype: modify", "delete: mail" );
}
- @Ignore("Until DIRSERVER-2308 is fixed")
- @Test
- public void testRenameAlreadyExistingEntry() throws Exception
+ @Disabled("Until DIRSERVER-2308 is fixed")
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRenameAlreadyExistingEntry( TestLdapServer server ) throws Exception
{
}
- @Ignore("Until DIRSERVER-2308 is fixed")
- @Test
- public void testMoveAlreadyExistingEntry() throws Exception
+ @Disabled("Until DIRSERVER-2308 is fixed")
+ @ParameterizedTest
+ @LdapServersSource
+ public void testMoveAlreadyExistingEntry( TestLdapServer server ) throws Exception
{
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java
index 0bc2f6856..f2c867f08 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ExtendedOperationsTest.java
@@ -21,32 +21,26 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.ldap.handlers.extended.PwdModifyHandler;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.BotUtils;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.ErrorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
+import org.apache.directory.studio.test.integration.ui.bots.GeneratedPasswordDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.PasswordEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.PasswordModifyExtendedOperationDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -55,50 +49,22 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") }, extendedOpHandlers =
- { PwdModifyHandler.class })
-@ApplyLdifFiles(clazz = ExtendedOperationsTest.class, value = "org/apache/directory/studio/test/integration/ui/BrowserTest.ldif")
-public class ExtendedOperationsTest extends AbstractLdapTestUnit
+public class ExtendedOperationsTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- @Before
- public void setUp() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testPasswordModifyExtendedOperationDialogValidation( TestLdapServer server ) throws Exception
{
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connectionsViewBot.createTestConnection( "BrowserTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
-
- @Test
- public void testPasswordModifyExtendedOperationDialogValidation()
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
// Open dialog
PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
assertTrue( dialogBot.isVisible() );
// Verify default UI state
- assertEquals( "uid=user.1,ou=users,ou=system", dialogBot.getUserIdentity() );
+ assertEquals( USER1_DN.getName(), dialogBot.getUserIdentity() );
assertFalse( dialogBot.useBindUserIdentity() );
assertEquals( "", dialogBot.getOldPassword() );
assertFalse( dialogBot.noOldPassword() );
@@ -154,17 +120,18 @@ public class ExtendedOperationsTest extends AbstractLdapTestUnit
}
- @Test
- public void testPasswordModifyExtendedOperationDialogOk()
+ @ParameterizedTest
+ @LdapServersSource(except = LdapServerType.Fedora389ds, reason = "389ds requires secure connection")
+ public void testPasswordModifyExtendedOperationDialogSetNewPassword( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String random = RandomStringUtils.random( 20 );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- String dn = "uid=user.1,ou=users,ou=system";
+ browserViewBot.selectEntry( path( USER1_DN ) );
// Open dialog
PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
assertTrue( dialogBot.isVisible() );
- assertEquals( dn, dialogBot.getUserIdentity() );
+ assertEquals( USER1_DN.getName(), dialogBot.getUserIdentity() );
// Change password
dialogBot.noOldPassword( true );
@@ -174,24 +141,100 @@ public class ExtendedOperationsTest extends AbstractLdapTestUnit
// Verify and bind with the correct password
browserViewBot.refresh();
BotUtils.sleep( 1000L );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
- PasswordEditorDialogBot pwdEditorBot = entryEditorBot.editValueExpectingPasswordEditor( "userPassword",
- "Plain text password" );
+ PasswordEditorDialogBot pwdEditorBot = entryEditorBot.editValueExpectingPasswordEditor( "userPassword", null );
pwdEditorBot.activateCurrentPasswordTab();
pwdEditorBot.setVerifyPassword( random );
assertNull( pwdEditorBot.clickVerifyButton() );
assertNull( pwdEditorBot.clickBindButton() );
+
pwdEditorBot.clickCancelButton();
}
- @Test
- public void testPasswordModifyExtendedOperationDialogError()
+ @ParameterizedTest
+ @LdapServersSource(mode=Mode.All, except = LdapServerType.Fedora389ds, reason = "389ds requires secure connection")
+ public void testPasswordModifyExtendedOperationDialogGenerateNewPassword( TestLdapServer server ) throws Exception
+ {
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+
+ // Open dialog
+ PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
+ assertTrue( dialogBot.isVisible() );
+ assertEquals( USER1_DN.getName(), dialogBot.getUserIdentity() );
+
+ // Generate password
+ dialogBot.noOldPassword( true );
+ dialogBot.generateNewPassword( true );
+
+ // ApacheDS does not support password generation
+ if ( server.getType() == LdapServerType.ApacheDS )
+ {
+ ErrorDialogBot errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
+ assertThat( errorBot.getErrorMessage(), containsString( "null new password" ) );
+ errorBot.clickOkButton();
+ dialogBot.activate();
+ dialogBot.clickCancelButton();
+ }
+ else
+ {
+ dialogBot.clickOkButton();
+ GeneratedPasswordDialogBot generatedPasswordDialogBot = new GeneratedPasswordDialogBot();
+ String generatedPassword = generatedPasswordDialogBot.getGeneratedPassword();
+ generatedPasswordDialogBot.clickOkButton();
+
+ // Verify and bind with the correct password
+ browserViewBot.refresh();
+ BotUtils.sleep( 1000L );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
+ entryEditorBot.activate();
+ PasswordEditorDialogBot pwdEditorBot = entryEditorBot.editValueExpectingPasswordEditor( "userPassword",
+ null );
+ pwdEditorBot.activateCurrentPasswordTab();
+ pwdEditorBot.setVerifyPassword( generatedPassword );
+ assertNull( pwdEditorBot.clickVerifyButton() );
+ assertNull( pwdEditorBot.clickBindButton() );
+ pwdEditorBot.clickCancelButton();
+ }
+
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.Fedora389ds, reason = "389ds requires secure connection")
+ public void testPasswordModifyExtendedOperationRequiresSecureConnection( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String random = RandomStringUtils.random( 20 );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- String dn = "uid=user.1,ou=users,ou=system";
+ browserViewBot.selectEntry( path( USER1_DN ) );
+
+ // Open dialog
+ PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
+ assertTrue( dialogBot.isVisible() );
+ assertEquals( USER1_DN.getName(), dialogBot.getUserIdentity() );
+
+ // Change password
+ dialogBot.noOldPassword( true );
+ dialogBot.setNewPassword( random );
+ ErrorDialogBot errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
+ assertThat( errorBot.getErrorMessage(), containsString( "Operation requires a secure connection" ) );
+ errorBot.clickOkButton();
+
+ dialogBot.activate();
+ dialogBot.clickCancelButton();
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(mode=Mode.All)
+ public void testPasswordModifyExtendedOperationDialogError( TestLdapServer server ) throws Exception
+ {
+ connectionsViewBot.createTestConnection( server );
+ String random = RandomStringUtils.random( 20 );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ String dn = USER1_DN.getName();
// Open dialog
PasswordModifyExtendedOperationDialogBot dialogBot = browserViewBot.openPasswordModifyExtendedOperationDialog();
@@ -204,7 +247,18 @@ public class ExtendedOperationsTest extends AbstractLdapTestUnit
dialogBot.setOldPassword( "wrong password" );
dialogBot.setNewPassword( random );
ErrorDialogBot errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
- assertTrue( errorBot.getErrorMessage().contains( "invalid credentials" ) );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "unwilling to verify old password" ) );
+ }
+ else if ( server.getType() == LdapServerType.Fedora389ds )
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "Operation requires a secure connection" ) );
+ }
+ else
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "invalid credentials" ) );
+ }
errorBot.clickOkButton();
// Not existing entry
@@ -213,17 +267,31 @@ public class ExtendedOperationsTest extends AbstractLdapTestUnit
dialogBot.noOldPassword( true );
dialogBot.setNewPassword( random );
errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
- assertTrue( errorBot.getErrorMessage().contains( "The entry does not exist" ) );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "unable to retrieve SASL username" ) );
+ }
+ else if ( server.getType() == LdapServerType.Fedora389ds )
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "Operation requires a secure connection" ) );
+ }
+ else
+ {
+ assertThat( errorBot.getErrorMessage(), containsString( "The entry does not exist" ) );
+ }
errorBot.clickOkButton();
// ApacheDS does not support password generation
- dialogBot.activate();
- dialogBot.setUserIdentity( dn );
- dialogBot.noOldPassword( true );
- dialogBot.generateNewPassword( true );
- errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
- assertTrue( errorBot.getErrorMessage().contains( "null new password" ) );
- errorBot.clickOkButton();
+ if ( server.getType() == LdapServerType.ApacheDS )
+ {
+ dialogBot.activate();
+ dialogBot.setUserIdentity( dn );
+ dialogBot.noOldPassword( true );
+ dialogBot.generateNewPassword( true );
+ errorBot = dialogBot.clickOkButtonExpectingErrorDialog();
+ assertThat( errorBot.getErrorMessage(), containsString( "null new password" ) );
+ errorBot.clickOkButton();
+ }
dialogBot.activate();
dialogBot.clickCancelButton();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/Fedora389dsTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/Fedora389dsTest.java
deleted file mode 100644
index 7c3b4888f..000000000
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/Fedora389dsTest.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * 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.
- *
- */
-
-package org.apache.directory.studio.test.integration.ui;
-
-
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.directory.api.ldap.model.exception.LdapAuthenticationException;
-import org.apache.directory.api.ldap.model.ldif.LdifEntry;
-import org.apache.directory.api.ldap.model.ldif.LdifReader;
-import org.apache.directory.ldap.client.api.LdapNetworkConnection;
-import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
-import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.NewAttributeWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.NewConnectionWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.SearchDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-
-/**
- * Tests against 389 Directory Sever.
- *
- * Expects a running 389ds server with below default connection parameters
- * which can be configured via environment variables.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-public class Fedora389dsTest
-{
- static String getOrDefault( String key, String defaultValue )
- {
- return System.getenv().getOrDefault( key, defaultValue );
- }
-
- private static final String FEDORA_389DS_HOST = getOrDefault( "FEDORA_389DS_HOST", LOCALHOST );
- private static final int FEDORA_389DS_PORT = Integer.parseInt( getOrDefault( "FEDORA_389DS_PORT", "21389" ) );
- private static final String FEDORA_389DS_ADMIN_DN = getOrDefault( "FEDORA_389DS_ADMIN_DN", "cn=Directory Manager" );
- private static final String FEDORA_389DS_ADMIN_PASSWORD = getOrDefault( "FEDORA_389DS_ADMIN_PASSWORD", "admin" );
-
- @BeforeClass
- public static void skip389dsTestIfNotRunning() throws Exception
- {
-
- try ( LdapNetworkConnection connection = new LdapNetworkConnection( FEDORA_389DS_HOST, FEDORA_389DS_PORT ) )
- {
- connection.connect();
- connection.bind( FEDORA_389DS_ADMIN_DN, FEDORA_389DS_ADMIN_PASSWORD );
- }
- catch ( InvalidConnectionException e )
- {
- Assume.assumeNoException(
- "Skipping tests as connection to Fedora 389 DS failed: " + FEDORA_389DS_HOST + ":" + FEDORA_389DS_PORT, e );
- }
- catch ( LdapAuthenticationException e )
- {
- Assume.assumeNoException(
- "Skipping tests as bind to Fedora 389 DS failed: " + FEDORA_389DS_HOST + ":" + FEDORA_389DS_PORT, e );
- }
- }
-
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- private Connection connection;
-
- @Before
- public void setUp() throws Exception
- {
- try ( LdapNetworkConnection connection = new LdapNetworkConnection( FEDORA_389DS_HOST, FEDORA_389DS_PORT );
- LdifReader ldifReader = new LdifReader( Fedora389dsTest.class.getResourceAsStream( "Fedora389dsTest.ldif" ) ) )
- {
- connection.bind( FEDORA_389DS_ADMIN_DN, FEDORA_389DS_ADMIN_PASSWORD );
- for ( LdifEntry entry : ldifReader )
- {
- connection.add( entry.getEntry() );
- }
- }
-
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "Fedora389dsTest", FEDORA_389DS_HOST, FEDORA_389DS_PORT,
- FEDORA_389DS_ADMIN_DN, FEDORA_389DS_ADMIN_PASSWORD );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
-
- try ( LdapNetworkConnection connection = new LdapNetworkConnection( FEDORA_389DS_HOST, FEDORA_389DS_PORT );
- LdifReader ldifReader = new LdifReader( Fedora389dsTest.class.getResourceAsStream( "Fedora389dsTest.ldif" ) ) )
- {
- connection.bind( FEDORA_389DS_ADMIN_DN, FEDORA_389DS_ADMIN_PASSWORD );
- List<LdifEntry> ldifEntries = StreamSupport.stream( ldifReader.spliterator(), false )
- .collect( Collectors.toList() );
- Collections.reverse( ldifEntries );
- for ( LdifEntry entry : ldifEntries )
- {
- connection.delete( entry.getDn() );
- }
- }
- }
-
-
- @Test
- public void testBrowseWithPagingWithScrollMode()
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
-
- // enable Simple Paged Results control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH, true );
- connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE, 3 );
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SCROLL_MODE, true );
-
- // 1st page
- browserViewBot.expandEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
-
- // next page
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
-
- // last page
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
-
- // back to top
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
- }
-
-
- @Test
- public void testBrowseWithPagingWithoutScrollMode()
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
-
- // enable Simple Paged Results control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH, true );
- connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE, 3 );
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SCROLL_MODE, false );
-
- browserViewBot.expandEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users (8)" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.8" ) );
- }
-
-
- @Test
- public void testSearchWithPagingWithScrollMode() throws Exception
- {
- String searchName = "Paged search with scroll mode";
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
- SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
- assertTrue( dialogBot.isVisible() );
- dialogBot.setSearchName( searchName );
- dialogBot.setFilter( "(objectClass=*)" );
- dialogBot.setReturningAttributes( "objectClass,ou,cn,uid" );
- dialogBot.setControlPagedSearch( true, 3, true );
- dialogBot.clickSearchButton();
-
- // 1st page
- browserViewBot.expandEntry( "Searches", searchName );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
-
- // next page
- browserViewBot.selectEntry( "Searches", searchName, "--- Next Page ---" );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
-
- // last page
- browserViewBot.selectEntry( "Searches", searchName, "--- Next Page ---" );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
-
- // back to top
- browserViewBot.selectEntry( "Searches", searchName, "--- Top Page ---" );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
- }
-
-
- @Test
- public void testSearchWithPagingWithoutScrollMode() throws Exception
- {
- String searchName = "Paged search without scroll mode";
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
- SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
- assertTrue( dialogBot.isVisible() );
- dialogBot.setSearchName( searchName );
- dialogBot.setFilter( "(objectClass=*)" );
- dialogBot.setReturningAttributes( "objectClass,ou,cn,uid" );
- dialogBot.setControlPagedSearch( true, 3, false );
- dialogBot.clickSearchButton();
-
- browserViewBot.expandEntry( "Searches", searchName );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName + " (9+)" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "uid=user.8" ) );
- }
-
-
- @Test
- public void testCheckAuthenticationButtonNotOK()
- {
- // enter connection parameter
- NewConnectionWizardBot wizardBot = connectionsViewBot.openNewConnectionWizard();
- wizardBot.typeConnectionName( "Fedora 389 DS connection test not ok" );
- wizardBot.typeHost( FEDORA_389DS_HOST );
- wizardBot.typePort( FEDORA_389DS_PORT );
- wizardBot.clickNextButton();
-
- // enter incorrect authentication parameter
- wizardBot.typeUser( FEDORA_389DS_ADMIN_DN );
- wizardBot.typePassword( "wrongpassword" );
-
- // click "Check Network Parameter" button
- String result = wizardBot.clickCheckAuthenticationButton();
- assertNotNull( "Expected Error", result );
- assertThat( result, containsString( "[LDAP result code 49 - invalidCredentials]" ) );
-
- wizardBot.clickCancelButton();
- }
-
-
- /**
- * Test adding, editing and deleting of attributes in the entry editor.
- */
- @Test
- public void testAddEditDeleteAttribute() throws Exception
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.1" );
-
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,dc=example,dc=org" );
- entryEditorBot.activate();
- String dn = entryEditorBot.getDnText();
- assertEquals( "DN: uid=user.1,ou=users,dc=example,dc=org", dn );
- assertEquals( 22, entryEditorBot.getAttributeValues().size() );
- assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
-
- // add description attribute
- entryEditorBot.activate();
- NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
- assertTrue( wizardBot.isVisible() );
- wizardBot.typeAttributeType( "description" );
- wizardBot.clickFinishButton();
- entryEditorBot.typeValueAndFinish( "This is the 1st description." );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- modificationLogsViewBot.waitForText( "add: description\ndescription: This is the 1st description." );
-
- // add second value
- entryEditorBot.activate();
- entryEditorBot.addValue( "description" );
- entryEditorBot.typeValueAndFinish( "This is the 2nd description." );
- assertEquals( 24, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 2nd description." ) );
- modificationLogsViewBot.waitForText( "add: description\ndescription: This is the 2nd description." );
-
- // edit second value
- entryEditorBot.editValue( "description", "This is the 2nd description." );
- entryEditorBot.typeValueAndFinish( "This is the 3rd description." );
- assertEquals( 24, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the 2nd description." ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 3rd description." ) );
- modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the 2nd description." );
- modificationLogsViewBot.waitForText( "add: description\ndescription: This is the 3rd description." );
-
- // delete second value
- entryEditorBot.deleteValue( "description", "This is the 3rd description." );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the 3rd description." ) );
- modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the 3rd description." );
-
- // edit 1st value
- entryEditorBot.editValue( "description", "This is the 1st description." );
- entryEditorBot.typeValueAndFinish( "This is the final description." );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the final description." ) );
- modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the 1st description." );
- modificationLogsViewBot.waitForText( "add: description\ndescription: This is the final description." );
-
- // delete 1st value/attribute
- entryEditorBot.deleteValue( "description", "This is the final description." );
- assertEquals( 22, entryEditorBot.getAttributeValues().size() );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the final description." ) );
- modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the final description.\n-" );
-
- assertEquals( "Expected 6 modifications.", 6,
- StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ) );
- }
-
-
- /**
- * Test adding, editing and deleting of attributes without equality matching rule in the entry editor.
- */
- @Test
- public void testAddEditDeleteAttributeWithoutEqualityMatchingRule() throws Exception
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.1" );
-
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,dc=example,dc=org" );
- entryEditorBot.activate();
- String dn = entryEditorBot.getDnText();
- assertEquals( "DN: uid=user.1,ou=users,dc=example,dc=org", dn );
- assertEquals( 22, entryEditorBot.getAttributeValues().size() );
- assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
-
- // add facsimileTelephoneNumber attribute
- entryEditorBot.activate();
- NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
- assertTrue( wizardBot.isVisible() );
- wizardBot.typeAttributeType( "facsimileTelephoneNumber" );
- wizardBot.clickFinishButton();
- entryEditorBot.typeValueAndFinish( "+1 234 567 890" );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: +1 234 567 890" ) );
- modificationLogsViewBot
- .waitForText( "add: facsimileTelephoneNumber\nfacsimileTelephoneNumber: +1 234 567 890" );
-
- // edit value
- entryEditorBot.editValue( "facsimileTelephoneNumber", "+1 234 567 890" );
- entryEditorBot.typeValueAndFinish( "000000000000" );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertFalse( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: +1 234 567 890" ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: 000000000000" ) );
- modificationLogsViewBot.waitForText( "delete: facsimileTelephoneNumber\nfacsimileTelephoneNumber: +1 234 567 890" );
- modificationLogsViewBot.waitForText( "add: facsimileTelephoneNumber\nfacsimileTelephoneNumber: 000000000000" );
-
- // delete 1st value/attribute
- entryEditorBot.deleteValue( "facsimileTelephoneNumber", "000000000000" );
- assertEquals( 22, entryEditorBot.getAttributeValues().size() );
- assertFalse( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: 000000000000" ) );
- modificationLogsViewBot.waitForText( "delete: facsimileTelephoneNumber\nfacsimileTelephoneNumber: 000000000000\n-" );
-
- assertEquals( "Expected 3 modifications.", 3,
- StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ) );
- }
-
-}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java
index 149176b38..35dc1dd1c 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/GssApiTest.java
@@ -21,13 +21,14 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.apache.directory.studio.test.integration.ui.utils.Constants.LOCALHOST;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Method;
import java.net.URL;
import java.nio.charset.StandardCharsets;
@@ -36,25 +37,18 @@ import javax.security.auth.kerberos.KerberosPrincipal;
import org.apache.directory.api.util.FileUtils;
import org.apache.directory.api.util.IOUtils;
import org.apache.directory.studio.test.integration.ui.bots.ApacheDSConfigurationEditorBot;
-import org.apache.directory.studio.test.integration.ui.bots.ApacheDSServersViewBot;
import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.ImportWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.NewApacheDSServerWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.NewConnectionWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
+import org.apache.directory.studio.test.integration.ui.utils.Constants;
import org.eclipse.core.runtime.Platform;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
@@ -63,42 +57,15 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-public class GssApiTest
+public class GssApiTest extends AbstractTestBase
{
private static final String serverName = "GssApiTest";
- @Rule
- public TestName name = new TestName();
-
private static int ldapPort;
private static int kdcPort;
+ private TestInfo testInfo;
- private static StudioBot studioBot;
- private static ApacheDSServersViewBot serversViewBot;
- private static ConnectionsViewBot connectionsViewBot;
-
-
- @BeforeClass
- public static void setUpClass() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- serversViewBot = studioBot.getApacheDSServersViewBot();
- connectionsViewBot = studioBot.getConnectionView();
-
- // ErrorDialog.AUTOMATED_MODE = false;
- }
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot.resetLdapPerspective();
- }
-
-
- @BeforeClass
+ @BeforeAll
public static void skipGssApiTestIfNoDefaultRealmIsConfigured()
{
try
@@ -112,31 +79,31 @@ public class GssApiTest
}
catch ( IllegalArgumentException e )
{
- Assume.assumeNoException( "Skipping tests as no default realm (/etc/krb5.conf) is configured", e );
+ Assumptions.assumeTrue( false, "Skipping tests as no default realm (/etc/krb5.conf) is configured" );
}
}
- @After
- public void tearDown() throws Exception
+ @BeforeEach
+ public void beforeEach( TestInfo testInfo )
{
- connectionsViewBot.deleteTestConnections();
+ this.testInfo = testInfo;
+ }
+
+ @AfterEach
+ public void afterEach() throws Exception
+ {
// stop ApacheDS
serversViewBot.stopServer( serverName );
serversViewBot.waitForServerStop( serverName );
-
- // delete ApacheDS
- DeleteDialogBot deleteDialogBot = serversViewBot.openDeleteServerDialog();
- deleteDialogBot.clickOkButton();
-
- Assertions.genericTearDownAssertions();
}
private String getConnectionName()
{
- return "GssApiTest." + name.getMethodName();
+ return testInfo.getTestMethod().map( Method::getName ).orElse( "null" ) + " "
+ + testInfo.getDisplayName();
}
@@ -174,7 +141,7 @@ public class GssApiTest
// check the connection
String result = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK", result );
+ assertNull( result, "Expected OK" );
wizardBot.clickCancelButton();
}
@@ -216,13 +183,13 @@ public class GssApiTest
// check the connection
String result = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK", result );
+ assertNull( result, "Expected OK" );
wizardBot.clickCancelButton();
}
- private static void createServer( String serverName )
+ private void createServer( String serverName )
{
// Showing view
serversViewBot.show();
@@ -240,7 +207,7 @@ public class GssApiTest
}
- private static void configureApacheDS( String serverName ) throws Exception
+ private void configureApacheDS( String serverName ) throws Exception
{
ApacheDSConfigurationEditorBot editorBot = serversViewBot.openConfigurationEditor( serverName );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
index 8c5e6529e..fcf5291d2 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
@@ -21,12 +21,22 @@
package org.apache.directory.studio.test.integration.ui;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.ALIAS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.GERMAN_UMLAUT_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC111_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.SUBENTRY_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER2_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.io.IOException;
@@ -39,11 +49,8 @@ import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.util.FileUtils;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
+import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.api.partition.Partition;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
@@ -51,25 +58,21 @@ import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.test.integration.junit5.ApacheDirectoryServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
import org.apache.directory.studio.test.integration.ui.bots.BotUtils;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.ExportWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.ImportWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.SearchLogsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Characters;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
+import org.apache.directory.studio.test.integration.ui.utils.Characters;
+import org.apache.directory.studio.test.integration.ui.utils.ResourceUtils;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -78,39 +81,8 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-@ApplyLdifFiles(clazz = ImportExportTest.class, value = "org/apache/directory/studio/test/integration/ui/ImportExportTest.ldif")
-public class ImportExportTest extends AbstractLdapTestUnit
+public class ImportExportTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private Connection connection;
- private SearchLogsViewBot searchLogsViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "ImportExportTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- searchLogsViewBot = studioBot.getSearchLogsViewBot();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-395.
@@ -123,13 +95,15 @@ public class ImportExportTest extends AbstractLdapTestUnit
* @throws Exception
* the exception
*/
- @Test
- public void testExportImportLdifWithGermanUmlautInDN() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportLdifWithGermanUmlautInDN( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
URL url = Platform.getInstanceLocation().getURL();
- final String file = url.getFile() + "ImportExportWithGermanUmlautInDnTest.ldif";
+ final String file = url.getFile() + "ImportExportWithGermanUmlautInDnTest" + server.getType().name() + ".ldif";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
// export LDIF
ExportWizardBot wizardBot = browserViewBot.openExportLdifWizard();
@@ -141,17 +115,16 @@ public class ImportExportTest extends AbstractLdapTestUnit
List<String> lines = FileUtils.readLines( new File( file ), StandardCharsets.UTF_8 );
// verify that the first line of exported LDIF is "version: 1"
- assertEquals( "LDIF must start with version: 1", lines.get( 0 ), "version: 1" );
+ assertEquals( lines.get( 0 ), "version: 1", "LDIF must start with version: 1" );
// verify that the third line of exported LDIF is the Base64 encoded DN
- assertEquals( "Expected Base64 encoded DN", lines.get( 2 ),
- "dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT11c2VycyxvdT1zeXN0ZW0=" );
+ assertEquals( lines.get( 2 ), "dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT1taXNjLGRjPWV4YW1wbGUsZGM9b3Jn",
+ "Expected Base64 encoded DN" );
// delete entry
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" ) );
+ assertFalse( browserViewBot.existsEntry( path( GERMAN_UMLAUT_DN ) ) );
// import LDIF
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
@@ -159,9 +132,8 @@ public class ImportExportTest extends AbstractLdapTestUnit
importWizardBot.clickFinishButton();
// verify that entry with umlaut exists
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ assertTrue( browserViewBot.existsEntry( path( GERMAN_UMLAUT_DN ) ) );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
}
@@ -176,13 +148,15 @@ public class ImportExportTest extends AbstractLdapTestUnit
* @throws Exception
* the exception
*/
- @Test
- public void testExportImportDsmlWithGermanUmlautInDN() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportDsmlWithGermanUmlautInDN( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
URL url = Platform.getInstanceLocation().getURL();
- final String file = url.getFile() + "ImportExportWithGermanUmlautInDnTest.dsml";
+ final String file = url.getFile() + "ImportExportWithGermanUmlautInDnTest" + server.getType().name() + ".dsml";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
// export DSML
ExportWizardBot wizardBot = browserViewBot.openExportDsmlWizard();
@@ -195,15 +169,14 @@ public class ImportExportTest extends AbstractLdapTestUnit
// verify that exported DSML contains the Base64 encoded DN
String content = FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
- assertTrue( "DSML must contain DN with umlaut.",
- content.contains( "dn=\"cn=Wolfgang K\u00f6lbel,ou=users,ou=system\"" ) );
+ assertTrue( content.contains( "dn=\"" + GERMAN_UMLAUT_DN.getName() + "\"" ),
+ "DSML must contain DN with umlaut." );
// delete entry
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" ) );
+ assertFalse( browserViewBot.existsEntry( path( GERMAN_UMLAUT_DN ) ) );
// import DSML
ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
@@ -211,187 +184,305 @@ public class ImportExportTest extends AbstractLdapTestUnit
importWizardBot.clickFinishButton();
// verify that entry with umlaut exists
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ assertTrue( browserViewBot.existsEntry( path( GERMAN_UMLAUT_DN ) ) );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
}
- @Test
- public void testExportImportLdifSpecialEntries() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportLdifAlias( TestLdapServer server ) throws Exception
{
+ Connection connection = connectionsViewBot.createTestConnection( server );
// disable alias dereferencing
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
+
+ URL url = Platform.getInstanceLocation().getURL();
+ final String file = url.getFile() + "ImportExportAlias" + server.getType().name() + ".ldif";
+
+ browserViewBot.selectEntry( path( ALIAS_DN.getParent() ) );
+
+ // export to LDIF
+ ExportWizardBot wizardBot = browserViewBot.openExportLdifWizard();
+ assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(objectClass=alias)" );
+ wizardBot.setScope( SearchScope.ONELEVEL );
+ wizardBot.setAliasDereferencingMode( AliasDereferencingMethod.NEVER );
+ wizardBot.clickNextButton();
+ wizardBot.typeFile( file );
+ wizardBot.clickFinishButton();
+ wizardBot.waitTillExportFinished( file, 50 );
+
+ List<String> lines = FileUtils.readLines( new File( file ), StandardCharsets.UTF_8 );
+ assertEquals( lines.get( 0 ), "version: 1", "LDIF must start with version: 1" );
+ assertTrue( lines.contains( "dn: " + ALIAS_DN.getName() ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( ALIAS_DN ) );
+ DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
+ assertTrue( dialogBot.isVisible() );
+ dialogBot.clickOkButton();
+ waitAndAssert( false,
+ () -> browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+
+ // import LDIF
+ ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
+ importWizardBot.typeFile( file );
+ importWizardBot.clickFinishButton();
+
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportLdifReferral( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
// enable ManageDsaIT control
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- // enable Subentries control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
URL url = Platform.getInstanceLocation().getURL();
- final String file1 = url.getFile() + "ImportExportSpecialEntries1Test.ldif";
- final String file2 = url.getFile() + "ImportExportSpecialEntries2Test.ldif";
+ final String file = url.getFile() + "ImportExportReferral" + server.getType().name() + ".ldif";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN.getParent() ) );
- // export first LDIF (alias and referral)
+ // export to LDIF
ExportWizardBot wizardBot = browserViewBot.openExportLdifWizard();
assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(" + REFERRAL_TO_USER1_DN.getRdn().getName() + ")" );
wizardBot.setReturningAttributes( "ref" );
wizardBot.setScope( SearchScope.ONELEVEL );
wizardBot.setControlManageDsaIT( true );
- wizardBot.setAliasDereferencingMode( AliasDereferencingMethod.NEVER );
wizardBot.clickNextButton();
- wizardBot.typeFile( file1 );
+ wizardBot.typeFile( file );
wizardBot.clickFinishButton();
- wizardBot.waitTillExportFinished( file1, 200 );
+ wizardBot.waitTillExportFinished( file, 20 );
+
+ List<String> lines = FileUtils.readLines( new File( file ), StandardCharsets.UTF_8 );
+ assertEquals( lines.get( 0 ), "version: 1", "LDIF must start with version: 1" );
+ assertTrue( lines.contains( "dn: " + REFERRAL_TO_USER1_DN.getName() ) );
+ assertTrue( lines.contains( "ref: " + server.getLdapUrl() + "/" + USER1_DN.getName() ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN ) );
+ DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
+ assertTrue( dialogBot.isVisible() );
+ dialogBot.clickOkButton();
+ waitAndAssert( false,
+ () -> browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
+
+ // import LDIF
+ ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
+ importWizardBot.typeFile( file );
+ importWizardBot.clickFinishButton();
+
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testExportImportLdifSubentry( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ // enable Subentries control
+ connection.getConnectionParameter().setExtendedBoolProperty(
+ IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
- List<String> lines1 = FileUtils.readLines( new File( file1 ), StandardCharsets.UTF_8 );
- assertEquals( "LDIF must start with version: 1", lines1.get( 0 ), "version: 1" );
- assertTrue( lines1.contains( "dn: cn=referral,ou=special,ou=system" ) );
- assertTrue( lines1.contains( "ref: ldap://foo.example.com/ou=system" ) );
- assertTrue( lines1.contains( "dn: cn=alias,ou=special,ou=system" ) );
+ URL url = Platform.getInstanceLocation().getURL();
+ final String file = url.getFile() + "ImportExportSubentry" + server.getType().name() + ".ldif";
- // export second LDIF (subentry)
- wizardBot = browserViewBot.openExportLdifWizard();
+ browserViewBot.selectEntry( path( SUBENTRY_DN.getParent() ) );
+
+ // export to LDIF
+ ExportWizardBot wizardBot = browserViewBot.openExportLdifWizard();
assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(objectClass=subentry)" );
wizardBot.setReturningAttributes( "subtreeSpecification" );
wizardBot.setScope( SearchScope.ONELEVEL );
wizardBot.setControlSubentries( true );
wizardBot.clickNextButton();
- wizardBot.typeFile( file2 );
+ wizardBot.typeFile( file );
wizardBot.clickFinishButton();
- wizardBot.waitTillExportFinished( file2, 100 );
-
- List<String> lines2 = FileUtils.readLines( new File( file2 ), StandardCharsets.UTF_8 );
- assertEquals( "LDIF must start with version: 1", lines2.get( 0 ), "version: 1" );
- assertTrue( lines2.contains( "dn: cn=subentry,ou=special,ou=system" ) );
- assertTrue( lines2.contains( "subtreespecification: { }" ) );
-
- // delete entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
- String[] children =
- { "cn=alias", "cn=referral", "cn=subentry" };
- // select entries twice, sometimes one gets unselected, reason unknown
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
+ wizardBot.waitTillExportFinished( file, 20 );
+
+ List<String> lines = FileUtils.readLines( new File( file ), StandardCharsets.UTF_8 );
+ assertEquals( lines.get( 0 ), "version: 1", "LDIF must start with version: 1" );
+ assertTrue( lines.contains( "dn: " + SUBENTRY_DN.getName() ) );
+ assertTrue( lines.contains( "subtreeSpecification: {}" ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( SUBENTRY_DN ) );
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ () -> browserViewBot.existsEntry( path( SUBENTRY_DN ) ) );
- // import LDIFs
+ // import LDIF
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
- importWizardBot.typeFile( file1 );
- importWizardBot.clickFinishButton();
- importWizardBot = browserViewBot.openImportLdifWizard();
- importWizardBot.typeFile( file2 );
+ importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- // verify that entries exist
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( SUBENTRY_DN ) ) );
}
- @Test
- public void testExportImportDsmlSpecialEntries() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportDsmlAlias( TestLdapServer server ) throws Exception
{
+ Connection connection = connectionsViewBot.createTestConnection( server );
// disable alias dereferencing
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
+
+ URL url = Platform.getInstanceLocation().getURL();
+ final String file = url.getFile() + "ImportExportAlias" + server.getType().name() + ".dsml";
+
+ browserViewBot.selectEntry( path( ALIAS_DN.getParent() ) );
+
+ // export to DSML
+ ExportWizardBot wizardBot = browserViewBot.openExportDsmlWizard();
+ assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(objectClass=alias)" );
+ wizardBot.setScope( SearchScope.ONELEVEL );
+ wizardBot.setAliasDereferencingMode( AliasDereferencingMethod.NEVER );
+ wizardBot.clickNextButton();
+ wizardBot.typeFile( file );
+ wizardBot.selectDsmlRequest();
+ wizardBot.clickFinishButton();
+ wizardBot.waitTillExportFinished( file, 50 );
+
+ // verify that exported DSML contains the entry
+ String content = FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
+ assertTrue( content.contains( "dn=\"" + ALIAS_DN.getName() + "\"" ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( ALIAS_DN ) );
+ DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
+ assertTrue( dialogBot.isVisible() );
+ dialogBot.clickOkButton();
+ waitAndAssert( false,
+ () -> browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+
+ // import DSML
+ ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
+ importWizardBot.typeFile( file );
+ importWizardBot.clickFinishButton();
+
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( ALIAS_DN ) ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportImportDsmlReferral( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
// enable ManageDsaIT control
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- // enable Subentries control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
URL url = Platform.getInstanceLocation().getURL();
- final String file1 = url.getFile() + "ImportExportSpecialEntries1Test.dsml";
- final String file2 = url.getFile() + "ImportExportSpecialEntries2Test.dsml";
+ final String file = url.getFile() + "ImportExportReferral" + server.getType().name() + ".dsml";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN.getParent() ) );
- // export first DSML (alias and referral)
+ // export to DSML
ExportWizardBot wizardBot = browserViewBot.openExportDsmlWizard();
assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(" + REFERRAL_TO_USER1_DN.getRdn().getName() + ")" );
wizardBot.setReturningAttributes( "ref" );
wizardBot.setScope( SearchScope.ONELEVEL );
wizardBot.setControlManageDsaIT( true );
- wizardBot.setAliasDereferencingMode( AliasDereferencingMethod.NEVER );
wizardBot.clickNextButton();
- wizardBot.typeFile( file1 );
+ wizardBot.typeFile( file );
wizardBot.selectDsmlRequest();
wizardBot.clickFinishButton();
- wizardBot.waitTillExportFinished( file1, 800 );
+ wizardBot.waitTillExportFinished( file, 50 );
- // verify that exported DSML contains the entries
- String content1 = FileUtils.readFileToString( new File( file1 ), StandardCharsets.UTF_8 );
- assertTrue( content1.contains( "dn=\"cn=referral,ou=special,ou=system\"" ) );
- assertTrue( content1.contains( "<attr name=\"ref\">" ) );
- assertTrue( content1.contains( "<value>ldap://foo.example.com/ou=system</value>" ) );
- assertTrue( content1.contains( "dn=\"cn=alias,ou=special,ou=system\"" ) );
+ // verify that exported DSML contains the entry
+ String content = FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
+ assertTrue( content.contains( "dn=\"" + REFERRAL_TO_USER1_DN.getName() + "\"" ) );
+ assertTrue( content.contains( "<attr name=\"ref\">" ) );
+ assertTrue( content.contains( "<value>" + server.getLdapUrl() + "/" + USER1_DN.getName() + "</value>" ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( REFERRAL_TO_USER1_DN ) );
+ DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
+ assertTrue( dialogBot.isVisible() );
+ dialogBot.clickOkButton();
+ waitAndAssert( false,
+ () -> browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
- // export second DSML (subentry)
- wizardBot = browserViewBot.openExportDsmlWizard();
+ // import DSML
+ ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
+ importWizardBot.typeFile( file );
+ importWizardBot.clickFinishButton();
+
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testExportImportDsmlSubentry( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ // enable Subentries control
+ connection.getConnectionParameter().setExtendedBoolProperty(
+ IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
+
+ URL url = Platform.getInstanceLocation().getURL();
+ final String file = url.getFile() + "ImportExportSubentry" + server.getType().name() + ".dsml";
+
+ browserViewBot.selectEntry( path( SUBENTRY_DN.getParent() ) );
+
+ // export to DSML
+ ExportWizardBot wizardBot = browserViewBot.openExportDsmlWizard();
assertTrue( wizardBot.isVisible() );
+ wizardBot.setFilter( "(objectClass=subentry)" );
wizardBot.setReturningAttributes( "subtreeSpecification" );
wizardBot.setScope( SearchScope.ONELEVEL );
wizardBot.setControlSubentries( true );
wizardBot.clickNextButton();
- wizardBot.typeFile( file2 );
+ wizardBot.typeFile( file );
wizardBot.selectDsmlRequest();
wizardBot.clickFinishButton();
- wizardBot.waitTillExportFinished( file2, 300 );
-
- // verify that exported DSML contains the entries
- String content2 = FileUtils.readFileToString( new File( file2 ), StandardCharsets.UTF_8 );
- assertTrue( content2.contains( "dn=\"cn=subentry,ou=special,ou=system\"" ) );
- assertTrue( content2.contains( "<attr name=\"subtreespecification\">" ) );
- assertTrue( content2.contains( "<value>{ }</value>" ) );
-
- // delete entries
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=special" );
- String[] children =
- { "cn=alias", "cn=referral", "cn=subentry" };
- // select entries twice, sometimes one gets unselected, reason unknown
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
- browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=special" );
+ wizardBot.waitTillExportFinished( file, 50 );
+
+ // verify that exported DSML
+ String content = FileUtils.readFileToString( new File( file ), StandardCharsets.UTF_8 );
+ assertTrue( content.contains( "dn=\"" + SUBENTRY_DN.getName() + "\"" ) );
+ assertTrue( content.contains( "<attr name=\"subtreespecification\">" ) );
+ assertTrue( content.contains( "<value>{}</value>" ) );
+
+ // delete entry
+ browserViewBot.selectEntry( path( SUBENTRY_DN ) );
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- waitAndAssert( false,
- () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ () -> browserViewBot.existsEntry( path( SUBENTRY_DN ) ) );
// import DSML
ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
- importWizardBot.typeFile( file1 );
- importWizardBot.clickFinishButton();
- importWizardBot = browserViewBot.openImportDsmlWizard();
- importWizardBot.typeFile( file2 );
+ importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- // verify that entries exist
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ // verify that entry exist
+ assertTrue( browserViewBot.existsEntry( path( SUBENTRY_DN ) ) );
}
@@ -416,9 +507,11 @@ public class ImportExportTest extends AbstractLdapTestUnit
}
- @Test
- public void testExportWithPagedResultControl() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testExportWithPagedResultControl( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
URL url = Platform.getInstanceLocation().getURL();
final String file = url.getFile() + "ExportWithPagedResultControl.ldif";
@@ -435,7 +528,7 @@ public class ImportExportTest extends AbstractLdapTestUnit
wizardBot.waitTillExportFinished( file, 2500 );
List<String> lines = FileUtils.readLines( new File( file ), StandardCharsets.UTF_8 );
- assertEquals( "LDIF must start with version: 1", lines.get( 0 ), "version: 1" );
+ assertEquals( lines.get( 0 ), "version: 1", "LDIF must start with version: 1" );
assertTrue( lines.contains( "dn: cn=adsconfig,ou=schema" ) );
assertTrue( lines.contains( "dn: cn=apachemeta,ou=schema" ) );
assertTrue( lines.contains( "dn: cn=core,ou=schema" ) );
@@ -451,14 +544,16 @@ public class ImportExportTest extends AbstractLdapTestUnit
*
* Import a new context entry must refresh the root DSE and
* show the new context entry in the LDAP Browser view.
- *
- * @throws Exception
- * the exception
*/
- @Test
- public void testImportContextEntryRefreshesRootDSE() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testImportContextEntryRefreshesRootDSE( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
+
// add a new partition
+ ApacheDirectoryServer apacheds = ( ApacheDirectoryServer ) server;
+ DirectoryService service = apacheds.getService();
Partition partition = new AvlPartition( service.getSchemaManager(), service.getDnFactory() );
partition.setId( "example" );
partition.setSuffixDn( new Dn( "dc=example,dc=com" ) );
@@ -490,47 +585,49 @@ public class ImportExportTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-489.
*
* Verify that there are no UI updates when importing an LDIF.
- *
- * @throws Exception
*/
- @Test
- public void testImportDoesNotUpdateUI() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testImportDoesNotUpdateUI( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( MISC111_DN ) );
+ browserViewBot.expandEntry( path( MISC111_DN ) );
long fireCount0 = EventRegistry.getFireCount();
// import the LDIF
- String file = prepareInputFile( "ImportExportTest_ImportDontUpdateUI.ldif" );
+ String file = prepareInputFile( "ImportExportTest_User1to8.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
+ browserViewBot.waitForEntry( path( MISC111_DN, "uid=User.1" ) );
+ browserViewBot.selectEntry( path( MISC111_DN, "uid=User.1" ) );
long fireCount1 = EventRegistry.getFireCount();
// verify that only three two events were fired between Import
long fireCount = fireCount1 - fireCount0;
- assertEquals( "Only 2 event firings expected when importing LDIF.", 2, fireCount );
+ assertEquals( 2, fireCount, "Only 2 event firings expected when importing LDIF." );
}
/**
* Export to CSV and checks that spreadsheet formulas are prefixed with an apostrophe.
*/
- @Test
- public void testExportCsvShouldPrefixFormulaWithApostrophe() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testExportCsvShouldPrefixFormulaWithApostrophe( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
// set CSV encoding explicit to UTF-8, otherwise platform default encoding would be used
Preferences store = BrowserCorePlugin.getDefault().getPluginPreferences();
store.setDefault( BrowserCoreConstants.PREFERENCE_FORMAT_CSV_ENCODING, "UTF-8" );
URL url = Platform.getInstanceLocation().getURL();
- final String file = url.getFile() + "ImportExportTest.csv";
+ final String file = url.getFile() + "ImportExportTest" + server.getType().name() + ".csv";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Wolfgang K\u00f6lbel" );
+ browserViewBot.selectEntry( path( GERMAN_UMLAUT_DN ) );
// export CSV
ExportWizardBot wizardBot = browserViewBot.openExportCsvWizard();
@@ -545,8 +642,7 @@ public class ImportExportTest extends AbstractLdapTestUnit
// verify that the first line is header
assertEquals( "dn,cn,description", lines.get( 0 ) );
// verify that the second line is actual content and the formula is prefixed with an apostrophe
- assertEquals( "\"cn=Wolfgang K\u00f6lbel,ou=users,ou=system\",\"Wolfgang K\u00f6lbel\",\"'=1+1\"",
- lines.get( 1 ) );
+ assertEquals( "\"" + GERMAN_UMLAUT_DN.getName() + "\",\"Wolfgang K\u00f6lbel\",\"'=1+1\"", lines.get( 1 ) );
}
@@ -554,22 +650,24 @@ public class ImportExportTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-1160.
*
* Attributes silently dropped and not imported when import LDIF and provider is Apache Directory LDAP API.
- *
- * @throws Exception
*/
- @Test
- public void testDIRSTUDIO_1160() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testDIRSTUDIO_1160( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
+ Dn dn = dn( "cn=U0034692", MISC_DN );
+
// import the LDIF
String file = prepareInputFile( "DIRSTUDIO-1160.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=U0034692" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=U0034692" );
+ browserViewBot.waitForEntry( path( dn ) );
+ browserViewBot.selectEntry( path( dn ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=U0034692,ou=users,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn.getName() );
entryEditorBot.activate();
assertTrue( entryEditorBot.getAttributeValues().contains( "description: Initial import" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "description: Good#Stuff" ) );
@@ -583,49 +681,67 @@ public class ImportExportTest extends AbstractLdapTestUnit
/**
* Test LDIF with several modifications.
*/
- @Test
- public void testLdifModification() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testLdifModification( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
// import the LDIF
String file = prepareInputFile( "ImportExportTest_Modifications.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.clickFinishButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,ou=system" );
+ browserViewBot.waitForEntry( path( USER1_DN ) );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( USER1_DN.getName() );
entryEditorBot.activate();
assertTrue( entryEditorBot.getAttributeValues().contains( "description: " + Characters.ALL ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 0000" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 1388" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 1234" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 2345" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "roomNumber: 3456" ) );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "userCertificate: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ if ( server.getType() == LdapServerType.ApacheDS )
+ {
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description: Deutsch" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description: English" ) );
+ }
+ else
+ {
+ assertTrue( entryEditorBot.getAttributeValues()
+ .contains( "userCertificate;binary: X.509v3: CN=End Entity,DC=example,DC=com" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-de: Deutsch" ) );
+ assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-en: English" ) );
+ }
modificationLogsViewBot.waitForText( "add: userCertificate;binary\nuserCertificate;binary:: " );
modificationLogsViewBot.waitForText( "add: description;lang-en\ndescription;lang-en: " );
modificationLogsViewBot.waitForText( "add: description;lang-de\ndescription;lang-de: " );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.2" ) );
+ assertFalse( browserViewBot.existsEntry( path( USER2_DN ) ) );
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.33" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.33" );
+ browserViewBot.waitForEntry( path( USERS_DN, "uid=user.33" ) );
+ browserViewBot.selectEntry( path( USERS_DN, "uid=user.33" ) );
entryEditorBot.activate();
assertTrue( entryEditorBot.getAttributeValues().contains( "uid: user.33" ) );
assertFalse( entryEditorBot.getAttributeValues().contains( "uid: user.3" ) );
}
- @Test
- public void testImportUpdateExistingEntriesFalse() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testImportUpdateExistingEntriesFalse( TestLdapServer server ) throws Exception
{
- String dn = "uid=User.1,ou=users,ou=system";
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), dn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: User.1" ) );
+ connectionsViewBot.createTestConnection( server );
+ Dn dn = dn( "uid=User.1", MISC111_DN );
+ server.withAdminConnection( conn -> {
+ conn.add( new DefaultEntry( conn.getSchemaManager(), dn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: User.1" ) );
+ } );
// import the LDIF
- String file = prepareInputFile( "ImportExportTest_ImportDontUpdateUI.ldif" );
+ String file = prepareInputFile( "ImportExportTest_User1to8.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.setUpdateExistingEntries( false );
@@ -633,9 +749,9 @@ public class ImportExportTest extends AbstractLdapTestUnit
importWizardBot.clickFinishButton();
// check entry was not updated
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn );
+ browserViewBot.waitForEntry( path( dn ) );
+ browserViewBot.selectEntry( path( dn ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn.getName() );
entryEditorBot.activate();
assertTrue( entryEditorBot.getAttributeValues().contains( "sn: X" ) );
assertFalse( entryEditorBot.getAttributeValues().contains( "sn: Amar" ) );
@@ -643,22 +759,26 @@ public class ImportExportTest extends AbstractLdapTestUnit
// check error in modifications logs view
modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]",
- "dn: uid=User.1,ou=users,ou=system", "changetype: add" );
+ "dn: " + dn.getName(), "changetype: add" );
// check error in LDIF log file
String logContent = FileUtils.readFileToString( new File( file + ".log" ), StandardCharsets.UTF_8 );
assertThat( logContent, containsString( "[LDAP result code 68 - entryAlreadyExists]" ) );
}
- @Test
- public void testImportUpdateExistingEntriesTrue() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testImportUpdateExistingEntriesTrue( TestLdapServer server ) throws Exception
{
- String dn = "uid=User.1,ou=users,ou=system";
- service.getAdminSession().add( new DefaultEntry( service.getSchemaManager(), dn,
- "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: User.1" ) );
+ connectionsViewBot.createTestConnection( server );
+ Dn dn = dn( "uid=User.1", MISC111_DN );
+ server.withAdminConnection( conn -> {
+ conn.add( new DefaultEntry( conn.getSchemaManager(), dn,
+ "objectClass: inetOrgPerson", "sn: X", "cn: X", "uid: User.1" ) );
+ } );
// import the LDIF
- String file = prepareInputFile( "ImportExportTest_ImportDontUpdateUI.ldif" );
+ String file = prepareInputFile( "ImportExportTest_User1to8.ldif" );
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
importWizardBot.typeFile( file );
importWizardBot.setUpdateExistingEntries( true );
@@ -666,9 +786,9 @@ public class ImportExportTest extends AbstractLdapTestUnit
importWizardBot.clickFinishButton();
// check entry was updated
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=User.1" );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn );
+ browserViewBot.waitForEntry( path( dn ) );
+ browserViewBot.selectEntry( path( dn ) );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn.getName() );
entryEditorBot.activate();
assertFalse( entryEditorBot.getAttributeValues().contains( "sn: X" ) );
assertTrue( entryEditorBot.getAttributeValues().contains( "sn: Amar" ) );
@@ -676,8 +796,8 @@ public class ImportExportTest extends AbstractLdapTestUnit
// check error and update in modifications logs view
modificationLogsViewBot.assertContainsError( "[LDAP result code 68 - entryAlreadyExists]",
- "dn: uid=User.1,ou=users,ou=system", "changetype: add" );
- modificationLogsViewBot.assertContainsOk( "dn: uid=User.1,ou=users,ou=system", "changetype: modify" );
+ "dn: " + dn.getName(), "changetype: add" );
+ modificationLogsViewBot.assertContainsOk( "dn: " + dn.getName(), "changetype: modify" );
// check no error but update in LDIF log file
String logContent = FileUtils.readFileToString( new File( file + ".log" ), StandardCharsets.UTF_8 );
assertThat( logContent, not( containsString( "[LDAP result code 68 - entryAlreadyExists]" ) ) );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
index 8c897549c..5f69391c5 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
@@ -21,18 +21,11 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.studio.test.integration.ui.bots.LdifEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.NewWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
/**
@@ -40,29 +33,8 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-public class LdifEditorTest extends AbstractLdapTestUnit
+public class LdifEditorTest extends AbstractTestBase
{
- private StudioBot studioBot;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
-
- // activate search and modifications logs, they also include an LDIF editor and increment the counter
- studioBot.getSearchLogsViewBot().getSearchLogsText();
- studioBot.getModificationLogsViewBot().getModificationLogsText();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-1043 (First open of LDIF editor fails)
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/MoveEntryTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/MoveEntryTest.java
index 9057c84f7..d1d55adc6 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/MoveEntryTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/MoveEntryTest.java
@@ -21,25 +21,25 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC111_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_ESCAPED_CHARACTERS_BACKSLASH_PREFIXED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_ESCAPED_CHARACTERS_HEX_PAIR_ESCAPED;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
import org.apache.directory.studio.test.integration.ui.bots.MoveEntriesDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SelectDnDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -48,72 +48,58 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-@ApplyLdifFiles(clazz = MoveEntryTest.class, value = "org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif")
-public class MoveEntryTest extends AbstractLdapTestUnit
+public class MoveEntryTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connectionsViewBot.createTestConnection( "MoveEntryTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- }
-
-
- @After
- public void tearDown() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testMoveUp( TestLdapServer server ) throws Exception
{
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
+ Dn dnToMove = MISC111_DN;
+ Dn newParentDn = MISC_DN;
-
- @Test
- public void testMoveUp() throws Exception
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen+uid=bjensen" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( dnToMove ) );
MoveEntriesDialogBot moveEntryDialog = browserViewBot.openMoveEntryDialog();
assertTrue( moveEntryDialog.isVisible() );
- moveEntryDialog.setParentText( "ou=system" );
+ moveEntryDialog.setParentText( newParentDn.getName() );
moveEntryDialog.clickOkButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=Barbara Jensen+uid=bjensen" ) );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen+uid=bjensen" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=Barbara Jensen+uid=bjensen" );
+ assertTrue( browserViewBot.existsEntry( path( newParentDn, dnToMove.getRdn() ) ) );
+ browserViewBot.selectEntry( path( newParentDn, dnToMove.getRdn() ) );
+ assertFalse( browserViewBot.existsEntry( path( dnToMove ) ) );
}
- @Test
- public void testMoveDown() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testMoveDown( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#123456" );
+ Dn dnToMove = DN_WITH_ESCAPED_CHARACTERS_BACKSLASH_PREFIXED;
+ Dn newParentDn = DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ // OpenLDAP and 389ds escape all characters with hex digits
+ dnToMove = DN_WITH_ESCAPED_CHARACTERS_HEX_PAIR_ESCAPED;
+ newParentDn = DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+ }
+
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( dnToMove ) );
MoveEntriesDialogBot moveEntryDialog = browserViewBot.openMoveEntryDialog();
assertTrue( moveEntryDialog.isVisible() );
SelectDnDialogBot selectDnBot = moveEntryDialog.clickBrowseButtonExpectingSelectDnDialog();
assertTrue( selectDnBot.isVisible() );
- selectDnBot.selectEntry( "Root DSE", "ou=system", "ou=users", "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"" );
+ selectDnBot.selectEntry( ArrayUtils.remove( path( newParentDn ), 0 ) );
selectDnBot.clickOkButton();
moveEntryDialog.activate();
- assertEquals( "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\",ou=users,ou=system", moveEntryDialog.getParentText() );
+ assertEquals( newParentDn.getName(), moveEntryDialog.getParentText() );
moveEntryDialog.clickOkButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"", "cn=\\#123456" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"", "cn=\\#123456" );
+ assertTrue( browserViewBot.existsEntry( path( newParentDn, dnToMove.getRdn() ) ) );
+ browserViewBot.selectEntry( path( newParentDn, dnToMove.getRdn() ) );
}
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
index b99ba396b..de7aeee64 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewConnectionWizardTest.java
@@ -21,37 +21,32 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST_ADDRESS;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.anyOf;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.lang.reflect.Method;
+import java.net.InetAddress;
import java.net.UnknownHostException;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
import org.apache.directory.studio.connection.core.ConnectionManager;
import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.Constants;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.NewConnectionWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
+import org.apache.mina.util.AvailablePortFinder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -60,47 +55,23 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class NewConnectionWizardTest extends AbstractLdapTestUnit
+public class NewConnectionWizardTest extends AbstractTestBase
{
- @Rule
- public TestName name = new TestName();
-
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
private NewConnectionWizardBot wizardBot;
+ private TestInfo testInfo;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
-
- // open the new connection wizard
- wizardBot = connectionsViewBot.openNewConnectionWizard();
-
- //ErrorDialog.AUTOMATED_MODE = false;
- }
-
-
- @After
- public void tearDown() throws Exception
+ @BeforeEach
+ public void beforeEach( TestInfo testInfo )
{
- connectionsViewBot.deleteTestConnections();
- studioBot = null;
- connectionsViewBot = null;
- wizardBot = null;
- Assertions.genericTearDownAssertions();
+ this.wizardBot = connectionsViewBot.openNewConnectionWizard();
+ this.testInfo = testInfo;
}
private String getConnectionName()
{
- return "NewConnectionWizardTest." + name.getMethodName();
+ return testInfo.getTestMethod().map( Method::getName ).orElse( "null" ) + " "
+ + testInfo.getDisplayName();
}
@@ -120,8 +91,8 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
// enter connection parameter
wizardBot.typeConnectionName( getConnectionName() );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( "test.example.com" );
+ wizardBot.typePort( 389 );
// ensure "Next >" button is enabled
assertFalse( wizardBot.isBackButtonEnabled() );
assertTrue( wizardBot.isNextButtonEnabled() );
@@ -137,7 +108,7 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
assertTrue( wizardBot.isCancelButtonEnabled() );
// enter host again
- wizardBot.typeHost( LOCALHOST );
+ wizardBot.typeHost( "test.example.com" );
// ensure "Next >" button is enabled
assertFalse( wizardBot.isBackButtonEnabled() );
assertTrue( wizardBot.isNextButtonEnabled() );
@@ -325,20 +296,21 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
/**
* Creates a new connection using the new connection wizard.
*/
- @Test
- public void testCreateConnection()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateConnection( TestLdapServer server )
{
// enter connection parameter
wizardBot.typeConnectionName( getConnectionName() );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( server.getHost() );
+ wizardBot.typePort( server.getPort() );
// jump to auth page
wizardBot.clickNextButton();
// enter authentication parameters
- wizardBot.typeUser( "uid=admin,ou=system" );
- wizardBot.typePassword( "secret" );
+ wizardBot.typeUser( server.getAdminDn() );
+ wizardBot.typePassword( server.getAdminPassword() );
// finish dialog
wizardBot.clickFinishButton( true );
@@ -350,11 +322,11 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
assertEquals( 1, connectionManager.getConnections().length );
Connection connection = connectionManager.getConnections()[0];
assertEquals( getConnectionName(), connection.getName() );
- assertEquals( LOCALHOST, connection.getHost() );
- assertEquals( ldapServer.getPort(), connection.getPort() );
+ assertEquals( server.getHost(), connection.getHost() );
+ assertEquals( server.getPort(), connection.getPort() );
assertEquals( AuthenticationMethod.SIMPLE, connection.getAuthMethod() );
- assertEquals( "uid=admin,ou=system", connection.getBindPrincipal() );
- assertEquals( "secret", connection.getBindPassword() );
+ assertEquals( server.getAdminDn(), connection.getBindPrincipal() );
+ assertEquals( server.getAdminPassword(), connection.getBindPassword() );
// ensure connection is visible in Connections view
assertEquals( 1, connectionsViewBot.getCount() );
@@ -367,25 +339,26 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
/**
* Tests the "Check Network Parameter" button.
*/
- @Test
- public void testCheckNetworkParameterButtonOK() throws UnknownHostException
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCheckNetworkParameterButtonOK( TestLdapServer server ) throws UnknownHostException
{
// enter connection parameter with host name
wizardBot.typeConnectionName( getConnectionName() );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( server.getHost() );
+ wizardBot.typePort( server.getPort() );
// click "Check Network Parameter" button
String result1 = wizardBot.clickCheckNetworkParameterButton();
- assertNull( "Expected OK", result1 );
+ assertNull( result1, "Expected OK" );
// enter connection parameter with IPv4 address
- wizardBot.typeHost( LOCALHOST_ADDRESS );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( InetAddress.getByName( server.getHost() ).getHostAddress() );
+ wizardBot.typePort( server.getPort() );
// click "Check Network Parameter" button
String result2 = wizardBot.clickCheckNetworkParameterButton();
- assertNull( "Expected OK", result2 );
+ assertNull( result2, "Expected OK" );
//
// Don't know why this doesn't work with SWTBot.
@@ -411,13 +384,12 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
{
// enter connection parameter with invalid port
wizardBot.typeConnectionName( getConnectionName() );
- int port = ldapServer.getPort() + 1;
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( port );
+ wizardBot.typeHost( Constants.LOCALHOST );
+ wizardBot.typePort( AvailablePortFinder.getNextAvailable( 1024 ) );
// click "Check Network Parameter" button and get the result
String result1 = wizardBot.clickCheckNetworkParameterButton();
- assertNotNull( "Expected Error", result1 );
+ assertNotNull( result1 );
// LDAP API: Connection refused
// JNDI: The connection failed
assertThat( result1,
@@ -426,7 +398,7 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
// enter connection parameter with invalid host name
String hostname = "qwertzuiop.asdfghjkl.yxcvbnm";
wizardBot.typeHost( hostname );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typePort( 389 );
// click "Check Network Parameter" button and get the result
String result2 = wizardBot.clickCheckNetworkParameterButton();
@@ -458,22 +430,23 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
/**
* Tests the "Check Network Parameter" button.
*/
- @Test
- public void testCheckAuthenticationButtonOK()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCheckAuthenticationButtonOK( TestLdapServer server )
{
// enter connection parameter
wizardBot.typeConnectionName( getConnectionName() );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( server.getHost() );
+ wizardBot.typePort( server.getPort() );
wizardBot.clickNextButton();
// enter correct authentication parameter
- wizardBot.typeUser( "uid=admin,ou=system" );
- wizardBot.typePassword( "secret" );
+ wizardBot.typeUser( server.getAdminDn() );
+ wizardBot.typePassword( server.getAdminPassword() );
// click "Check Network Parameter" button
String result = wizardBot.clickCheckAuthenticationButton();
- assertNull( "Expected OK", result );
+ assertNull( result, "Expected OK" );
wizardBot.clickCancelButton();
}
@@ -482,22 +455,23 @@ public class NewConnectionWizardTest extends AbstractLdapTestUnit
/**
* Tests the "Check Authentication" button.
*/
- @Test
- public void testCheckAuthenticationButtonNotOK()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCheckAuthenticationButtonNotOK( TestLdapServer server )
{
// enter connection parameter
wizardBot.typeConnectionName( getConnectionName() );
- wizardBot.typeHost( LOCALHOST );
- wizardBot.typePort( ldapServer.getPort() );
+ wizardBot.typeHost( server.getHost() );
+ wizardBot.typePort( server.getPort() );
wizardBot.clickNextButton();
// enter incorrect authentication parameter
- wizardBot.typeUser( "uid=admin,ou=system" );
+ wizardBot.typeUser( server.getAdminDn() );
wizardBot.typePassword( "secret45" );
// click "Check Network Parameter" button
String result = wizardBot.clickCheckAuthenticationButton();
- assertNotNull( "Expected Error", result );
+ assertNotNull( result );
assertThat( result, containsString( "[LDAP result code 49 - invalidCredentials]" ) );
wizardBot.clickCancelButton();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
index 6fbaa3d2b..c14599f8f 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java
@@ -21,47 +21,36 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST_ADDRESS;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
-import org.apache.directory.api.ldap.model.entry.DefaultEntry;
-import org.apache.directory.api.ldap.model.entry.DefaultModification;
-import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.api.ldap.model.entry.Modification;
-import org.apache.directory.api.ldap.model.entry.ModificationOperation;
-import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.TARGET_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
import org.apache.directory.studio.test.integration.ui.bots.CertificateEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.DnEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.EditAttributeWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.HexEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.NewAttributeWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.NewEntryWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.ReferralDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
import org.apache.directory.studio.test.integration.ui.bots.SubtreeSpecificationEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
+import org.apache.directory.studio.test.integration.ui.utils.ResourceUtils;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -70,57 +59,18 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class NewEntryWizardTest extends AbstractLdapTestUnit
+public class NewEntryWizardTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- private Connection connection;
-
- @Before
- public void setUp() throws Exception
- {
- // enable krb5kdc and nis schemas
- ApacheDsUtils.enableSchema( ldapServer, "krb5kdc" );
- ApacheDsUtils.enableSchema( ldapServer, "nis" );
-
- // create referral entry
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "cn=referral,ou=system" ) );
- entry.add( "objectClass", "top", "referral", "extensibleObject" );
- entry.add( "cn", "referral" );
- entry.add( "ref", "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/ou=users,ou=system" );
- service.getAdminSession().add( entry );
-
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "NewEntryWizardTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test to create a single organization entry.
*/
- @Test
- public void testCreateOrganizationEntry()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateOrganizationEntry( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
assertTrue( wizardBot.isVisible() );
@@ -167,18 +117,20 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "o=testCreateOrganizationEntry" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "o=testCreateOrganizationEntry" );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "o=testCreateOrganizationEntry" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "o=testCreateOrganizationEntry" ) );
}
/**
* Test to create a single person entry.
*/
- @Test
- public void testCreatePersonEntry()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreatePersonEntry( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -195,8 +147,8 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.typeValueAndFinish( "test" );
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=testCreatePersonEntry" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=testCreatePersonEntry" );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=testCreatePersonEntry" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=testCreatePersonEntry" ) );
}
@@ -206,10 +158,12 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
* Create entries with upper case attribute types and ensures that the
* retrieved entries still are in upper case.
*/
- @Test
- public void testCreateUpperCaseOrganizationEntries()
+ @ParameterizedTest
+ @LdapServersSource(except = LdapServerType.OpenLdap, reason = "Attributes type is not case sensitive in OpenLDAP")
+ public void testCreateUpperCaseOrganizationEntries( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -225,8 +179,8 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "O=testCreateOrganizationEntry" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "O=testCreateOrganizationEntry" );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "O=testCreateOrganizationEntry" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "O=testCreateOrganizationEntry" ) );
// Now create a second entry under the previously created entry
// to ensure that the selected parent is also upper case.
@@ -241,16 +195,16 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.setRdnType( 1, "O" );
wizardBot.setRdnValue( 1, "testCreateOrganizationEntry2" );
- assertEquals( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry,ou=system",
+ assertEquals( "O=testCreateOrganizationEntry2,O=testCreateOrganizationEntry," + TARGET_DN.getName(),
wizardBot.getDnPreview() );
wizardBot.clickNextButton();
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "O=testCreateOrganizationEntry",
- "O=testCreateOrganizationEntry2" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "O=testCreateOrganizationEntry",
- "O=testCreateOrganizationEntry2" );
+ assertTrue( browserViewBot
+ .existsEntry( path( TARGET_DN, "O=testCreateOrganizationEntry", "O=testCreateOrganizationEntry2" ) ) );
+ browserViewBot
+ .selectEntry( path( TARGET_DN, "O=testCreateOrganizationEntry", "O=testCreateOrganizationEntry2" ) );
}
@@ -259,44 +213,45 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
*
* Create entries with a slash '/' in the RDN value.
*/
- @Test
- public void testCreateEntryWithSlash()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateEntryWithSlash( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
wizardBot.selectCreateEntryFromScratch();
wizardBot.clickNextButton();
- wizardBot.addObjectClasses( "krb5Principal", "person" );
+ wizardBot.addObjectClasses( "person" );
wizardBot.clickNextButton();
- wizardBot.setRdnType( 1, "krb5PrincipalName" );
+ wizardBot.setRdnType( 1, "cn" );
wizardBot.setRdnValue( 1, "kadmin/changepw@DOMAIN" );
wizardBot.clickNextButton();
- wizardBot.editValue( "cn", "" );
- wizardBot.typeValueAndFinish( "test" );
wizardBot.editValue( "sn", "" );
wizardBot.typeValueAndFinish( "test" );
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system",
- "krb5PrincipalName=kadmin/changepw@DOMAIN" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "krb5PrincipalName=kadmin/changepw@DOMAIN" );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=kadmin/changepw@DOMAIN" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=kadmin/changepw@DOMAIN" ) );
}
- @Test
- public void testCreateAliasEntry()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateAliasEntry( TestLdapServer server ) throws Exception
{
// disable alias dereferencing
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
AliasDereferencingMethod.NEVER.ordinal() );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -307,32 +262,29 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.clickNextButton();
wizardBot.setRdnType( 1, "cn" );
- wizardBot.setRdnValue( 1, "alias2" );
+ wizardBot.setRdnValue( 1, "alias" );
wizardBot.clickNextButton();
DnEditorDialogBot dnEditorBot = new DnEditorDialogBot();
- dnEditorBot.setDnText( "ou=system" );
+ dnEditorBot.setDnText( USER1_DN.getName() );
dnEditorBot.clickOkButton();
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=alias2" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=alias2" );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=alias" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=alias" ) );
}
- @Test
- public void testCreateSubEntry() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testCreateSubEntry( TestLdapServer server ) throws Exception
{
// set Subentries control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_FETCH_SUBENTRIES, true );
- // create accessControlSpecificArea
- Modification modification = new DefaultModification( ModificationOperation.ADD_ATTRIBUTE,
- new DefaultAttribute( "administrativeRole", "accessControlSpecificArea" ) );
- service.getAdminSession().modify( new Dn( "ou=system" ), modification );
-
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -343,29 +295,31 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.clickNextButton();
wizardBot.setRdnType( 1, "cn" );
- wizardBot.setRdnValue( 1, "subentry2" );
+ wizardBot.setRdnValue( 1, "subentry" );
wizardBot.clickNextButton();
SubtreeSpecificationEditorDialogBot subtreeEditorBot = new SubtreeSpecificationEditorDialogBot();
subtreeEditorBot.clickOkButton();
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=subentry2" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=subentry2" );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=subentry" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=subentry" ) );
}
- @Test
- public void testCreateReferralEntry()
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testCreateReferralEntry( TestLdapServer server ) throws Exception
{
// set ManageDsaIT control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
ReferralHandlingMethod.IGNORE.ordinal() );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -376,15 +330,26 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.clickNextButton();
wizardBot.setRdnType( 1, "cn" );
- wizardBot.setRdnValue( 1, "referral2" );
+ wizardBot.setRdnValue( 1, "referral" );
wizardBot.clickNextButton();
+ // 389ds doesn't define ref as mandatory attribute
+ if ( server.getType() == LdapServerType.Fedora389ds )
+ {
+ NewAttributeWizardBot newAttributeWizardBot = wizardBot.openNewAttributeWizard();
+ assertTrue( newAttributeWizardBot.isVisible() );
+ newAttributeWizardBot.typeAttributeType( "ref" );
+ newAttributeWizardBot.clickFinishButton();
+ wizardBot.cancelEditValue();
+ wizardBot.activate();
+ }
wizardBot.editValue( "ref", "" );
- wizardBot.typeValueAndFinish( "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/ou=users,ou=system" );
+
+ wizardBot.typeValueAndFinish( server.getLdapUrl() + "/" + USER1_DN.getName() );
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=referral2" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=referral2" );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=referral" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=referral" ) );
}
@@ -395,17 +360,19 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
* The connection selection dialog pops up and we cancel the selection.
* No error should occur and the wizard is not closed.
*/
- @Test
- public void testCreateEntryBelowReferralObjectCancel()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateEntryBelowReferralObjectCancel( TestLdapServer server ) throws Exception
{
// set ManageDsaIT control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
ReferralHandlingMethod.IGNORE.ordinal() );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=referral" );
+ browserViewBot.selectEntry( path( REFERRAL_TO_MISC_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -431,7 +398,7 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.clickCancelButton();
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "o=orgBelowReferral" ) );
+ assertFalse( browserViewBot.existsEntry( path( MISC_DN, "o=orgBelowReferral" ) ) );
}
@@ -442,17 +409,19 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
* The connection selection dialog pops up and we select a connection.
* The entry is created under the target entry.
*/
- @Test
- public void testCreateEntryBelowReferralObjectFollow()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateEntryBelowReferralObjectFollow( TestLdapServer server ) throws Exception
{
// set ManageDsaIT control
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
ReferralHandlingMethod.IGNORE.ordinal() );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=referral" );
+ browserViewBot.selectEntry( path( REFERRAL_TO_MISC_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -474,8 +443,8 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
referralDialogBot.clickOkButton();
// check entry was created under referral target entry
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "o=orgBelowReferral" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "o=orgBelowReferral" );
+ assertTrue( browserViewBot.existsEntry( path( MISC_DN, "o=orgBelowReferral" ) ) );
+ browserViewBot.selectEntry( path( MISC_DN, "o=orgBelowReferral" ) );
}
@@ -484,10 +453,12 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
*
* Create an entry with sharp in DN: cn=\#123456.
*/
- @Test
- public void testCreateEntryWithSharp()
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testCreateEntryWithSharp( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -504,8 +475,16 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.typeValueAndFinish( "#123456" );
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=\\#123456" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=\\#123456" );
+ if ( server.getType() == LdapServerType.ApacheDS )
+ {
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=\\#123456" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=\\#123456" ) );
+ }
+ else
+ {
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=\\23123456" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=\\23123456" ) );
+ }
}
@@ -514,10 +493,12 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
*
* Create an entry with multi-valued RDN and numeric OID (IP address) in RDN value.
*/
- @Test
- public void testCreateMvRdnWithNumericOid()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateMvRdnWithNumericOid( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -532,14 +513,13 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.setRdnType( 1, "cn" );
wizardBot.setRdnValue( 1, "loopback" );
wizardBot.setRdnType( 2, "ipHostNumber" );
- wizardBot.setRdnValue( 2, LOCALHOST_ADDRESS );
+ wizardBot.setRdnValue( 2, "127.0.0.1" );
wizardBot.clickNextButton();
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system",
- "cn=loopback+ipHostNumber=" + LOCALHOST_ADDRESS ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=loopback+ipHostNumber=" + LOCALHOST_ADDRESS );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=loopback+ipHostNumber=127.0.0.1" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=loopback+ipHostNumber=127.0.0.1" ) );
}
@@ -548,10 +528,12 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
*
* Create and browse entry with multi-valued RDN with same attribute type.
*/
- @Test
- public void testCreateMvRdnWithSameAttribute()
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All, except = LdapServerType.OpenLdap, reason = "Multi-valued RDN with same attribute is not supported by OpenLDAP")
+ public void testCreateMvRdnWithSameAttribute( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -573,22 +555,32 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system",
- "l=eu+l=de+l=Berlin" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "l=eu+l=de+l=Berlin" );
+ if ( server.getType() == LdapServerType.Fedora389ds )
+ {
+ // 389ds sorts the RDN
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "l=Berlin+l=de+l=eu" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "l=Berlin+l=de+l=eu" ) );
+ }
+ else
+ {
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "l=eu+l=de+l=Berlin" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "l=eu+l=de+l=Berlin" ) );
+ }
}
/**
* DIRSTUDIO-1267: Test creation of new entry with binary option and language tags.
*/
- @Test
- public void testCreateEntryWithBinaryOptionAndLanguageTags() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCreateEntryWithBinaryOptionAndLanguageTags( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String certFile = ResourceUtils.prepareInputFile( "rfc5280_cert1.cer" );
String crlFile = ResourceUtils.prepareInputFile( "rfc5280_crl.crl" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( TARGET_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
@@ -672,10 +664,10 @@ public class NewEntryWizardTest extends AbstractLdapTestUnit
wizardBot.activate();
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "cn=asdf" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=asdf" );
+ assertTrue( browserViewBot.existsEntry( path( TARGET_DN, "cn=asdf" ) ) );
+ browserViewBot.selectEntry( path( TARGET_DN, "cn=asdf" ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=asdf,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn( "cn=asdf", TARGET_DN ).getName() );
entryEditorBot.activate();
modificationLogsViewBot.waitForText( "cACertificate;binary:: MIICPjCCAaeg" );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/OpenLdapTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/OpenLdapTest.java
deleted file mode 100644
index d5a6af00d..000000000
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/OpenLdapTest.java
+++ /dev/null
@@ -1,703 +0,0 @@
-/*
- * 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.
- *
- */
-
-package org.apache.directory.studio.test.integration.ui;
-
-
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.StreamSupport;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.directory.api.ldap.model.entry.Modification;
-import org.apache.directory.api.ldap.model.exception.LdapAuthenticationException;
-import org.apache.directory.api.ldap.model.ldif.LdifEntry;
-import org.apache.directory.api.ldap.model.ldif.LdifReader;
-import org.apache.directory.ldap.client.api.LdapNetworkConnection;
-import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
-import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ModifyMode;
-import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.CertificateEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.EditAttributeWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
-import org.apache.directory.studio.test.integration.ui.bots.ErrorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.HexEditorDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ModificationLogsViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.NewAttributeWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.NewConnectionWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.NewEntryWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.SchemaBrowserBot;
-import org.apache.directory.studio.test.integration.ui.bots.SearchDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-
-/**
- * Tests against OpenLDAP.
- *
- * Expects a running OpenLDAP server with below default connection parameters
- * which can be configured via environment variables.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-public class OpenLdapTest
-{
- static String getOrDefault( String key, String defaultValue )
- {
- return System.getenv().getOrDefault( key, defaultValue );
- }
-
- private static final String OPENLDAP_HOST = getOrDefault( "OPENLDAP_HOST", LOCALHOST );
- private static final int OPENLDAP_PORT = Integer.parseInt( getOrDefault( "OPENLDAP_PORT", "20389" ) );
- private static final String OPENLDAP_ADMIN_DN = getOrDefault( "OPENLDAP_ADMIN_DN", "cn=admin,dc=example,dc=org" );
- private static final String OPENLDAP_ADMIN_PASSWORD = getOrDefault( "OPENLDAP_ADMIN_PASSWORD", "admin" );
- private static final String OPENLDAP_CONFIG_DN = getOrDefault( "OPENLDAP_CONFIG_DN", "cn=admin,cn=config" );
- private static final String OPENLDAP_CONFIG_PASSWORD = getOrDefault( "OPENLDAP_CONFIG_PASSWORD", "config" );
-
- @BeforeClass
- public static void skipOpenLdapTestIfNotRunning() throws Exception
- {
-
- try ( LdapNetworkConnection connection = new LdapNetworkConnection( OPENLDAP_HOST, OPENLDAP_PORT ) )
- {
- connection.connect();
- connection.bind( OPENLDAP_ADMIN_DN, OPENLDAP_ADMIN_PASSWORD );
- }
- catch ( InvalidConnectionException e )
- {
- Assume.assumeNoException(
- "Skipping tests as connection to OpenLDAP server failed: " + OPENLDAP_HOST + ":" + OPENLDAP_PORT, e );
- }
- catch ( LdapAuthenticationException e )
- {
- Assume.assumeNoException(
- "Skipping tests as bind to OpenLDAP server failed: " + OPENLDAP_HOST + ":" + OPENLDAP_PORT, e );
- }
- }
-
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
- private ModificationLogsViewBot modificationLogsViewBot;
-
- private Connection connection;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "OpenLdapTest", OPENLDAP_HOST, OPENLDAP_PORT,
- OPENLDAP_ADMIN_DN, OPENLDAP_ADMIN_PASSWORD );
- browserViewBot = studioBot.getBrowserView();
- modificationLogsViewBot = studioBot.getModificationLogsViewBot();
-
- try ( LdapNetworkConnection connection = new LdapNetworkConnection( OPENLDAP_HOST, OPENLDAP_PORT );
- LdifReader ldifReader = new LdifReader( OpenLdapTest.class.getResourceAsStream( "OpenLdapTest.ldif" ) ) )
- {
- connection.bind( OPENLDAP_ADMIN_DN, OPENLDAP_ADMIN_PASSWORD );
- for ( LdifEntry entry : ldifReader )
- {
- connection.add( entry.getEntry() );
- }
- }
-
- try ( LdapNetworkConnection connection = new LdapNetworkConnection( OPENLDAP_HOST, OPENLDAP_PORT );
- LdifReader ldifReader = new LdifReader( OpenLdapTest.class.getResourceAsStream( "OpenLdapConfig.ldif" ) ) )
- {
- connection.bind( OPENLDAP_CONFIG_DN, OPENLDAP_CONFIG_PASSWORD );
- for ( LdifEntry entry : ldifReader )
- {
- for ( Modification modification : entry.getModifications() )
- {
- connection.modify( entry.getDn(), modification );
- }
- }
- }
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
-
- try ( LdapNetworkConnection connection = new LdapNetworkConnection( OPENLDAP_HOST, OPENLDAP_PORT );
- LdifReader ldifReader = new LdifReader( OpenLdapTest.class.getResourceAsStream( "OpenLdapTest.ldif" ) ) )
- {
- connection.bind( OPENLDAP_ADMIN_DN, OPENLDAP_ADMIN_PASSWORD );
- List<LdifEntry> ldifEntries = StreamSupport.stream( ldifReader.spliterator(), false )
- .collect( Collectors.toList() );
- Collections.reverse( ldifEntries );
- for ( LdifEntry entry : ldifEntries )
- {
- connection.delete( entry.getDn() );
- }
- }
- }
-
-
- @Test
- public void testBrowseWithPagingWithScrollMode()
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
-
- // enable Simple Paged Results control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH, true );
- connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE, 3 );
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SCROLL_MODE, true );
-
- // 1st page
- browserViewBot.expandEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
-
- // next page
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
-
- // last page
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
-
- // back to top
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertTrue(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
- }
-
-
- @Test
- public void testBrowseWithPagingWithoutScrollMode()
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
-
- // enable Simple Paged Results control
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH, true );
- connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SIZE, 3 );
- connection.getConnectionParameter().setExtendedBoolProperty(
- IBrowserConnection.CONNECTION_PARAMETER_PAGED_SEARCH_SCROLL_MODE, false );
-
- browserViewBot.expandEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Top Page ---" ) );
- assertFalse(
- browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "--- Next Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users (8)" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.8" ) );
- }
-
-
- @Test
- public void testSearchWithPagingWithScrollMode() throws Exception
- {
- String searchName = "Paged search with scroll mode";
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
- SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
- assertTrue( dialogBot.isVisible() );
- dialogBot.setSearchName( searchName );
- dialogBot.setFilter( "(objectClass=*)" );
- dialogBot.setReturningAttributes( "objectClass,ou,cn,uid" );
- dialogBot.setControlPagedSearch( true, 3, true );
- dialogBot.clickSearchButton();
-
- // 1st page
- browserViewBot.expandEntry( "Searches", searchName );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
-
- // next page
- browserViewBot.selectEntry( "Searches", searchName, "--- Next Page ---" );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
-
- // last page
- browserViewBot.selectEntry( "Searches", searchName, "--- Next Page ---" );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
-
- // back to top
- browserViewBot.selectEntry( "Searches", searchName, "--- Top Page ---" );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
- }
-
-
- @Test
- public void testSearchWithPagingWithoutScrollMode() throws Exception
- {
- String searchName = "Paged search without scroll mode";
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
- SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
- assertTrue( dialogBot.isVisible() );
- dialogBot.setSearchName( searchName );
- dialogBot.setFilter( "(objectClass=*)" );
- dialogBot.setReturningAttributes( "objectClass,ou,cn,uid" );
- dialogBot.setControlPagedSearch( true, 3, false );
- dialogBot.clickSearchButton();
-
- browserViewBot.expandEntry( "Searches", searchName );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
- assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName + " (9+)" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "uid=user.8" ) );
- }
-
-
- @Test
- public void testCheckAuthenticationButtonNotOK()
- {
- // enter connection parameter
- NewConnectionWizardBot wizardBot = connectionsViewBot.openNewConnectionWizard();
- wizardBot.typeConnectionName( "OpenLDAP connection test not ok" );
- wizardBot.typeHost( OPENLDAP_HOST );
- wizardBot.typePort( OPENLDAP_PORT );
- wizardBot.clickNextButton();
-
- // enter incorrect authentication parameter
- wizardBot.typeUser( OPENLDAP_ADMIN_DN );
- wizardBot.typePassword( "wrongpassword" );
-
- // click "Check Network Parameter" button
- String result = wizardBot.clickCheckAuthenticationButton();
- assertNotNull( "Expected Error", result );
- assertThat( result, containsString( "[LDAP result code 49 - invalidCredentials]" ) );
-
- wizardBot.clickCancelButton();
- }
-
-
- /**
- * Test adding, editing and deleting of attributes in the entry editor.
- */
- @Test
- public void testAddEditDeleteAttribute() throws Exception
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.1" );
-
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,dc=example,dc=org" );
- entryEditorBot.activate();
- String dn = entryEditorBot.getDnText();
- assertEquals( "DN: uid=user.1,ou=users,dc=example,dc=org", dn );
- assertEquals( 22, entryEditorBot.getAttributeValues().size() );
- assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
-
- // add description attribute
- entryEditorBot.activate();
- NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
- assertTrue( wizardBot.isVisible() );
- wizardBot.typeAttributeType( "description" );
- wizardBot.clickFinishButton();
- entryEditorBot.typeValueAndFinish( "This is the 1st description." );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- modificationLogsViewBot.waitForText( "add: description\ndescription: This is the 1st description." );
-
- // add second value
- entryEditorBot.activate();
- entryEditorBot.addValue( "description" );
- entryEditorBot.typeValueAndFinish( "This is the 2nd description." );
- assertEquals( 24, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 2nd description." ) );
- modificationLogsViewBot.waitForText( "add: description\ndescription: This is the 2nd description." );
-
- // edit second value
- entryEditorBot.editValue( "description", "This is the 2nd description." );
- entryEditorBot.typeValueAndFinish( "This is the 3rd description." );
- assertEquals( 24, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the 2nd description." ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 3rd description." ) );
- modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the 2nd description." );
- modificationLogsViewBot.waitForText( "add: description\ndescription: This is the 3rd description." );
-
- // delete second value
- entryEditorBot.deleteValue( "description", "This is the 3rd description." );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the 3rd description." ) );
- modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the 3rd description." );
-
- // edit 1st value
- entryEditorBot.editValue( "description", "This is the 1st description." );
- entryEditorBot.typeValueAndFinish( "This is the final description." );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the 1st description." ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description: This is the final description." ) );
- modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the 1st description." );
- modificationLogsViewBot.waitForText( "add: description\ndescription: This is the final description." );
-
- // delete 1st value/attribute
- entryEditorBot.deleteValue( "description", "This is the final description." );
- assertEquals( 22, entryEditorBot.getAttributeValues().size() );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description: This is the final description." ) );
- modificationLogsViewBot.waitForText( "delete: description\ndescription: This is the final description.\n-" );
-
- assertEquals( "Expected 6 modifications.", 6,
- StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ) );
- }
-
-
- /**
- * Test adding, editing and deleting of attributes without equality matching rule in the entry editor.
- */
- @Test
- public void testAddEditDeleteAttributeWithoutEqualityMatchingRule() throws Exception
- {
- IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
- .getBrowserConnection( connection );
- browserConnection.setModifyModeNoEMR( ModifyMode.REPLACE );
-
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.1" );
-
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,dc=example,dc=org" );
- entryEditorBot.activate();
- String dn = entryEditorBot.getDnText();
- assertEquals( "DN: uid=user.1,ou=users,dc=example,dc=org", dn );
- assertEquals( 22, entryEditorBot.getAttributeValues().size() );
- assertEquals( "", modificationLogsViewBot.getModificationLogsText() );
-
- // add facsimileTelephoneNumber attribute
- entryEditorBot.activate();
- NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
- assertTrue( wizardBot.isVisible() );
- wizardBot.typeAttributeType( "facsimileTelephoneNumber" );
- wizardBot.clickFinishButton();
- entryEditorBot.typeValueAndFinish( "+1 234 567 890" );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertTrue( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: +1 234 567 890" ) );
- modificationLogsViewBot
- .waitForText( "replace: facsimileTelephoneNumber\nfacsimileTelephoneNumber: +1 234 567 890" );
-
- // edit value
- entryEditorBot.editValue( "facsimileTelephoneNumber", "+1 234 567 890" );
- entryEditorBot.typeValueAndFinish( "000000000000" );
- assertEquals( 23, entryEditorBot.getAttributeValues().size() );
- assertFalse( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: +1 234 567 890" ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: 000000000000" ) );
- modificationLogsViewBot
- .waitForText( "replace: facsimileTelephoneNumber\nfacsimileTelephoneNumber: 000000000000" );
-
- // delete 1st value/attribute
- entryEditorBot.deleteValue( "facsimileTelephoneNumber", "000000000000" );
- assertEquals( 22, entryEditorBot.getAttributeValues().size() );
- assertFalse( entryEditorBot.getAttributeValues().contains( "facsimileTelephoneNumber: 000000000000" ) );
- modificationLogsViewBot
- .waitForText( "replace: facsimileTelephoneNumber\n-" );
-
- assertEquals( "Expected 3 modifications.", 3,
- StringUtils.countMatches( modificationLogsViewBot.getModificationLogsText(), "#!RESULT OK" ) );
- }
-
-
- @Test
- public void testNoPermissionToReadSchema() throws Exception
- {
- // Close connection and reset cached schema
- connectionsViewBot.closeSelectedConnections();
- IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
- .getBrowserConnection( connection );
- browserConnection.setSchema( Schema.DEFAULT_SCHEMA );
-
- // Open connection as uid=user.1 which is not allowed to read cn=subschema
- connection.setBindPrincipal( "uid=user.1,ou=users,dc=example,dc=org" );
- connection.setBindPassword( "password" );
- ErrorDialogBot errorDialog = connectionsViewBot.openSelectedConnectionExpectingNoSchemaProvidedErrorDialog();
- assertThat( errorDialog.getErrorDetails(),
- containsString( "No schema information returned by server, using default schema." ) );
- errorDialog.clickOkButton();
-
- // Verify default schema is used
- SchemaBrowserBot schemaBrowser = connectionsViewBot.openSchemaBrowser();
- schemaBrowser.selectObjectClass( "DEFAULTSCHEMA" );
- String rawSchemaDefinition = schemaBrowser.getRawSchemaDefinition();
- assertNotNull( rawSchemaDefinition );
- assertTrue( rawSchemaDefinition.contains( "This is the Default Schema" ) );
-
- // Verify browser
- browserViewBot.selectEntry( "DIT", "Root DSE" );
- }
-
-
- /**
- * DIRSTUDIO-1267: Test creation of new entry with binary option and language tags.
- */
- @Test
- public void testCreateEntryWithBinaryOptionAndLanguageTags() throws Exception
- {
- String certFile = ResourceUtils.prepareInputFile( "rfc5280_cert1.cer" );
- String crlFile = ResourceUtils.prepareInputFile( "rfc5280_crl.crl" );
-
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users" );
-
- NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
-
- wizardBot.selectCreateEntryFromScratch();
- wizardBot.clickNextButton();
- wizardBot.addObjectClasses( "organizationalRole" );
- wizardBot.addObjectClasses( "certificationAuthority" );
- wizardBot.clickNextButton();
-
- wizardBot.setRdnType( 1, "cn" );
- wizardBot.setRdnValue( 1, "asdf" );
- wizardBot.clickNextButton();
-
- // by default the hex or certificate editor is opened, close it
- try
- {
- new HexEditorDialogBot().clickCancelButton();
- }
- catch ( WidgetNotFoundException e )
- {
- }
- try
- {
- new CertificateEditorDialogBot().clickCancelButton();
- }
- catch ( WidgetNotFoundException e )
- {
- }
-
- wizardBot.activate();
- NewAttributeWizardBot newAttributeWizardBot = wizardBot.openNewAttributeWizard();
- assertTrue( newAttributeWizardBot.isVisible() );
- newAttributeWizardBot.typeAttributeType( "description" );
- newAttributeWizardBot.clickNextButton();
- newAttributeWizardBot.setLanguageTag( "en", "us" );
- newAttributeWizardBot.clickFinishButton();
- wizardBot.cancelEditValue();
- wizardBot.activate();
- wizardBot.editValue( "description;lang-en-us", null );
- SWTUtils.sleep( 1000 );
- wizardBot.typeValueAndFinish( "English description" );
-
- wizardBot.activate();
- EditAttributeWizardBot editAttributeBot = wizardBot.editAttribute( "cACertificate", null );
- editAttributeBot.clickNextButton();
- editAttributeBot.selectBinaryOption();
- editAttributeBot.clickFinishButton();
-
- wizardBot.activate();
- wizardBot.editValue( "cACertificate;binary", null );
- CertificateEditorDialogBot certEditorBot = new CertificateEditorDialogBot();
- assertTrue( certEditorBot.isVisible() );
- certEditorBot.typeFile( certFile );
- certEditorBot.clickOkButton();
-
- wizardBot.activate();
- editAttributeBot = wizardBot.editAttribute( "certificateRevocationList", null );
- editAttributeBot.clickNextButton();
- editAttributeBot.selectBinaryOption();
- editAttributeBot.clickFinishButton();
-
- wizardBot.activate();
- wizardBot.editValue( "certificateRevocationList;binary", null );
- HexEditorDialogBot hexEditorBot = new HexEditorDialogBot();
- assertTrue( hexEditorBot.isVisible() );
- hexEditorBot.typeFile( crlFile );
- hexEditorBot.clickOkButton();
-
- wizardBot.activate();
- editAttributeBot = wizardBot.editAttribute( "authorityRevocationList", null );
- editAttributeBot.clickNextButton();
- editAttributeBot.selectBinaryOption();
- editAttributeBot.clickFinishButton();
-
- wizardBot.activate();
- wizardBot.editValue( "authorityRevocationList;binary", null );
- assertTrue( hexEditorBot.isVisible() );
- hexEditorBot.typeFile( crlFile );
- hexEditorBot.clickOkButton();
-
- wizardBot.activate();
- wizardBot.clickFinishButton();
-
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "cn=asdf" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "cn=asdf" );
-
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=asdf,ou=users,dc=example,dc=org" );
- entryEditorBot.activate();
-
- modificationLogsViewBot.waitForText( "cACertificate;binary:: MIICPjCCAaeg" );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "cACertificate;binary: X.509v3: CN=Example CA,DC=example,DC=com" ) );
-
- modificationLogsViewBot.waitForText( "certificateRevocationList;binary:: MIIBYDCBygIB" );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "certificateRevocationList;binary: Binary Data (356 Bytes)" ) );
-
- modificationLogsViewBot.waitForText( "authorityRevocationList;binary:: MIIBYDCBygIB" );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "authorityRevocationList;binary: Binary Data (356 Bytes)" ) );
-
- modificationLogsViewBot.waitForText( "description;lang-en-us: English description" );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "description;lang-en-us: English description" ) );
-
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "cn=asdf" );
- DeleteDialogBot deleteDialogBot = browserViewBot.openDeleteDialog();
- deleteDialogBot.clickOkButton();
- }
-
-
- /**
- * DIRSTUDIO-1267: Test adding, editing and deleting of attributes with binary option in the entry editor.
- */
- @Test
- public void testAddEditDeleteAttributeWithBinaryOption() throws Exception
- {
- String cert2File = ResourceUtils.prepareInputFile( "rfc5280_cert2.cer" );
- String cert3File = ResourceUtils.prepareInputFile( "rfc5280_cert3.cer" );
-
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.1" );
-
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,dc=example,dc=org" );
- entryEditorBot.activate();
-
- // add userCertificate;binary
- NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
- assertTrue( wizardBot.isVisible() );
- wizardBot.typeAttributeType( "userCertificate" );
- wizardBot.clickNextButton();
- wizardBot.selectBinaryOption();
- CertificateEditorDialogBot certEditorBot = wizardBot.clickFinishButtonExpectingCertificateEditor();
- assertTrue( certEditorBot.isVisible() );
- certEditorBot.typeFile( cert2File );
- certEditorBot.clickOkButton();
- modificationLogsViewBot.waitForText( "add: userCertificate;binary\nuserCertificate;binary:: MIICcTCCAdqg" );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "userCertificate;binary: X.509v3: CN=End Entity,DC=example,DC=com" ) );
-
- // edit userCertificate;binary
- certEditorBot = entryEditorBot.editValueExpectingCertificateEditor( "userCertificate;binary",
- "X.509v3: CN=End Entity,DC=example,DC=com" );
- assertTrue( certEditorBot.isVisible() );
- certEditorBot.typeFile( cert3File );
- certEditorBot.clickOkButton();
- modificationLogsViewBot.waitForText( "delete: userCertificate;binary\nuserCertificate;binary:: MIICcTCCAdqg" );
- modificationLogsViewBot.waitForText( "add: userCertificate;binary\nuserCertificate;binary:: MIIDjjCCA06g" );
- assertFalse( entryEditorBot.getAttributeValues()
- .contains( "userCertificate;binary: X.509v3: CN=End Entity,DC=example,DC=com" ) );
- assertTrue( entryEditorBot.getAttributeValues()
- .contains( "userCertificate;binary: X.509v3: CN=DSA End Entity,DC=example,DC=com" ) );
-
- // delete userCertificate;binary
- entryEditorBot.deleteValue( "userCertificate;binary", "X.509v3: CN=DSA End Entity,DC=example,DC=com" );
- modificationLogsViewBot.waitForText( "delete: userCertificate;binary\nuserCertificate;binary:: MIIDjjCCA06g" );
- assertFalse( entryEditorBot.getAttributeValues()
- .contains( "userCertificate;binary: X.509v3: CN=DSA End Entity,DC=example,DC=com" ) );
-
- }
-
-
- /**
- * DIRSTUDIO-1267:Test adding, editing and deleting of attributes with language tag in the entry editor.
- */
- @Test
- public void testAddEditDeleteAttributeWithLanguageTag() throws Exception
- {
- browserViewBot.selectEntry( "DIT", "Root DSE", "dc=example,dc=org", "ou=users", "uid=user.1" );
-
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "uid=user.1,ou=users,dc=example,dc=org" );
- entryEditorBot.activate();
-
- // add attribute description;lang-en
- entryEditorBot.activate();
- NewAttributeWizardBot wizardBot = entryEditorBot.openNewAttributeWizard();
- assertTrue( wizardBot.isVisible() );
- wizardBot.typeAttributeType( "description" );
- wizardBot.clickNextButton();
- wizardBot.setLanguageTag( "en", "" );
- wizardBot.clickFinishButton();
- entryEditorBot.typeValueAndFinish( "English" );
- modificationLogsViewBot.waitForText( "add: description;lang-en\ndescription;lang-en: English\n-" );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-en: English" ) );
-
- // edit the attribute to description;lang-en
- EditAttributeWizardBot editWizardBot = entryEditorBot.editAttribute( "description;lang-en", "English" );
- editWizardBot.clickNextButton();
- editWizardBot.setLanguageTag( "en", "us" );
- editWizardBot.clickFinishButton();
- modificationLogsViewBot.waitForText( "delete: description;lang-en\ndescription;lang-en: English\n-" );
- modificationLogsViewBot.waitForText( "add: description;lang-en-us\ndescription;lang-en-us: English\n-" );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description;lang-en: English" ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-en-us: English" ) );
-
- // edit the value
- entryEditorBot.editValue( "description;lang-en-us", "English" );
- entryEditorBot.typeValueAndFinish( "English US" );
- modificationLogsViewBot.waitForText( "delete: description;lang-en-us\ndescription;lang-en-us: English\n-" );
- modificationLogsViewBot.waitForText( "add: description;lang-en-us\ndescription;lang-en-us: English US\n-" );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description;lang-en-us: English" ) );
- assertTrue( entryEditorBot.getAttributeValues().contains( "description;lang-en-us: English US" ) );
-
- // delete the attribute
- entryEditorBot.deleteValue( "description;lang-en-us", "English US" );
- modificationLogsViewBot.waitForText( "delete: description;lang-en-us\ndescription;lang-en-us: English US\n-" );
- assertFalse( entryEditorBot.getAttributeValues().contains( "description;lang-en-us: English US" ) );
- }
-
-}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PerformanceTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PerformanceTest.java
index 30fb5d477..240282b9f 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PerformanceTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PerformanceTest.java
@@ -21,27 +21,21 @@
package org.apache.directory.studio.test.integration.ui;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.GROUPS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
+
import java.util.ArrayList;
import java.util.List;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -50,58 +44,38 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class PerformanceTest extends AbstractLdapTestUnit
+public class PerformanceTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connectionsViewBot.createTestConnection( "EntryEditorTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-1119 (Group with over 1000 members crashes)
*/
- @Test
- public void testEditLargeGroup() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testEditLargeGroup( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
BrowserCommonActivator.getDefault()
.getPluginPreferences().setValue( BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING, false );
+ Dn dn = dn( "cn=Large Group", GROUPS_DN );
int n = 5000;
String memberAt = "member";
List<String> memberDns = new ArrayList<>( n );
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "cn=Large Group,ou=system" ) );
- entry.add( "objectClass", "top", "groupOfNames" );
- entry.add( "cn", "Large Group" );
- for ( int i = 0; i < n; i++ )
- {
- String memberDn = "cn=user." + String.format( "%04d", i );
- memberDns.add( memberDn );
- entry.add( memberAt, memberDn );
- }
- service.getAdminSession().add( entry );
+ server.withAdminConnection( conn -> {
+ Entry entry = new DefaultEntry( conn.getSchemaManager() );
+ entry.setDn( dn );
+ entry.add( "objectClass", "top", "groupOfNames" );
+ entry.add( "cn", "Large Group" );
+ for ( int i = 0; i < n; i++ )
+ {
+ String memberDn = "cn=user." + String.format( "%04d", i );
+ memberDns.add( memberDn );
+ entry.add( memberAt, memberDn );
+ }
+ conn.add( entry );
+ } );
String first = memberDns.get( 0 );
String second = memberDns.get( 1 );
@@ -109,9 +83,9 @@ public class PerformanceTest extends AbstractLdapTestUnit
String secondToLast = memberDns.get( n - 2 );
String last = memberDns.get( n - 1 );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "cn=Large Group" );
+ browserViewBot.selectEntry( path( dn ) );
- EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( "cn=Large Group,ou=system" );
+ EntryEditorBot entryEditorBot = studioBot.getEntryEditorBot( dn.getName() );
entryEditorBot.activate();
// edit some values
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java
index cf6c22455..60c7bee37 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/PreferencesTest.java
@@ -21,44 +21,36 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
import java.net.URL;
import java.nio.charset.StandardCharsets;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
import java.security.cert.X509Certificate;
+import java.util.Date;
import java.util.List;
+import org.apache.directory.api.ldap.model.entry.DefaultEntry;
+import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.util.FileUtils;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.core.security.CertificateUtil;
+import org.apache.directory.server.core.security.TlsKeyGenerator;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
import org.apache.directory.studio.connection.core.PasswordsKeyStoreManager;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.CertificateValidationPreferencePageBot;
import org.apache.directory.studio.test.integration.ui.bots.CertificateViewerDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.KeepConnectionsPasswordsDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.PasswordsKeystorePreferencePageBot;
import org.apache.directory.studio.test.integration.ui.bots.PreferencesBot;
import org.apache.directory.studio.test.integration.ui.bots.SetupMasterPasswordDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
import org.apache.directory.studio.test.integration.ui.bots.VerifyMasterPasswordDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.eclipse.core.runtime.Platform;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import sun.security.x509.X500Name;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -67,37 +59,12 @@ import sun.security.x509.X500Name;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class PreferencesTest extends AbstractLdapTestUnit
+public class PreferencesTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-580
* (Setting "Validate certificates for secure LDAP connections" is not saved).
- *
- * @throws Exception
*/
@Test
public void testCertificatValidationSettingsSaved() throws Exception
@@ -157,11 +124,15 @@ public class PreferencesTest extends AbstractLdapTestUnit
preferencesBot.clickCancelButton();
// add a certificate (not possible via native file dialog)
- X500Name issuer = new X500Name( "apacheds", "directory", "apache", "US" );
- KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance( "EC" );
- keyPairGenerator.initialize( 256 );
- KeyPair keyPair = keyPairGenerator.generateKeyPair();
- X509Certificate certificate = CertificateUtil.generateSelfSignedCertificate( issuer, keyPair, 365, "SHA256WithECDSA" );
+ Entry entry = new DefaultEntry();
+ String issuerDn = "cn=apacheds,ou=directory,o=apache,c=US";
+ Date startDate = new Date();
+ Date expiryDate = new Date( System.currentTimeMillis() + TlsKeyGenerator.YEAR_MILLIS );
+ String keyAlgo = "RSA";
+ int keySize = 1024;
+ CertificateValidationTest.addKeyPair( entry, issuerDn, issuerDn, startDate, expiryDate, keyAlgo, keySize,
+ null );
+ X509Certificate certificate = TlsKeyGenerator.getCertificate( entry );
ConnectionCorePlugin.getDefault().getPermanentTrustStoreManager().addCertificate( certificate );
// verify there is one certificate now
@@ -197,10 +168,11 @@ public class PreferencesTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-1179
* (java.io.IOException: Invalid secret key format after Java update).
*/
- @Test
- public void testConnectionPasswordsKeystore() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testConnectionPasswordsKeystore( TestLdapServer server ) throws Exception
{
- Connection connection = connectionsViewBot.createTestConnection( "BrowserTest", ldapServer.getPort() );
+ Connection connection = connectionsViewBot.createTestConnection( server );
connectionsViewBot.closeSelectedConnections();
// the global password keystore manager
@@ -251,7 +223,8 @@ public class PreferencesTest extends AbstractLdapTestUnit
pageBot = preferencesBot.openPasswordsKeystorePage();
assertTrue( pageBot.isPasswordsKeystoreEnabled() );
KeepConnectionsPasswordsDialogBot keepConnectionsPasswordsDialogBot = pageBot.disablePasswordsKeystore();
- VerifyMasterPasswordDialogBot verifyMasterPasswordDialog = keepConnectionsPasswordsDialogBot.clickYesButtonExpectingVerifyMasterPasswordDialog();
+ VerifyMasterPasswordDialogBot verifyMasterPasswordDialog = keepConnectionsPasswordsDialogBot
+ .clickYesButtonExpectingVerifyMasterPasswordDialog();
verifyMasterPasswordDialog.enterMasterPassword( "secret12" );
verifyMasterPasswordDialog.clickOkButton();
assertFalse( pageBot.isPasswordsKeystoreEnabled() );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ProgressViewTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ProgressViewTest.java
index 5e19dc864..d192a0329 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ProgressViewTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ProgressViewTest.java
@@ -21,18 +21,11 @@
package org.apache.directory.studio.test.integration.ui;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.ProgressViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -40,29 +33,8 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class ProgressViewTest extends AbstractLdapTestUnit
+public class ProgressViewTest extends AbstractTestBase
{
- private StudioBot studioBot;
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- studioBot.getConnectionView().deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
@Test
public void testRemoveAllFinishedOperations() throws Exception
@@ -72,14 +44,13 @@ public class ProgressViewTest extends AbstractLdapTestUnit
}
- @Test
- public void testNoRemainingOpenConnectionJobs() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testNoRemainingOpenConnectionJobs( TestLdapServer server ) throws Exception
{
- ConnectionsViewBot connectionView = studioBot.getConnectionView();
-
- connectionView.createTestConnection( "ProgressViewTest", ldapServer.getPort() );
- connectionView.createTestConnection( "ProgressViewTest", ldapServer.getPort() );
- connectionView.createTestConnection( "ProgressViewTest", ldapServer.getPort() );
+ connectionsViewBot.createTestConnection( server );
+ connectionsViewBot.createTestConnection( server );
+ connectionsViewBot.createTestConnection( server );
// actual assertion is done in Assertions.genericTearDownAssertions()
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java
index ca7069e9b..b856742ae 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RcpAppTest.java
@@ -21,24 +21,16 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.studio.test.integration.ui.bots.ExportWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.ImportWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.NewWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.PreferencesBot;
import org.apache.directory.studio.test.integration.ui.bots.ShowViewsBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
/**
@@ -47,29 +39,8 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-public class RcpAppTest extends AbstractLdapTestUnit
+public class RcpAppTest extends AbstractTestBase
{
- private SWTWorkbenchBot bot;
- private StudioBot studioBot;
-
-
- @Before
- public void setUp() throws Exception
- {
- bot = new SWTWorkbenchBot();
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- Assertions.genericTearDownAssertions();
- }
-
-
/**
* Verify views in LDAP perspective.
*/
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java
index 1593e7b32..65dcee372 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java
@@ -21,30 +21,28 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.api.ldap.model.entry.DefaultEntry;
-import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.api.ldap.model.name.Dn;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRALS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_LOOP_1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_LOOP_2_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_REFERRALS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_REFERRAL_TO_USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_USERS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USERS_DN;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.ReferralDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -53,84 +51,42 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class ReferralDialogTest extends AbstractLdapTestUnit
+public class ReferralDialogTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
-
- private Connection connection;
-
- private String[] parentPath;
- private String[] referralPath;
- private String[] targetPath;
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "ReferralDialogTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
-
- // create referral entry
- Entry entry = new DefaultEntry( service.getSchemaManager() );
- entry.setDn( new Dn( "cn=referralDialogTest,ou=system" ) );
- entry.add( "objectClass", "top", "referral", "extensibleObject" );
- entry.add( "cn", "referralDialogTest" );
- entry.add( "ref", "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/ou=users,ou=system" );
- service.getAdminSession().add( entry );
-
- // get paths
- parentPath = new String[]
- { "DIT", "Root DSE", "ou=system" };
- referralPath = new String[]
- { "DIT", "Root DSE", "ou=system", "cn=referralDialogTest" };
- targetPath = new String[]
- { "DIT", "Root DSE", "ou=system",
- "ldap://" + LOCALHOST + ":" + ldapServer.getPort() + "/ou=users,ou=system" };
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.closeSelectedConnections();
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-343.
*
* Follows a continuation reference.
*/
- @Test
- public void testBrowseAndFollowContinuationReference()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseAndFollowContinuationReference( TestLdapServer server ) throws Exception
{
// ensure that referrals handling method is FOLLOW
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD, ReferralHandlingMethod.FOLLOW.ordinal() );
+ IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
+ ReferralHandlingMethod.FOLLOW.ordinal() );
int referralsHandlingMethodOrdinal = connection.getConnectionParameter().getExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD );
assertEquals( ReferralHandlingMethod.FOLLOW.ordinal(), referralsHandlingMethodOrdinal );
- // expand ou=system, that reads the referral and opens the referral dialog
- ReferralDialogBot referralDialogBot = browserViewBot.expandEntryExpectingReferralDialog( parentPath );
+ // expand ou=referrals, that reads the referrals and opens the referral dialog
+ ReferralDialogBot referralDialogBot = browserViewBot.expandEntryExpectingReferralDialog( path( REFERRALS_DN ) );
assertTrue( referralDialogBot.isVisible() );
assertEquals( connection.getName(), referralDialogBot.getSelectedConnection() );
referralDialogBot.clickOkButton();
- // ensure that the target exists, the referral is not visible
- assertFalse( browserViewBot.existsEntry( referralPath ) );
- assertTrue( browserViewBot.existsEntry( targetPath ) );
- browserViewBot.selectEntry( targetPath );
+ // ensure that the continuation URLs are visible and can be expanded, but not the referrals entries
+ assertReferralEntriesAreNotVisible();
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, USER1_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, USERS_DN ) ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, USERS_DN ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, MISC_DN ) ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, MISC_DN ) );
}
@@ -140,59 +96,68 @@ public class ReferralDialogTest extends AbstractLdapTestUnit
* Does not follow a continuation reference by clicking the cancel button in
* the referral dialog.
*/
- @Test
- public void testBrowseAndCancelFollowingContinuationReference()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseAndCancelFollowingContinuationReference( TestLdapServer server ) throws Exception
{
// ensure that referrals handling method is FOLLOW
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD, ReferralHandlingMethod.FOLLOW.ordinal() );
+ IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
+ ReferralHandlingMethod.FOLLOW.ordinal() );
int referralsHandlingMethodOrdinal = connection.getConnectionParameter().getExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD );
assertEquals( ReferralHandlingMethod.FOLLOW.ordinal(), referralsHandlingMethodOrdinal );
- // expand ou=system, that reads the referral and opens the referral dialog
- ReferralDialogBot referralDialogBot = browserViewBot.expandEntryExpectingReferralDialog( parentPath );
+ // expand ou=referrals, that reads the referral and opens the referral dialog
+ ReferralDialogBot referralDialogBot = browserViewBot.expandEntryExpectingReferralDialog( path( REFERRALS_DN ) );
assertTrue( referralDialogBot.isVisible() );
assertEquals( connection.getName(), referralDialogBot.getSelectedConnection() );
referralDialogBot.clickCancelButton();
- // ensure that neither the target, nor the referral exist
- assertFalse( browserViewBot.existsEntry( referralPath ) );
- assertFalse( browserViewBot.existsEntry( targetPath ) );
+ // ensure that neither the continuation URLs, nor the referral entries are visible
+ assertReferralEntriesAreNotVisible();
+ assertRefLdapUrlsAreNotVisible( server );
}
/**
* Tests ignore referral by setting the connection property to IGNORE.
*/
- @Test
- public void testBrowseAndIgnoreReferral()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseAndIgnoreReferral( TestLdapServer server ) throws Exception
{
// ensure that referrals handling method is IGNORE
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD, ReferralHandlingMethod.IGNORE.ordinal() );
+ IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
+ ReferralHandlingMethod.IGNORE.ordinal() );
int referralsHandlingMethodOrdinal = connection.getConnectionParameter().getExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD );
assertEquals( ReferralHandlingMethod.IGNORE.ordinal(), referralsHandlingMethodOrdinal );
- // expand ou=system, no referral dialog expected
- browserViewBot.expandEntry( parentPath );
+ // expand ou=referrals, no referral dialog expected
+ browserViewBot.expandEntry( path( REFERRALS_DN ) );
- // ensure that neither the target, nor the referral exist
- assertFalse( browserViewBot.existsEntry( referralPath ) );
- assertFalse( browserViewBot.existsEntry( targetPath ) );
+ // ensure that neither the continuation URLs, nor the referral entries are visible
+ assertReferralEntriesAreNotVisible();
+ assertRefLdapUrlsAreNotVisible( server );
}
/**
* Tests manage referral entry by setting the ManageDsaIT control.
*/
- @Test
- public void testBrowseAndManageReferralEntry()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseAndManageReferralEntry( TestLdapServer server ) throws Exception
{
// ensure that ManageDsaIT is set
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
- IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD, ReferralHandlingMethod.IGNORE.ordinal() );
+ IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
+ ReferralHandlingMethod.IGNORE.ordinal() );
connection.getConnectionParameter().setExtendedBoolProperty(
IBrowserConnection.CONNECTION_PARAMETER_MANAGE_DSA_IT, true );
int referralsHandlingMethodOrdinal = connection.getConnectionParameter().getExtendedIntProperty(
@@ -202,23 +167,30 @@ public class ReferralDialogTest extends AbstractLdapTestUnit
assertEquals( ReferralHandlingMethod.IGNORE.ordinal(), referralsHandlingMethodOrdinal );
assertTrue( manageDsaIT );
- // expand ou=system, that reads the referral object
- browserViewBot.expandEntry( parentPath );
-
- // ensure that the referral entry exists
- assertTrue( browserViewBot.existsEntry( referralPath ) );
- assertFalse( browserViewBot.existsEntry( targetPath ) );
- browserViewBot.selectEntry( referralPath );
+ // expand ou=referrals, that reads the referral object
+ browserViewBot.expandEntry( path( REFERRALS_DN ) );
+
+ // ensure that the referral entries are visible, but not the continuation URLs
+ assertRefLdapUrlsAreNotVisible( server );
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_USERS_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_REFERRAL_TO_USERS_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_REFERRALS_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_LOOP_1_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_LOOP_2_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( path( REFERRAL_TO_MISC_DN ) ) );
}
/**
* Tests manual referral following.
*/
- @Test
- public void testBrowseAndFollowManuallyContinuationReference()
+ @ParameterizedTest
+ @LdapServersSource
+ public void testBrowseAndFollowManuallyContinuationReference( TestLdapServer server ) throws Exception
{
// ensure that referrals handling method is FOLLOW_MANUALLY
+ Connection connection = connectionsViewBot.createTestConnection( server );
connection.getConnectionParameter().setExtendedIntProperty(
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
ReferralHandlingMethod.FOLLOW_MANUALLY.ordinal() );
@@ -226,22 +198,58 @@ public class ReferralDialogTest extends AbstractLdapTestUnit
IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD );
assertEquals( ReferralHandlingMethod.FOLLOW_MANUALLY.ordinal(), referralsHandlingMethodOrdinal );
- // expand ou=system, no referral dialog expected yet
- browserViewBot.expandEntry( parentPath );
-
- // ensure that the target exists, the referral is not visible
- assertFalse( browserViewBot.existsEntry( referralPath ) );
- assertTrue( browserViewBot.existsEntry( targetPath ) );
-
- // select the target, that should popup the referral dialog
- ReferralDialogBot referralDialogBot = browserViewBot.selectEntryExpectingReferralDialog( targetPath );
+ // expand ou=referrals, no referral dialog expected yet
+ browserViewBot.expandEntry( path( REFERRALS_DN ) );
+
+ // ensure that only the referral targets are visible, not the referrals
+ assertReferralEntriesAreNotVisible();
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, USER1_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, USERS_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRAL_TO_USERS_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_1_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_2_DN ) ) );
+ assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, MISC_DN ) ) );
+
+ // select one target, that should popup the referral dialog
+ ReferralDialogBot referralDialogBot = browserViewBot
+ .selectEntryExpectingReferralDialog( pathWithRefLdapUrl( server, USER1_DN ) );
assertTrue( referralDialogBot.isVisible() );
assertEquals( connection.getName(), referralDialogBot.getSelectedConnection() );
referralDialogBot.clickOkButton();
- // ensure that the target exists, the referral is not visible
- assertFalse( browserViewBot.existsEntry( referralPath ) );
- assertTrue( browserViewBot.existsEntry( targetPath ) );
- browserViewBot.selectEntry( targetPath );
+ // now all ref URLs can be expanded, no additional referral dialog is expected
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, USER1_DN ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, USERS_DN ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRAL_TO_USERS_DN ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_1_DN ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_2_DN ) );
+ browserViewBot.expandEntry( pathWithRefLdapUrl( server, MISC_DN ) );
+ }
+
+
+ private void assertRefLdapUrlsAreNotVisible( TestLdapServer server )
+ {
+ assertFalse( browserViewBot.existsEntry( pathWithRefLdapUrl( server, USER1_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( pathWithRefLdapUrl( server, USERS_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRAL_TO_USERS_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_1_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_2_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( pathWithRefLdapUrl( server, MISC_DN ) ) );
}
+
+
+ private void assertReferralEntriesAreNotVisible()
+ {
+ assertFalse( browserViewBot.existsEntry( path( REFERRAL_TO_USER1_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( path( REFERRAL_TO_USERS_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( path( REFERRAL_TO_REFERRAL_TO_USERS_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( path( REFERRAL_TO_REFERRALS_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( path( REFERRAL_LOOP_1_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( path( REFERRAL_LOOP_2_DN ) ) );
+ assertFalse( browserViewBot.existsEntry( path( REFERRAL_TO_MISC_DN ) ) );
+ }
+
} \ No newline at end of file
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryTest.java
index 1927e6a51..2e679b507 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/RenameEntryTest.java
@@ -21,22 +21,24 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MULTI_VALUED_RDN_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_ESCAPED_CHARACTERS_BACKSLASH_PREFIXED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_ESCAPED_CHARACTERS_HEX_PAIR_ESCAPED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.dn;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.directory.api.ldap.model.name.Ava;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.name.Rdn;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
import org.apache.directory.studio.test.integration.ui.bots.RenameEntryDialogBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -45,59 +47,37 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-@ApplyLdifFiles( clazz = RenameEntryTest.class,
- value = "org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif" )
-public class RenameEntryTest extends AbstractLdapTestUnit
+public class RenameEntryTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connectionsViewBot.createTestConnection( "RenameEntryTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-318.
*
* Renames a multi-valued RDN by changing both RDN attributes.
- *
- * @throws Exception
- * the exception
*/
- @Test
- public void testRenameMultiValuedRdn() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRenameMultiValuedRdn( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Barbara Jensen+uid=bjensen" );
+ Dn oldDn = MULTI_VALUED_RDN_DN;
+ Rdn newRdn = new Rdn( new Ava( "cn", "Babs Jensen" ), new Ava( "uid", "dj" ) );
+ Dn newDn = dn( newRdn, oldDn.getParent() );
+
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( oldDn ) );
RenameEntryDialogBot renameDialogBot = browserViewBot.openRenameDialog();
assertTrue( renameDialogBot.isVisible() );
- renameDialogBot.setRdnValue( 1, "Babs Jensen" );
- renameDialogBot.setRdnValue( 2, "babsjens" );
+ for ( int i = 0; i < newRdn.size(); i++ )
+ {
+ renameDialogBot.setRdnType( i + 1, newRdn.getAva( i ).getType() );
+ renameDialogBot.setRdnValue( i + 1, newRdn.getAva( i ).getValue().getString() );
+ }
renameDialogBot.clickOkButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=Babs Jensen+uid=babsjens" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=Babs Jensen+uid=babsjens" );
+ assertTrue( browserViewBot.existsEntry( path( newDn ) ) );
+ browserViewBot.selectEntry( path( newDn ) );
+ assertFalse( browserViewBot.existsEntry( path( oldDn ) ) );
}
@@ -105,73 +85,123 @@ public class RenameEntryTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-484.
*
* Renames a RDN with escaped characters.
- *
- * @throws Exception
- * the exception
*/
- @Test
- public void testRenameRdnWithEscapedCharacters() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testRenameRdnWithEscapedCharacters( TestLdapServer server ) throws Exception
{
- browserViewBot
- .selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"" );
+ Dn oldDn = DN_WITH_ESCAPED_CHARACTERS_BACKSLASH_PREFIXED;
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ oldDn = DN_WITH_ESCAPED_CHARACTERS_HEX_PAIR_ESCAPED;
+ }
+ Dn newDn = dn( oldDn.getRdn().getName() + " renamed", oldDn.getParent() );
+
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( oldDn ) );
RenameEntryDialogBot renameDialogBot = browserViewBot.openRenameDialog();
assertTrue( renameDialogBot.isVisible() );
- renameDialogBot.setRdnValue( 1, "#\\+, \"\u00F6\u00E9\"2" );
+ renameDialogBot.setRdnValue( 1, newDn.getRdn().getValue() );
renameDialogBot.clickOkButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"2" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users",
- "cn=\\#\\\\\\+\\, \\\"\u00F6\u00E9\\\"2" );
+ assertTrue( browserViewBot.existsEntry( path( newDn ) ) );
+ browserViewBot.selectEntry( path( newDn ) );
+ assertFalse( browserViewBot.existsEntry( path( oldDn ) ) );
}
/**
* Test for DIRSTUDIO-589, DIRSTUDIO-591, DIRSHARED-38.
*
- * Rename an entry with sharp in DN: cn=\#123456.
+ * Rename an entry with leading sharp in DN: cn=\#123456.
*/
- @Test
- public void testRenameRdnWithSharp() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All)
+ public void testRenameRdnWithLeadingSharp( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#123456" );
+ Dn oldDn = DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+ Dn newDn = dn( "cn=\\#ABCDEF", oldDn.getParent() );
+ if ( server.getType() == LdapServerType.OpenLdap || server.getType() == LdapServerType.Fedora389ds )
+ {
+ oldDn = DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+ newDn = dn( "cn=\\23ABCDEF", oldDn.getParent() );
+ }
+
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( oldDn ) );
RenameEntryDialogBot renameDialogBot = browserViewBot.openRenameDialog();
assertTrue( renameDialogBot.isVisible() );
renameDialogBot.setRdnValue( 1, "#ABCDEF" );
renameDialogBot.clickOkButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#ABCDEF" ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#ABCDEF" );
+ assertTrue( browserViewBot.existsEntry( path( newDn ) ) );
+ browserViewBot.selectEntry( path( newDn ) );
+ assertFalse( browserViewBot.existsEntry( path( oldDn ) ) );
}
/**
* Test for DIRSHARED-39.
*
- * Rename an entry with trailing space in RDN.
+ * Rename an entry with leading and trailing space in RDN.
*/
- @Test
- public void testRenameRdnWithTrailingSpace() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All, except = LdapServerType.Fedora389ds, reason = "Leading and trailing space is trimmed by 389ds")
+ public void testRenameRdnWithTrailingSpace( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#123456" );
+ Dn oldDn = DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+ Dn newDn = dn( "cn=\\#ABCDEF\\ ", oldDn.getParent() );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ oldDn = DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+ newDn = dn( "cn=\\23ABCDEF\\20", oldDn.getParent() );
+ }
+
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( oldDn ) );
RenameEntryDialogBot renameDialogBot = browserViewBot.openRenameDialog();
assertTrue( renameDialogBot.isVisible() );
renameDialogBot.setRdnValue( 1, "#ABCDEF " );
renameDialogBot.clickOkButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#ABCDEF\\ " ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=\\#ABCDEF\\ " );
+ assertTrue( browserViewBot.existsEntry( path( newDn ) ) );
+ browserViewBot.selectEntry( path( newDn ) );
+ assertFalse( browserViewBot.existsEntry( path( oldDn ) ) );
+
+ }
- renameDialogBot = browserViewBot.openRenameDialog();
+
+ /**
+ * Test for DIRSHARED-39.
+ *
+ * Rename an entry with leading and trailing space in RDN.
+ */
+ @ParameterizedTest
+ @LdapServersSource(mode = Mode.All, except = LdapServerType.Fedora389ds, reason = "Leading and trailing space is trimmed by 389ds")
+ public void testRenameRdnWithLeadingAndTrailingSpace( TestLdapServer server ) throws Exception
+ {
+ Dn oldDn = DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+ Dn newDn = dn( "cn=\\ #ABCDEF \\ ", oldDn.getParent() );
+ if ( server.getType() == LdapServerType.OpenLdap )
+ {
+ oldDn = DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+ newDn = dn( "cn=\\20 #ABCDEF \\20", oldDn.getParent() );
+ }
+
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( oldDn ) );
+
+ RenameEntryDialogBot renameDialogBot = browserViewBot.openRenameDialog();
assertTrue( renameDialogBot.isVisible() );
- renameDialogBot.setRdnValue( 1, "A " );
+ renameDialogBot.setRdnValue( 1, " #ABCDEF " );
renameDialogBot.clickOkButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=A\\ " ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "cn=A\\ " );
+ assertTrue( browserViewBot.existsEntry( path( newDn ) ) );
+ browserViewBot.selectEntry( path( newDn ) );
+ assertFalse( browserViewBot.existsEntry( path( oldDn ) ) );
}
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaBrowserTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaBrowserTest.java
index 2a9aea6db..e8c0e04fb 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaBrowserTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaBrowserTest.java
@@ -21,22 +21,22 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.ui.bots.ErrorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SchemaBrowserBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -44,41 +44,17 @@ import org.junit.runner.RunWith;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class SchemaBrowserTest extends AbstractLdapTestUnit
+public class SchemaBrowserTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
-
- private Connection connection;
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection = connectionsViewBot.createTestConnection( "SchemaBrowserTest", ldapServer.getPort() );
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-1061 (RawSchemaDefinition always shows single hyphen/dash)
*/
- @Test
- public void testRawSchemaDefinitionIsFilled() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRawSchemaDefinitionIsFilled( TestLdapServer server ) throws Exception
{
+ Connection connection = connectionsViewBot.createTestConnection( server );
connectionsViewBot.select( connection.getName() );
SchemaBrowserBot schemaBrowser = connectionsViewBot.openSchemaBrowser();
//schemaBrowser.activateObjectClassesTab();
@@ -88,4 +64,35 @@ public class SchemaBrowserTest extends AbstractLdapTestUnit
assertTrue( rawSchemaDefinition.contains( "account" ) );
}
+
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.OpenLdap, reason = "OpenLDAP specific test")
+ public void testNoPermissionToReadSchema( TestLdapServer server ) throws Exception
+ {
+ Connection connection = connectionsViewBot.createTestConnection( server );
+
+ // Close connection and reset cached schema
+ connectionsViewBot.closeSelectedConnections();
+ IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+ .getBrowserConnection( connection );
+ browserConnection.setSchema( Schema.DEFAULT_SCHEMA );
+
+ // Open connection as uid=user.1 which is not allowed to read cn=subschema
+ connection.setBindPrincipal( USER1_DN.getName() );
+ connection.setBindPassword( "password" );
+ ErrorDialogBot errorDialog = connectionsViewBot.openSelectedConnectionExpectingNoSchemaProvidedErrorDialog();
+ assertThat( errorDialog.getErrorDetails(),
+ containsString( "No schema information returned by server, using default schema." ) );
+ errorDialog.clickOkButton();
+
+ // Verify default schema is used
+ SchemaBrowserBot schemaBrowser = connectionsViewBot.openSchemaBrowser();
+ schemaBrowser.selectObjectClass( "DEFAULTSCHEMA" );
+ String rawSchemaDefinition = schemaBrowser.getRawSchemaDefinition();
+ assertNotNull( rawSchemaDefinition );
+ assertTrue( rawSchemaDefinition.contains( "This is the Default Schema" ) );
+
+ // Verify browser
+ browserViewBot.selectEntry( ROOT_DSE_PATH );
+ }
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
index e0e14075a..e672ffa8b 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
@@ -24,30 +24,26 @@ package org.apache.directory.studio.test.integration.ui;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.AttributeTypeEditorBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.NewSchemaProjectWizardBot;
import org.apache.directory.studio.test.integration.ui.bots.ObjectClassEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.SchemaEditorBot;
import org.apache.directory.studio.test.integration.ui.bots.SchemaProjectsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.SchemaSearchViewBot;
import org.apache.directory.studio.test.integration.ui.bots.SchemaViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -56,35 +52,24 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class SchemaEditorTest extends AbstractLdapTestUnit
+public class SchemaEditorTest extends AbstractTestBase
{
- private StudioBot studioBot;
private SchemaProjectsViewBot projectsView;
private SchemaViewBot schemaView;
- private ConnectionsViewBot connectionsViewBot;
- private Connection connection;
-
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
- studioBot = new StudioBot();
studioBot.resetSchemaPerspective();
projectsView = studioBot.getSchemaProjectsView();
schemaView = studioBot.getSchemaView();
- connectionsViewBot = studioBot.getConnectionView();
}
- @After
+ @AfterEach
public void tearDown() throws Exception
{
- connectionsViewBot.deleteTestConnections();
projectsView.deleteAllProjects();
- Assertions.genericTearDownAssertions();
}
@@ -94,11 +79,6 @@ public class SchemaEditorTest extends AbstractLdapTestUnit
@Test
public void testSearchForAliases() throws Exception
{
- /*
- * This test fails on Jenkins Windows Server, to be investigated...
- */
- // Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
-
createProject( "Project Search For Aliases" );
SchemaSearchViewBot searchView = studioBot.getSchemaSearchView();
@@ -180,11 +160,12 @@ public class SchemaEditorTest extends AbstractLdapTestUnit
}
- @Test
- public void testCreateSchemaOnlineApacheDS() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specific test")
+ public void testCreateSchemaOnlineApacheDS( TestLdapServer server ) throws Exception
{
studioBot.resetLdapPerspective();
- connection = connectionsViewBot.createTestConnection( "SchemaEditorTest", ldapServer.getPort() );
+ Connection connection = connectionsViewBot.createTestConnection( server );
studioBot.resetSchemaPerspective();
SchemaProjectsViewBot projectsView = studioBot.getSchemaProjectsView();
@@ -211,6 +192,58 @@ public class SchemaEditorTest extends AbstractLdapTestUnit
}
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.OpenLdap, reason = "OpenLDAP specific test")
+ public void testCreateSchemaOnlineOpenLDAP( TestLdapServer server ) throws Exception
+ {
+ studioBot.resetLdapPerspective();
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ studioBot.resetSchemaPerspective();
+
+ SchemaProjectsViewBot projectsView = studioBot.getSchemaProjectsView();
+ NewSchemaProjectWizardBot wizard = projectsView.openNewSchemaProjectWizard();
+ wizard.typeProjectName( "Project Online OpenLDAP" );
+ wizard.selectOnlineSchema();
+ wizard.clickNextButton();
+ wizard.selectConnection( connection.getName() );
+ wizard.clickFinishButton();
+
+ assertTrue( schemaView.existsSchema( "schema" ) );
+
+ assertTrue( schemaView.existsObjectClass( "schema", "top" ) );
+ assertTrue( schemaView.existsObjectClass( "schema", "olcGlobal" ) );
+
+ assertTrue( schemaView.existsAttributeType( "schema", "objectClass" ) );
+ assertTrue( schemaView.existsAttributeType( "schema", "olcBackend" ) );
+ }
+
+
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.Fedora389ds, reason = "389ds specific test")
+ public void testCreateSchemaOnline389ds( TestLdapServer server ) throws Exception
+ {
+ studioBot.resetLdapPerspective();
+ Connection connection = connectionsViewBot.createTestConnection( server );
+ studioBot.resetSchemaPerspective();
+
+ SchemaProjectsViewBot projectsView = studioBot.getSchemaProjectsView();
+ NewSchemaProjectWizardBot wizard = projectsView.openNewSchemaProjectWizard();
+ wizard.typeProjectName( "Project Online 389ds" );
+ wizard.selectOnlineSchema();
+ wizard.clickNextButton();
+ wizard.selectConnection( connection.getName() );
+ wizard.clickFinishButton();
+
+ assertTrue( schemaView.existsSchema( "schema" ) );
+
+ assertTrue( schemaView.existsObjectClass( "schema", "top" ) );
+ assertTrue( schemaView.existsObjectClass( "schema", "nsConfig" ) );
+
+ assertTrue( schemaView.existsAttributeType( "schema", "objectClass" ) );
+ assertTrue( schemaView.existsAttributeType( "schema", "nsBaseDN" ) );
+ }
+
+
@Test
public void testOpenObjectClassEditor() throws Exception
{
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
index 09923f193..24fff97a4 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
@@ -21,37 +21,41 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.ALIAS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.CONTEXT_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.GROUP1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.GROUPS_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.REFERRAL_TO_USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.SUBENTRY_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER8_DN;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.USERS_DN;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.commons.lang3.StringUtils;
import org.apache.directory.api.ldap.model.message.ModifyRequest;
import org.apache.directory.api.ldap.model.message.ModifyRequestImpl;
-import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.annotations.ApplyLdifFiles;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
+import org.apache.directory.studio.connection.core.Utils;
import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import org.apache.directory.studio.test.integration.junit5.LdapServerType;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.FilterEditorDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SearchDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SearchPropertiesDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SearchResultEditorBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -60,49 +64,21 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-@ApplyLdifFiles(clazz = BrowserTest.class, value = "org/apache/directory/studio/test/integration/ui/BrowserTest.ldif")
-public class SearchTest extends AbstractLdapTestUnit
+public class SearchTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
-
- private Connection connection1;
- private Connection connection2;
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connection1 = connectionsViewBot.createTestConnection( "SearchTest1", ldapServer.getPort() );
- connection2 = connectionsViewBot.createTestConnection( "SearchTest2", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-490.
*
* Copy/Paste a search between connections and verify that the associated browser connection is correct.
- *
- * @throws Exception
*/
- @Test
- public void testCopyPasteSearchBetweenConnections() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testCopyPasteSearchBetweenConnections( TestLdapServer server ) throws Exception
{
+ Connection connection1 = connectionsViewBot.createTestConnection( server );
+ Connection connection2 = connectionsViewBot.createTestConnection( server );
+
BrowserConnectionManager browserConnectionManager = BrowserCorePlugin.getDefault().getConnectionManager();
IBrowserConnection browserConnection1 = browserConnectionManager.getBrowserConnectionByName( connection1
.getName() );
@@ -113,7 +89,7 @@ public class SearchTest extends AbstractLdapTestUnit
// create a search for in connection 1
connectionsViewBot.select( connection1.getName() );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( "Search all persons" );
@@ -149,124 +125,128 @@ public class SearchTest extends AbstractLdapTestUnit
* Test for DIRSTUDIO-587 (UI flickers on quick search).
*
* When performing a quick search only one UI update should be fired.
- *
- * @throws Exception
*/
- @Test
- public void testOnlyOneUiUpdateOnQuickSearch() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testOnlyOneUiUpdateOnQuickSearch( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
+ browserViewBot.expandEntry( path( CONTEXT_DN ) );
browserViewBot.typeQuickSearchAttributeType( "ou" );
browserViewBot.typeQuickSearchValue( "*" );
long fireCount0 = EventRegistry.getFireCount();
browserViewBot.clickRunQuickSearchButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "Quick Search" );
+ browserViewBot.waitForEntry( path( CONTEXT_DN, "Quick Search" ) );
long fireCount1 = EventRegistry.getFireCount();
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "Quick Search" );
+ browserViewBot.selectEntry( path( CONTEXT_DN, "Quick Search" ) );
// verify that only one event was fired
long fireCount = fireCount1 - fireCount0;
- assertEquals( "Only 1 event firings expected when running quick search.", 1, fireCount );
+ assertEquals( 1, fireCount, "Only 1 event firings expected when running quick search." );
}
- @Test
- public void testQuickSearch() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testQuickSearch( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
// quick search on context entry
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
+ browserViewBot.expandEntry( path( CONTEXT_DN ) );
browserViewBot.typeQuickSearchAttributeType( "ou" );
browserViewBot.typeQuickSearchValue( "*" );
browserViewBot.clickRunQuickSearchButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "Quick Search (5)" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "Quick Search (5)" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "Quick Search (5)" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "Quick Search (5)", "ou=users,ou=system" );
+ browserViewBot.waitForEntry( path( CONTEXT_DN, "Quick Search (5)" ) );
+ browserViewBot.selectEntry( path( CONTEXT_DN, "Quick Search (5)" ) );
+ browserViewBot.expandEntry( path( CONTEXT_DN, "Quick Search (5)" ) );
+ browserViewBot.selectEntry( path( CONTEXT_DN, "Quick Search (5)", USERS_DN.getName() ) );
// quick search on non-leaf entry
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
+ browserViewBot.expandEntry( path( USERS_DN ) );
browserViewBot.typeQuickSearchAttributeType( "uid" );
browserViewBot.typeQuickSearchValue( "user.1" );
browserViewBot.clickRunQuickSearchButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "Quick Search (1)" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "Quick Search (1)" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "Quick Search (1)" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "Quick Search (1)",
- "uid=user.1,ou=users,ou=system" );
+ browserViewBot.waitForEntry( path( USERS_DN, "Quick Search (1)" ) );
+ browserViewBot.selectEntry( path( USERS_DN, "Quick Search (1)" ) );
+ browserViewBot.expandEntry( path( USERS_DN, "Quick Search (1)" ) );
+ browserViewBot.selectEntry( path( USERS_DN, "Quick Search (1)", USER1_DN.getName() ) );
// quick search on leaf entry
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1" );
+ browserViewBot.selectEntry( path( USER1_DN ) );
+ browserViewBot.expandEntry( path( USER1_DN ) );
browserViewBot.typeQuickSearchAttributeType( "uid" );
browserViewBot.typeQuickSearchValue( "user.1" );
browserViewBot.clickRunQuickSearchButton();
- browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1", "Quick Search (0)" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1", "Quick Search (0)" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1", "Quick Search (0)" );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users", "uid=user.1", "Quick Search (0)",
- "No Results" );
+ browserViewBot.waitForEntry( path( USER1_DN, "Quick Search (0)" ) );
+ browserViewBot.selectEntry( path( USER1_DN, "Quick Search (0)" ) );
+ browserViewBot.expandEntry( path( USER1_DN, "Quick Search (0)" ) );
+ browserViewBot.selectEntry( path( USER1_DN, "Quick Search (0)", "No Results" ) );
}
/**
* Test for DIRSTUDIO-601.
* (The 'Perform Search/Search Again' button in the Search Result Editor does not work correctly)
- *
- * @throws Exception
*/
- @Test
- public void testRefresh() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testRefresh( TestLdapServer server ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ connectionsViewBot.createTestConnection( server );
+ browserViewBot.selectEntry( path( GROUPS_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
- dialogBot.setSearchName( "Search Admin" );
- dialogBot.setFilter( "(uid=admin)" );
- dialogBot.setReturningAttributes( "objectClass, uid, description" );
+ dialogBot.setSearchName( "Search Group" );
+ dialogBot.setFilter( "(" + GROUP1_DN.getRdn().getName() + ")" );
+ dialogBot.setReturningAttributes( "objectClass, cn, description" );
dialogBot.clickSearchButton();
- browserViewBot.selectEntry( "Searches", "Search Admin" );
+ browserViewBot.selectEntry( "Searches", "Search Group" );
- SearchResultEditorBot srEditorBot = studioBot.getSearchResultEditorBot( "Search Admin" );
+ SearchResultEditorBot srEditorBot = studioBot.getSearchResultEditorBot( "Search Group" );
srEditorBot.activate();
assertTrue( srEditorBot.isEnabled() );
// assert that description attribute is empty
- assertEquals( "uid=admin,ou=system", srEditorBot.getContent( 1, 1 ) );
+ assertEquals( GROUP1_DN.getName(), srEditorBot.getContent( 1, 1 ) );
assertEquals( "", srEditorBot.getContent( 1, 4 ) );
// add description
ModifyRequest request = new ModifyRequestImpl();
- request.setName( new Dn( "uid=admin,ou=system" ) );
+ request.setName( GROUP1_DN );
request.replace( "description", "The 1st description." );
- service.getAdminSession().modify( request );
+ server.withAdminConnection( conn -> {
+ conn.modify( request );
+ } );
// refresh the search, using the toolbar icon
srEditorBot.refresh();
SWTUtils.sleep( 1000 );
// assert the description attribute value is displayed now
- assertEquals( "uid=admin,ou=system", srEditorBot.getContent( 1, 1 ) );
+ assertEquals( GROUP1_DN.getName(), srEditorBot.getContent( 1, 1 ) );
assertEquals( "The 1st description.", srEditorBot.getContent( 1, 4 ) );
}
- @Test
- public void testSearchAlias() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchAlias( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String searchName = "Search Alias";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( searchName );
@@ -277,52 +257,58 @@ public class SearchTest extends AbstractLdapTestUnit
// assert search result exists in tree
browserViewBot.expandEntry( "Searches", "Search Alias" );
- assertTrue( browserViewBot.existsEntry( "Searches", "Search Alias", "cn=alias,ou=special,ou=system" ) );
+ assertTrue( browserViewBot.existsEntry( "Searches", "Search Alias", ALIAS_DN.getName() ) );
// assert attributes in search result editor
browserViewBot.selectEntry( "Searches", "Search Alias" );
SearchResultEditorBot srEditorBot = studioBot.getSearchResultEditorBot( "Search Alias" );
srEditorBot.activate();
assertTrue( srEditorBot.isEnabled() );
- assertEquals( "cn=alias,ou=special,ou=system", srEditorBot.getContent( 1, 1 ) );
+ assertEquals( ALIAS_DN.getName(), srEditorBot.getContent( 1, 1 ) );
assertEquals( "alias", srEditorBot.getContent( 1, 2 ) );
- assertEquals( "ou=special,ou=system", srEditorBot.getContent( 1, 3 ) );
+ assertEquals( MISC_DN, srEditorBot.getContent( 1, 3 ) );
}
- @Test
- public void testSearchReferral() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchReferral( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String searchName = "Search Referral";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( searchName );
- dialogBot.setFilter( "(objectClass=referral)" );
+ dialogBot.setFilter( "(&(objectClass=referral)(" + REFERRAL_TO_USER1_DN.getRdn().getName() + "))" );
dialogBot.setReturningAttributes( "cn,ref" );
dialogBot.setControlManageDsaIT( true );
dialogBot.clickSearchButton();
// assert search result exists in tree
browserViewBot.expandEntry( "Searches", searchName );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "cn=referral,ou=special,ou=system" ) );
+ assertTrue(
+ browserViewBot.existsEntry( "Searches", searchName, Utils.shorten( REFERRAL_TO_USER1_DN.getName(), 50 ) ) );
// assert attributes in search result editor
browserViewBot.selectEntry( "Searches", searchName );
SearchResultEditorBot srEditorBot = studioBot.getSearchResultEditorBot( searchName );
srEditorBot.activate();
assertTrue( srEditorBot.isEnabled() );
- assertEquals( "cn=referral,ou=special,ou=system", srEditorBot.getContent( 1, 1 ) );
- assertEquals( "referral", srEditorBot.getContent( 1, 2 ) );
- assertEquals( "ldap://foo.example.com/ou=system", srEditorBot.getContent( 1, 3 ) );
+ assertEquals( REFERRAL_TO_USER1_DN.getName(), srEditorBot.getContent( 1, 1 ) );
+ assertEquals( REFERRAL_TO_USER1_DN.getRdn().getValue(), srEditorBot.getContent( 1, 2 ) );
+ assertEquals( StringUtils.abbreviate( server.getLdapUrl() + "/" + USER1_DN.getName(), 50 ),
+ srEditorBot.getContent( 1, 3 ) );
}
- @Test
- public void testSearchSubentry() throws Exception
+ @ParameterizedTest
+ @LdapServersSource(only = LdapServerType.ApacheDS, reason = "ApacheDS specifc test")
+ public void testSearchSubentry( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String searchName = "Search Subentry";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( searchName );
@@ -333,30 +319,32 @@ public class SearchTest extends AbstractLdapTestUnit
// assert search result exists in tree
browserViewBot.expandEntry( "Searches", searchName );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "cn=subentry,ou=special,ou=system" ) );
+ assertTrue( browserViewBot.existsEntry( "Searches", searchName, SUBENTRY_DN.getName() ) );
// assert attributes in search result editor
browserViewBot.selectEntry( "Searches", searchName );
SearchResultEditorBot srEditorBot = studioBot.getSearchResultEditorBot( searchName );
srEditorBot.activate();
assertTrue( srEditorBot.isEnabled() );
- assertEquals( "cn=subentry,ou=special,ou=system", srEditorBot.getContent( 1, 1 ) );
- assertEquals( "subentry", srEditorBot.getContent( 1, 2 ) );
- assertEquals( "{ }", srEditorBot.getContent( 1, 3 ) );
+ assertEquals( SUBENTRY_DN.getName(), srEditorBot.getContent( 1, 1 ) );
+ assertEquals( SUBENTRY_DN.getRdn().getValue(), srEditorBot.getContent( 1, 2 ) );
+ assertEquals( "{}", srEditorBot.getContent( 1, 3 ) );
}
- @Test
- public void testSearchWithPagingWithScrollMode() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchWithPagingWithScrollMode( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String searchName = "Paged search with scroll mode";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( searchName );
dialogBot.setFilter( "(objectClass=*)" );
dialogBot.setReturningAttributes( "objectClass,ou,cn,uid" );
- dialogBot.setControlPagedSearch( true, 5, true );
+ dialogBot.setControlPagedSearch( true, 3, true );
dialogBot.clickSearchButton();
// 1st page
@@ -381,33 +369,37 @@ public class SearchTest extends AbstractLdapTestUnit
}
- @Test
- public void testSearchWithPagingWithoutScrollMode() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSearchWithPagingWithoutScrollMode( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String searchName = "Paged search without scroll mode";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( searchName );
dialogBot.setFilter( "(objectClass=*)" );
dialogBot.setReturningAttributes( "objectClass,ou,cn,uid" );
- dialogBot.setControlPagedSearch( true, 5, false );
+ dialogBot.setControlPagedSearch( true, 3, false );
dialogBot.clickSearchButton();
browserViewBot.expandEntry( "Searches", searchName );
assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Top Page ---" ) );
assertFalse( browserViewBot.existsEntry( "Searches", searchName, "--- Next Page ---" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName + " (15+)" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "uid=user.1" ) );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "uid=user.8" ) );
+ assertTrue( browserViewBot.existsEntry( "Searches", searchName + " (9+)" ) );
+ assertTrue( browserViewBot.existsEntry( "Searches", searchName, USER1_DN.getName() ) );
+ assertTrue( browserViewBot.existsEntry( "Searches", searchName, USER8_DN.getName() ) );
}
- @Test
- public void testFilterEditor() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testFilterEditor( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String searchName = "Test filter editor";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
+ browserViewBot.selectEntry( path( USERS_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( searchName );
@@ -417,14 +409,13 @@ public class SearchTest extends AbstractLdapTestUnit
filterBot.setFilter( "(&(objectClass=*)(uid=user.1))" );
filterBot.clickFormatButton();
String formattetFilter = filterBot.getFilter();
- // SWTUtils.sleep( 10000 );
filterBot.clickOkButton();
dialogBot.activate();
String filter = dialogBot.getFilter();
dialogBot.clickSearchButton();
browserViewBot.expandEntry( "Searches", searchName );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "uid=user.1" ) );
+ assertTrue( browserViewBot.existsEntry( "Searches", searchName, USER1_DN.getName() ) );
assertEquals( "(&(objectClass=*)(uid=user.1))", filter );
assertEquals( "(&\n (objectClass=*)\n (uid=user.1)\n)", formattetFilter );
}
@@ -433,18 +424,21 @@ public class SearchTest extends AbstractLdapTestUnit
/**
* Test for DIRSTUDIO-1078/DIRAPI-365: unable to use # pound hash sign in LDAP filters
*/
- @Test
- public void testFilterForDnWithLeadingHash() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testFilterForDnWithLeadingHash( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String searchName = "Test filter for DN with leading hash character";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( searchName );
dialogBot.setReturningAttributes( "objectClass,ou,cn,uid" );
+ String filterValue = DN_WITH_LEADING_SHARP_BACKSLASH_PREFIXED.getName().replace( "\\#", "\\5c#" );
FilterEditorDialogBot filterBot = dialogBot.openFilterEditor();
- filterBot.setFilter( "member=CN=\\5c#ACL_AD-Projects_Author,ou=users,ou=system" );
+ filterBot.setFilter( "member=" + filterValue );
filterBot.clickFormatButton();
filterBot.clickOkButton();
dialogBot.activate();
@@ -452,26 +446,29 @@ public class SearchTest extends AbstractLdapTestUnit
dialogBot.clickSearchButton();
browserViewBot.expandEntry( "Searches", searchName );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "cn=My Group,ou=groups,ou=system" ) );
- assertEquals( "(member=CN=\\5c#ACL_AD-Projects_Author,ou=users,ou=system)", filter );
+ assertTrue( browserViewBot.existsEntry( "Searches", searchName, GROUP1_DN.getName() ) );
+ assertEquals( "(member=" + filterValue + ")", filter );
}
/**
* Test for DIRSTUDIO-1078/DIRAPI-365: unable to use # pound hash sign in LDAP filters
*/
- @Test
- public void testFilterForDnWithLeadingHashHex() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testFilterForDnWithLeadingHashHex( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
String searchName = "Test filter for DN with leading hash character";
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( CONTEXT_DN ) );
SearchDialogBot dialogBot = browserViewBot.openSearchDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.setSearchName( searchName );
dialogBot.setReturningAttributes( "objectClass,ou,cn,uid" );
+ String filterValue = DN_WITH_LEADING_SHARP_HEX_PAIR_ESCAPED.getName().replace( "\\23", "\\5C23" );
FilterEditorDialogBot filterBot = dialogBot.openFilterEditor();
- filterBot.setFilter( "member=CN=\\5C23ACL_AD-Projects_Author,ou=users,ou=system" );
+ filterBot.setFilter( "member=" + filterValue );
filterBot.clickFormatButton();
filterBot.clickOkButton();
dialogBot.activate();
@@ -479,8 +476,8 @@ public class SearchTest extends AbstractLdapTestUnit
dialogBot.clickSearchButton();
browserViewBot.expandEntry( "Searches", searchName );
- assertTrue( browserViewBot.existsEntry( "Searches", searchName, "cn=My Group,ou=groups,ou=system" ) );
- assertEquals( "(member=CN=\\5C23ACL_AD-Projects_Author,ou=users,ou=system)", filter );
+ assertTrue( browserViewBot.existsEntry( "Searches", searchName, GROUP1_DN.getName() ) );
+ assertEquals( "(member=" + filterValue + ")", filter );
}
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
index 21b1ef1b9..b4162a121 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
@@ -21,27 +21,19 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.directory.server.annotations.CreateLdapServer;
-import org.apache.directory.server.annotations.CreateTransport;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
-import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
+import static org.apache.directory.studio.test.integration.junit5.TestFixture.MISC_DN;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.NewEntryWizardBot;
-import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.apache.directory.studio.test.integration.ui.bots.utils.Assertions;
-import org.apache.directory.studio.test.integration.ui.bots.utils.FrameworkRunnerWithScreenshotCaptureListener;
import org.eclipse.swt.graphics.DeviceData;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.IntResult;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.params.ParameterizedTest;
/**
@@ -50,47 +42,21 @@ import org.junit.runner.RunWith;
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-@RunWith(FrameworkRunnerWithScreenshotCaptureListener.class)
-@CreateLdapServer(transports =
- { @CreateTransport(protocol = "LDAP") })
-public class SwtResourcesTest extends AbstractLdapTestUnit
+public class SwtResourcesTest extends AbstractTestBase
{
- private StudioBot studioBot;
- private ConnectionsViewBot connectionsViewBot;
- private BrowserViewBot browserViewBot;
-
-
- @Before
- public void setUp() throws Exception
- {
- studioBot = new StudioBot();
- studioBot.resetLdapPerspective();
- connectionsViewBot = studioBot.getConnectionView();
- connectionsViewBot.createTestConnection( "SwtResourcesTest", ldapServer.getPort() );
- browserViewBot = studioBot.getBrowserView();
- }
-
-
- @After
- public void tearDown() throws Exception
- {
- connectionsViewBot.deleteTestConnections();
- Assertions.genericTearDownAssertions();
- }
-
/**
* Test for DIRSTUDIO-319.
*
* Creates multiple entries using the New Entry wizard. Checks that we don't
* allocate too much SWT resources during the run.
- *
- * @throws Exception
- * the exception
*/
- @Test
- public void testSwtResourcesDelta() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSwtResourcesDelta( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
+
// run the new entry wizard once to ensure all SWT resources are created
createAndDeleteEntry( "testSwtResourcesDelta" + 0 );
@@ -107,8 +73,9 @@ public class SwtResourcesTest extends AbstractLdapTestUnit
int afterObjectCount = getSwtObjectCount();
// we expect none or only very few additional SWT objects
- assertTrue( "Too many SWT resources were allocated in testSwtResourcesDelta: before=" + beforeObjectCount
- + ", after=" + afterObjectCount, afterObjectCount - beforeObjectCount < 5 );
+ assertTrue( afterObjectCount - beforeObjectCount < 5,
+ "Too many SWT resources were allocated in testSwtResourcesDelta: before=" + beforeObjectCount
+ + ", after=" + afterObjectCount );
}
@@ -116,12 +83,14 @@ public class SwtResourcesTest extends AbstractLdapTestUnit
* Ensure that we have not allocated too many SWT resources during the
* complete test suite.
*/
- @Test
- public void testSwtResourcesCount() throws Exception
+ @ParameterizedTest
+ @LdapServersSource
+ public void testSwtResourcesCount( TestLdapServer server ) throws Exception
{
+ connectionsViewBot.createTestConnection( server );
int swtObjectCount = getSwtObjectCount();
- System.out.println("### SWT resouces count: " + swtObjectCount);
- assertTrue( "Too many SWT resources were allocated: " + swtObjectCount, swtObjectCount < 1500 );
+ System.out.println( "### SWT resouces count: " + swtObjectCount );
+ assertTrue( swtObjectCount < 1500, "Too many SWT resources were allocated: " + swtObjectCount );
}
@@ -135,7 +104,8 @@ public class SwtResourcesTest extends AbstractLdapTestUnit
DeviceData info = bot.getDisplay().getDeviceData();
if ( !info.tracking )
{
- fail( "To run this test options 'org.eclipse.ui/debug' and 'org.eclipse.ui/trace/graphics' must be true." );
+ fail(
+ "To run this test options 'org.eclipse.ui/debug' and 'org.eclipse.ui/trace/graphics' must be true." );
}
return info.objects.length;
}
@@ -145,8 +115,8 @@ public class SwtResourcesTest extends AbstractLdapTestUnit
private void createAndDeleteEntry( final String name ) throws Exception
{
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
- browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system" );
+ browserViewBot.selectEntry( path( MISC_DN ) );
+ browserViewBot.expandEntry( path( MISC_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
wizardBot.selectCreateEntryFromScratch();
@@ -161,8 +131,8 @@ public class SwtResourcesTest extends AbstractLdapTestUnit
wizardBot.clickFinishButton();
- assertTrue( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "o=" + name ) );
- browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "o=" + name );
+ assertTrue( browserViewBot.existsEntry( path( MISC_DN, "o=" + name ) ) );
+ browserViewBot.selectEntry( path( MISC_DN, "o=" + name ) );
DeleteDialogBot dialog = browserViewBot.openDeleteDialog();
dialog.clickOkButton();
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java
index 0896131d6..ac394d5dc 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ValueEditorTest.java
@@ -21,12 +21,13 @@
package org.apache.directory.studio.test.integration.ui;
-import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.nio.charset.StandardCharsets;
+import java.util.stream.Stream;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
@@ -43,12 +44,9 @@ import org.apache.directory.studio.valueeditors.InPlaceTextValueEditor;
import org.apache.directory.studio.valueeditors.TextValueEditor;
import org.apache.directory.studio.valueeditors.bool.InPlaceBooleanValueEditor;
import org.apache.directory.studio.valueeditors.oid.InPlaceOidValueEditor;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
/**
@@ -56,8 +54,7 @@ import org.junit.runners.Parameterized.Parameters;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@RunWith(Parameterized.class)
-public class ValueEditorTest
+public class ValueEditorTest extends AbstractTestBase
{
private static final String CN = "cn";
@@ -79,50 +76,55 @@ public class ValueEditorTest
private static final String NUMERIC_OID = "1.3.6.1.4.1.1466.20037";
private static final String DESCR_OID = "a-zA-Z0-9";
-
- @Parameters(name = "{0}")
- public static Object[] data()
+ public static Stream<Arguments> data()
{
- return new Object[][]
+ return Stream.of( new Object[][]
{
/*
* InPlaceTextValueEditor can handle string values and binary values that can be decoded as UTF-8.
*/
- { "InPlaceTextValueEditor - empty value",
+ {
+ "InPlaceTextValueEditor - empty value",
Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute( CN )
.rawValue( IValue.EMPTY_STRING_VALUE ).expectedRawValue( EMPTY_STRING )
.expectedDisplayValue( EMPTY_STRING ).expectedHasValue( true )
.expectedStringOrBinaryValue( EMPTY_STRING ) },
- { "InPlaceTextValueEditor - empty string",
+ {
+ "InPlaceTextValueEditor - empty string",
Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute( CN )
.rawValue( EMPTY_STRING ).expectedRawValue( EMPTY_STRING ).expectedDisplayValue( EMPTY_STRING )
.expectedHasValue( true ).expectedStringOrBinaryValue( EMPTY_STRING ) },
- { "InPlaceTextValueEditor - ascii",
+ {
+ "InPlaceTextValueEditor - ascii",
Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute( CN ).rawValue( ASCII )
.expectedRawValue( ASCII ).expectedDisplayValue( ASCII ).expectedHasValue( true )
.expectedStringOrBinaryValue( ASCII ) },
- { "InPlaceTextValueEditor - unicode",
+ {
+ "InPlaceTextValueEditor - unicode",
Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute( CN ).rawValue( UNICODE )
.expectedRawValue( UNICODE ).expectedDisplayValue( UNICODE ).expectedHasValue( true )
.expectedStringOrBinaryValue( UNICODE ) },
- { "InPlaceTextValueEditor - bytearray UTF8",
+ {
+ "InPlaceTextValueEditor - bytearray UTF8",
Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute( USER_PWD ).rawValue( UTF8 )
.expectedRawValue( UNICODE ).expectedDisplayValue( UNICODE ).expectedHasValue( true )
.expectedStringOrBinaryValue( UNICODE ) },
// text editor always tries to decode byte[] as UTF-8, so it can not handle ISO-8859-1 encoded byte[]
- { "InPlaceTextValueEditor - bytearray ISO-8859-1",
+ {
+ "InPlaceTextValueEditor - bytearray ISO-8859-1",
Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute( USER_PWD )
.rawValue( ISO88591 ).expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL )
.expectedHasValue( true ).expectedStringOrBinaryValue( null ) },
// text editor always tries to decode byte[] as UTF-8, so it can not handle arbitrary byte[]
- { "InPlaceTextValueEditor - bytearray PNG",
+ {
+ "InPlaceTextValueEditor - bytearray PNG",
Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute( USER_PWD ).rawValue( PNG )
.expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL ).expectedHasValue( true )
.expectedStringOrBinaryValue( null ) },
@@ -131,32 +133,38 @@ public class ValueEditorTest
* InPlaceBooleanValueEditor can only handle TRUE or FALSE values.
*/
- { "InPlaceBooleanValueEditor - TRUE",
+ {
+ "InPlaceBooleanValueEditor - TRUE",
Data.data().valueEditorClass( InPlaceBooleanValueEditor.class ).attribute( CN ).rawValue( TRUE )
.expectedRawValue( TRUE ).expectedDisplayValue( TRUE ).expectedHasValue( true )
.expectedStringOrBinaryValue( TRUE ) },
- { "InPlaceBooleanValueEditor - FALSE",
+ {
+ "InPlaceBooleanValueEditor - FALSE",
Data.data().valueEditorClass( InPlaceBooleanValueEditor.class ).attribute( CN ).rawValue( FALSE )
.expectedRawValue( FALSE ).expectedDisplayValue( FALSE ).expectedHasValue( true )
.expectedStringOrBinaryValue( FALSE ) },
- { "InPlaceBooleanValueEditor - INVALID",
+ {
+ "InPlaceBooleanValueEditor - INVALID",
Data.data().valueEditorClass( InPlaceBooleanValueEditor.class ).attribute( CN )
.rawValue( "invalid" ).expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL )
.expectedHasValue( true ).expectedStringOrBinaryValue( null ) },
- { "InPlaceBooleanValueEditor - bytearray TRUE",
+ {
+ "InPlaceBooleanValueEditor - bytearray TRUE",
Data.data().valueEditorClass( InPlaceBooleanValueEditor.class ).attribute( USER_PWD )
.rawValue( TRUE.getBytes( UTF_8 ) ).expectedRawValue( TRUE ).expectedDisplayValue( TRUE )
.expectedHasValue( true ).expectedStringOrBinaryValue( TRUE ) },
- { "InPlaceBooleanValueEditor - bytearray FALSE",
+ {
+ "InPlaceBooleanValueEditor - bytearray FALSE",
Data.data().valueEditorClass( InPlaceBooleanValueEditor.class ).attribute( USER_PWD )
.rawValue( FALSE.getBytes( UTF_8 ) ).expectedRawValue( FALSE ).expectedDisplayValue( FALSE )
.expectedHasValue( true ).expectedStringOrBinaryValue( FALSE ) },
- { "InPlaceBooleanValueEditor - bytearray INVALID",
+ {
+ "InPlaceBooleanValueEditor - bytearray INVALID",
Data.data().valueEditorClass( InPlaceBooleanValueEditor.class ).attribute( USER_PWD )
.rawValue( "invalid".getBytes( UTF_8 ) ).expectedRawValue( null )
.expectedDisplayValue( IValueEditor.NULL ).expectedHasValue( true )
@@ -166,34 +174,40 @@ public class ValueEditorTest
* InPlaceOidValueEditor can only handle OIDs
*/
- { "InPlaceOidValueEditor - numeric OID",
+ {
+ "InPlaceOidValueEditor - numeric OID",
Data.data().valueEditorClass( InPlaceOidValueEditor.class ).attribute( CN ).rawValue( NUMERIC_OID )
.expectedRawValue( NUMERIC_OID ).expectedDisplayValue( NUMERIC_OID + " (Start TLS)" )
.expectedHasValue( true ).expectedStringOrBinaryValue( NUMERIC_OID ) },
- { "InPlaceOidValueEditor - descr OID",
+ {
+ "InPlaceOidValueEditor - descr OID",
Data.data().valueEditorClass( InPlaceOidValueEditor.class ).attribute( CN ).rawValue( DESCR_OID )
.expectedRawValue( DESCR_OID ).expectedDisplayValue( DESCR_OID ).expectedHasValue( true )
.expectedStringOrBinaryValue( DESCR_OID ) },
- { "InPlaceOidValueEditor - relaxed descr OID",
+ {
+ "InPlaceOidValueEditor - relaxed descr OID",
Data.data().valueEditorClass( InPlaceOidValueEditor.class ).attribute( CN )
.rawValue( "orclDBEnterpriseRole_82" ).expectedRawValue( "orclDBEnterpriseRole_82" )
.expectedDisplayValue( "orclDBEnterpriseRole_82" ).expectedHasValue( true )
- .expectedStringOrBinaryValue("orclDBEnterpriseRole_82" ) },
+ .expectedStringOrBinaryValue( "orclDBEnterpriseRole_82" ) },
- { "InPlaceOidValueEditor - INVALID",
+ {
+ "InPlaceOidValueEditor - INVALID",
Data.data().valueEditorClass( InPlaceOidValueEditor.class ).attribute( CN ).rawValue( "in valid" )
.expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL ).expectedHasValue( true )
.expectedStringOrBinaryValue( null ) },
- { "InPlaceOidValueEditor - bytearray numeric OID",
+ {
+ "InPlaceOidValueEditor - bytearray numeric OID",
Data.data().valueEditorClass( InPlaceOidValueEditor.class ).attribute( USER_PWD )
.rawValue( NUMERIC_OID.getBytes( UTF_8 ) ).expectedRawValue( NUMERIC_OID )
.expectedDisplayValue( NUMERIC_OID + " (Start TLS)" ).expectedHasValue( true )
.expectedStringOrBinaryValue( NUMERIC_OID ) },
- { "InPlaceOidValueEditor - bytearray INVALID",
+ {
+ "InPlaceOidValueEditor - bytearray INVALID",
Data.data().valueEditorClass( InPlaceOidValueEditor.class ).attribute( USER_PWD )
.rawValue( "in valid".getBytes( UTF_8 ) ).expectedRawValue( null )
.expectedDisplayValue( IValueEditor.NULL ).expectedHasValue( true )
@@ -203,51 +217,60 @@ public class ValueEditorTest
* TextValueEditor can handle string values and binary values that can be decoded as UTF-8.
*/
- { "TextValueEditor - empty string value",
+ {
+ "TextValueEditor - empty string value",
Data.data().valueEditorClass( TextValueEditor.class ).attribute( CN )
.rawValue( IValue.EMPTY_STRING_VALUE ).expectedRawValue( EMPTY_STRING )
.expectedDisplayValue( EMPTY_STRING ).expectedHasValue( true )
.expectedStringOrBinaryValue( EMPTY_STRING ) },
- { "TextValueEditor - empty string",
+ {
+ "TextValueEditor - empty string",
Data.data().valueEditorClass( TextValueEditor.class ).attribute( CN ).rawValue( EMPTY_STRING )
.expectedRawValue( EMPTY_STRING ).expectedDisplayValue( EMPTY_STRING ).expectedHasValue( true )
.expectedStringOrBinaryValue( EMPTY_STRING ) },
- { "TextValueEditor - ascii",
+ {
+ "TextValueEditor - ascii",
Data.data().valueEditorClass( TextValueEditor.class ).attribute( CN ).rawValue( ASCII )
.expectedRawValue( ASCII ).expectedDisplayValue( ASCII ).expectedHasValue( true )
.expectedStringOrBinaryValue( ASCII ) },
- { "TextValueEditor - unicode",
+ {
+ "TextValueEditor - unicode",
Data.data().valueEditorClass( TextValueEditor.class ).attribute( CN ).rawValue( UNICODE )
.expectedRawValue( UNICODE ).expectedDisplayValue( UNICODE ).expectedHasValue( true )
.expectedStringOrBinaryValue( UNICODE ) },
- { "TextValueEditor - empty binary value",
+ {
+ "TextValueEditor - empty binary value",
Data.data().valueEditorClass( TextValueEditor.class ).attribute( USER_PWD )
.rawValue( IValue.EMPTY_BINARY_VALUE ).expectedRawValue( EMPTY_STRING )
.expectedDisplayValue( EMPTY_STRING ).expectedHasValue( true )
.expectedStringOrBinaryValue( EMPTY_STRING ) },
- { "TextValueEditor - empty bytearray",
+ {
+ "TextValueEditor - empty bytearray",
Data.data().valueEditorClass( TextValueEditor.class ).attribute( USER_PWD ).rawValue( EMPTY_BYTES )
.expectedRawValue( EMPTY_STRING ).expectedDisplayValue( EMPTY_STRING ).expectedHasValue( true )
.expectedStringOrBinaryValue( EMPTY_STRING ) },
- { "TextValueEditor - bytearray UTF8",
+ {
+ "TextValueEditor - bytearray UTF8",
Data.data().valueEditorClass( TextValueEditor.class ).attribute( USER_PWD ).rawValue( UTF8 )
.expectedRawValue( UNICODE ).expectedDisplayValue( UNICODE ).expectedHasValue( true )
.expectedStringOrBinaryValue( UNICODE ) },
// text editor always tries to decode byte[] as UTF-8, so it can not handle ISO-8859-1 encoded byte[]
- { "TextValueEditor - bytearray ISO-8859-1",
+ {
+ "TextValueEditor - bytearray ISO-8859-1",
Data.data().valueEditorClass( TextValueEditor.class ).attribute( USER_PWD ).rawValue( ISO88591 )
.expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL ).expectedHasValue( true )
.expectedStringOrBinaryValue( null ) },
// text editor always tries to decode byte[] as UTF-8, so it can not handle arbitrary byte[]
- { "TextValueEditor - bytearray PNG",
+ {
+ "TextValueEditor - bytearray PNG",
Data.data().valueEditorClass( InPlaceTextValueEditor.class ).attribute( USER_PWD ).rawValue( PNG )
.expectedRawValue( null ).expectedDisplayValue( IValueEditor.NULL ).expectedHasValue( true )
.expectedStringOrBinaryValue( null ) },
@@ -256,65 +279,64 @@ public class ValueEditorTest
* HexValueEditor can handle all string or binary values.
*/
- { "HexValueEditor - empty string value",
+ {
+ "HexValueEditor - empty string value",
Data.data().valueEditorClass( HexValueEditor.class ).attribute( CN )
.rawValue( IValue.EMPTY_STRING_VALUE ).expectedRawValue( EMPTY_BYTES )
.expectedDisplayValue( "Binary Data (0 Bytes)" ).expectedHasValue( true )
.expectedStringOrBinaryValue( EMPTY_BYTES ) },
- { "HexValueEditor - empty string",
+ {
+ "HexValueEditor - empty string",
Data.data().valueEditorClass( HexValueEditor.class ).attribute( CN ).rawValue( EMPTY_STRING )
.expectedRawValue( EMPTY_BYTES ).expectedDisplayValue( "Binary Data (0 Bytes)" )
.expectedHasValue( true ).expectedStringOrBinaryValue( EMPTY_BYTES ) },
- { "HexValueEditor - ascii",
+ {
+ "HexValueEditor - ascii",
Data.data().valueEditorClass( HexValueEditor.class ).attribute( CN ).rawValue( ASCII )
.expectedRawValue( ASCII.getBytes( StandardCharsets.US_ASCII ) )
.expectedDisplayValue( "Binary Data (9 Bytes)" ).expectedHasValue( true )
.expectedStringOrBinaryValue( ASCII.getBytes( StandardCharsets.US_ASCII ) ) },
- { "HexValueEditor - empty binary value",
+ {
+ "HexValueEditor - empty binary value",
Data.data().valueEditorClass( HexValueEditor.class ).attribute( USER_PWD )
.rawValue( IValue.EMPTY_BINARY_VALUE ).expectedRawValue( EMPTY_BYTES )
.expectedDisplayValue( "Binary Data (0 Bytes)" ).expectedHasValue( true )
.expectedStringOrBinaryValue( EMPTY_BYTES ) },
- { "HexValueEditor - empty bytearray",
+ {
+ "HexValueEditor - empty bytearray",
Data.data().valueEditorClass( HexValueEditor.class ).attribute( USER_PWD ).rawValue( EMPTY_BYTES )
.expectedRawValue( EMPTY_BYTES ).expectedDisplayValue( "Binary Data (0 Bytes)" )
.expectedHasValue( true ).expectedStringOrBinaryValue( EMPTY_BYTES ) },
- { "HexValueEditor - bytearray UTF8",
+ {
+ "HexValueEditor - bytearray UTF8",
Data.data().valueEditorClass( HexValueEditor.class ).attribute( USER_PWD ).rawValue( UTF8 )
.expectedRawValue( UTF8 ).expectedDisplayValue( "Binary Data (30 Bytes)" )
.expectedHasValue( true ).expectedStringOrBinaryValue( UTF8 ) },
- { "HexValueEditor - bytearray ISO-8859-1",
+ {
+ "HexValueEditor - bytearray ISO-8859-1",
Data.data().valueEditorClass( HexValueEditor.class ).attribute( USER_PWD ).rawValue( ISO88591 )
.expectedRawValue( ISO88591 ).expectedDisplayValue( "Binary Data (4 Bytes)" )
.expectedHasValue( true ).expectedStringOrBinaryValue( ISO88591 ) },
- { "HexValueEditor - bytearray PNG",
+ {
+ "HexValueEditor - bytearray PNG",
Data.data().valueEditorClass( HexValueEditor.class ).attribute( USER_PWD ).rawValue( PNG )
.expectedRawValue( PNG ).expectedDisplayValue( "Binary Data (4 Bytes)" )
.expectedHasValue( true ).expectedStringOrBinaryValue( PNG ) },
-
- };
+ } ).map( d -> Arguments.arguments( ( String ) d[0], ( Data ) d[1] ) );
}
- @Parameter(value = 0)
- public String name;
-
- @Parameter(value = 1)
- public Data data;
-
private IValue value;
private IValueEditor editor;
-
- @Before
- public void setup() throws Exception
+ public void setup( String name, Data data ) throws Exception
{
IEntry entry = new DummyEntry( new Dn(), new DummyConnection( Schema.DEFAULT_SCHEMA ) );
IAttribute attribute = new Attribute( entry, data.attribute );
@@ -323,9 +345,11 @@ public class ValueEditorTest
}
- @Test
- public void testGetRawValue()
+ @ParameterizedTest
+ @MethodSource("data")
+ public void testGetRawValue( String name, Data data ) throws Exception
{
+ setup( name, data );
if ( data.expectedRawValue instanceof byte[] )
{
assertArrayEquals( ( byte[] ) data.expectedRawValue, ( byte[] ) editor.getRawValue( value ) );
@@ -337,23 +361,29 @@ public class ValueEditorTest
}
- @Test
- public void testGetDisplayValue()
+ @ParameterizedTest
+ @MethodSource("data")
+ public void testGetDisplayValue( String name, Data data ) throws Exception
{
+ setup( name, data );
assertEquals( data.expectedDisplayValue, editor.getDisplayValue( value ) );
}
- @Test
- public void testHasValue()
+ @ParameterizedTest
+ @MethodSource("data")
+ public void testHasValue( String name, Data data ) throws Exception
{
+ setup( name, data );
assertEquals( data.expectedHasValue, editor.hasValue( value ) );
}
- @Test
- public void testGetStringOrBinaryValue()
+ @ParameterizedTest
+ @MethodSource("data")
+ public void testGetStringOrBinaryValue( String name, Data data ) throws Exception
{
+ setup( name, data );
if ( data.expectedStringOrBinaryValue instanceof byte[] )
{
assertArrayEquals( ( byte[] ) data.expectedStringOrBinaryValue,
@@ -382,7 +412,6 @@ public class ValueEditorTest
public Object expectedStringOrBinaryValue;
-
public static Data data()
{
return new Data();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSConfigurationEditorBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSConfigurationEditorBot.java
index 8bf61033a..ac58dc2bf 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSConfigurationEditorBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSConfigurationEditorBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.apache.mina.util.AvailablePortFinder;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java
index e1171eee8..c516c1cc3 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ApacheDSServersViewBot.java
@@ -25,7 +25,7 @@ import java.util.ArrayList;
import org.apache.directory.studio.ldapservers.LdapServersManager;
import org.apache.directory.studio.ldapservers.model.LdapServer;
import org.apache.directory.studio.ldapservers.model.LdapServerStatus;
-import org.apache.directory.studio.test.integration.ui.ContextMenuHelper;
+import org.apache.directory.studio.test.integration.ui.utils.ContextMenuHelper;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
index 194f92aa2..de48835cc 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
@@ -21,8 +21,8 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.ContextMenuHelper;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.ContextMenuHelper;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
index 37891b04b..7fa0aa864 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
@@ -23,9 +23,11 @@ package org.apache.directory.studio.test.integration.ui.bots;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
@@ -43,7 +45,6 @@ class BrowserWidgetBot
{
private SWTBot bot;
-
BrowserWidgetBot( SWTBot bot )
{
this.bot = bot;
@@ -243,7 +244,7 @@ class BrowserWidgetBot
List<String> nodes = entry.getNodes();
for ( String node : nodes )
{
- if ( node.toUpperCase().startsWith( nodeName.toUpperCase() ) )
+ if ( matches( node, nodeName ) )
{
return node;
}
@@ -258,7 +259,7 @@ class BrowserWidgetBot
for ( SWTBotTreeItem item : allItems )
{
String node = item.getText();
- if ( node.toUpperCase().startsWith( nodeName.toUpperCase() ) )
+ if ( matches( node, nodeName ) )
{
return node;
}
@@ -267,6 +268,19 @@ class BrowserWidgetBot
}
+ private boolean matches( String candidate, String needle )
+ {
+ Pattern pattern = Pattern.compile( "(.*) \\(\\d+\\+?\\)" );
+ Matcher candidateMatcher = pattern.matcher( candidate );
+ Matcher needleMatcher = pattern.matcher( needle );
+ if ( candidateMatcher.matches() && !needleMatcher.matches() )
+ {
+ candidate = candidateMatcher.group( 1 );
+ }
+ return candidate.toUpperCase().equals( needle.toUpperCase() );
+ }
+
+
SWTBotTree getTree()
{
return bot.tree();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java
index 1a7b2c949..2dec48747 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ConnectionsViewBot.java
@@ -20,7 +20,7 @@
package org.apache.directory.studio.test.integration.ui.bots;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
+import static org.apache.directory.studio.test.integration.ui.utils.Constants.LOCALHOST;
import java.util.ArrayList;
import java.util.Arrays;
@@ -37,8 +37,9 @@ import org.apache.directory.studio.connection.core.ConnectionParameter.Encryptio
import org.apache.directory.studio.connection.core.Messages;
import org.apache.directory.studio.connection.core.jobs.OpenConnectionsRunnable;
import org.apache.directory.studio.connection.core.jobs.StudioConnectionJob;
-import org.apache.directory.studio.test.integration.ui.ContextMenuHelper;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
+import org.apache.directory.studio.test.integration.ui.utils.ContextMenuHelper;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.utils.TableCollection;
@@ -213,6 +214,14 @@ public class ConnectionsViewBot
}
+ public Connection createTestConnection( TestLdapServer server ) throws Exception
+ {
+ return createTestConnection( server.getType().name(), server.getHost(),
+ server.getPort(), server.getAdminDn(),
+ server.getAdminPassword() );
+ }
+
+
/**
* Creates the test connection.
*
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DeleteDialogBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DeleteDialogBot.java
index 6c6cdc26b..986fa5316 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DeleteDialogBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DeleteDialogBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
public class DeleteDialogBot extends DialogBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
index dcae169a4..0012f6868 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorBot.java
@@ -23,7 +23,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import java.util.List;
-import org.apache.directory.studio.test.integration.ui.ContextMenuHelper;
+import org.apache.directory.studio.test.integration.ui.utils.ContextMenuHelper;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
index a768b8ac3..15bfdecdb 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/EntryEditorWidgetBot.java
@@ -25,8 +25,8 @@ import java.util.Arrays;
import java.util.List;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.ContextMenuHelper;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.ContextMenuHelper;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java
index 092f37de3..d169a88d8 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ExportWizardBot.java
@@ -25,7 +25,7 @@ import java.io.File;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/GeneratedPasswordDialogBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/GeneratedPasswordDialogBot.java
new file mode 100644
index 000000000..ab88a2d16
--- /dev/null
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/GeneratedPasswordDialogBot.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ *
+ */
+package org.apache.directory.studio.test.integration.ui.bots;
+
+
+public class GeneratedPasswordDialogBot extends DialogBot
+{
+
+ public GeneratedPasswordDialogBot()
+ {
+ super( "Generated Password" );
+ }
+
+
+ public String getGeneratedPassword()
+ {
+ return bot.text( 0 ).getText();
+ }
+
+}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java
index 6f4bc6105..b483dcbcd 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ImportWizardBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
public class ImportWizardBot extends WizardBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/MoveEntriesDialogBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/MoveEntriesDialogBot.java
index 5622dd76e..05795085d 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/MoveEntriesDialogBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/MoveEntriesDialogBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
public class MoveEntriesDialogBot extends DialogBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewConnectionWizardBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewConnectionWizardBot.java
index 59cb804ee..309ccbd20 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewConnectionWizardBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewConnectionWizardBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java
index 4de6704e1..98c866005 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewEntryWizardBot.java
@@ -22,7 +22,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
public class NewEntryWizardBot extends WizardBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java
index f0ac007fc..35788cb43 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/PreferencesBot.java
@@ -19,7 +19,7 @@
*/
package org.apache.directory.studio.test.integration.ui.bots;
-import org.apache.directory.studio.test.integration.ui.bots.utils.TreeBot;
+import org.apache.directory.studio.test.integration.ui.utils.TreeBot;
public class PreferencesBot extends DialogBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ReferralDialogBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ReferralDialogBot.java
index c68c45d06..31a97fc90 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ReferralDialogBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ReferralDialogBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.swtbot.swt.finder.utils.TableCollection;
import org.eclipse.swtbot.swt.finder.utils.TableRow;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java
index 76ac490d5..1ef636d0d 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/RenameEntryDialogBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
public class RenameEntryDialogBot extends DialogBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchResultEditorBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchResultEditorBot.java
index e72e1f5f9..ed05bdf73 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchResultEditorBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchResultEditorBot.java
@@ -27,7 +27,7 @@ import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withSt
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withTooltip;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Widget;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyDepthDialogBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyDepthDialogBot.java
index 0a27c277c..03ab8858a 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyDepthDialogBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyDepthDialogBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
public class SelectCopyDepthDialogBot extends DialogBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyStrategyBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyStrategyBot.java
index 1bcd35da0..0d09a8421 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyStrategyBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SelectCopyStrategyBot.java
@@ -21,7 +21,7 @@ package org.apache.directory.studio.test.integration.ui.bots;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.test.integration.ui.bots.utils.JobWatcher;
+import org.apache.directory.studio.test.integration.ui.utils.JobWatcher;
public class SelectCopyStrategyBot extends DialogBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java
index 742cc5bf0..0c8e702ef 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ShowViewsBot.java
@@ -20,7 +20,7 @@
package org.apache.directory.studio.test.integration.ui.bots;
-import org.apache.directory.studio.test.integration.ui.bots.utils.TreeBot;
+import org.apache.directory.studio.test.integration.ui.utils.TreeBot;
public class ShowViewsBot extends DialogBot
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
index 341afbe14..f781dab12 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
@@ -203,11 +203,8 @@ public class StudioBot
}
// reset LDAP perspective
- if ( page.getActivePart() != null )
- {
- page.closeAllEditors( false );
- page.resetPerspective();
- }
+ page.closeAllEditors( false );
+ page.resetPerspective();
}
catch ( Exception e )
{
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
index db3e9adf3..de5b1aeef 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/WizardBot.java
@@ -20,7 +20,7 @@
package org.apache.directory.studio.test.integration.ui.bots;
-import org.apache.directory.studio.test.integration.ui.bots.utils.TreeBot;
+import org.apache.directory.studio.test.integration.ui.utils.TreeBot;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/FrameworkRunnerWithScreenshotCaptureListener.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/FrameworkRunnerWithScreenshotCaptureListener.java
deleted file mode 100644
index acf0ee4d3..000000000
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/FrameworkRunnerWithScreenshotCaptureListener.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- *
- */
-package org.apache.directory.studio.test.integration.ui.bots.utils;
-
-
-import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.eclipse.swtbot.swt.finder.junit.ScreenshotCaptureListener;
-import org.junit.runner.notification.RunListener;
-import org.junit.runner.notification.RunNotifier;
-import org.junit.runners.model.InitializationError;
-
-
-public class FrameworkRunnerWithScreenshotCaptureListener extends FrameworkRunner
-{
-
- public FrameworkRunnerWithScreenshotCaptureListener( Class<?> clazz ) throws InitializationError
- {
- super( clazz );
- }
-
-
- public void run( RunNotifier notifier )
- {
- RunListener failureSpy = new ScreenshotCaptureListener();
- notifier.removeListener( failureSpy );
- notifier.addListener( failureSpy );
- try
- {
- super.run( notifier );
- }
- finally
- {
- notifier.removeListener( failureSpy );
- }
- }
-
-}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDsUtils.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ApacheDsUtils.java
index 3600f7bbb..43046133a 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ApacheDsUtils.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ApacheDsUtils.java
@@ -18,10 +18,10 @@
*
*/
-package org.apache.directory.studio.test.integration.ui;
+package org.apache.directory.studio.test.integration.ui.utils;
-import static org.apache.directory.studio.test.integration.ui.Constants.LOCALHOST;
+import static org.apache.directory.studio.test.integration.ui.utils.Constants.LOCALHOST;
import java.util.Hashtable;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/Assertions.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Assertions.java
index 0bbc59932..90394134f 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/Assertions.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Assertions.java
@@ -17,10 +17,10 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.ui.bots.utils;
+package org.apache.directory.studio.test.integration.ui.utils;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
import org.apache.directory.studio.connection.core.Messages;
import org.apache.directory.studio.test.integration.ui.bots.BotUtils;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/Characters.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Characters.java
index f9b51a5e7..830eb5ba4 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/Characters.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Characters.java
@@ -17,14 +17,12 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.ui.bots.utils;
+package org.apache.directory.studio.test.integration.ui.utils;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
-import org.junit.Test;
-
public class Characters
{
@@ -60,7 +58,6 @@ public class Characters
}
- @Test
public void print()
{
System.out.println( LATIN_A );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/Constants.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Constants.java
index 496287719..0f5db92e6 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/Constants.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/Constants.java
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.ui;
+package org.apache.directory.studio.test.integration.ui.utils;
import org.apache.directory.api.util.Network;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ContextMenuHelper.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ContextMenuHelper.java
index d8dac4efb..de5bb6135 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ContextMenuHelper.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ContextMenuHelper.java
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.ui;
+package org.apache.directory.studio.test.integration.ui.utils;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withRegex;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/JobWatcher.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/JobWatcher.java
index 41fd0daa4..44cdc76ad 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/JobWatcher.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/JobWatcher.java
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.ui.bots.utils;
+package org.apache.directory.studio.test.integration.ui.utils;
import java.util.Arrays;
@@ -142,6 +142,6 @@ public class JobWatcher
}, SWTBotPreferences.TIMEOUT * 4 );
// Wait a bit longer after job is done to allow UI update
- BotUtils.sleep( 1000L );
+ BotUtils.sleep( 100L );
}
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ResourceUtils.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ResourceUtils.java
index 2fad2f3bc..dac7de29e 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ResourceUtils.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/ResourceUtils.java
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.ui;
+package org.apache.directory.studio.test.integration.ui.utils;
import java.io.File;
@@ -28,6 +28,7 @@ import java.net.URL;
import java.util.UUID;
import org.apache.directory.api.util.IOUtils;
+import org.apache.directory.studio.test.integration.ui.Activator;
import org.eclipse.core.runtime.Platform;
@@ -38,7 +39,7 @@ public class ResourceUtils
URL url = Platform.getInstanceLocation().getURL();
String destFile = url.getFile() + UUID.randomUUID().toString();
- try ( InputStream is = ResourceUtils.class.getResourceAsStream( inputFileName );
+ try ( InputStream is = Activator.class.getResourceAsStream( inputFileName );
FileOutputStream fos = new FileOutputStream( new File( destFile ) ); )
{
IOUtils.copy( is, fos );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/SWTBotUtils.java
index afe8515d7..6235c7c2d 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/SWTBotUtils.java
@@ -18,7 +18,7 @@
*
*/
-package org.apache.directory.studio.test.integration.ui;
+package org.apache.directory.studio.test.integration.ui.utils;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/StudioSystemUtils.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/StudioSystemUtils.java
index d15e9550d..521523694 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/StudioSystemUtils.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/StudioSystemUtils.java
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.ui.bots.utils;
+package org.apache.directory.studio.test.integration.ui.utils;
import org.apache.commons.lang3.SystemUtils;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/TreeBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/TreeBot.java
index 2427b9228..33e2bbfe4 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/utils/TreeBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/utils/TreeBot.java
@@ -17,7 +17,7 @@
* under the License.
*
*/
-package org.apache.directory.studio.test.integration.ui.bots.utils;
+package org.apache.directory.studio.test.integration.ui.utils;
import java.util.Arrays;
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif
deleted file mode 100644
index 761db633a..000000000
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/BrowserTest.ldif
+++ /dev/null
@@ -1,298 +0,0 @@
-# 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.
-#
-dn: uid=user.1,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaccf
-sn: Amar
-cn: Aaccf Amar
-initials: AA
-uid: user.1
-mail: user.1@null
-userPassword: password
-telephoneNumber: 976-893-3312
-homePhone: 337-310-0727
-pager: 185-156-4071
-mobile: 626-188-0934
-employeeNumber: 1
-street: 27919 Broadway Street
-l: Tallahassee
-st: DE
-postalCode: 67698
-postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE 67698
-description: This is the description for Aaccf Amar.
-roomNumber: 1388
-
-dn: uid=user.2,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaren
-sn: Atp
-cn: Aaren Atp
-initials: AA
-uid: user.2
-mail: user.2@null
-userPassword: password
-telephoneNumber: 147-953-0396
-homePhone: 174-439-5329
-pager: 617-443-8449
-mobile: 045-464-2512
-employeeNumber: 2
-street: 36109 Center Street
-l: Harlingen
-st: CO
-postalCode: 21733
-postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO 21733
-description: This is the description for Aaren Atp.
-roomNumber: 1198
-
-dn: uid=user.3,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aarika
-sn: Atpco
-cn: Aarika Atpco
-initials: AA
-uid: user.3
-mail: user.3@null
-userPassword: password
-telephoneNumber: 925-356-4943
-homePhone: 099-983-0308
-pager: 806-672-7363
-mobile: 425-493-8009
-employeeNumber: 3
-street: 14730 Fourteenth Street
-l: Evansville
-st: ND
-postalCode: 95526
-postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND 95526
-description: This is the description for Aarika Atpco.
-roomNumber: 1135
-
-dn: uid=user.4,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaron
-sn: Atrc
-cn: Aaron Atrc
-initials: AA
-uid: user.4
-mail: user.4@null
-userPassword: password
-telephoneNumber: 696-981-0488
-homePhone: 854-401-1330
-pager: 389-028-9518
-mobile: 117-882-4912
-employeeNumber: 4
-street: 98495 Fifteenth Street
-l: Miami
-st: PA
-postalCode: 16887
-postalAddress: Aaron Atrc$98495 Fifteenth Street$Miami, PA 16887
-description: This is the description for Aaron Atrc.
-roomNumber: 1311
-
-dn: uid=user.5,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aartjan
-sn: Aalders
-cn: Aartjan Aalders
-initials: AA
-uid: user.5
-mail: user.5@null
-userPassword: password
-telephoneNumber: 657-627-9753
-homePhone: 109-158-4533
-pager: 801-392-0010
-mobile: 763-973-0947
-employeeNumber: 5
-street: 52408 Ridge Street
-l: Omaha
-st: AR
-postalCode: 08015
-postalAddress: Aartjan Aalders$52408 Ridge Street$Omaha, AR 08015
-description: This is the description for Aartjan Aalders.
-roomNumber: 1090
-
-dn: uid=user.6,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abagael
-sn: Aasen
-cn: Abagael Aasen
-initials: AA
-uid: user.6
-mail: user.6@null
-userPassword: password
-telephoneNumber: 600-556-9017
-homePhone: 543-731-7797
-pager: 349-743-6572
-mobile: 042-921-9717
-employeeNumber: 6
-street: 87514 Dogwood Street
-l: Bloomington
-st: ID
-postalCode: 56762
-postalAddress: Abagael Aasen$87514 Dogwood Street$Bloomington, ID 56762
-description: This is the description for Abagael Aasen.
-roomNumber: 1449
-
-dn: uid=user.7,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abagail
-sn: Abadines
-cn: Abagail Abadines
-initials: AA
-uid: user.7
-mail: user.7@null
-userPassword: password
-telephoneNumber: 628-294-0713
-homePhone: 313-764-3970
-pager: 118-541-2978
-mobile: 111-360-9243
-employeeNumber: 7
-street: 60751 Main Street
-l: Macon
-st: MI
-postalCode: 38755
-postalAddress: Abagail Abadines$60751 Main Street$Macon, MI 38755
-description: This is the description for Abagail Abadines.
-roomNumber: 1312
-
-dn: uid=user.8,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abahri
-sn: Abazari
-cn: Abahri Abazari
-initials: AA
-uid: user.8
-mail: user.8@null
-userPassword: password
-telephoneNumber: 760-373-5805
-homePhone: 856-861-3648
-pager: 271-218-0027
-mobile: 957-465-6928
-employeeNumber: 8
-street: 81023 River Street
-l: Monroe
-st: SD
-postalCode: 51865
-postalAddress: Abahri Abazari$81023 River Street$Monroe, SD 51865
-description: This is the description for Abahri Abazari.
-roomNumber: 1963
-
-dn: cn=\#ACL_AD-Projects_Author,ou=users,ou=system
-objectClass: top
-objectClass: person
-cn: #ACL_AD-Projects_Author
-sn: #ACL_AD-Projects_Author
-
-dn: cn=My Group,ou=groups,ou=system
-objectClass: groupOfNames
-objectClass: top
-cn: My Group
-member: cn=\#ACL_AD-Projects_Author,ou=users,ou=system
-
-dn: cn=nghZwwtHgxgyvVbTQCYyeY\+O4cc=,ou=users,ou=system
-objectClass: top
-objectClass: person
-cn: nghZwwtHgxgyvVbTQCYyeY+O4cc=
-sn: nghZwwtHgxgyvVbTQCYyeY+O4cc=
-
-dn: cn=nghZwwtHgxgyvVbTQCYyeY+email=,ou=users,ou=system
-objectClass: top
-objectClass: person
-objectClass: extensibleObject
-cn: nghZwwtHgxgyvVbTQCYyeY
-sn: nghZwwtHgxgyvVbTQCYyeY
-email:
-
-dn: l=eu + l=de + l=Berlin + l=Brandenburger Tor, ou=users, ou=system
-objectClass: top
-objectClass: locality
-l: eu
-l: de
-l: Berlin
-l: Brandenburger Tor
-
-dn: cn=A, l=eu + l=de + l=Berlin + l=Brandenburger Tor, ou=users, ou=system
-objectClass: top
-objectClass: person
-cn: user.A
-sn: user.A
-
-dn: uid=user.0\,foo,ou=users, ou=system
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-sn: bbb
-cn: aaa
-uid: user.0,foo
-
-dn: ou=target,ou=system
-objectClass: top
-objectClass: organizationalUnit
-ou: target
-administrativeRole: accessControlSpecificArea
-
-dn: ou=special,ou=system
-objectClass: top
-objectClass: organizationalUnit
-ou: special
-administrativeRole: accessControlSpecificArea
-
-dn: cn=alias,ou=special,ou=system
-objectClass: alias
-objectClass: top
-objectClass: extensibleObject
-cn: alias
-aliasedObjectName: ou=special,ou=system
-
-dn: cn=referral,ou=special,ou=system
-objectClass: referral
-objectClass: top
-objectClass: extensibleObject
-cn: referral
-ref: ldap://foo.example.com/ou=system
-
-dn: cn=subentry,ou=special,ou=system
-objectClass: subentry
-objectClass: top
-cn: subentry
-subtreeSpecification: { }
-
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif
index d504a3282..3b58de635 100644
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif
+++ b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/DIRSTUDIO-1160.ldif
@@ -17,7 +17,7 @@
#
version: 1
-dn: cn=U0034692,ou=users,ou=system
+dn: cn=U0034692,ou=misc,dc=example,dc=org
sn: Doe
displayName:: SsO2aG4gRG/DpGXDtg==
givenName:: SsO2aG4gRG/DpGXDtg==
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/EntryEditorTest.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/EntryEditorTest.ldif
deleted file mode 100644
index 94a61d3c4..000000000
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/EntryEditorTest.ldif
+++ /dev/null
@@ -1,102 +0,0 @@
-# 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.
-#
-dn: cn=Barbara Jensen,ou=users,ou=system
-objectClass: inetOrgPerson
-objectClass: organizationalPerson
-objectClass: person
-objectClass: top
-cn: Barbara Jensen
-sn: Jensen
-givenName: Barbara
-uid: bjensen
-
-dn: uid=hnelson,ou=users,ou=system
-objectClass: inetOrgPerson
-objectClass: organizationalPerson
-objectClass: person
-objectClass: top
-objectClass: extensibleObject
-objectclass: accessControlSubentry
-cn: Horatio Nelson
-sn: Nelson
-uid: hnelson
-description:: QSDDqSDigqwg0K8gzrsg16kg2Lkg4ruhIA==
-userPassword:: e1NTSEE1MTJ9aUlyTG1uR0MxdTNaTGFPWmRvSjZUMjBKdG9XQ05wWjArWGFLRnN
- 5bEVEdFpYK3I3bUZrcjRwYTNKMXE3VWpSZ3ZFV2lCd1FNUjZadjBoYnRsYnRqSTQ2TmR6WVRDdG9G
-jpegPhoto:: /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw
- 8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRw
- hMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAB
- AAEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEA
- wUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKS
- o0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqK
- jpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QA
- HwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEB
- SExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSE
- lKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba
- 3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD3+iii
- gD//2Q==
-entryACI: { identificationTag "test", precedence 1, authenticationLevel none,
- itemOrUserFirst userFirst: { userClasses { subtree { { base "dc=example,dc=co
- m", minimum 1, maximum 2, specificExclusions { chopBefore: "dc=example,dc=com
- " } } }, allUsers, userGroup { "dc=example,dc=com" } }, userPermissions { { p
- recedence 2, protectedItems { allUserAttributeTypes, attributeValue {userpass
- word=* }, maxImmSub 2, entry, maxValueCount {{ type userPassword, maxCount 2
- }} }, grantsAndDenials { denyRemove, grantReturnDN, denyModify, denyAdd, deny
- Rename, grantFilterMatch, grantBrowse, grantRead, grantCompare } } } } }
-userSMIMECertificate:: AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJyg
- pKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFi
- Y2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbn
- J2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1d
- bX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==
-userSMIMECertificate:: AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJyg
- pKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFi
- Y2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbn
- J2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1d
- bX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/wA=
-userSMIMECertificate:: AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJyg
- pKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFi
- Y2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbn
- J2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1d
- bX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+
-subtreeSpecification: {}
-prescriptiveACI: { identificationTag "allUsersACI", precedence 10, authenticat
- ionLevel simple, itemOrUserFirst userFirst: { userClasses { allUsers }, userP
- ermissions { { protectedItems { allUserAttributeTypesAndValues, entry }, gran
- tsAndDenials { grantReturnDN, grantCompare, grantRead, grantDiscloseOnError,
- grantFilterMatch, grantBrowse } }, { protectedItems { attributeType { userPas
- sword } }, grantsAndDenials { denyCompare, denyRead, denyFilterMatch } } } }
- }
-
-# cn=\#\\\+\, \"öé\",ou=users,ou=system
-dn:: Y249XCNcXFwrXCwgXCLDtsOpXCIsb3U9dXNlcnMsb3U9c3lzdGVt
-objectClass: inetOrgPerson
-objectClass: organizationalPerson
-objectClass: person
-objectClass: top
-cn:: I1wrLCAiw7bDqSI=
-sn:: I1wrLCAiw7bDqSI=
-givenName:: I1wrLCAiw7bDqSI=
-uid:: I1wrLCAiw7bDqSI=
-
-dn: cn=My Group,ou=groups,ou=system
-objectClass: groupOfNames
-objectClass: top
-cn: My Group
-member: cn=Barbara Jensen,ou=users,ou=system
-
-
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/Fedora389dsTest.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/Fedora389dsTest.ldif
deleted file mode 100644
index 96ae7520a..000000000
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/Fedora389dsTest.ldif
+++ /dev/null
@@ -1,226 +0,0 @@
-# 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.
-#
-dn: dc=example,dc=org
-objectClass: top
-objectClass: domain
-dc: example
-
-dn: ou=users,dc=example,dc=org
-objectClass: top
-objectClass: organizationalUnit
-ou: users
-
-dn: uid=user.1,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaccf
-sn: Amar
-cn: Aaccf Amar
-initials: AA
-uid: user.1
-mail: user.1@null
-userPassword: password
-telephoneNumber: 976-893-3312
-homePhone: 337-310-0727
-pager: 185-156-4071
-mobile: 626-188-0934
-employeeNumber: 1
-street: 27919 Broadway Street
-l: Tallahassee
-st: DE
-postalCode: 67698
-postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE 67698
-roomNumber: 1388
-
-dn: uid=user.2,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaren
-sn: Atp
-cn: Aaren Atp
-initials: AA
-uid: user.2
-mail: user.2@null
-userPassword: password
-telephoneNumber: 147-953-0396
-homePhone: 174-439-5329
-pager: 617-443-8449
-mobile: 045-464-2512
-employeeNumber: 2
-street: 36109 Center Street
-l: Harlingen
-st: CO
-postalCode: 21733
-postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO 21733
-description: This is the description for Aaren Atp.
-roomNumber: 1198
-
-dn: uid=user.3,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aarika
-sn: Atpco
-cn: Aarika Atpco
-initials: AA
-uid: user.3
-mail: user.3@null
-userPassword: password
-telephoneNumber: 925-356-4943
-homePhone: 099-983-0308
-pager: 806-672-7363
-mobile: 425-493-8009
-employeeNumber: 3
-street: 14730 Fourteenth Street
-l: Evansville
-st: ND
-postalCode: 95526
-postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND 95526
-description: This is the description for Aarika Atpco.
-roomNumber: 1135
-
-dn: uid=user.4,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaron
-sn: Atrc
-cn: Aaron Atrc
-initials: AA
-uid: user.4
-mail: user.4@null
-userPassword: password
-telephoneNumber: 696-981-0488
-homePhone: 854-401-1330
-pager: 389-028-9518
-mobile: 117-882-4912
-employeeNumber: 4
-street: 98495 Fifteenth Street
-l: Miami
-st: PA
-postalCode: 16887
-postalAddress: Aaron Atrc$98495 Fifteenth Street$Miami, PA 16887
-description: This is the description for Aaron Atrc.
-roomNumber: 1311
-
-dn: uid=user.5,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aartjan
-sn: Aalders
-cn: Aartjan Aalders
-initials: AA
-uid: user.5
-mail: user.5@null
-userPassword: password
-telephoneNumber: 657-627-9753
-homePhone: 109-158-4533
-pager: 801-392-0010
-mobile: 763-973-0947
-employeeNumber: 5
-street: 52408 Ridge Street
-l: Omaha
-st: AR
-postalCode: 08015
-postalAddress: Aartjan Aalders$52408 Ridge Street$Omaha, AR 08015
-description: This is the description for Aartjan Aalders.
-roomNumber: 1090
-
-dn: uid=user.6,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abagael
-sn: Aasen
-cn: Abagael Aasen
-initials: AA
-uid: user.6
-mail: user.6@null
-userPassword: password
-telephoneNumber: 600-556-9017
-homePhone: 543-731-7797
-pager: 349-743-6572
-mobile: 042-921-9717
-employeeNumber: 6
-street: 87514 Dogwood Street
-l: Bloomington
-st: ID
-postalCode: 56762
-postalAddress: Abagael Aasen$87514 Dogwood Street$Bloomington, ID 56762
-description: This is the description for Abagael Aasen.
-roomNumber: 1449
-
-dn: uid=user.7,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abagail
-sn: Abadines
-cn: Abagail Abadines
-initials: AA
-uid: user.7
-mail: user.7@null
-userPassword: password
-telephoneNumber: 628-294-0713
-homePhone: 313-764-3970
-pager: 118-541-2978
-mobile: 111-360-9243
-employeeNumber: 7
-street: 60751 Main Street
-l: Macon
-st: MI
-postalCode: 38755
-postalAddress: Abagail Abadines$60751 Main Street$Macon, MI 38755
-description: This is the description for Abagail Abadines.
-roomNumber: 1312
-
-dn: uid=user.8,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abahri
-sn: Abazari
-cn: Abahri Abazari
-initials: AA
-uid: user.8
-mail: user.8@null
-userPassword: password
-telephoneNumber: 760-373-5805
-homePhone: 856-861-3648
-pager: 271-218-0027
-mobile: 957-465-6928
-employeeNumber: 8
-street: 81023 River Street
-l: Monroe
-st: SD
-postalCode: 51865
-postalAddress: Abahri Abazari$81023 River Street$Monroe, SD 51865
-description: This is the description for Abahri Abazari.
-roomNumber: 1963
-
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest.ldif
deleted file mode 100644
index 9a4bd360b..000000000
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest.ldif
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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.
-#
-dn:: Y249V29sZmdhbmcgS8O2bGJlbCxvdT11c2VycyxvdT1zeXN0ZW0=
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-objectClass: top
-cn:: V29sZmdhbmcgS8O2bGJlbA==
-sn:: S8O2bGJlbA==
-description: =1+1
-
-dn: ou=special,ou=system
-objectClass: top
-objectClass: organizationalUnit
-ou: special
-administrativeRole: accessControlSpecificArea
-
-dn: cn=alias,ou=special,ou=system
-objectClass: alias
-objectClass: top
-objectClass: extensibleObject
-cn: alias
-aliasedObjectName: ou=special,ou=system
-
-dn: cn=referral,ou=special,ou=system
-objectClass: referral
-objectClass: top
-objectClass: extensibleObject
-cn: referral
-ref: ldap://foo.example.com/ou=system
-
-dn: cn=subentry,ou=special,ou=system
-objectClass: subentry
-objectClass: top
-cn: subentry
-subtreeSpecification: { }
-
-
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif
index 5034e9cb3..0042152e7 100644
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif
+++ b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_Modifications.ldif
@@ -15,85 +15,8 @@
# specific language governing permissions and limitations
# under the License.
#
-dn: uid=user.1,ou=users,ou=system
-changetype: add
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaccf
-sn: Amar
-cn: Aaccf Amar
-initials: AA
-uid: user.1
-mail: user.1@null
-userPassword: password
-telephoneNumber: 976-893-3312
-homePhone: 337-310-0727
-pager: 185-156-4071
-mobile: 626-188-0934
-employeeNumber: 1
-street: 27919 Broadway Street
-l: Tallahassee
-st: DE
-postalCode: 67698
-postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE 67698
-description: This is the description for Aaccf Amar.
-roomNumber: 0000
-
-dn: uid=user.2,ou=users,ou=system
-changetype: add
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaren
-sn: Atp
-cn: Aaren Atp
-initials: AA
-uid: user.2
-mail: user.2@null
-userPassword: password
-telephoneNumber: 147-953-0396
-homePhone: 174-439-5329
-pager: 617-443-8449
-mobile: 045-464-2512
-employeeNumber: 2
-street: 36109 Center Street
-l: Harlingen
-st: CO
-postalCode: 21733
-postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO 21733
-description: This is the description for Aaren Atp.
-roomNumber: 1198
-
-dn: uid=user.3,ou=users,ou=system
-changetype: add
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aarika
-sn: Atpco
-cn: Aarika Atpco
-initials: AA
-uid: user.3
-mail: user.3@null
-userPassword: password
-telephoneNumber: 925-356-4943
-homePhone: 099-983-0308
-pager: 806-672-7363
-mobile: 425-493-8009
-employeeNumber: 3
-street: 14730 Fourteenth Street
-l: Evansville
-st: ND
-postalCode: 95526
-postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND 95526
-description: This is the description for Aarika Atpco.
-roomNumber: 1135
-dn: uid=user.1,ou=users,ou=system
+dn: uid=user.1,ou=users,dc=example,dc=org
changetype: modify
delete: initials
initials: AA
@@ -138,10 +61,10 @@ userCertificate;binary:: MIICcTCCAdqgAwIBAgIBEjANBgkqhkiG9w0BAQUFADBDMRMwEQYKCZI
ORRepiXc0=
-dn: uid=user.2,ou=users,ou=system
+dn: uid=user.2,ou=users,dc=example,dc=org
changetype: delete
-dn: uid=user.3,ou=users,ou=system
+dn: uid=user.3,ou=users,dc=example,dc=org
changetype: moddn
newrdn: uid=user.33
deleteoldrdn: 1
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_ImportDontUpdateUI.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_User1to8.ldif
index 1c800ea13..4b39ca70c 100644
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_ImportDontUpdateUI.ldif
+++ b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/ImportExportTest_User1to8.ldif
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
#
-dn: uid=User.1,ou=users,ou=system
+dn: uid=User.1,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -40,7 +40,7 @@ postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE 67698
description: This is the description for Aaccf Amar.
roomNumber: 1388
-dn: uid=user.2,ou=users,ou=system
+dn: uid=user.2,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -65,7 +65,7 @@ postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO 21733
description: This is the description for Aaren Atp.
roomNumber: 1198
-dn: uid=user.3,ou=users,ou=system
+dn: uid=user.3,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -90,7 +90,7 @@ postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND 95526
description: This is the description for Aarika Atpco.
roomNumber: 1135
-dn: uid=user.4,ou=users,ou=system
+dn: uid=user.4,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -115,7 +115,7 @@ postalAddress: Aaron Atrc$98495 Fifteenth Street$Miami, PA 16887
description: This is the description for Aaron Atrc.
roomNumber: 1311
-dn: uid=user.5,ou=users,ou=system
+dn: uid=user.5,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -140,7 +140,7 @@ postalAddress: Aartjan Aalders$52408 Ridge Street$Omaha, AR 08015
description: This is the description for Aartjan Aalders.
roomNumber: 1090
-dn: uid=user.6,ou=users,ou=system
+dn: uid=user.6,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -165,7 +165,7 @@ postalAddress: Abagael Aasen$87514 Dogwood Street$Bloomington, ID 56762
description: This is the description for Abagael Aasen.
roomNumber: 1449
-dn: uid=user.7,ou=users,ou=system
+dn: uid=user.7,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
@@ -190,7 +190,7 @@ postalAddress: Abagail Abadines$60751 Main Street$Macon, MI 38755
description: This is the description for Abagail Abadines.
roomNumber: 1312
-dn: uid=user.8,ou=users,ou=system
+dn: uid=user.8,ou=misc.1.1.1,ou=misc.1.1,ou=misc.1,ou=misc,dc=example,dc=org
objectClass: top
objectClass: person
objectClass: organizationalPerson
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/OpenLdapTest.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/OpenLdapTest.ldif
deleted file mode 100644
index 4e39b2f64..000000000
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/OpenLdapTest.ldif
+++ /dev/null
@@ -1,221 +0,0 @@
-# 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.
-#
-dn: ou=users,dc=example,dc=org
-objectClass: top
-objectClass: organizationalUnit
-ou: users
-
-dn: uid=user.1,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaccf
-sn: Amar
-cn: Aaccf Amar
-initials: AA
-uid: user.1
-mail: user.1@null
-userPassword: password
-telephoneNumber: 976-893-3312
-homePhone: 337-310-0727
-pager: 185-156-4071
-mobile: 626-188-0934
-employeeNumber: 1
-street: 27919 Broadway Street
-l: Tallahassee
-st: DE
-postalCode: 67698
-postalAddress: Aaccf Amar$27919 Broadway Street$Tallahassee, DE 67698
-roomNumber: 1388
-
-dn: uid=user.2,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaren
-sn: Atp
-cn: Aaren Atp
-initials: AA
-uid: user.2
-mail: user.2@null
-userPassword: password
-telephoneNumber: 147-953-0396
-homePhone: 174-439-5329
-pager: 617-443-8449
-mobile: 045-464-2512
-employeeNumber: 2
-street: 36109 Center Street
-l: Harlingen
-st: CO
-postalCode: 21733
-postalAddress: Aaren Atp$36109 Center Street$Harlingen, CO 21733
-description: This is the description for Aaren Atp.
-roomNumber: 1198
-
-dn: uid=user.3,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aarika
-sn: Atpco
-cn: Aarika Atpco
-initials: AA
-uid: user.3
-mail: user.3@null
-userPassword: password
-telephoneNumber: 925-356-4943
-homePhone: 099-983-0308
-pager: 806-672-7363
-mobile: 425-493-8009
-employeeNumber: 3
-street: 14730 Fourteenth Street
-l: Evansville
-st: ND
-postalCode: 95526
-postalAddress: Aarika Atpco$14730 Fourteenth Street$Evansville, ND 95526
-description: This is the description for Aarika Atpco.
-roomNumber: 1135
-
-dn: uid=user.4,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aaron
-sn: Atrc
-cn: Aaron Atrc
-initials: AA
-uid: user.4
-mail: user.4@null
-userPassword: password
-telephoneNumber: 696-981-0488
-homePhone: 854-401-1330
-pager: 389-028-9518
-mobile: 117-882-4912
-employeeNumber: 4
-street: 98495 Fifteenth Street
-l: Miami
-st: PA
-postalCode: 16887
-postalAddress: Aaron Atrc$98495 Fifteenth Street$Miami, PA 16887
-description: This is the description for Aaron Atrc.
-roomNumber: 1311
-
-dn: uid=user.5,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Aartjan
-sn: Aalders
-cn: Aartjan Aalders
-initials: AA
-uid: user.5
-mail: user.5@null
-userPassword: password
-telephoneNumber: 657-627-9753
-homePhone: 109-158-4533
-pager: 801-392-0010
-mobile: 763-973-0947
-employeeNumber: 5
-street: 52408 Ridge Street
-l: Omaha
-st: AR
-postalCode: 08015
-postalAddress: Aartjan Aalders$52408 Ridge Street$Omaha, AR 08015
-description: This is the description for Aartjan Aalders.
-roomNumber: 1090
-
-dn: uid=user.6,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abagael
-sn: Aasen
-cn: Abagael Aasen
-initials: AA
-uid: user.6
-mail: user.6@null
-userPassword: password
-telephoneNumber: 600-556-9017
-homePhone: 543-731-7797
-pager: 349-743-6572
-mobile: 042-921-9717
-employeeNumber: 6
-street: 87514 Dogwood Street
-l: Bloomington
-st: ID
-postalCode: 56762
-postalAddress: Abagael Aasen$87514 Dogwood Street$Bloomington, ID 56762
-description: This is the description for Abagael Aasen.
-roomNumber: 1449
-
-dn: uid=user.7,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abagail
-sn: Abadines
-cn: Abagail Abadines
-initials: AA
-uid: user.7
-mail: user.7@null
-userPassword: password
-telephoneNumber: 628-294-0713
-homePhone: 313-764-3970
-pager: 118-541-2978
-mobile: 111-360-9243
-employeeNumber: 7
-street: 60751 Main Street
-l: Macon
-st: MI
-postalCode: 38755
-postalAddress: Abagail Abadines$60751 Main Street$Macon, MI 38755
-description: This is the description for Abagail Abadines.
-roomNumber: 1312
-
-dn: uid=user.8,ou=users,dc=example,dc=org
-objectClass: top
-objectClass: person
-objectClass: organizationalPerson
-objectClass: inetOrgPerson
-givenName: Abahri
-sn: Abazari
-cn: Abahri Abazari
-initials: AA
-uid: user.8
-mail: user.8@null
-userPassword: password
-telephoneNumber: 760-373-5805
-homePhone: 856-861-3648
-pager: 271-218-0027
-mobile: 957-465-6928
-employeeNumber: 8
-street: 81023 River Street
-l: Monroe
-st: SD
-postalCode: 51865
-postalAddress: Abahri Abazari$81023 River Street$Monroe, SD 51865
-description: This is the description for Abahri Abazari.
-roomNumber: 1963
-
diff --git a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif b/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
deleted file mode 100644
index 197592f45..000000000
--- a/tests/test.integration.ui/src/main/resources/org/apache/directory/studio/test/integration/ui/RenameEntryDialogTest.ldif
+++ /dev/null
@@ -1,48 +0,0 @@
-# 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.
-#
-dn: cn=Barbara Jensen+uid=bjensen,ou=users,ou=system
-objectClass: inetOrgPerson
-objectClass: organizationalPerson
-objectClass: person
-objectClass: top
-cn: Barbara Jensen
-sn: Jensen
-givenName: Barbara
-uid: bjensen
-
-# cn=\#\\\+\, \"öé\",ou=users,ou=system
-dn:: Y249XCNcXFwrXCwgXCLDtsOpXCIsb3U9dXNlcnMsb3U9c3lzdGVt
-objectClass: inetOrgPerson
-objectClass: organizationalPerson
-objectClass: person
-objectClass: top
-cn:: I1wrLCAiw7bDqSI=
-sn:: I1wrLCAiw7bDqSI=
-givenName:: I1wrLCAiw7bDqSI=
-uid:: I1wrLCAiw7bDqSI=
-
-dn: cn=\#123456,ou=users,ou=system
-objectClass: inetOrgPerson
-objectClass: organizationalPerson
-objectClass: person
-objectClass: top
-cn: #123456
-sn: #123456
-givenName: #123456
-uid: #123456
-