Example #1
0
        public void ContainerTest()
        {
            container = new WindsorContainer(TestHelper.GetConfigDir() + "WindsorContainerTest.xml");

            IOrganisationService organisationSession = (IOrganisationService)container["OrganisationSession"];

            Assert.IsNotNull(organisationSession);
            organisationSession = (IOrganisationService)container[typeof(IOrganisationService)];
            Assert.IsNotNull(organisationSession);

            ISchedulerSessionLocal schedulerSession = (ISchedulerSessionLocal)container["SchedulerSession"];

            Assert.IsNotNull(schedulerSession);
            schedulerSession = (ISchedulerSessionLocal)container[typeof(ISchedulerSessionLocal)];
            Assert.IsNotNull(schedulerSession);

            IProcessDefinitionService definitionSession = (IProcessDefinitionService)container["DefinitionSession"];

            Assert.IsNotNull(definitionSession);
            definitionSession = (IProcessDefinitionService)container[typeof(IProcessDefinitionService)];
            Assert.IsNotNull(definitionSession);

            IExecutionApplicationService executionSession = (IExecutionApplicationService)container["ExecutionSession"];

            Assert.IsNotNull(executionSession);
            executionSession = (IExecutionApplicationService)container[typeof(IExecutionApplicationService)];
            Assert.IsNotNull(executionSession);

            ILogSessionLocal logSession = (ILogSessionLocal)container["LogSession"];

            Assert.IsNotNull(logSession);
            logSession = (ILogSessionLocal)container[typeof(ILogSessionLocal)];
            Assert.IsNotNull(logSession);
        }
Example #2
0
 public void SetContainer()
 {
     //configure the container
     _container            = new NetBpmContainer(new XmlInterpreter(TestHelper.GetConfigDir() + "app_config.xml"));
     testUtil              = new TestUtil();
     servicelocator        = ServiceLocator.Instance;
     definitionComponent   = servicelocator.GetService(typeof(IProcessDefinitionService)) as IProcessDefinitionService;
     executionComponent    = servicelocator.GetService(typeof(IExecutionApplicationService)) as IExecutionApplicationService;
     schedulerComponent    = servicelocator.GetService(typeof(ISchedulerSessionLocal)) as ISchedulerSessionLocal;
     organisationComponent = servicelocator.GetService(typeof(IOrganisationService)) as IOrganisationService;
     testUtil.LoginUser("ae");
 }
Example #3
0
		public void SetContainer()
		{
			//configure the container
			_container = new NetBpmContainer(new XmlInterpreter(TestHelper.GetConfigDir()+"app_config.xml"));
			testUtil = new TestUtil();
			servicelocator = ServiceLocator.Instance;
			definitionComponent = servicelocator.GetService(typeof (IProcessDefinitionService)) as IProcessDefinitionService;
			executionComponent = servicelocator.GetService(typeof (IExecutionApplicationService)) as IExecutionApplicationService;
			schedulerComponent = servicelocator.GetService(typeof (ISchedulerSessionLocal)) as ISchedulerSessionLocal;
			organisationComponent = servicelocator.GetService(typeof (IOrganisationService)) as IOrganisationService;
			testUtil.LoginUser("ae");
		}
Example #4
0
		public void DisposeContainer()
		{	
			servicelocator.Release(definitionComponent);
			definitionComponent=null;
			servicelocator.Release(executionComponent);
			executionComponent=null;
			servicelocator.Release(schedulerComponent);
			schedulerComponent=null;
			servicelocator.Release(organisationComponent);
			organisationComponent=null;

			_container.Dispose();
			_container = null;
		}
Example #5
0
        public void DisposeContainer()
        {
            servicelocator.Release(definitionComponent);
            definitionComponent = null;
            servicelocator.Release(executionComponent);
            executionComponent = null;
            servicelocator.Release(schedulerComponent);
            schedulerComponent = null;
            servicelocator.Release(organisationComponent);
            organisationComponent = null;

            _container.Dispose();
            _container = null;
        }
Example #6
0
        public void Schedule(Job job, String reference)
        {
            ISchedulerSessionLocal schedulerComponent = null;

            try
            {
                schedulerComponent = (ISchedulerSessionLocal)serviceLocator.GetService(typeof(ISchedulerSessionLocal));
                job.Context        = _processInstance.RootFlow;
                schedulerComponent.ScheduleJob(job, reference);
                serviceLocator.Release(schedulerComponent);
            }
            finally
            {
                serviceLocator.Release(schedulerComponent);
            }
        }
