public void RunTestWithSuppliedDbConfig()
        {
            IJobOperator jobOperator = BatchRuntime.GetJobOperator(new MyDbUnityLoader());

            Assert.IsInstanceOfType(jobOperator, typeof(SimpleJobOperator));
            Type         t           = jobOperator.GetType();
            PropertyInfo f           = t.GetProperty("JobLauncher", BindingFlags.Instance | BindingFlags.Public);
            IJobLauncher jobLauncher = (IJobLauncher)f.GetValue(jobOperator);

            Assert.IsNotNull(jobLauncher);
            Assert.IsInstanceOfType(jobLauncher, typeof(SimpleJobLauncher));
            PropertyInfo   f2            = t.GetProperty("JobRepository", BindingFlags.Instance | BindingFlags.Public);
            IJobRepository jobRepository = (IJobRepository)f2.GetValue(jobOperator);

            Assert.IsNotNull(jobRepository);
            Assert.IsInstanceOfType(jobRepository, typeof(SimpleJobRepository));
            PropertyInfo        f3          = t.GetProperty("JobRegistry", BindingFlags.Instance | BindingFlags.Public);
            IListableJobLocator jobRegistry = (IListableJobLocator)f3.GetValue(jobOperator);

            Assert.IsNotNull(jobRegistry);
            Assert.IsInstanceOfType(jobRegistry, typeof(MapJobRegistry));
            PropertyInfo f4          = t.GetProperty("JobExplorer", BindingFlags.Instance | BindingFlags.Public);
            IJobExplorer jobExplorer = (IJobExplorer)f4.GetValue(jobOperator);

            Assert.IsNotNull(jobExplorer);
            Assert.IsInstanceOfType(jobExplorer, typeof(SimpleJobExplorer));
            FieldInfo       f5  = jobRepository.GetType().GetField("_jobInstanceDao", BindingFlags.Instance | BindingFlags.NonPublic);
            IJobInstanceDao dao = (IJobInstanceDao)f5.GetValue(jobRepository);

            Assert.IsNotNull(dao);
            Assert.IsInstanceOfType(dao, typeof(DbJobInstanceDao));
        }
Exemple #2
0
 public Job(IJobLauncher inLauncher, string inCommand, object[] inArgs)
 {
     _jobLauncher = inLauncher;
     _commandName = inCommand;
     _args        = inArgs;
     _name        = inLauncher.GetJobName(inCommand);
 }
 public StateSynchronizer(
     IStreamStatesProvider statesProvider,
     IStreamJobFactory jobFactory,
     IJobLauncher jobLauncher)
 {
     this.statesProvider = statesProvider;
     this.jobFactory     = jobFactory;
     this.jobLauncher    = jobLauncher;
 }
Exemple #4
0
        public void TestSetup()
        {
            state = new SchedulerState(Task.CompletedTask, CancellationToken.None);

            job = Substitute.For <IStreamJob>();

            launcher = Substitute.For <IJobLauncher>();

            handler = new JobHandler(launcher);
        }
        public void TestSetup()
        {
            state1 = Substitute.For <IStreamState>();
            state2 = Substitute.For <IStreamState>();
            state3 = Substitute.For <IStreamState>();

            state1.Name.Returns("state1");
            state2.Name.Returns("state2");
            state3.Name.Returns("state3");

            statesProvider = Substitute.For <IStreamStatesProvider>();
            statesProvider.GetStates().Returns(new[] { state1, state2, state3 });

            jobFactory  = Substitute.For <IStreamJobFactory>();
            jobLauncher = Substitute.For <IJobLauncher>();

            state = new SchedulerState(Task.CompletedTask, CancellationToken.None);

            synchronizer = new StateSynchronizer(statesProvider, jobFactory, jobLauncher);
        }
Exemple #6
0
 public JobHandler(IJobLauncher launcher)
 {
     this.launcher = launcher;
 }