From cacf8bff097fbb66a7be1bfe267b5da2605145f8 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 18 Nov 2013 22:31:37 -0500 Subject: Use Dagger to inject managers into all filters and servlets Change-Id: I9bb2cc0cbfac9841b13bed15a474fefb24355cd4 --- .../java/com/gitblit/tests/GitDaemonStopTest.java | 32 ---------------------- .../java/com/gitblit/tests/LuceneExecutorTest.java | 11 ++++---- .../com/gitblit/tests/mock/MemorySettings.java | 9 ++++-- 3 files changed, 13 insertions(+), 39 deletions(-) delete mode 100644 src/test/java/com/gitblit/tests/GitDaemonStopTest.java (limited to 'src/test') 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 map = new HashMap(); - 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 backingMap; + public MemorySettings() { + this(new HashMap()); + } + public MemorySettings(Map 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 -- cgit v1.2.3