summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2013-11-18 22:31:37 -0500
committerJames Moger <james.moger@gitblit.com>2013-11-29 11:05:46 -0500
commitcacf8bff097fbb66a7be1bfe267b5da2605145f8 (patch)
tree7096df41b5944c569b1db24203eae8dcfa26ba04 /src/test
parent79cad53bba094cffa1d25581edbf4972a5158cd4 (diff)
downloadgitblit-cacf8bff097fbb66a7be1bfe267b5da2605145f8.tar.gz
gitblit-cacf8bff097fbb66a7be1bfe267b5da2605145f8.zip
Use Dagger to inject managers into all filters and servlets
Change-Id: I9bb2cc0cbfac9841b13bed15a474fefb24355cd4
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/gitblit/tests/GitDaemonStopTest.java32
-rw-r--r--src/test/java/com/gitblit/tests/LuceneExecutorTest.java11
-rw-r--r--src/test/java/com/gitblit/tests/mock/MemorySettings.java9
3 files changed, 13 insertions, 39 deletions
diff --git a/src/test/java/com/gitblit/tests/GitDaemonStopTest.java b/src/test/java/com/gitblit/tests/GitDaemonStopTest.java
deleted file mode 100644
index 6e940cbe..00000000
--- a/src/test/java/com/gitblit/tests/GitDaemonStopTest.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2013 gitblit.com.
- *
- * Licensed 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 com.gitblit.tests;
-
-import org.junit.Test;
-
-import com.gitblit.git.GitDaemon;
-
-public class GitDaemonStopTest extends GitblitUnitTest {
-
- @Test
- public void testGitDaemonStop() throws Exception {
- GitDaemon daemon = new GitDaemon("localhost", GitDaemon.DEFAULT_PORT + 1, GitBlitSuite.REPOSITORIES);
- daemon.setTimeout(5);
- daemon.start();
- Thread.sleep(5000);
- daemon.stop();
- }
-}
diff --git a/src/test/java/com/gitblit/tests/LuceneExecutorTest.java b/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
index 0f7e55ca..0e1aee1e 100644
--- a/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
+++ b/src/test/java/com/gitblit/tests/LuceneExecutorTest.java
@@ -16,15 +16,15 @@
package com.gitblit.tests;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.eclipse.jgit.lib.Repository;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import com.gitblit.GitBlit;
+import com.gitblit.Keys;
import com.gitblit.LuceneExecutor;
import com.gitblit.models.RefModel;
import com.gitblit.models.RepositoryModel;
@@ -44,9 +44,10 @@ public class LuceneExecutorTest extends GitblitUnitTest {
LuceneExecutor lucene;
private LuceneExecutor newLuceneExecutor() {
- Map<String, Object> map = new HashMap<String, Object>();
- MemorySettings settings = new MemorySettings(map);
- return new LuceneExecutor(settings, GitBlitSuite.REPOSITORIES);
+ MemorySettings settings = new MemorySettings();
+ settings.put(Keys.git.repositoriesFolder, GitBlitSuite.REPOSITORIES);
+ GitBlit gitblit = new GitBlit(settings, GitBlitSuite.REPOSITORIES);
+ return new LuceneExecutor(settings, gitblit);
}
private RepositoryModel newRepositoryModel(Repository repository) {
diff --git a/src/test/java/com/gitblit/tests/mock/MemorySettings.java b/src/test/java/com/gitblit/tests/mock/MemorySettings.java
index 5b8e60a9..e3f971f0 100644
--- a/src/test/java/com/gitblit/tests/mock/MemorySettings.java
+++ b/src/test/java/com/gitblit/tests/mock/MemorySettings.java
@@ -16,6 +16,7 @@
*/
package com.gitblit.tests.mock;
+import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -25,6 +26,10 @@ public class MemorySettings extends IStoredSettings {
private Map<String, Object> backingMap;
+ public MemorySettings() {
+ this(new HashMap<String, Object>());
+ }
+
public MemorySettings(Map<String, Object> backingMap) {
super(MemorySettings.class);
this.backingMap = backingMap;
@@ -38,8 +43,8 @@ public class MemorySettings extends IStoredSettings {
return props;
}
- public void put(Object key, Object value) {
- backingMap.put(key.toString(), value);
+ public void put(String key, Object value) {
+ backingMap.put(key, value);
}
@Override