public void Configure(FubuRegistry registry)
 {
     registry.Policies.Add<ViewDiagnosticsMenu>();
     registry.Actions.IncludeType<ViewsEndpoint>();
     registry.Services(x => x.FillType<IActivator, ProblemGatherer>());
     registry.Services(x => x.FillType<IViewProblemStoreCache, ViewProblemStoreCache>());
 }
Esempio n. 2
0
        public void Configure(FubuRegistry registry)
        {
            registry.Services(addServices);
            registry.Services(addActivators);
            registry.Services(setupAssetCaching);

            registry.Configure(graph =>
            {
                var chain = createAssetContentChain(graph);
                chain.Filters.Add(new AssetEtagInvocationFilter(_assetCache));

                addCaching(chain);
                addWritingAction(chain);
            });
        }
        public void Configure(FubuRegistry registry)
        {
            registry.Policies.Add<HtmlConventionActivation>();
            registry.Services<UIServiceRegistry>();

            registry.ViewFacility(new HtmlDocumentViewFacility());
        }
 protected override void configure(FubuRegistry registry)
 {
     registry.Services(x => x.AddService<IFieldAccessRule, ShowEditFakePolicy>());
     registry.Actions.IncludeType<ShowEditEndpoints>();
     registry.Import<HtmlConventionRegistry>(x => {
         x.Profile("table", profile => profile.FieldChrome<TableRowFieldChrome>());
     });
 }
        public void Configure(FubuRegistry registry)
        {
            registry.Services<AssetServicesRegistry>();
            registry.Policies.Add<AssetContentEndpoint>();

            registry.AlterSettings<CommonViewNamespaces>(x => {
                x.AddForType<AssetBottleRegistration>();
            });
        }
Esempio n. 6
0
        void IFubuRegistryExtension.Configure(FubuRegistry registry)
        {
            registry.Services(services =>
            {
                // This isn't something that changes very often at all
                var encodings = new IHttpContentEncoding[] { new GZipHttpContentEncoding(), new DeflateHttpContentEncoding() };
                var encoders = new HttpContentEncoders(encodings);
                services.SetServiceIfNone<IHttpContentEncoders>(encoders);
            });

            registry.ApplyConvention(new ContentCompressionConvention(_filters.Matches));
        }
Esempio n. 7
0
 public void Modify(FubuRegistry registry)
 {
     registry.Services(x =>
     {
         x.ReplaceService<IOutputWriter, DebuggingOutputWriter>();
         x.ReplaceService<IObjectResolver, RecordingObjectResolver>();
         x.ReplaceService<IDebugReport, DebugReport>();
         x.ReplaceService<IRequestData, RecordingRequestData>();
         x.ReplaceService<IFubuRequest, RecordingFubuRequest>();
         x.ReplaceService<IDebugDetector, DebugDetector>();
     });
 }
 public void Configure(FubuRegistry registry)
 {
     registry.Services(x =>
     {
         x.ReplaceService<IOutputWriter, DebuggingOutputWriter>();
         x.ReplaceService<IObjectResolver, RecordingObjectResolver>();
         x.ReplaceService<IDebugReport, DebugReport>();
         x.ReplaceService<IRequestData, RecordingRequestData>();
         x.ReplaceService<IFubuRequest, RecordingFubuRequest>();
         x.ReplaceService<IDebugDetector, DebugDetector>();
         x.ReplaceService<IAuthorizationPolicyExecutor, RecordingAuthorizationPolicyExecutor>();
     });
 }
Esempio n. 9
0
        public void smoke_test_the_with_types()
        {
            var registry = new FubuRegistry();

            registry.Applies.ToThisAssembly();
            registry.WithTypes(types =>
            {
                types.TypesMatching(x => x.IsConcreteTypeOf <MyInterface>()).Each(type =>
                {
                    registry.Services(s => s.AddService(typeof(MyInterface), new ObjectDef(type)));
                });
            });

            registry.BuildGraph().Services.ServicesFor <MyInterface>()
            .Single().Type.ShouldEqual(typeof(MyConcreteClass));
        }
        public void Configure(FubuRegistry registry)
        {
            registry.Services(x =>
            {
                x.Scan(y =>
                {
                    y.Applies.ToAllPackageAssemblies();
                    y.Applies.ToThisAssembly();
                    y.Applies.ToAssemblyContainingType(registry.GetType());

                    y.AddAllTypesOf <IBuildMenuTree>();
                });

                x.SetServiceIfNone <IBuildMenu, DefaultMenuBuilder>();
            });
        }
