Пример #1
0
        public override void Initialize(NfsTestCase testCase)
        {
            StdTestCase standardTestCase = (StdTestCase)testCase;

            SpringBootstrapper.Bootstrap();
            standardTestCase.Ctx = SpringBootstrapper.Ctx;
        }
Пример #2
0
        /// <summary>
        /// Todo
        /// </summary>
        private void BootstrapAssembly()
        {
            // Get a way to create the top level objects
            Log4netFactory      log4netFactory      = new Log4netFactoryImpl();
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();

            // Initialise the individual bootstrappers
            CommonLoggingBootstrapper commonLoggingBootstrapper = bootstrapperFactory.NewCommonLoggingBootstrapper();
            LogBootstrapper           logBootstrapper           = bootstrapperFactory.NewLogBootstrapper(Log4NetAssembly, Log4NetAssemblyName, Log4NetXmlCfgFPathFile);
            LoggerSetter loggerSetter = log4netFactory.NewBootstrapDependentLoggerSetter(logBootstrapper);
            //AssemblyResolver assemblyResolver = bootstrapperFactory.NewAssemblyResolver(loggerSetter);
            SpringBootstrapper springBootstrapper = bootstrapperFactory.NewSpringBootstrapper(loggerSetter, SpringContextPathFile);

            // Combine them into a composite
            IList <Bootstrapper> bootstrappers = new List <Bootstrapper>();

            bootstrappers.Add(commonLoggingBootstrapper);
            bootstrappers.Add(logBootstrapper);
            bootstrappers.Add(loggerSetter);
            //bootstrappers.Add(assemblyResolver);
            bootstrappers.Add(springBootstrapper);
            Bootstrapper bootstrapper = bootstrapperFactory.NewCompositeBootstrapper(loggerSetter, bootstrappers);

            // Bootstrap
            bootstrapper.Bootstrap();

            // Set the main object
            AddinMain = (AddinMain)springBootstrapper.Ctx.GetObject("AddinMainObj");
        }
Пример #3
0
        public Runner NewSpringRunner(LoggerSetter loggerSetter, SpringBootstrapper springBootstrapper)
        {
            SpringRunnerImpl runner = new SpringRunnerImpl();

            runner.SpringBootstrapper = springBootstrapper;
            loggerSetter.Add(runner);
            return(runner);
        }
Пример #4
0
        public void TestNewSpringBootstrapper()
        {
            SpringBootstrapper springBootstrapper = BootstrapperFactory.NewSpringBootstrapper(LoggerSetter);

            Assert.IsNotNull(springBootstrapper);
            Assert.IsInstanceOf(typeof(Bootstrapper), springBootstrapper);
            Assert.IsInstanceOf(typeof(SpringBootstrapperImpl), springBootstrapper);
            Assert.IsTrue(LoggerSetterImpl.LoggerRecipients.Contains(springBootstrapper));
        }
Пример #5
0
        public void TestBootstrap()
        {
            SpringBootstrapper bootstrapper = BootstrapperFactory.NewSpringBootstrapper(LoggerSetter);

            LoggerSetter.Bootstrap();
            Assert.IsFalse(bootstrapper.IsDone);
            bootstrapper.Bootstrap();
            Assert.IsTrue(bootstrapper.IsDone);
            Assert.IsNotNull(bootstrapper.Ctx);
        }
Пример #6
0
        static void Main(string[] args)
        {
            // Get a way to create the top level objects
            Log4netFactory      log4netFactory      = new Log4netFactoryImpl();
            BootstrapperFactory bootstrapperFactory = new BootstrapperFactoryImpl();
            MainFactory         mainFactory         = new MainFactoryClass();

            mainFactory.BootstrapperFactory = bootstrapperFactory;

            // Initialise the individual bootstrappers
            LogBootstrapper    logBootstrapper    = bootstrapperFactory.NewLogBootstrapper();
            LoggerSetter       loggerSetter       = log4netFactory.NewBootstrapDependentLoggerSetter(logBootstrapper);
            AssemblyResolver   assemblyResolver   = bootstrapperFactory.NewAssemblyResolver(loggerSetter);
            SpringBootstrapper springBootstrapper = bootstrapperFactory.NewSpringBootstrapper(loggerSetter);

            // Create the program components
            Bootstrapper bootstrapper = mainFactory.NewProgramBootstrapper(logBootstrapper, loggerSetter, assemblyResolver, springBootstrapper);
            Runner       runner       = bootstrapperFactory.NewSpringRunner(loggerSetter, springBootstrapper);

            // Create and run the program
            Program program = mainFactory.NewProgram(bootstrapper, runner);

            program.Run();
        }
Пример #7
0
        public Bootstrapper NewProgramBootstrapper(LogBootstrapper logBootstrapper, LoggerSetter loggerSetter, AssemblyResolver assemblyResolver, SpringBootstrapper springBootstrapper)
        {
            IList <Bootstrapper> bootstrappers = new List <Bootstrapper>();

            bootstrappers.Add(logBootstrapper);
            bootstrappers.Add(loggerSetter);
            bootstrappers.Add(assemblyResolver);
            bootstrappers.Add(springBootstrapper);
            CompositeBootstrapper compositeBootstrapper = BootstrapperFactory.NewCompositeBootstrapper(loggerSetter, bootstrappers);

            return(compositeBootstrapper);
        }