Exemplo n.º 1
0
 public void UnInit()
 {
     if (m_fResetSharedProjectValue)
     {
         Db4oServerInfo.AreProjectsShared_Internal = m_fResetSharedProjectValue;
     }
     RemotingServer.Stop();
 }
        public void StopFwRemoteDatabaseConnector()
        {
            RemotingServer.Stop();

            Directory.Delete(DirectoryFinder.ProjectsDirectory, true);
            DirectoryFinder.ProjectsDirectory = m_oldProjectDirectory;

            m_db4OServerInfo = null;
        }
        public void Server_Creating()
        {
            // Prepare
            RemotingServer server = this._Provider.GetRequiredService <RemotingServer>();

            // Pre-validate
            Assert.False(server.IsEnable());

            // Perform
            server.Start();

            // Post-validate
            Assert.True(server.IsEnable());

            server.Stop();
        }
Exemplo n.º 4
0
        public void RestoreProject_OverwriteOnlyDataRestored()
        {
            IThreadedProgress progressDlg = new DummyProgressDlg();

            m_restoreSettings.IncludeConfigurationSettings = false;

            RemoveAnyFilesAndFoldersCreatedByTests(m_restoreSettings);
            m_restoreProjectService = new ProjectRestoreService(m_restoreSettings);

            //Restore the project once and do not delete it so that we can restore the project over the previous one.
            m_restoreProjectService.RestoreProject(progressDlg);

            string restoreProjectDirectory = m_restoreSettings.ProjectPath;

            VerifyFileExists(restoreProjectDirectory, DirectoryFinder.GetXmlDataFileName("TestRestoreFWProject"));
            var dateTimeTicksOfFirstFile = GetLastWriteTimeOfRestoredFile(restoreProjectDirectory, DirectoryFinder.GetXmlDataFileName("TestRestoreFWProject"));

            // Linux filesystem modification time precision can be to the second, so wait a moment.
            if (MiscUtils.IsUnix)
            {
                Thread.Sleep(1000);
            }

            //Verify that the restoreProjectService indicates that the project already exists. The restoreProjectPresenter
            //can then inform the user that the project already exists on disk and gives them the chance to backup before
            //overwriting it.
            Assert.True(m_restoreSettings.ProjectExists, "Project does not exist but it should.");

            //Now do another restore then verify that the two files are not the same by comparing the LastWriteTime values.
            m_restoreProjectService.RestoreProject(progressDlg);

            var dateTimeTicksOfSecondFile = GetLastWriteTimeOfRestoredFile(restoreProjectDirectory, DirectoryFinder.GetXmlDataFileName("TestRestoreFWProject"));

            Assert.True(dateTimeTicksOfSecondFile.Equals(dateTimeTicksOfFirstFile), "The dates and times of the files should be the same since they are set to the timestamp of the file in the zip file.");

            VerifyManditoryFilesUnzippedAndDeleteThem();

            RemoveAnyFilesAndFoldersCreatedByTests(m_restoreSettings);
            RemotingServer.Stop();
        }
        public void Server_Client_Start_Stop()
        {
            int i = 0;

            while (i < 3)
            {
                // Prepare
                RemotingServer server = this._Provider.GetRequiredService <RemotingServer>();
                server.Start();
                IRemotingClient client = this._Provider.GetRequiredService <IRemotingClient>();

                // Pre-validate
                client.CheckBindings();


                // Perform
                client.Dispose();
                server.Stop();

                // Post-validate
                Assert.False(server.IsEnable());
            }
        }
        public void Server_Method_Invocation(int valueInt, string valueString, Unit unit)
        {
            EventHandler <Part> onDetect = (sender, e) => {
                Debug.WriteLine($"{e.GetType().ToString()} detected: {e}");
                Assert.NotNull(e);
            };

            RemotingServer server = this._Provider.GetRequiredService <RemotingServer>();

            server.Start();

            IRemotingClient client = this._Provider.GetRequiredService <IRemotingClient>();

            client.CheckBindings();

            IMyService service = this._Provider.GetRequiredService <IMyService>();

            service.OnSomeBDetect += onDetect;

            Assert.NotNull(service.Do(valueInt, valueString, unit));

            client.Dispose();
            server.Stop();
        }
Exemplo n.º 7
0
 public void UnInit()
 {
     RemotingServer.Stop();
 }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// If a test overrides this, it should call the base implementation.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public override void FixtureTeardown()
 {
     base.FixtureTeardown();
     RemotingServer.Stop();
 }
Exemplo n.º 9
0
        public void Run()
        {
            _Log.Info("AccountServer is starting");

            _Log.Info("Reading configuration");
            _ConfigTree.FromConfigFile("Config/AccountServer.cfg");

            _Log.Info("Connecting to database");
            _DatabaseConnection = new MySqlConnection(BuildConnectionString());

            try
            {
                _DatabaseConnection.Open();
            }
            catch (Exception ex)
            {
                _Log.Fatal("Error connecting to database!", ex);
                return;
            }

            _RemotingServer = new RemotingServer(_ConfigTree.Get("inter.uri", "net.tcp://localhost:5401/"));
            _RemotingServer.ExposeType<CharServerService>("CharServer", typeof(ICharServerService));
            _RemotingServer.Start();
            _Log.InfoFormat("Accepting CharServer connections at {0}", _RemotingServer.BaseUri);

            IPAddress bindAddress = IPAddress.Parse(_ConfigTree.Get("network.interface.ip", "0.0.0.0"));
            int bindPort = _ConfigTree.Get("network.interface.port", 5500);
            _Log.InfoFormat("Accepting connections at {0}:{1}", bindAddress, bindPort);
            _Listener.Bind(bindAddress, bindPort);
            _Listener.Listen();

            _Running = true;
            while (_Running)
                Thread.Yield();

            _RemotingServer.Stop();
        }
Exemplo n.º 10
0
 public void StopFwRemoteDatabaseConnector()
 {
     m_db4OServerInfo = null;
     RemotingServer.Stop();
 }