Esempio n. 11
0
        private void configurationIs(Action <DateTimePolicies> action)
        {
            container = new Container();
            var registry = new FubuRegistry();

            registry.Services(x =>
            {
                x.SetServiceIfNone <ITimeZoneContext>(theTimeZoneContext);
            });
            registry.Import <DateTimePolicies>(action);

            FubuApplication.For(registry).StructureMap(container).Bootstrap();


            _formatter = container.GetInstance <IDisplayFormatter>();
        }
        public void Configure(FubuRegistry registry)
        {
            registry.Services(x => {
                x.ReplaceService <IMembershipRepository, MembershipRepository <T> >();
                x.SetServiceIfNone <IPasswordHash, PasswordHash>();
                x.SetServiceIfNone <ILoginAuditor, PersistedLoginAuditor>();
            });

            registry.AlterSettings <AuthenticationSettings>(x => {
                x.Strategies.AddToEnd(new MembershipNode(typeof(MembershipRepository <T>)));

                x.Strategies.OfType <MembershipNode>()
                .Where(node => node.MembershipType == typeof(MembershipAuthentication))
                .ToArray()
                .Each(node => node.Remove());
            });
        }
Esempio n. 13
0
        public void registers_spark_view_factory()
        {
            var registry = new FubuRegistry();

            registry.WithSparkDefaults();

            ISparkViewFactory factory = null;

            registry.Services(x =>
            {
                factory = (ISparkViewFactory)x.DefaultServiceFor <ISparkViewFactory>().Value;
            });

            registry.BuildGraph();

            factory.ShouldNotBeNull();
        }
        public void conneg_attachement_policy_finds_and_applies_resource_configuration()
        {
            var registry = new FubuRegistry();

            var typePool = new TypePool();

            typePool.AddAssembly(Assembly.GetExecutingAssembly());

            registry.Policies.Add(x => {
                x.Conneg.ApplyConneg();
            });

            registry.Policies.Add(new ConnegAttachmentPolicy(typePool));
            registry.Services <ResourcesServiceRegistry>();

            registry.Actions.IncludeType <RestController1>();


            var graph = BehaviorGraph.BuildFrom(registry);

            var connegOutput = graph
                               .BehaviorFor <RestController1>(x => x.Find(null))
                               .Output;

            var writerNode = connegOutput.Writers.Single().As <MediaWriterNode>();

            // Assert the xml media
            var objectDef = writerNode.As <IContainerModel>().ToObjectDef()
                            .FindDependencyDefinitionFor <IMediaWriter <Address> >();


            var document = objectDef.DependencyFor <IMediaDocument>().ShouldBeOfType <ConfiguredDependency>();

            document.DependencyType.ShouldEqual(typeof(IMediaDocument));
            document.Definition.Type.ShouldEqual(typeof(XmlMediaDocument));
            document.Definition.DependencyFor <XmlMediaOptions>().ShouldBeOfType <ValueDependency>()
            .Value.ShouldBeOfType <XmlMediaOptions>().Namespace.ShouldEqual("something.xsd");

            objectDef.DependencyFor <ILinkSource <Address> >().ShouldBeOfType <ValueDependency>()
            .Value.ShouldNotBeNull();


            objectDef.DependencyFor <IProjection <Address> >().ShouldBeOfType <ValueDependency>()
            .Value.ShouldBeOfType <Projection <Address> >();
        }
        public void Configure(FubuRegistry registry)
        {
            registry.Services(x =>
            {
                x.SetServiceIfNone <ILocalizeText, DefaultTextLocalizer>();
                x.SetServiceIfNone <IFindCurrentLocalizationNamespace, DefaultLocalizationNamespaceFinder>();

                x.Scan(y =>
                {
                    y.Applies.ToAllPackageAssemblies();
                    y.Applies.ToThisAssembly();
                    y.Applies.ToAssemblyContainingType(registry.GetType());
                    y.Applies.ToAssemblyContainingType <ILocalizationVisitor>();

                    y.AddAllTypesOf <ILocalizationVisitor>();
                });
            });
        }
        public void Configure(FubuRegistry registry)
        {
            var types = new TypePool();

            types.AddAssemblies(AppDomain.CurrentDomain.GetAssemblies());
            types.IgnoreExportTypeFailures = true;

            // Some ugly Generic trickery
            types.TypesMatching(IsGridDefinitionType).Each(type => {
                typeof(Loader <>).CloseAndBuildAs <ILoader>(type).Apply(registry);
            });


            var policies = new ColumnPolicies();

            registry.ReplaceSettings(policies);

            registry.Services(x => x.AddService <IColumnPolicies>(policies));
        }
