private void CopyWebStatsDB()
        {
            string dbFolder = Path.Combine(Environment.CurrentDirectory, "Experiments", mConfig.ExperimentName);
            string file     = "LocalUserStatistics.db";

            if (!mCopyDone)
            {
                mCopyDone = true;

                string local = dbFolder.Substring(2);
                //string remote = "/home/opensim/opensim-0.7.3.1/bin/LocalUserStatistics.db";
                string remote   = "/home/opensim/opensim-0.7.6.1/bin/" + file;
                string server   = "apollo.cs.st-andrews.ac.uk";
                string pass     = "******";
                string username = "******";

                ProcessController p = new ProcessController("cmd.exe", "C:\\Windows\\System32", "");

                p.Start();

                Thread.Sleep(500);

                p.PressKey("E:{ENTER}");
                p.SendString("scp " + username + "@" + server + ":" + remote + " " + local);
                p.PressKey("{ENTER}");
                p.SendString(pass);
                p.PressKey("{ENTER}");
                p.SendString(pass);
                p.PressKey("{ENTER}");

                p.Process.Close();

                Thread.Sleep(5000);
            }
        }
        public void CanProcessData()
        {
            var controller = new ProcessController();

            var model = new BillingProcessDataCommand
            {
                BillingCategory = BillingCategory.Tool | BillingCategory.Room | BillingCategory.Store,
                ClientID        = 81,
                Period          = DateTime.Parse("2019-02-01"),
                Record          = 0
            };

            var result = controller.BillingProcessData(model);

            //WriteToolDataProcessResult
            Assert.AreEqual(23, result.WriteToolDataProcessResult.RowsDeleted);
            Assert.AreEqual(23, result.WriteToolDataProcessResult.RowsExtracted);
            Assert.AreEqual(23, result.WriteToolDataProcessResult.RowsLoaded);
            Assert.AreEqual(20402, result.WriteToolDataProcessResult.RowsAdjusted);

            //WriteRoomDataProcessResult
            Assert.AreEqual(1, result.WriteRoomDataProcessResult.DistinctClientRows);
            Assert.AreEqual(9, result.WriteRoomDataProcessResult.RowsDeleted);
            Assert.AreEqual(6, result.WriteRoomDataProcessResult.RowsExtracted);
            Assert.AreEqual(9, result.WriteRoomDataProcessResult.RowsLoaded);
            Assert.AreEqual(8035, result.WriteRoomDataProcessResult.RowsAdjusted);
            Assert.AreEqual(0, result.WriteRoomDataProcessResult.BadEntryRowsDeleted);

            //WriteStoreDataProcessResult
            Assert.AreEqual(0, result.WriteStoreDataProcessResult.RowsDeleted);
            Assert.AreEqual(0, result.WriteStoreDataProcessResult.RowsExtracted);
            Assert.AreEqual(0, result.WriteStoreDataProcessResult.RowsLoaded);
        }
Beispiel #3
0
        public void OpenMoreLink(IDebugLineItem item)
        {
            if (item == null)
            {
                Dev2Logger.Log.Debug("Debug line item is null, did not proceed");
                return;
            }

            if (string.IsNullOrEmpty(item.MoreLink))
            {
                Dev2Logger.Log.Debug("Link is empty");
            }
            else
            {
                try
                {
                    string debugItemTempFilePath = FileHelper.GetDebugItemTempFilePath(item.MoreLink);
                    Dev2Logger.Log.Debug(string.Format("Debug file path is [{0}]", debugItemTempFilePath));
                    ProcessController = new ProcessController(Process.Start(new ProcessStartInfo(debugItemTempFilePath)));
                }
                catch (Exception ex)
                {
                    Dev2Logger.Log.Error(ex);
                    throw;
                }
            }
        }
