private void StartConsole() { inputLinesBuffer = new BlockingCollection <string>(); proxy = new ConsoleProxy(this); var controller = MainActivity.Service?.Controller; if (controller == null) { appendText("Cannot initialize console: the controller is not running. Please start the service and try again.\n", Color.Red); return; } consoleHub = new ConsoleHub(); Commands.AddCommands(consoleHub.CommandHub, controller, "", new[] { "all" }); new System.Threading.Thread(() => { try { consoleHub.CommandHub.CmdLoop(proxy); } catch (System.Exception e) { Logging.exception(e, Logging.Level.Warning, "ConsoleCmdLoop thread"); } }) { Name = "ConsoleCmdLoop" }.Start(); }
public override bool Reloading(object oldInstance) { base.Reloading(oldInstance); if (oldInstance is WebConAdapter old) { consoleHub = old.consoleHub; } return(false); }
protected override void OnStart() { base.OnStart(); if (passwd.IsNullOrEmpty() && no_passwd == false) { Logger.warning("'passwd' is null or empty while 'no_passwd' is false!"); } if (consoleHub == null) { consoleHub = new ConsoleHub(); var cmdHub = consoleHub.CommandHub; Commands.AddCommands(cmdHub, Controller, "", cmds.ToArray()); } }
public ConsoleSignalRController(ConsoleHub consoleHub) { _consoleHub = consoleHub; }
public MinecraftService(ConsoleHub ch, IBackupService bs) { _consoleHub = ch; _backupService = bs; }
public void RunProduction(int uniqueSimNum, int orderQuantity, ModelSize resourceModelSize, ModelSize setupModelSize, ModelSize operatorModelSize, int numberOfWorkers, bool secondResource) { LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Info, LogLevel.Info); LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Debug, LogLevel.Debug); _testOutputHelper.WriteLine("DatabaseString: " + _contextDataBase.ConnectionString.Value); _testOutputHelper.WriteLine("ResultDatabaseString: " + _resultContextDataBase.ConnectionString.Value); //Handle this one in our Resource Model? MasterDBInitializerTruck.DbInitialize(_contextDataBase.DbContext, resourceModelSize, setupModelSize, operatorModelSize, numberOfWorkers, secondResource); _testOutputHelper.WriteLine("MasterDBInitialized finished"); ResultDBInitializerBasic.DbInitialize(_resultContextDataBase.DbContext); _testOutputHelper.WriteLine("ResultDBInitializerBasic finished"); var messageHub = new ConsoleHub(); var simContext = new AgentSimulation(DBContext: _contextDataBase.DbContext, messageHub: messageHub); var simConfig = ArgumentConverter.ConfigurationConverter(_resultContextDataBase.DbContext, 1); _testOutputHelper.WriteLine("ArgumentConverter finished"); simConfig.ReplaceOption(new DBConnectionString(_resultContextDataBase.ConnectionString.Value)); simConfig.ReplaceOption(new TimeToAdvance(new TimeSpan(0L))); simConfig.ReplaceOption(new KpiTimeSpan(240)); simConfig.ReplaceOption(new DebugAgents(true)); simConfig.ReplaceOption(new MinDeliveryTime(1440)); simConfig.ReplaceOption(new MaxDeliveryTime(2880)); simConfig.ReplaceOption(new TransitionFactor(3)); simConfig.ReplaceOption(new SimulationKind(value: SimulationType.Default)); simConfig.ReplaceOption(new OrderArrivalRate(value: 0.15)); simConfig.ReplaceOption(new OrderQuantity(value: orderQuantity)); simConfig.ReplaceOption(new EstimatedThroughPut(value: 1920)); simConfig.ReplaceOption(new TimePeriodForThroughputCalculation(value: 2880)); simConfig.ReplaceOption(new Seed(value: 1337)); simConfig.ReplaceOption(new SettlingStart(value: 0)); simConfig.ReplaceOption(new SimulationEnd(value: 4380)); simConfig.ReplaceOption(new SaveToDB(value: true)); simConfig.ReplaceOption(new MaxBucketSize(value: 480)); simConfig.ReplaceOption(new SimulationNumber(value: uniqueSimNum)); simConfig.ReplaceOption(new DebugSystem(value: true)); simConfig.ReplaceOption(new WorkTimeDeviation(0.0)); simConfig.ReplaceOption(new TimeConstraintQueueLength(480)); var simulation = simContext.InitializeSimulation(configuration: simConfig).Result; _testOutputHelper.WriteLine("simContext.InitializeSimulation finished"); var sim = simulation.RunAsync(); _testOutputHelper.WriteLine("simulation.RunAsync() finished"); Within(TimeSpan.FromSeconds(120), async() => { simContext.StateManager.ContinueExecution(simulation); await sim; }).Wait(); var processedOrders = _resultContextDataBase.DbContext.Kpis .Single(x => x.IsFinal.Equals(true) && x.Name.Equals("OrderProcessed")).Value; Assert.Equal(orderQuantity, processedOrders); Assert.False(AnyOverlappingTaskItemsExistsOnOneMachine()); foreach (var obj in messageHub.Logs) { dynamic guardChildCounter = JsonConvert.DeserializeObject(obj); Assert.Equal(0, int.Parse(guardChildCounter[1].Value)); } _contextDataBase.DbContext.Dispose(); _resultContextDataBase.DbContext.Dispose(); }