Esempio n. 17
0
        public void Configure(FubuRegistry registry)
        {
            registry.AlterSettings <CommonViewNamespaces>(x => {
                x.AddForType <FubuDocsRegistry>();
                x.AddForType <TopicLinkTag>();
                x.AddForType <CommandSectionTag>();
                x.Add("FubuMVC.CodeSnippets");
            });

            registry.Services(x => {
                x.SetServiceIfNone <ITopicTokenCache, TopicTokenCache>();
                x.AddService <IPropertyBinder, RequestLogPropertyBinder>();
                x.ReplaceService <ITopicContext, TopicContext>();
                x.ReplaceService <ICommandDocumentationSource, CommandDocumentationSource>();
            });

            registry.ReplaceSettings(TopicGraph.AllTopics);
            registry.Policies.Add <DocumentationProjectLoader>();
            registry.Policies.Add <SetHomePage>();
        }
Esempio n. 18
0
        public void registers_spark_view_renderer()
        {
            var registry = new FubuRegistry();

            registry.WithSparkDefaults();

            var hasRenderer = false;

            registry.Services(x => x.Each((type, def) =>
            {
                if (type == typeof(ISparkViewRenderer <>))
                {
                    hasRenderer = def.Type == typeof(SparkViewRenderer <>);
                }
            }));

            registry.BuildGraph();

            hasRenderer.ShouldBeTrue();
        }
Esempio n. 19
0
        public void first_configuration_supercedes_second()         // Packaging activator runs second so this is very important
        {
            var registry = new FubuRegistry();

            registry.Spark(spark => spark.Settings.AddNamespace("Test"));
            registry.WithSparkDefaults();

            SparkSettings settings = null;

            registry.Services(x =>
            {
                settings = (SparkSettings)x.DefaultServiceFor <ISparkSettings>().Value;
            });

            registry.BuildGraph();

            settings
            .UseNamespaces
            .ShouldContain("Test");
        }
        void IFubuRegistryExtension.Configure(FubuRegistry registry)
        {
            _internalRegistry.As <IFubuRegistryExtension>().Configure(registry);

            registry.Services(x =>
            {
                if (_useTheDefaultStorageMechanism)
                {
                    x.AddService <IActivator, RegisterXmlDirectoryLocalizationStorage>();
                }
                else
                {
                    x.AddService <IActivator, SpinUpLocalizationCaches>();
                }

                if (_localizationLoader != null)
                {
                    x.AddService(typeof(IActivator), _localizationLoader);
                }
            });
        }
