Move EventRecorder setup to AbstractDaemonTest

So it can also be used by other tests.

Change-Id: Ieb6d1f08e403fefcf8ab73f700581fa00df80c6b
This commit is contained in:
David Pursehouse
2016-06-16 14:14:27 +09:00
parent d66154ca48
commit 0fd4b3a2c0
2 changed files with 16 additions and 12 deletions

View File

@@ -93,7 +93,9 @@ import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.Transport;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
@@ -202,6 +204,9 @@ public abstract class AbstractDaemonTest {
@Inject
protected ChangeResource.Factory changeResourceFactory;
@Inject
private EventRecorder.Factory eventRecorderFactory;
protected TestRepository<InMemoryRepository> testRepo;
protected GerritServer server;
protected TestAccount admin;
@@ -212,6 +217,7 @@ public abstract class AbstractDaemonTest {
protected SshSession userSshSession;
protected ReviewDb db;
protected Project.NameKey project;
protected EventRecorder eventRecorder;
@Inject
protected TestNotesMigration notesMigration;
@@ -246,6 +252,16 @@ public abstract class AbstractDaemonTest {
@Rule
public TemporaryFolder tempSiteDir = new TemporaryFolder();
@Before
public void startEventRecorder() {
eventRecorder = eventRecorderFactory.create(user);
}
@After
public void closeEventRecorder() {
eventRecorder.close();
}
@AfterClass
public static void stopCommonServer() throws Exception {
if (commonServer != null) {