public ContentVersionCleanup(IItemNotifier notifier, ContentVersionRepository repository)
		{
			this.notifier = notifier;
			this.repository = repository;


		}
		public override void SetUp()
		{
			base.SetUp();

			finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
			notifier = mocks.Stub<IItemNotifier>();
			mocks.Replay(notifier);

			activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new InterceptingProxyFactory());
			definitions = new DefinitionManager(
				new[] {new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), 
					finder, 
					new TransformerBase<IUniquelyNamed>[0],
					TestSupport.SetupEngineSection()))}, 
				activator, new StateChanger(), new DefinitionMap());
			definitions.Start();
			parser = mocks.StrictMock<IUrlParser>();
			Expect.On(parser)
				.Call(parser.BuildUrl(null))
				.IgnoreArguments()
				.Do(new BuildUrl(delegate(ContentItem itemToBuild)
									{
										string url = "/" + itemToBuild.Name + ".aspx";
										foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
										{
											if (parent.Parent != null)
												url = "/" + parent.Name + url;
										}
										return url.ToUrl();
									}))
				.Repeat.Any();
			mocks.Replay(parser);

			persister = TestSupport.SetupFakePersister();
		}
Ejemplo n.º 3
0
        public override void SetUp()
        {
            base.SetUp();
            DefinitionBuilder builder  = new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase <IUniquelyNamed> [0], TestSupport.SetupEngineSection());
            IItemNotifier     notifier = mocks.DynamicMock <IItemNotifier>();

            mocks.Replay(notifier);
            var changer = new N2.Edit.Workflow.StateChanger();

            definitions = new DefinitionManager(new[] { new DefinitionProvider(builder) }, new ContentActivator(changer, notifier, new EmptyProxyFactory()), changer, new DefinitionMap());

            versioner = mocks.StrictMock <IVersionManager>();
            var urls = new FakeEditUrlManager();

            editManager = new EditManager(definitions, persister, versioner, null, null, null, urls, changer, new EditableHierarchyBuilder(new SecurityManager(new ThreadContext(), new EditSection()), TestSupport.SetupEngineSection()), new EditSection());
            editManager.EnableVersioning = true;

            var engine = new FakeEngine();

            engine.Container.AddComponentInstance("editManager", typeof(IEditManager), editManager);

            engine.Container.AddComponentInstance("editSection", typeof(EditSection), new EditSection());

            Context.Replace(engine);
        }
Ejemplo n.º 4
0
        public override void SetUp()
        {
            base.SetUp();

            finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
            notifier = mocks.Stub<IItemNotifier>();
            mocks.Replay(notifier);

            activator = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new InterceptingProxyFactory());
            definitions = new DefinitionManager(
                new[] {new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), 
                    finder, 
                    new TransformerBase<IUniquelyNamed>[0],
                    TestSupport.SetupEngineSection()))}, 
                activator, new StateChanger(), new DefinitionMap());
            definitions.Start();
            parser = mocks.StrictMock<IUrlParser>();
            Expect.On(parser)
                .Call(parser.BuildUrl(null))
                .IgnoreArguments()
                .Do(new BuildUrl(delegate(ContentItem itemToBuild)
                                    {
                                        string url = "/" + itemToBuild.Name + ".aspx";
                                        foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
                                        {
                                            if (parent.Parent != null)
                                                url = "/" + parent.Name + url;
                                        }
                                        return url.ToUrl();
                                    }))
                .Repeat.Any();
            mocks.Replay(parser);

            persister = TestSupport.SetupFakePersister();
        }
Ejemplo n.º 5
0
 public ContentActivator(StateChanger changer, IItemNotifier notifier, IProxyFactory interceptor)
 {
     this.stateChanger    = changer;
     this.notifier        = notifier;
     this.interceptor     = interceptor;
     this.contentBuilders = new Dictionary <Type, ItemDefinition>();
 }
Ejemplo n.º 6
0
 public XmlContentRepository(IDefinitionManager definitions, IWebContext webContext, XmlFileSystem fileSystem, IItemXmlWriter writer, IItemXmlReader reader, IItemNotifier notifier)
     : base(webContext, fileSystem)
 {
     this.definitions = definitions;
     this.writer      = writer;
     this.reader      = reader;
     this.notifier    = notifier;
 }