Esempio n. 21
0
        public void Configure(FubuRegistry registry)
        {
            var cssPolicy = new CssTransformerPolicy <YuiCssCompressor>(ActionType.Global);

            cssPolicy.AddExclusionCriteria(file => file.Name.Contains(".min."));

            var jsPolicy = JavascriptTransformerPolicy <YuiJavascriptCompressor>
                           .For(ActionType.Global);

            jsPolicy.AddMatchingCriteria(file => file.MimeType == MimeType.Javascript);
            jsPolicy.AddExclusionCriteria(file => file.Name.Contains(".min."));

            registry.Services(x =>
            {
                x.SetServiceIfNone <IJavaScriptCompressor, JavaScriptCompressor>();
                x.SetServiceIfNone <ICssCompressor, CssCompressor>();

                x.AddService <ITransformerPolicy>(cssPolicy);
                x.AddService <ITransformerPolicy>(jsPolicy);
            });
        }
Esempio n. 22
0
        public static FubuRegistry Spark(this FubuRegistry registry, Action <ConfigureSparkExpression> configure)
        {
            var settings = new SparkSettings()
                           .AddAssembly(typeof(HtmlTag).Assembly)
                           .AddAssembly(typeof(FubuPageExtensions).Assembly)
                           .AddNamespace(typeof(FubuRegistryExtensions).Namespace) // Spark.Web.FubuMVC
                           .AddNamespace(typeof(FubuPageExtensions).Namespace)     // FubuMVC.Core.UI
                           .AddNamespace(typeof(HtmlTag).Namespace);               // HtmlTags

            var policies = new List <ISparkPolicy>();
            var visitors = new List <ISparkDescriptorVisitor>();

            var expression = new ConfigureSparkExpression(settings, policies, visitors);

            // TODO -- this shouldn't be assuming the location of the package folder.
            // go through the front end and get this out of the package
            PackageRegistry.Packages.Each(package => registerViewFolder(expression, package));

            configure(expression);

            var factory         = new SparkViewFactory(settings);
            var resolver        = new SparkPolicyResolver(policies);
            var visitorRegistry = new SparkDescriptorVisitorRegistry(visitors);

            registry
            .Services(c =>
            {
                c.SetServiceIfNone <ISparkViewFactory>(factory);
                c.SetServiceIfNone(factory.Settings);
                c.SetServiceIfNone(typeof(ISparkViewRenderer <>), typeof(SparkViewRenderer <>));
            });

            registry
            .Views
            .Facility(new SparkViewFacility(factory, resolver))
            .TryToAttach(x => x.by(new ActionAndViewMatchedBySparkViewDescriptors(resolver, visitorRegistry)));

            return(registry);
        }
        public void blows_up_with_no_saml_certificate_repository()
        {
            var registry = new FubuRegistry();

            var samlCertificateRepository = MockRepository.GenerateMock <ISamlCertificateRepository>();

            samlCertificateRepository.Stub(r => r.AllKnownCertificates())
            .Return(new SamlCertificate[0]);

            registry.Services(x =>
            {
                x.SetServiceIfNone <IPrincipalBuilder>(MockRepository.GenerateMock <IPrincipalBuilder>());



                x.SetServiceIfNone <ISamlCertificateRepository>(samlCertificateRepository);
                //x.SetServiceIfNone(MockRepository.GenerateMock<ISamlResponseHandler>());
            });

            Exception <FubuException> .ShouldBeThrownBy(() => {
                FubuApplication.For(registry).StructureMap(new Container()).Bootstrap();
            });
        }
Esempio n. 24
0
        public void configures_settings_with_default_assemblies_and_namespaces()
        {
            var registry = new FubuRegistry();

            registry.WithSparkDefaults();

            SparkSettings settings = null;

            registry.Services(x =>
            {
                settings = (SparkSettings)x.DefaultServiceFor <ISparkSettings>().Value;
            });

            registry.BuildGraph();



            settings
            .UseAssemblies
            .ShouldContain(typeof(HtmlTag).Assembly.FullName);

            settings
            .UseAssemblies
            .ShouldContain(typeof(FubuPageExtensions).Assembly.FullName);

            settings
            .UseNamespaces
            .ShouldContain(typeof(FubuRegistryExtensions).Namespace);

            settings
            .UseNamespaces
            .ShouldContain(typeof(FubuPageExtensions).Namespace);

            settings
            .UseNamespaces
            .ShouldContain(typeof(HtmlTag).Namespace);
        }
        public void SetUp()
        {
            theParent = new Parent {
                Children = new Child[] {
                    new Child {
                        Name = "Jeremy"
                    },
                    new Child {
                        Name = "Jessica"
                    },
                    new Child {
                        Name = "Natalie"
                    }
                }
            };

            var container = new Container();
            var registry  = new FubuRegistry();

            registry.Services <ResourcesServiceRegistry>();
            FubuApplication.For(registry).StructureMap(container).Bootstrap();

            runner = container.GetInstance <IProjectionRunner>();
        }
