public void find_loader_types()
        {
            var types = BottleServiceApplication.FindLoaderTypes();

            types.ShouldContain(typeof(GoodApplicationSource));
            types.ShouldContain(typeof(FakeApplicationLoader));

            types.ShouldNotContain(typeof(DefaultBottleApplication));
        }
        public void Start(string bootstrapperName, MarshalByRefObject remoteListener)
        {
            var domainSetup = AppDomain.CurrentDomain.SetupInformation;
            System.Environment.CurrentDirectory = domainSetup.ApplicationBase;
             
            // TODO -- need to handle exceptions gracefully here
            EventAggregator.Start((IRemoteListener) remoteListener);

            var application = new BottleServiceApplication();
            _runner = application.Bootstrap(bootstrapperName);
            _runner.Start();
        }
예제 #3
0
        public static RemoteServiceRunner For <T>(Action <RemoteDomainExpression> configure = null)
        {
            BottleServiceApplication.DetermineLoaderType(typeof(T));

            if (configure == null)
            {
                configure = x => { };
            }

            return(new RemoteServiceRunner(x => {
                configure(x);
                x.BootstrapperName = typeof(T).AssemblyQualifiedName;
            }));
        }
예제 #4
0
        public void Start(string bootstrapperName, Dictionary <string, string> properties, MarshalByRefObject remoteListener)
        {
            var domainSetup = AppDomain.CurrentDomain.SetupInformation;

            System.Environment.CurrentDirectory = domainSetup.ApplicationBase;

            // TODO -- need to handle exceptions gracefully here
            EventAggregator.Start((IRemoteListener)remoteListener);

            properties.Each(x => PackageRegistry.Properties[x.Key] = x.Value);

            var loader = BottleServiceApplication.FindLoader(bootstrapperName);

            _shutdown = loader.Load();

            EventAggregator.SendMessage(new LoaderStarted
            {
                LoaderTypeName = _shutdown.GetType().FullName
            });
        }
 public void application_source_with_no_default_ctor_is_not_candidate()
 {
     BottleServiceApplication.IsLoaderTypeCandidate(typeof(AbstractApplicationSource))
     .ShouldBeFalse();
 }
 public void finds_bootstrapper_by_name()
 {
     BottleServiceApplication.FindLoader(typeof(FakeApplicationLoader).AssemblyQualifiedName)
     .ShouldBeOfType <FakeApplicationLoader>();
 }
 public void finds_bootstrapper_by_name_for_a_source()
 {
     BottleServiceApplication.FindLoader(typeof(GoodApplicationSource).AssemblyQualifiedName)
     .ShouldBeOfType <ApplicationLoader <GoodApplicationSource, Application, IDisposable> >();
 }
 public void building_an_activation_loader_for_a_bad_type_thows()
 {
     Exception <ArgumentOutOfRangeException> .ShouldBeThrownBy(() => {
         BottleServiceApplication.BuildApplicationLoader(GetType());
     });
 }
 public void building_an_activation_loader_for_bootstrapper()
 {
     BottleServiceApplication.BuildApplicationLoader(typeof(FakeBootstrapper))
     .ShouldBeOfType <BootstrapperApplicationLoader <FakeBootstrapper> >();
 }
 public void building_an_application_loader_for_application_source()
 {
     BottleServiceApplication.BuildApplicationLoader(typeof(GoodApplicationSource))
     .ShouldBeOfType <ApplicationLoader <GoodApplicationSource, Application, IDisposable> >();
 }
 public void build_application_loader_for_application_loader_type()
 {
     BottleServiceApplication.BuildApplicationLoader(typeof(FakeApplicationLoader))
     .ShouldBeOfType <FakeApplicationLoader>();
 }
 public void application_source_without_default_ctor_is_not_a_candidate()
 {
     BottleServiceApplication.IsLoaderTypeCandidate(typeof(TemplatedApplicationSource))
     .ShouldBeFalse();
 }
 public void application_source_with_default_ctor_and_concrete_is_candidate()
 {
     BottleServiceApplication.IsLoaderTypeCandidate(typeof(GoodApplicationSource))
     .ShouldBeTrue();
 }
 public void application_loader_is_not_candidate_if_no_default_ctor()
 {
     BottleServiceApplication.IsLoaderTypeCandidate(typeof(TemplatedApplicationLoader))
     .ShouldBeFalse();
 }
 public void application_loader_is_not_candidate_if_abstract()
 {
     BottleServiceApplication.IsLoaderTypeCandidate(typeof(AbstractApplicationLoader))
     .ShouldBeFalse();
 }
 public void concrete_type_of_application_loader_with_default_ctor_is_a_candidate()
 {
     BottleServiceApplication.IsLoaderTypeCandidate(typeof(FakeApplicationLoader))
     .ShouldBeTrue();
 }
 public void blows_up_if_more_than_one_application_source()
 {
     Exception <Exception> .ShouldBeThrownBy(() => {
         BottleServiceApplication.FindLoader(null);
     }).Message.ShouldContain("Found multiple candidates, you may need to specify an explicit selection in the bottle-service.config file.");
 }