Ejemplo n.º 7
0
        private IItemNotifier CreateNotifier(bool replay)
        {
            IItemNotifier notifier = mocks.StrictMock <IItemNotifier>();

            notifier.ItemCreated += null;
            LastCall.IgnoreArguments().Repeat.Any();
            if (replay)
            {
                mocks.Replay(notifier);
            }
            return(notifier);
        }
Ejemplo n.º 8
0
        public override void SetUp()
        {
            base.SetUp();

            user = CreatePrincipal("SomeSchmuck");

            DefinitionBuilder builder  = new DefinitionBuilder(typeFinder, new EngineSection());
            IItemNotifier     notifier = mocks.DynamicMock <IItemNotifier>();

            mocks.Replay(notifier);
            activator   = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new EmptyProxyFactory());
            definitions = new DefinitionManager(new [] { new DefinitionProvider(builder) }, activator);
        }
Ejemplo n.º 9
0
        public override void SetUp()
        {
            base.SetUp();

            user = CreatePrincipal("SomeSchmuck");

            map = new DefinitionMap();
            DefinitionBuilder builder  = new DefinitionBuilder(map, typeFinder, new TransformerBase <IUniquelyNamed> [0], new EngineSection());
            IItemNotifier     notifier = mocks.DynamicMock <IItemNotifier>();

            mocks.Replay(notifier);
            var changer = new N2.Edit.Workflow.StateChanger();

            activator   = new ContentActivator(changer, notifier, new EmptyProxyFactory());
            definitions = new DefinitionManager(new[] { new DefinitionProvider(builder) }, new ITemplateProvider[0], activator, changer);
        }
Ejemplo n.º 10
0
        public UrlParser(IPersister persister, IHost host, IWebContext webContext, IItemNotifier notifier, HostSection config, ILanguageManager languageManager, CustomUrlsSection urls, GlobalizationSection globalizationConfig)
        {
            _persister = persister;
            _host = host;
            _webContext = webContext;

            _ignoreExistingFiles = config.Web.IgnoreExistingFiles;

            notifier.ItemCreated += OnItemCreated;

            _languageManager = languageManager;

            DefaultDocument = "default";

            _useBrowserLanguagePreferences = (globalizationConfig != null) ? globalizationConfig.UseBrowserLanguagePreferences : false;

            _configUrlsSection = urls;
        }
Ejemplo n.º 11
0
        public override void SetUp()
        {
            base.SetUp();

            CreatePersister();

            parser = mocks.StrictMock <IUrlParser>();

            ITypeFinder       typeFinder = CreateTypeFinder();
            DefinitionBuilder builder    = new DefinitionBuilder(typeFinder, new EngineSection());
            IItemNotifier     notifier   = mocks.DynamicMock <IItemNotifier>();

            mocks.Replay(notifier);
            activator       = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, new EmptyProxyFactory());
            definitions     = new DefinitionManager(new [] { new DefinitionProvider(builder) }, activator);
            finder          = new FakeItemFinder(definitions, () => Enumerable.Empty <ContentItem>());
            integrityManger = new IntegrityManager(definitions, finder, parser);
            IntegrityEnforcer enforcer = new IntegrityEnforcer(persister, integrityManger, activator);

            enforcer.Start();
        }
Ejemplo n.º 12
0
        public override void SetUp()
        {
            base.SetUp();

            finder = new FakeTypeFinder(typeof(XmlableItem).Assembly, typeof(XmlableItem), typeof(XmlableItem2));
            notifier = mocks.Stub<IItemNotifier>();
            mocks.Replay(notifier);

            definitions = new DefinitionManager(
                new DefinitionBuilder(
                    finder,
                    new EngineSection(),
                    new FakeEditUrlManager()),
                new N2.Edit.Workflow.StateChanger(),
                notifier,
                new InterceptingProxyFactory());

            parser = mocks.StrictMock<IUrlParser>();
            Expect.On(parser)
                .Call(parser.BuildUrl(null))
                .IgnoreArguments()
                .Do(new BuildUrl(delegate(ContentItem itemToBuild)
                                    {
                                        string url = "/" + itemToBuild.Name + ".aspx";
                                        foreach (ContentItem parent in Find.EnumerateParents(itemToBuild, null))
                                        {
                                            if (parent.Parent != null)
                                                url = "/" + parent.Name + url;
                                        }
                                        return url;
                                    }))
                .Repeat.Any();
            mocks.Replay(parser);

            persister = mocks.StrictMock<IPersister>();
            persister.Save(null);
            LastCall.IgnoreArguments().Repeat.Any();
            mocks.Replay(persister);
        }
