diff options
Diffstat (limited to 'sonar-testing-ldap/src/test')
5 files changed, 95 insertions, 0 deletions
diff --git a/sonar-testing-ldap/src/test/java/org/sonar/ldap/ApacheDSTest.java b/sonar-testing-ldap/src/test/java/org/sonar/ldap/ApacheDSTest.java new file mode 100644 index 00000000000..a193f7bb7e3 --- /dev/null +++ b/sonar-testing-ldap/src/test/java/org/sonar/ldap/ApacheDSTest.java @@ -0,0 +1,38 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.sonar.ldap; + +import org.junit.Test; + +public class ApacheDSTest { + + @Test + public void start_and_stop_apache_server() throws Exception { + ApacheDS apacheDS = ApacheDS.start("example.org", "dc=example,dc=org"); + apacheDS.importLdif(ApacheDS.class.getResourceAsStream("/init.ldif")); + apacheDS.importLdif(ApacheDS.class.getResourceAsStream("/change.ldif")); + apacheDS.importLdif(ApacheDS.class.getResourceAsStream("/delete.ldif")); + apacheDS.disableAnonymousAccess(); + apacheDS.enableAnonymousAccess(); + apacheDS.stop(); + } + +} diff --git a/sonar-testing-ldap/src/test/resources/change.ldif b/sonar-testing-ldap/src/test/resources/change.ldif new file mode 100644 index 00000000000..903ebc0e1f7 --- /dev/null +++ b/sonar-testing-ldap/src/test/resources/change.ldif @@ -0,0 +1,5 @@ +dn: cn=Evgeny Mandrikov,dc=example,dc=org +changetype: modify +replace: userpassword +userpassword: 54321 +- diff --git a/sonar-testing-ldap/src/test/resources/delete.ldif b/sonar-testing-ldap/src/test/resources/delete.ldif new file mode 100644 index 00000000000..586472648cd --- /dev/null +++ b/sonar-testing-ldap/src/test/resources/delete.ldif @@ -0,0 +1,2 @@ +dn: cn=Evgeny Mandrikov,dc=example,dc=org +changetype: delete diff --git a/sonar-testing-ldap/src/test/resources/init.ldif b/sonar-testing-ldap/src/test/resources/init.ldif new file mode 100644 index 00000000000..4c3ce81f0b4 --- /dev/null +++ b/sonar-testing-ldap/src/test/resources/init.ldif @@ -0,0 +1,9 @@ +dn: dc=example,dc=org +objectClass: domain +objectClass: top +dc: example + +dn: cn=Evgeny Mandrikov,dc=example,dc=org +objectClass: inetOrgPerson +cn: Evgeny Mandrikov +sn: Mandrikov diff --git a/sonar-testing-ldap/src/test/resources/logback-test.xml b/sonar-testing-ldap/src/test/resources/logback-test.xml new file mode 100644 index 00000000000..f0b4f642ca5 --- /dev/null +++ b/sonar-testing-ldap/src/test/resources/logback-test.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ SonarQube + ~ Copyright (C) 2009-2019 SonarSource SA + ~ mailto:info AT sonarsource DOT com + ~ + ~ This program is free software; you can redistribute it and/or + ~ modify it under the terms of the GNU Lesser General Public + ~ License as published by the Free Software Foundation; either + ~ version 3 of the License, or (at your option) any later version. + ~ + ~ This program is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + ~ Lesser General Public License for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public License + ~ along with this program; if not, write to the Free Software Foundation, + ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + --> + +<configuration> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern> + %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + </pattern> + </encoder> + </appender> + + <logger name="org.apache"> + <level value="ERROR"/> + </logger> + + <root> + <level value="INFO"/> + <appender-ref ref="STDOUT"/> + </root> + +</configuration> |