Beispiel #4
0
        public async Task <object> IsProcessRunning(dynamic input)
        {
            string            processName = (string)input.processName;
            ProcessController process     = new ProcessController(processName);

            return(process.IsAnyProcessRunning());
        }
        public bool Launch()
        {
            StartServer();
            string windowPosition = "";


            if (mConfig.Fill != Chimera.Fill.Windowed)
            {
                windowPosition += " -WinX=" + mFrame.Monitor.Bounds.X;
                windowPosition += " -WinY=" + mFrame.Monitor.Bounds.Y;
                if (mConfig.Fill == Chimera.Fill.Full)
                {
                    windowPosition += " -ResX=" + mFrame.Monitor.Bounds.Width;
                    windowPosition += " -ResY=" + mFrame.Monitor.Bounds.Height;
                }
                else if (mConfig.Fill == Chimera.Fill.Left || mConfig.Fill == Chimera.Fill.Right)
                {
                    Rectangle position = mFrame.Monitor.Bounds;
                    position.Width /= 2;
                    if (mConfig.Fill == Chimera.Fill.Right)
                    {
                        position.X += position.Width;
                    }
                    windowPosition += " -ResX=" + position.Width;
                    windowPosition += " -ResY=" + position.Height;
                }
            }


            mProcess = new ProcessController(mConfig.UnrealExecutable, mConfig.UnrealWorkingDirectory, mConfig.UnrealArguments + windowPosition);
            mProcess.Start();

            return(false);
        }
 public ProcessControllerFacts()
 {
     _tracerMock      = new Mock <ITracer>(MockBehavior.Strict);
     _environmentMock = new Mock <IEnvironment>(MockBehavior.Strict);
     _deploymentSettingsManagerMock = new Mock <IDeploymentSettingsManager>(MockBehavior.Strict);
     _controller = new ProcessController(_tracerMock.Object, _environmentMock.Object, _deploymentSettingsManagerMock.Object);
 }
 public ProcessControllerFacts()
 {
     _tracerMock = new Mock<ITracer>(MockBehavior.Strict);
     _environmentMock = new Mock<IEnvironment>(MockBehavior.Strict);
     _deploymentSettingsManagerMock = new Mock<IDeploymentSettingsManager>(MockBehavior.Strict);
     _controller = new ProcessController(_tracerMock.Object, _environmentMock.Object, _deploymentSettingsManagerMock.Object);
 }
Beispiel #8
0
        protected override void Load(ContainerBuilder builder)
        {
            if (!_process.Enabled)
            {
                return;
            }

            builder.Register <IProcessController>(ctx => {
                var pipelines = new List <IPipeline>();

                // entity-level pipelines
                foreach (var entity in _process.Entities)
                {
                    var pipeline = ctx.ResolveNamed <IPipeline>(entity.Key);

                    pipelines.Add(pipeline);
                    if (entity.Delete && _process.Mode != "init")
                    {
                        pipeline.Register(ctx.ResolveNamed <IEntityDeleteHandler>(entity.Key));
                    }
                }

                // process-level pipeline
                pipelines.Add(ctx.ResolveNamed <IPipeline>(_process.Name));

                var context = new PipelineContext(ctx.Resolve <IPipelineLogger>(), _process);

                var controller = new ProcessController(pipelines, context);

                return(controller);
            }).Named <IProcessController>(_process.Name);
        }