Ejemplo n.º 13
0
        public override void SetUp()
        {
            base.SetUp();

            CreatePersister();

            parser = mocks.StrictMock <IUrlParser>();

            ITypeFinder       typeFinder = CreateTypeFinder();
            DefinitionBuilder builder    = new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase <IUniquelyNamed> [0], TestSupport.SetupEngineSection());
            IItemNotifier     notifier   = mocks.DynamicMock <IItemNotifier>();

            mocks.Replay(notifier);
            var changer = new N2.Edit.Workflow.StateChanger();

            activator       = new ContentActivator(changer, notifier, new EmptyProxyFactory());
            definitions     = new DefinitionManager(new[] { new DefinitionProvider(builder) }, activator, changer, new DefinitionMap());
            integrityManger = new IntegrityManager(definitions, persister.Repository, parser);
            IntegrityEnforcer enforcer = new IntegrityEnforcer(persister, integrityManger, activator);

            enforcer.Start();
        }
Ejemplo n.º 14
0
 public ContentDependencyInjector(IServiceContainer services, IDefinitionManager definitions, IItemNotifier notifier)
 {
     this.services    = services;
     this.definitions = definitions;
     this.notifier    = notifier;
 }
Ejemplo n.º 15
0
 public NHInterceptor(IProxyFactory interceptor, IConfigurationBuilder builder, IItemNotifier notifier)
 {
     this.interceptor    = interceptor;
     this.sessionFactory = builder.BuildSessionFactory();
     this.notifier       = notifier;
 }
Ejemplo n.º 16
0
 public ContentVersionCleanup(IItemNotifier notifier, ContentVersionRepository repository)
 {
     this.notifier   = notifier;
     this.repository = repository;
 }
Ejemplo n.º 17
0
 public NHInterceptorFactory(IProxyFactory interceptor, IItemNotifier notifier)
 {
     this.interceptor = interceptor;
     this.notifier    = notifier;
 }
Ejemplo n.º 18
0
        public static void Setup(out IDefinitionProvider[] definitionProviders, out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out InterceptingProxyFactory proxyFactory, params Type[] itemTypes)
        {
            ITypeFinder typeFinder = new Fakes.FakeTypeFinder(itemTypes[0].Assembly, itemTypes);

            DefinitionBuilder definitionBuilder = new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase <IUniquelyNamed> [0], SetupEngineSection());

            notifier            = new ItemNotifier();
            proxyFactory        = new InterceptingProxyFactory();
            activator           = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, proxyFactory);
            definitionProviders = new IDefinitionProvider[] { new DefinitionProvider(definitionBuilder) };
            definitions         = new DefinitionManager(definitionProviders, new ITemplateProvider[0], activator, new StateChanger());
            ((DefinitionManager)definitions).Start();
        }
Ejemplo n.º 19
0
        public UrlParser(IPersister persister, IHost host, IWebContext webContext, IItemNotifier notifier, HostSection config, ILanguageManager languageManager, CustomUrlsSection urls)
            : this(persister, host, webContext, notifier, config, languageManager, urls, null)
        {

        }
Ejemplo n.º 20
0
 public NHInterceptor(IProxyFactory interceptor, IConfigurationBuilder builder, IItemNotifier notifier)
 {
     this.interceptor = interceptor;
     this.sessionFactory = builder.BuildSessionFactory();
     this.notifier = notifier;
 }
Ejemplo n.º 21
0
 public ContentActivator(StateChanger changer, IItemNotifier notifier, IProxyFactory interceptor)
 {
     this.stateChanger = changer;
     this.notifier     = notifier;
     this.interceptor  = interceptor;
 }
