Update Installer.UI and tests to use the new IServerInterface

This commit is contained in:
Cyberboss
2017-12-08 13:12:18 -05:00
parent e58f09eef4
commit 4d5b4735fb
3 changed files with 9 additions and 10 deletions
+6 -6
View File
@@ -79,7 +79,7 @@ namespace TGS.Installer.UI
var verifiedConnection = Interface.ConnectionStatus().HasFlag(ConnectivityLevel.Administrator);
try
{
var realVersion = Interface.ServerVersion;
var realVersion = Interface.Server.Version;
var isV0 = realVersion < new Version(3, 1, 0, 0);
if (isV0) //OH GOD!!!!
MessageBox.Show("Upgrading from version 3.0 may trigger a bug that can delete /config and /data. IT IS STRONGLY RECCOMMENDED THAT YOU BACKUP THESE FOLDERS BEFORE UPDATING!", "Warning");
@@ -106,7 +106,7 @@ namespace TGS.Installer.UI
var connectionVerified = Interface.ConnectionStatus().HasFlag(ConnectivityLevel.Administrator);
try
{
Interface.GetServiceComponent<ITGSService>().PrepareForUpdate();
Interface.Server.Management.PrepareForUpdate();
Thread.Sleep(3000); //chat messages
return true;
}
@@ -194,18 +194,18 @@ namespace TGS.Installer.UI
var sc = new ServerConfig();
try
{
sc.PythonPath = Interface.GetServiceComponent<ITGSService>().PythonPath();
sc.PythonPath = Interface.Server.Management.PythonPath();
}
catch { }
try
{
sc.RemoteAccessPort = Interface.GetServiceComponent<ITGSService>().RemoteAccessPort();
sc.RemoteAccessPort = Interface.Server.Management.RemoteAccessPort();
}
catch { }
try
{
foreach (var I in Interface.GetServiceComponent<ITGLanding>().ListInstances())
sc.InstancePaths.Add(I.Path);
foreach (var I in Interface.Server.Instances)
sc.InstancePaths.Add(I.Metadata.Path);
}
catch { }
@@ -21,7 +21,7 @@ namespace TGS.CommandLine.Commands.Repository.Tests
var ran = false;
var repo = new Mock<ITGRepository>();
repo.Setup(foo => foo.SetPushTestmergeCommits(true)).Callback(() => { ran = true; });
ConsoleCommand.Server = MockInterfaceToRepo(repo.Object);
ConsoleCommand.Instance = MockInterfaceToRepo(repo.Object);
Assert.AreEqual(new RepoSetPushTestmergeCommitsCommand().DoRun(new List<string> { "on" }), Command.ExitCode.Normal);
Assert.IsTrue(ran);
}
@@ -36,7 +36,7 @@ namespace TGS.CommandLine.Commands.Repository.Tests
var ran = false;
var repo = new Mock<ITGRepository>();
repo.Setup(foo => foo.SetPushTestmergeCommits(false)).Callback(() => { ran = true; });
ConsoleCommand.Server = MockInterfaceToRepo(repo.Object);
ConsoleCommand.Instance = MockInterfaceToRepo(repo.Object);
Assert.AreEqual(new RepoSetPushTestmergeCommitsCommand().DoRun(new List<string> { "off" }), Command.ExitCode.Normal);
Assert.IsTrue(ran);
}
@@ -20,8 +20,7 @@ namespace TGS.ControlPanel.Tests
{
var mockLanding = new Mock<ITGLanding>();
mockLanding.Setup(x => x.ListInstances()).Returns(new List<InstanceMetadata>());
var mockInter = new Mock<IServerInterface>();
mockInter.Setup(x => x.GetComponent<ITGLanding>()).Returns(mockLanding.Object);
var mockInter = new Mock<IServer>();
new InstanceSelector(mockInter.Object).Dispose();
}