Esempio n. 26
0
 void IFubuRegistryExtension.Configure(FubuRegistry registry)
 {
     registry.Services(x => x.AddService(_options));
     registry.Services(x => x.AddService(_bindingReaderOptions));
     registry.Policies.Add <FormatterConvention>();
 }
Esempio n. 27
0
        public void Configure(FubuRegistry registry)
        {
            registry.Policies.Add <TransactionalBehaviorPolicy>();

            registry.Services(x => { x.AddService <Registry, RavenDbRegistry>(); });
        }
 public void Configure(FubuRegistry registry)
 {
     registry.Services <ResourcesServiceRegistry>();
 }
Esempio n. 29
0
 public void Configure(FubuRegistry registry)
 {
     registry.Policies.Add <SamlResponseValidationRulesRegistration>();
     registry.Policies.Add <Saml2AuthenticationRegistration>();
     registry.Services <Saml2ServicesRegistry>();
 }
 public void SetUp()
 {
     _registry = new FubuRegistry();
     _registry.Services <FubuTransportServiceRegistry>();
 }
Esempio n. 31
0
 void IFubuRegistryExtension.Configure(FubuRegistry registry)
 {
     registry.Views.Facility(new SparkViewFacility(_templateRegistry, _parsings));
     registry.Services(configureServices);
 }
 public void Configure(FubuRegistry registry)
 {
     registry.Services(registerDefaultServices);
     MimeType.Css.AddExtension(LESS_EXTENSION);
 }
Esempio n. 33
0
 public void Configure(FubuRegistry registry)
 {
     registry.Services(x => x.SetServiceIfNone <IUploadFiles, DefaultFileUploader>());
 }
 public void Configure(FubuRegistry registry)
 {
     registry.Services(services);
 }
        public void Configure(FubuRegistry registry)
        {
            registry.Services <LightningQueuesServiceRegistry>();

            registry.Import <LightningQueuesJobRegistry>();
        }
 public void Configure(FubuRegistry registry)
 {
     registry.Services(x => x.SetServiceIfNone <IObjectConverter, FastPackObjectConverter>());
     registry.Services(x => x.SetServiceIfNone <IQueryService, QueryService>());
     registry.Services(x => x.SetServiceIfNone <ISmartGridService, SmartGridService>());
 }
 public void Configure(FubuRegistry registry)
 {
     registry.Services(x =>
     {
         x.ReplaceService<IContentFileCombiner, ContentFileCombiner>();
         x.ReplaceService<IScriptTagWriter, CombiningScriptTagWriter>();
         x.ReplaceService<ICssLinkTagWriter, CombiningCssLinkTagWriter>();
     });
 }
Esempio n. 38
0
 void IFubuRegistryExtension.Configure(FubuRegistry registry)
 {
     registry.Services(x => x.AddService(this));
 }
Esempio n. 39
0
 public void Configure(FubuRegistry registry)
 {
     registry.Services(x => x.SetServiceIfNone <IFindBreadCrumbsFor, DefaultBreadCrumbsFinder>());
 }
        public void Configure(FubuRegistry registry)
        {
            registry.Services<UIServiceRegistry>();

            registry.ViewFacility(new HtmlDocumentViewFacility());
        }
Esempio n. 41
0
        /// <summary>
        /// Define a view activation policy
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public PageActivationExpression IfTheViewTypeMatches(Func <Type, bool> filter)
        {
            Action <IPageActivationSource> registration = source => _registry.Services(x => x.AddService <IPageActivationSource>(source));

            return(new PageActivationExpression(registration, filter));
        }