Ejemplo n.º 22
0
 public MultipleSitesUrlParser(IPersister persister, IWebContext webContext, IItemNotifier notifier, IHost host, HostSection config, ILanguageManager languageManager, CustomUrlsSection urls, GlobalizationSection globalizationConfig)
     : base(persister, host, webContext, notifier, config, languageManager, urls, globalizationConfig)
 {
 }
Ejemplo n.º 23
0
        public static void Setup(out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out FakeSessionProvider sessionProvider, out ItemFinder finder, out SchemaExport schemaCreator, out InterceptingProxyFactory proxyFactory, params Type[] itemTypes)
        {
            var participators             = new ConfigurationBuilderParticipator[0];
            FakeWebContextWrapper context = new Fakes.FakeWebContextWrapper();
            DatabaseSection       config  = (DatabaseSection)ConfigurationManager.GetSection("n2/database");

            Setup(out definitions, out activator, out notifier, out sessionProvider, out finder, out schemaCreator, out proxyFactory, context, config, participators, itemTypes);
        }
Ejemplo n.º 24
0
        public static void Setup(out IDefinitionProvider[] definitionProviders, out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out InterceptingProxyFactory proxyFactory, params Type[] itemTypes)
        {
            var map = new DefinitionMap();

            definitionProviders = SetupDefinitionProviders(map, itemTypes);
            notifier            = new ItemNotifier();
            proxyFactory        = new InterceptingProxyFactory();
            activator           = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, proxyFactory);
            definitions         = new DefinitionManager(definitionProviders, activator, new StateChanger(), new DefinitionMap());
            ((DefinitionManager)definitions).Start();
            activator.Initialize(definitions.GetDefinitions());
        }
Ejemplo n.º 25
0
        public static void Setup(out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out InterceptingProxyFactory proxyFactory, params Type[] itemTypes)
        {
            ITypeFinder typeFinder = new Fakes.FakeTypeFinder(itemTypes[0].Assembly, itemTypes);

            DefinitionBuilder definitionBuilder = new DefinitionBuilder(typeFinder, new EngineSection());

            notifier     = new ItemNotifier();
            proxyFactory = new InterceptingProxyFactory();
            activator    = new ContentActivator(new N2.Edit.Workflow.StateChanger(), notifier, proxyFactory);
            definitions  = new DefinitionManager(new [] { new DefinitionProvider(definitionBuilder) }, activator);
            ((DefinitionManager)definitions).Start();
        }
Ejemplo n.º 26
0
        public static void Setup(out IDefinitionManager definitions, out ContentActivator activator, out IItemNotifier notifier, out FakeSessionProvider sessionProvider, out ItemFinder finder, out SchemaExport schemaCreator, out InterceptingProxyFactory proxyFactory, IWebContext context, DatabaseSection config, ConfigurationBuilderParticipator[] participators, params Type[] itemTypes)
        {
            Setup(out definitions, out activator, out notifier, out proxyFactory, itemTypes);

            var connectionStrings    = (ConnectionStringsSection)ConfigurationManager.GetSection("connectionStrings");
            var configurationBuilder = new ConfigurationBuilder(definitions, new ClassMappingGenerator(), new ThreadContext(), participators, config, connectionStrings);
            var configurationSource  = new ConfigurationSource(configurationBuilder);

            sessionProvider = new FakeSessionProvider(configurationSource, new NHInterceptor(proxyFactory, configurationSource, notifier), context);

            finder = new ItemFinder(sessionProvider, definitions);

            schemaCreator = new SchemaExport(configurationSource.BuildConfiguration());
        }
Ejemplo n.º 27
0
		public NHInterceptor(IProxyFactory interceptor, IItemNotifier notifier)
		{
			this.interceptor = interceptor;
			this.notifier = notifier;
		}
 public ContentDependencyInjector(IServiceContainer services, IDefinitionManager definitions, IItemNotifier notifier)
 {
     this.services = services;
     this.definitions = definitions;
     this.notifier = notifier;
 }
Ejemplo n.º 29
0
 public NotifyingInterceptor(IItemNotifier notifier)
 {
     _notifier = notifier;
 }