Beispiel #9
0
        public void TestPostProcess()
        {
            // seeding DB
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                DbContextSeeder.SeedFull(context);
            }

            // db is Test-Ready
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                var dbm       = new DatabaseQueryManager(context);
                var converter = new ResourceDTOConverter(dbm);

                var controller = new ProcessController(context, converter, dbm);

                var dtos     = DbContextSeeder.GetSeededProcessDTOs(4).ToList();
                var expected = DbContextSeeder.GetSeededProcesses(4).ToList();
                //dtos[3].Abbreviation = "test";
                //dtos[3].Description = "test";

                var actual = controller.PostProcess(dtos[3]);

                actual.Should().BeEquivalentTo(dtos[3]);

                var actualCount = context.Process.ToList().Count;
                Assert.Equal(4, actualCount);

                context.Process.FirstOrDefault(x => x.ProcessID == 4).Should().BeEquivalentTo(expected[3]);
            }
        }
        public ActionResult Edit(CalendarVisitDrugStoreViewModel model)
        {
            var urlRefer = Request["UrlReferrer"];

            if (ModelState.IsValid)
            {
                if (Request["Submit"] == "Save")
                {
                    var CalendarVisitDrugStore = CalendarVisitDrugStoreRepository.GetCalendarVisitDrugStoreById(model.Id);
                    AutoMapper.Mapper.Map(model, CalendarVisitDrugStore);
                    CalendarVisitDrugStore.ModifiedUserId = WebSecurity.CurrentUserId;
                    CalendarVisitDrugStore.ModifiedDate   = DateTime.Now;
                    CalendarVisitDrugStoreRepository.UpdateCalendarVisitDrugStore(CalendarVisitDrugStore);

                    TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess;

                    var task = CalendarVisitDrugStoreRepository.GetvwCalendarVisitDrugStoreById(CalendarVisitDrugStore.Id);
                    ProcessController.Run("CalendarVisitDrugStore"
                                          , "Edit"
                                          , task.Id
                                          , null
                                          , null
                                          , task
                                          , task.DrugStoreId.Value.ToString());

                    if (Request["IsPopup"] == "true" || Request["IsPopup"] == "True")
                    {
                        return(RedirectToAction("_ClosePopup", "Home", new { area = "", FunctionCallback = "ClosePopupAndReloadPage" }));
                    }
                    return(Redirect(urlRefer));
                }
                return(View(model));
            }
            return(View(model));
        }
Beispiel #11
0
        public MainWindowViewModel()
        {
            DARPResults       = null;
            ILSEvolution      = null;
            AlgorithmSummary  = null;
            ChartsViewModel   = null;
            VNSOperators      = null;
            ProblemsInput     = null;
            SolutionsData     = null;
            DARPProblems      = new List <string>();
            DARPSelected      = null;
            HeuristicExecuted = false;
            TabSelected       = 0;

            //Inicializate Commands
            LoadInput       = commands.AddAsyncCommand(ExecuteLoadProblems, CanExecuteLoadProblems);
            SettingsCommand = commands.AddCommand(ExecuteOpenSettings, CanExecuteOpenSettings);
            RunHeuristic    = commands.AddAsyncCommand(ExecuteRunHeuristic, CanExecuteRunHeuristic);
            ExportCSV       = commands.AddAsyncCommand(ExecuteExportCSV, CanExecuteExportCSV);

            //Load Settings
            Context.Instance.Settings = DARP.Settings.CheckDeserializeSettings(LoadLasSettings());

            //Inicializate controllers.
            var controllers = ViewModelControllers.Instance;

            windowController  = controllers.WindowController;
            processController = ProcessController.Instance;
            splashController  = controllers.SplashController;
        }
Beispiel #12
0
        private bool SetupCommunication(ProcessController rtu)
        {
            bool retval = false;


            switch (rtu.TransportHandler)
            {
            case TransportHandler.TCP:

                // na osnovu ovoga on sad zna u factoryju da pravi sta treba konkretno za Tcp...
                CommunicationManager.CurrentTransportHndl = TransportHandler.TCP;

                CommunicationParameters commPar = new CommunicationParameters(rtu.HostName, rtu.HostPort);
                var commObj = CommunicationManager.Factory.CreateNew(commPar);

                if (commObj.Setup())
                {
                    CommunicationManager.CommunicationObjects.TryAdd(rtu.Name, commObj);
                    retval = true;
                }

                break;

            default:
                // not implemented yet
                break;
            }
            return(retval);
        }
