]> source.dussan.org Git - gitblit.git/commitdiff
Added LdapSyncServiceTest to GitBlitSuite. 05/5/2
authorAlfred Schmid <A.Schmid@ff-muenchen.de>
Fri, 21 Feb 2014 10:52:11 +0000 (11:52 +0100)
committerAlfred Schmid <A.Schmid@ff-muenchen.de>
Fri, 21 Feb 2014 10:52:11 +0000 (11:52 +0100)
src/test/java/com/gitblit/service/LdapSyncServiceTest.java [deleted file]
src/test/java/com/gitblit/tests/GitBlitSuite.java
src/test/java/com/gitblit/tests/LdapSyncServiceTest.java [new file with mode: 0644]

diff --git a/src/test/java/com/gitblit/service/LdapSyncServiceTest.java b/src/test/java/com/gitblit/service/LdapSyncServiceTest.java
deleted file mode 100644 (file)
index 434043c..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*\r
- * Copyright 2014 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.service;\r
-\r
-import static org.junit.Assert.assertFalse;\r
-import static org.junit.Assert.assertTrue;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-\r
-import com.gitblit.Keys;\r
-import com.gitblit.tests.mock.MemorySettings;\r
-\r
-/**\r
- * A behavior driven test for the LdapSyncService with in-memory Settings.\r
- *\r
- * @author Alfred Schmid\r
- *\r
- */\r
-public class LdapSyncServiceTest {\r
-\r
-       private MemorySettings settings;\r
-\r
-       @Before\r
-       public void init() throws Exception {\r
-               settings = getSettings();\r
-       }\r
-\r
-       @Test\r
-       public void defaultOfUnAvailableLdapSynchronizeKeyIsLdapServiceNotReady() {\r
-               LdapSyncService ldapSyncService = new LdapSyncService(settings, null);\r
-               assertFalse("When key " + Keys.realm.ldap.synchronize + " is not configured ldap sync is not ready." , ldapSyncService.isReady());\r
-       }\r
-\r
-       @Test\r
-       public void whenLdapSynchronizeKeyIsFalseLdapServiceNotReady() {\r
-               LdapSyncService ldapSyncService = new LdapSyncService(settings, null);\r
-               settings.put(Keys.realm.ldap.synchronize, "false");\r
-               assertFalse("When key " + Keys.realm.ldap.synchronize + " is configured with value false ldap sync is not ready." , ldapSyncService.isReady());\r
-       }\r
-\r
-       @Test\r
-       public void whenLdapSynchronizeKeyIsTrueLdapServiceIsReady() {\r
-               LdapSyncService ldapSyncService = new LdapSyncService(settings, null);\r
-               settings.put(Keys.realm.ldap.synchronize, "true");\r
-               assertTrue("When key " + Keys.realm.ldap.synchronize + " is configured with value true ldap sync is not ready." , ldapSyncService.isReady());\r
-       }\r
-\r
-       private MemorySettings getSettings() {\r
-               Map<String, Object> backingMap = new HashMap<String, Object>();\r
-               MemorySettings ms = new MemorySettings(backingMap);\r
-               return ms;\r
-       }\r
-\r
-}\r
index 7b38c18351d060550dfd17f7a9a95403a775f50e..9fe7312c066dd83d837c83f01d31de70199f9259 100644 (file)
@@ -63,7 +63,7 @@ import com.gitblit.utils.JGitUtils;
                GitBlitTest.class, FederationTests.class, RpcTests.class, GitServletTest.class, GitDaemonTest.class,\r
                GroovyScriptTest.class, LuceneExecutorTest.class, RepositoryModelTest.class,\r
                FanoutServiceTest.class, Issue0259Test.class, Issue0271Test.class, HtpasswdAuthenticationTest.class,\r
-               ModelUtilsTest.class, JnaUtilsTest.class })\r
+               ModelUtilsTest.class, JnaUtilsTest.class, LdapSyncServiceTest.class })\r
 public class GitBlitSuite {\r
 \r
        public static final File BASEFOLDER = new File("data");\r
diff --git a/src/test/java/com/gitblit/tests/LdapSyncServiceTest.java b/src/test/java/com/gitblit/tests/LdapSyncServiceTest.java
new file mode 100644 (file)
index 0000000..eda0903
--- /dev/null
@@ -0,0 +1,72 @@
+/*\r
+ * Copyright 2014 gitblit.com.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package com.gitblit.tests;\r
+\r
+import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertTrue;\r
+\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.gitblit.Keys;\r
+import com.gitblit.service.LdapSyncService;\r
+import com.gitblit.tests.mock.MemorySettings;\r
+\r
+/**\r
+ * A behavior driven test for the LdapSyncService with in-memory Settings.\r
+ *\r
+ * @author Alfred Schmid\r
+ *\r
+ */\r
+public class LdapSyncServiceTest {\r
+\r
+       private MemorySettings settings;\r
+\r
+       @Before\r
+       public void init() throws Exception {\r
+               settings = getSettings();\r
+       }\r
+\r
+       @Test\r
+       public void defaultOfUnAvailableLdapSynchronizeKeyIsLdapServiceNotReady() {\r
+               LdapSyncService ldapSyncService = new LdapSyncService(settings, null);\r
+               assertFalse("When key " + Keys.realm.ldap.synchronize + " is not configured ldap sync is not ready." , ldapSyncService.isReady());\r
+       }\r
+\r
+       @Test\r
+       public void whenLdapSynchronizeKeyIsFalseLdapServiceNotReady() {\r
+               LdapSyncService ldapSyncService = new LdapSyncService(settings, null);\r
+               settings.put(Keys.realm.ldap.synchronize, "false");\r
+               assertFalse("When key " + Keys.realm.ldap.synchronize + " is configured with value false ldap sync is not ready." , ldapSyncService.isReady());\r
+       }\r
+\r
+       @Test\r
+       public void whenLdapSynchronizeKeyIsTrueLdapServiceIsReady() {\r
+               LdapSyncService ldapSyncService = new LdapSyncService(settings, null);\r
+               settings.put(Keys.realm.ldap.synchronize, "true");\r
+               assertTrue("When key " + Keys.realm.ldap.synchronize + " is configured with value true ldap sync is not ready." , ldapSyncService.isReady());\r
+       }\r
+\r
+       private MemorySettings getSettings() {\r
+               Map<String, Object> backingMap = new HashMap<String, Object>();\r
+               MemorySettings ms = new MemorySettings(backingMap);\r
+               return ms;\r
+       }\r
+\r
+}\r