Example #1
0
        public void TestFixtureSetUp()
        {
            _hogController = new HeartOfGoldController
            {
                RuntimeDir       = HogHelper.RuntimeDir,
                ConfigDir        = HogHelper.ConfigDirParam,
                ExecutionTimeout = 120
            };

            Console.WriteLine("Starting HeartOfGold");

            var started = _hogController.StartApplication();

            _hogController.CreateClients();

            Assert.IsTrue(started, "Can't start HeartOfGold.");
            Assert.IsFalse(_hogController.Process.HasExited, "HeartOfGold has exited unexpectedly.");

            var result = _hogController.WaitForService(DependentTestModule.ModuleController.ModuleName, ServerModuleState.Running, 10);

            Assert.IsTrue(result, "Service 'TestModule' did not reach state 'Running'");

            var channelFactory = new ChannelFactory <IVersionService>(BindingFactory.CreateDefaultBasicHttpBinding(false, null));

            _versionService = channelFactory.CreateChannel(new EndpointAddress($"http://localhost:{_hogController.HttpPort}/ServiceVersions"));

            Assert.NotNull(_versionService, "Can't create VersionServiceClient");
        }
Example #2
0
        public void TestFixtureSetUp()
        {
            _hogController = new HeartOfGoldController
            {
                RuntimeDir       = HogHelper.RuntimeDir,
                ConfigDir        = HogHelper.ConfigDirParam,
                ExecutionTimeout = 120
            };

            Console.WriteLine("Starting HeartOfGold");

            var started = _hogController.StartApplication();

            _hogController.CreateClients();

            Assert.IsTrue(started, "Can't start HeartOfGold.");
            Assert.IsFalse(_hogController.Process.HasExited, "HeartOfGold has exited unexpectedly.");

            var result = _hogController.WaitForService(DependentTestModule.ModuleController.ModuleName, ServerModuleState.Running, 10);

            Assert.IsTrue(result, "Service 'TestModule' did not reach state 'Running'");

            _versionService = new VersionServiceManager(new ProxyConfig(), "localhost", _hogController.HttpPort);

            Assert.NotNull(_versionService, "Can't create VersionServiceClient");
        }
        public void Setup()
        {
            _databaseName        = GetType().Name;
            _databaseConfigModel = HeartOfGoldController.CreateDatabaseConfig("localhost", _databaseName, "postgres", "postgres");

            _hogController = new HeartOfGoldController
            {
                RuntimeDir       = HogHelper.RuntimeDir,
                ConfigDir        = HogHelper.ConfigDirParam,
                ExecutionTimeout = 60
            };

            _targetModel = typeof(TestModelContext).FullName;

            Console.WriteLine("Starting HeartOfGold");

            var started = _hogController.StartApplication();

            Assert.IsTrue(started, "Can't start HeartOfGold.");
            Assert.IsFalse(_hogController.Process.HasExited, "HeartOfGold has exited unexpectedly.");

            _hogController.CreateClients();

            var result = _hogController.WaitForService("Maintenance", ServerModuleState.Running, 10);

            Assert.IsTrue(result, "Service 'Maintenance' did not reach state 'Running'");

            if (_hogController.CheckDatabase(_databaseConfigModel, _targetModel).Result == TestConnectionResult.Success)
            {
                result = _hogController.DeleteDatabase(_databaseConfigModel, _targetModel);
                Assert.IsTrue(result, "Can't delete database '{0}' in Setup.", _databaseName);
            }
        }
Example #4
0
 public void Dispose()
 {
     if (_hogController != null)
     {
         _hogController.Dispose();
         _hogController = null;
     }
 }
 public void Setup()
 {
     _hogController = new HeartOfGoldController
     {
         RuntimeDir       = HogHelper.RuntimeDir,
         ConfigDir        = HogHelper.ConfigDirParam,
         ExecutionTimeout = 60
     };
 }