Beispiel #13
0
        internal void DumpAllResources()
        {
            List <string> otherResourcesList =
                (from s in SMAddon.SmVessel.PartsByResource.Keys
                 where SMConditions.TypeOfResource(s) == SMConditions.ResourceType.Pump
                 select s).ToList();
            uint pumpId = TransferPump.GetPumpIdFromHash(string.Join("", otherResourcesList.ToArray()),
                                                         SMAddon.SmVessel.Vessel.parts.First(), SMAddon.SmVessel.Vessel.parts.Last(), TransferPump.TypePump.Dump,
                                                         TransferPump.TriggerButton.Preflight);
            List <TransferPump> pumpList =
                otherResourcesList.Select(
                    resource =>
                    new TransferPump(resource, TransferPump.TypePump.Dump, TransferPump.TriggerButton.Preflight,
                                     TransferPump.CalcRemainingResource(SMAddon.SmVessel.PartsByResource[resource], resource))
            {
                FromParts = SMAddon.SmVessel.PartsByResource[resource],
                PumpId    = pumpId
            }).ToList();

            if (!TransferPump.PumpsInProgress(pumpId).Any())
            {
                SMAddon.SmVessel.TransferPumps.AddRange(pumpList);
                ProcessController.DumpResources(SMAddon.SmVessel.TransferPumps);
            }
            else
            {
                TransferPump.AbortAllPumpsInProcess(pumpId);
            }
        }
Beispiel #14
0
        public async Task activities_controller_post_should_return_accepted()
        {
            var busClientMock = new Mock <IBusClient>();
            var controller    = new ProcessController(busClientMock.Object);
            var userId        = Guid.NewGuid();

            controller.ControllerContext = new ControllerContext
            {
                HttpContext = new DefaultHttpContext
                {
                    User = new ClaimsPrincipal(new ClaimsIdentity(new Claim[]
                    {
                        new Claim(ClaimTypes.Name, userId.ToString())
                    }, "test"))
                }
            };

            var command = new ProcessPayment
            {
                UserId = userId
            };

            var result = await controller.Post(command);

            var contentResult = result as AcceptedResult;

            contentResult.Should().NotBeNull();
            contentResult.Location.Should().StartWith($"processes/");
        }
Beispiel #15
0
        public void TestDeleteProcess()
        {
            // seeding DB
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                DbContextSeeder.SeedFull(context);
            }

            // db is Test-Ready
            using (var context = new ProTickDatabaseContext(dbOptions))
            {
                var dbm       = new DatabaseQueryManager(context);
                var converter = new ResourceDTOConverter(dbm);

                var controller = new ProcessController(context, converter, dbm);

                var dtos = DbContextSeeder.GetSeededProcessDTOs(
                    3
                    )
                           .ToList();

                controller.DeleteProcess(dtos[2].ProcessID);

                var actualCount = context.Process.ToList().Count;
                Assert.Equal(2, actualCount);
                Assert.True(context.Process.FirstOrDefault(x => x.ProcessID == 3) == null);
                Assert.True(context.Process.FirstOrDefault(x => x.ProcessID != 3) != null);

                controller.DeleteProcess(dtos[1].ProcessID);

                actualCount = context.Process.ToList().Count;
                Assert.Equal(1, actualCount);
                Assert.True(context.Process.FirstOrDefault(x => x.ProcessID == 2) == null);
            }
        }