Example #7
0
        public static void Main(String[] args)
        {
            try
            {
                bool loop = true;
                if (args.Length != 1)
                {
                    Console.Out.WriteLine("SchedulerMain loop(true|false)");
                }
                ServiceLocator sl = ServiceLocator.Instance;

                if (args.Length > 0 && args[0].EndsWith("false"))
                {
                    loop = false;
                }
                ISchedulerSessionLocal schedulerSessionRemote = SchedulerSessionRemote;

                while (loop)
                {
                    long millisToWait = DEFAULT_INTERVAL;

                    try
                    {
                        if (schedulerSessionRemote != null)
                        {
                            Console.Out.WriteLine(DateTime.Now + " : scheduling task...");
                            millisToWait = schedulerSessionRemote.ExecuteJobs();
                        }
                        else
                        {
                            schedulerSessionRemote = SchedulerSessionRemote;
                        }
                    }
                    catch (Exception t)
                    {
                        Console.WriteLine("Error: " + t.Message);
                    }

                    Console.Out.WriteLine("going to sleep for " + millisToWait + " milliseconds...");
                    Thread.Sleep(new TimeSpan(10000 * millisToWait));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e.Message);
            }
        }
Example #8
0
		public void SetContainer()
		{
			//configure the container
			_container = new NetBpmContainer(new XmlInterpreter(TestHelper.GetConfigDir()+"app_config.xml"));
			testUtil = new TestUtil();
			servicelocator = ServiceLocator.Instance;
			definitionComponent = servicelocator.GetService(typeof (IDefinitionSessionLocal)) as IDefinitionSessionLocal;
			executionComponent = servicelocator.GetService(typeof (IExecutionSessionLocal)) as IExecutionSessionLocal;
			schedulerComponent = servicelocator.GetService(typeof (ISchedulerSessionLocal)) as ISchedulerSessionLocal;
			organisationComponent = servicelocator.GetService(typeof (IOrganisationSessionLocal)) as IOrganisationSessionLocal;
			testUtil.LoginUser("ae");

			// deploy Archiv
			FileInfo parFile = new FileInfo(TestHelper.GetExampleDir()+GetParArchiv());
			FileStream fstream = parFile.OpenRead();
			byte[] b = new byte[parFile.Length];
			fstream.Read(b, 0, (int) parFile.Length);
			definitionComponent.DeployProcessArchive(b);

		}
Example #9
0
        public void SetContainer()
        {
            //configure the container
            _container            = new NetBpmContainer(new XmlInterpreter("app_config.xml"));
            testUtil              = new TestUtil();
            servicelocator        = ServiceLocator.Instance;
            definitionComponent   = servicelocator.GetService(typeof(IProcessDefinitionService)) as IProcessDefinitionService;
            executionComponent    = servicelocator.GetService(typeof(IExecutionApplicationService)) as IExecutionApplicationService;
            schedulerComponent    = servicelocator.GetService(typeof(ISchedulerSessionLocal)) as ISchedulerSessionLocal;
            organisationComponent = servicelocator.GetService(typeof(IOrganisationService)) as IOrganisationService;
            testUtil.LoginUser("ae");

            // Par是一個壓縮檔,除了有定義檔之外,還有可以用來展出Web-UI定義及相關圖形
            FileInfo   parFile = new FileInfo(TestHelper.GetExampleDir() + GetParArchiv());
            FileStream fstream = parFile.OpenRead();

            byte[] b = new byte[parFile.Length];
            fstream.Read(b, 0, (int)parFile.Length);
            //此處在解壓縮Par
            definitionComponent.DeployProcessArchive(b);
        }
Example #10
0
        public void Run()
        {
            ISchedulerSessionLocal scheduler = null;

            try
            {
                scheduler = (ISchedulerSessionLocal)ServiceLocator.Instance.GetService(typeof(ISchedulerSessionLocal));
                while (Runing)
                {
                    //do somting
                    log.Debug("SchedulerThread ExecuteJobs");
                    scheduler.ExecuteJobs();
                    //sleep 5 seconds
                    Thread.Sleep(5000);
                }
            }
            finally
            {
                ServiceLocator.Instance.Release(scheduler);
            }
        }