mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Enable the BuiltInServer for tests
It is needed for Git tests. For Cucumber tests we could stay with the previous implementation, since they are run after all other tests on our build server; but it is not acceptable for JUnits. The alternative to start/stop before/after each test is also unacceptable slow down. Remove the test startup instruction from GitCucumberWorld. Move default server port setting to a utility function.
This commit is contained in:
@@ -37,7 +37,7 @@ public class BuiltInServerManagerImpl extends BuiltInServerManager {
|
||||
|
||||
@Nullable
|
||||
private BuiltInServer server;
|
||||
private boolean myEnabledInUnitTestMode;
|
||||
private boolean myEnabledInUnitTestMode = true;
|
||||
|
||||
@Override
|
||||
public int getPort() {
|
||||
|
||||
@@ -31,8 +31,6 @@ import git4idea.test.GitExecutor;
|
||||
import git4idea.test.GitTestUtil;
|
||||
import git4idea.test.TestNotificator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.ide.BuiltInServerManager;
|
||||
import org.jetbrains.ide.BuiltInServerManagerImpl;
|
||||
import org.junit.Assert;
|
||||
import org.picocontainer.MutablePicoContainer;
|
||||
|
||||
@@ -139,9 +137,8 @@ public class GitCucumberWorld {
|
||||
@Before("@remote")
|
||||
@Order(1)
|
||||
public void setUpRemoteOperations() {
|
||||
((BuiltInServerManagerImpl)BuiltInServerManager.getInstance()).setEnabledInUnitTestMode(true);
|
||||
// default port will be occupied by main idea instance => define the custom default to avoid searching of free port
|
||||
System.setProperty(BuiltInServerManagerImpl.PROPERTY_RPC_PORT, "64463");
|
||||
GitTestUtil.setDefaultBuiltInServerPort();
|
||||
myHttpAuthService = (GitHttpAuthTestService)ServiceManager.getService(GitHttpAuthService.class);
|
||||
}
|
||||
|
||||
@@ -156,7 +153,6 @@ public class GitCucumberWorld {
|
||||
@After("@remote")
|
||||
@Order(1)
|
||||
public void tearDownRemoteOperations() {
|
||||
((BuiltInServerManagerImpl)BuiltInServerManager.getInstance()).setEnabledInUnitTestMode(false);
|
||||
}
|
||||
|
||||
@After
|
||||
|
||||
@@ -29,6 +29,7 @@ import git4idea.repo.GitRepository;
|
||||
import junit.framework.Assert;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.ide.BuiltInServerManagerImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
@@ -127,4 +128,7 @@ public class GitTestUtil {
|
||||
Assert.assertEquals("Notification has wrong content", expected.getContent(), actualNotification.getContent());
|
||||
}
|
||||
|
||||
public static void setDefaultBuiltInServerPort() {
|
||||
System.setProperty(BuiltInServerManagerImpl.PROPERTY_RPC_PORT, "64463");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user