Beispiel #16
0
        public void OpenMoreLink(IDebugLineItem item)
        {
            if (item == null)
            {
                Dev2Logger.Log.Debug("Debug line item is null, did not proceed");
                return;
            }

            if (string.IsNullOrEmpty(item.MoreLink))
            {
                Dev2Logger.Log.Debug("Link is empty");
            }
            else
            {
                try
                {
                    string debugItemTempFilePath = FileHelper.GetDebugItemTempFilePath(item.MoreLink);
                    Dev2Logger.Log.Debug(string.Format("Debug file path is [{0}]", debugItemTempFilePath));
                    ProcessController = new ProcessController(Process.Start(new ProcessStartInfo(debugItemTempFilePath)));
                }
                catch (Exception ex)
                {
                    Dev2Logger.Log.Error(ex);
                    if (ex.Message.Contains("The remote name could not be resolved"))
                    {
                        _popup.Show("Warewolf was unable to download the debug output values from the remote server. Please insure that the remote server is accessible.", "Failed to retrieve remote debug items", MessageBoxButton.OK, MessageBoxImage.Error, "");
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }
        protected override void RegisterProcess(ContainerBuilder builder, Process original) {

            builder.Register<IProcessController>(ctx => {

                var pipelines = new List<IPipeline>();
                var deleteHandlers = new List<IEntityDeleteHandler>();

                // entity-level pipelines
                foreach (var entity in original.Entities) {
                    pipelines.Add(ctx.ResolveNamed<IPipeline>(entity.Key));
                    if (entity.Delete) {
                        deleteHandlers.Add(ctx.ResolveNamed<IEntityDeleteHandler>(entity.Key));
                    }
                }

                // process-level pipeline
                pipelines.Add(ctx.ResolveNamed<IPipeline>(original.Key));

                var outputProvider = original.Connections.First(c => c.Name == "output").Provider;
                var context = new PipelineContext(ctx.Resolve<IPipelineLogger>(), original);

                var controller = new ProcessController(pipelines, deleteHandlers);

                if (original.Mode == "init") {
                    switch (outputProvider) {
                        case "sqlserver":
                            var output = new OutputContext(context, new Incrementer(context));
                            controller.PreActions.Add(new SqlInitializer(output));
                            controller.PostActions.Add(new SqlStarViewCreator(output));
                            break;
                    }
                }

                // templates
                foreach (var template in original.Templates.Where(t => t.Enabled)) {
                    controller.PreActions.Add(new RenderTemplateAction(template, ctx.ResolveNamed<ITemplateEngine>(template.Key)));
                    foreach (var action in template.Actions.Where(a => a.GetModes().Any(m => m == original.Mode))) {
                        if (action.Before) {
                            controller.PreActions.Add(ctx.ResolveNamed<IAction>(action.Key));
                        }
                        if (action.After) {
                            controller.PostActions.Add(ctx.ResolveNamed<IAction>(action.Key));
                        }
                    }
                }

                // actions
                foreach (var action in original.Actions.Where(a => a.GetModes().Any(m => m == original.Mode))) {
                    if (action.Before) {
                        controller.PreActions.Add(ctx.ResolveNamed<IAction>(action.Key));
                    }
                    if (action.After) {
                        controller.PostActions.Add(ctx.ResolveNamed<IAction>(action.Key));
                    }
                }

                return controller;
            }).Named<IProcessController>(original.Key);
        }
        public HttpResponseMessage AuthenticateUser(MemberLoginRequestDto model)
        {
            //object result = null;
            var result = new ProcessController().MemberValidation(model);

            result = new ProcessController().MemberValidation(model);
            return(Request.CreateResponse(HttpStatusCode.OK, result));
        }
Beispiel #19
0
        public async Task <object> KillAllProcessesByName(dynamic input)
        {
            string            processName = (string)input.processName;
            ProcessController process     = new ProcessController(processName);

            process.KillAll();
            return(null);
        }
        public void CompleteProcessWithoutStart()
        {
            ProcessController processController = NewProcessController(MockContext(), null);

            ActionResult <ProcessState> result = processController.CompleteProcess(org, app, int.Parse(instanceOwnerId), instanceGuid).Result;

            Assert.IsType <ConflictObjectResult>(result.Result);
        }
        public ProcessControllerTest()
        {
            EnvironmentVariables.AccessKey = "AACC$%";
            var processDocument = A.Fake <ProcessDocument>();

            _backgroundJobClient = new Mock <IBackgroundJobClient>();
            _controller          = new ProcessController(processDocument, _backgroundJobClient.Object);
        }
Beispiel #22
0
 void Clear()
 {
     if (controller != null)
     {
         controller.Dispose();
         controller = null;
     }
 }
Beispiel #23
0
        public async Task <object> LaunchProcess(dynamic input)
        {
            string            processName = (string)input.processName;
            ProcessController process     = new ProcessController(processName);

            process.Start();

            return(null);
        }
        public void GetStartEventsFromUnstartedProcess()
        {
            ProcessController processController = NewProcessController(MockContext(), null);

            ActionResult <List <string> > result = processController.GetNextElements(org, app, int.Parse(instanceOwnerId), instanceGuid).Result;
            List <string> startEvents            = (List <string>)((OkObjectResult)result.Result).Value;

            Assert.NotNull(startEvents);
            Assert.Contains("StartEvent_1", startEvents[0]);
        }
Beispiel #25
0
        internal static void Exec(string binariesDirectory, string dataDirectory)
        {
            string pgControllerExecutablePath = $"{binariesDirectory}{Path.DirectorySeparatorChar}{PostgresDefaults.ServerControllerExecutable}";
            string arguments = $"stop -D \"{dataDirectory}\" ";

            System.Diagnostics.Process serverStopperProcess = Process.ProcessController
                                                              .CreateProcess(pgControllerExecutablePath, arguments);

            ProcessOutput output = ProcessController
                                   .StartAndWaitForReady(serverStopperProcess, ProcessTimeoutInSeconds, ProcessIdentifier, "Postgres stopping");
        }
Beispiel #26
0
        public void Initialize(Machine _machine, ADC _adc, ProcessController _controller)
        {
            machine    = _machine;
            adc        = _adc;
            controller = _controller;

            // Start Event triggers in autoCycle.startProcess()
            // Stop event triggers in autoCycle.endProcess()
            _controller.autoCycle.cycleStartEvent += StartFileWriter;
            _controller.autoCycle.cycleStopEvent  += StopFileWriter;
        }
        private dynamic InstanceRouteItemController(Mock <IProcessFacade> mockRouteItemStore)
        {
            var controller = new ProcessController(mockRouteItemStore.Object, _mockLogger.Object, _mockContextPersonStore.Object)
            {
                ControllerContext = new ControllerContext {
                    HttpContext = _mockHttpContext.Object
                }
            };

            return(controller);
        }
Beispiel #28
0
        public MainWindow()
        {
            InitializeComponent();


            //initialize controller
            categoryController = new CategoryController(this);
            categoryController.GetCategories();

            processController = new ProcessController(this);
            processController.GetRunningProcesses();
        }
Beispiel #29
0
        public void home_controller_get_should_return_string_content()
        {
            var busClientMock = new Mock <IBusClient>();
            var controller    = new ProcessController(busClientMock.Object);

            var result = controller.Get();

            var contentResult = result as ContentResult;

            contentResult.Should().NotBeNull();
            contentResult.Content.Should().BeEquivalentTo("Hello from Process Controller API!");
        }
        public void GetProcessStateOfInstanceWithoutProcessReturnsNull()
        {
            Mock <HttpContext> contextMock = MockContext();

            ProcessController processController = NewProcessController(contextMock, null);

            ActionResult <ProcessState> result = processController.GetProcessState(org, app, int.Parse(instanceOwnerId), instanceGuid).Result;

            ProcessState state = result.Value;

            Assert.Null(state);
        }
Beispiel #31
0
        private void unrealPanel_DoubleClick(object sender, EventArgs e)
        {
            Process p = Process.Start("E:\\Engines\\Unreal Editor\\ChimeraLinkTest\\WindowsNoEditor\\ChimeraLinkTest\\Binaries\\Win64\\ChimeraLinkTest.exe");

            Thread.Sleep(15000); // Allow the process to open it's window
            ProcessController pc = new ProcessController(p);

            pc.FullScreen = true;
            SetParent(p.MainWindowHandle, unrealPanel.Handle);

            Start();
        }
Beispiel #32
0
        private void TestProcessRunningDetection(string processName = "osk")
        {
            Logger.Debug("TestProcessRunningDetection for " + processName);
            var processController = new ProcessController(processName);

            Assert(processController.IsAnyProcessRunning() == false, "Verify process not running at beginning of test");

            processController.Start();
            Assert(processController.IsAnyProcessRunning(), "Process should be running");

            processController.KillAll();
            Assert(processController.IsAnyProcessRunning() == false, "Process should have been killed");
        }