public override void Initialize(NfsTestCase testCase) { StdTestCase standardTestCase = (StdTestCase)testCase; SpringBootstrapper.Bootstrap(); standardTestCase.Ctx = SpringBootstrapper.Ctx; }
/// <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"); }
public Runner NewSpringRunner(LoggerSetter loggerSetter, SpringBootstrapper springBootstrapper) { SpringRunnerImpl runner = new SpringRunnerImpl(); runner.SpringBootstrapper = springBootstrapper; loggerSetter.Add(runner); return(runner); }
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)); }
public void TestBootstrap() { SpringBootstrapper bootstrapper = BootstrapperFactory.NewSpringBootstrapper(LoggerSetter); LoggerSetter.Bootstrap(); Assert.IsFalse(bootstrapper.IsDone); bootstrapper.Bootstrap(); Assert.IsTrue(bootstrapper.IsDone); Assert.IsNotNull(bootstrapper.Ctx); }
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(); }
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); }