Example #6
0
        public void Dispose()
        {
            if (_hogController == null)
            {
                return;
            }

            _hogController.Dispose();
            _hogController = null;
        }
        public void TestFixtureSetUp()
        {
            Directory.CreateDirectory(HogHelper.ConfigDir);

            _configManager = new RuntimeConfigManager
            {
                ConfigDirectory = HogHelper.ConfigDir
            };

            _hogController = new HeartOfGoldController
            {
                RuntimeDir       = HogHelper.RuntimeDir,
                ConfigDir        = HogHelper.ConfigDirParam,
                ExecutionTimeout = 1000,
                TimerInterval    = 100
            };

            _hogController.LogMessagesReceived += HandleLogMessages;

            ModuleConfig config = new ModuleConfig
            {
                Config = new PortConfig(),

                SleepTime = ServerSleepTime,
                LogLevel  = LogLevel.Info
            };

            _configManager.SaveConfiguration(config);

            Console.WriteLine("Starting HeartOfGold");

            bool started = _hogController.StartApplication();

            _hogController.CreateClients();

            Assert.IsTrue(started, "Can't start HeartOfGold.");
            Assert.IsFalse(_hogController.Process.HasExited, "HeartOfGold has exited unexpectedly.");

            bool result = _hogController.WaitForService("TestModule", ServerModuleState.Running, 10);

            Assert.IsTrue(result, "Service 'TestModule' did not reach state 'Running'");

            _loggers = _hogController.GetAllLoggers();

            _testModuleLogger = _loggers.FirstOrDefault(l => l.Name == "TestModule");
            Assert.NotNull(_testModuleLogger, "Can't get logger configuration for TestModule");
        }
        public void TestFixtureSetUp()
        {
            _hogController = new HeartOfGoldController
            {
                RuntimeDir       = HogHelper.RuntimeDir,
                ConfigDir        = HogHelper.ConfigDirParam,
                ExecutionTimeout = 120
            };

            Console.WriteLine("Starting HeartOfGold");

            bool started = _hogController.StartApplication();

            _hogController.CreateClients();

            Assert.IsTrue(started, "Can't start HeartOfGold.");
            Assert.IsFalse(_hogController.Process.HasExited, "HeartOfGold has exited unexpectedly.");
        }
        public void TestFixtureSetUp()
        {
            _hogController = new HeartOfGoldController
            {
                RuntimeDir       = HogHelper.RuntimeDir,
                ConfigDir        = HogHelper.ConfigDirParam,
                ExecutionTimeout = 600
            };

            Console.WriteLine("Starting HeartOfGold");

            bool started = _hogController.StartApplication();

            _hogController.CreateClients();

            Assert.IsTrue(started, "Can't start application.");
            Assert.IsFalse(_hogController.Process.HasExited, "HeartOfGold has exited unexpectedly.");

            bool result = _hogController.WaitForService(ModuleController.ModuleName, ServerModuleState.Running, 10);

            Assert.IsTrue(result, "Service 'TestModule' did not reach state 'Running'");
        }
Example #10
0
        public void Setup()
        {
            Directory.CreateDirectory(HogHelper.ConfigDir);

            _configManager = new RuntimeConfigManager
            {
                ConfigDirectory = HogHelper.ConfigDir
            };

            _hogController = new HeartOfGoldController
            {
                RuntimeDir       = HogHelper.RuntimeDir,
                ConfigDir        = HogHelper.ConfigDirParam,
                ExecutionTimeout = 60
            };

            ModuleConfig config = new ModuleConfig
            {
                SleepTime = 0,

                Config = new PortConfig(),

                IntegerValue = OrgIntegerValue,
                DoubleValue  = OrgDoubleValue,
                StringValue  = OrgStringValue,
                LongValue    = OrgLongValue,
                BoolValue    = OrgBoolValue,
                EnumValue    = OrgEnumValue,
                TestPlugin   = new TestPluginConfig
                {
                    PluginBoolValue    = !OrgBoolValue,
                    PluginDoubleValue  = OrgDoubleValue * 100,
                    PluginIntegerValue = OrgIntegerValue * 100,
                    PluginLongValue    = OrgLongValue * 100,
                    PluginStringValue  = OrgStringValue + " asdf",
                    PluginEnumValue    = OrgEnumValue + 1
                },
                Plugins = new List <TestPluginConfig>
                {
                    new TestPluginConfig1
                    {
                        PluginBoolValue    = OrgBoolValue,
                        PluginDoubleValue  = OrgDoubleValue * 10,
                        PluginIntegerValue = OrgIntegerValue * 10,
                        PluginLongValue    = OrgLongValue * 10,
                        PluginStringValue  = OrgStringValue + " abc",
                        PluginEnumValue    = OrgEnumValue + 2
                    },
                    new TestPluginConfig2
                    {
                        PluginBoolValue    = !OrgBoolValue,
                        PluginDoubleValue  = OrgDoubleValue * -1,
                        PluginIntegerValue = OrgIntegerValue * -1,
                        PluginLongValue    = OrgLongValue * -1,
                        PluginStringValue  = OrgStringValue + " xyz",
                        PluginEnumValue    = OrgEnumValue + 3
                    }
                }
            };

            _configManager.SaveConfiguration(config);

            Console.WriteLine("Starting HeartOfGold");

            bool started = _hogController.StartApplication();

            Assert.IsTrue(started, "Can't start HeartOfGold.");
            Assert.IsFalse(_hogController.Process.HasExited, "HeartOfGold has exited unexpectedly.");

            _hogController.CreateClients();

            bool result = _hogController.WaitForService("TestModule", ServerModuleState.Running, 10);

            Assert.IsTrue(result, "Service 'TestModule' did not reach state 'Running'");
        }