Пример #1
0
        public void SSOMTokenReplacementService_Can_Replace_Site_Token()
        {
            var isValid = true;
            var runner  = new SSOMProvisionRunner();

            runner.SiteUrls.ForEach(siteUrl =>
            {
                runner.WithSSOMSiteAndWebContext(siteUrl, (site, web) =>
                {
                    if (site.ServerRelativeUrl == "/")
                    {
                        isValid &= CheckRootWebOnHost(site);
                        isValid &= CheckRootWebOnHost(web);
                        isValid &= CheckRootWebOnHost(web.Lists[0]);
                    }
                    else
                    {
                        isValid &= CheckSubWebOnHost(site, web.ServerRelativeUrl);
                        isValid &= CheckSubWebOnHost(web, web.ServerRelativeUrl);
                        isValid &= CheckSubWebOnHost(web.Lists[0], web.ServerRelativeUrl);
                    }
                });
            });

            Assert.IsTrue(isValid);
        }
Пример #2
0
        public void Can_Provision_Incrementally_With_SSOMFarmPropertyBagStorage()
        {
            var provisionRunner  = new SSOMProvisionRunner();
            var provisionService = provisionRunner.ProvisionService;

            var incrementalModelId = "m2.regression." + Guid.NewGuid().ToString("N");

            provisionRunner.WithSSOMFarmContext(farm =>
            {
                for (var i = 0; i < 3; i++)
                {
                    var incrementalProvisionConfig = new IncrementalProvisionConfig();
                    incrementalProvisionConfig.PersistenceStorages.Add(new DefaultSSOMFarmPropertyBagStorage(farm));

                    provisionService.SetIncrementalProvisionMode(incrementalProvisionConfig);

                    var model = SPMeta2Model.NewSiteModel(site =>
                    {
                    });

                    model.SetIncrementalProvisionModelId(incrementalModelId);

                    provisionService.DeployModel(SPMeta2.SSOM.ModelHosts.FarmModelHost.FromFarm(farm), model);
                }
            });
        }
Пример #3
0
        public void Can_Provision_Incrementally_With_SSOMWebPropertyBagStorage()
        {
            var provisionRunner  = new SSOMProvisionRunner();
            var provisionService = provisionRunner.ProvisionService;

            var incrementalModelId = "m2.regression." + Guid.NewGuid().ToString("N");

            provisionRunner.SiteUrls.ForEach(siteUrl =>
            {
                provisionRunner.WithSSOMSiteAndWebContext((spSite, spWeb) =>
                {
                    for (var i = 0; i < 3; i++)
                    {
                        var incrementalProvisionConfig = new IncrementalProvisionConfig();
                        incrementalProvisionConfig.PersistenceStorages.Add(
                            new DefaultSSOMWebPropertyBagStorage(spWeb));

                        provisionService.SetIncrementalProvisionMode(incrementalProvisionConfig);

                        var model = SPMeta2Model.NewSiteModel(site =>
                        {
                        });

                        model.SetIncrementalProvisionModelId(incrementalModelId);


                        provisionService.DeployModel(SPMeta2.SSOM.ModelHosts.WebModelHost.FromWeb(spWeb), model);
                    }
                });
            });
        }
Пример #4
0
        public void SSOMTokenReplacementService_Should_Not_ChangeNonTokenedUrl()
        {
            var isValid = true;
            var runner  = new SSOMProvisionRunner();

            runner.SiteUrls.ForEach(siteUrl =>
            {
                runner.WithSSOMSiteAndWebContext(siteUrl, (site, web) =>
                {
                    var originalFullUrl         = site.Url;
                    var originalSiteRelativeUrl = site.ServerRelativeUrl;

                    var originalValueResult = Service.ReplaceTokens(new TokenReplacementContext
                    {
                        Value   = originalFullUrl,
                        Context = site
                    });

                    var originalSiteRelativeResult = Service.ReplaceTokens(new TokenReplacementContext
                    {
                        Value   = originalSiteRelativeUrl,
                        Context = site
                    });

                    Assert.AreEqual(originalFullUrl, originalValueResult.Value);
                    Assert.AreEqual(originalSiteRelativeUrl, originalSiteRelativeResult.Value);
                });
            });

            Assert.IsTrue(isValid);
        }
        public SSOMListViewLookupServiceTests()
        {
            Service         = new SSOMListViewLookupService();
            ProvisionRunner = new SSOMProvisionRunner();
            Rnd             = new DefaultRandomService();

            ModelGeneratorService = new ModelGeneratorService();
            ModelGeneratorService.RegisterDefinitionGenerators(typeof(ImageRenditionDefinitionGenerator).Assembly);

            ProvisionRunner.EnableDefinitionProvision  = true;
            ProvisionRunner.EnableDefinitionValidation = false;
        }
Пример #6
0
        public void Can_Provision_Incrementally_With_AutoDetection_As_SSOM()
        {
            var provisionRunner  = new SSOMProvisionRunner();
            var provisionService = provisionRunner.ProvisionService;

            var incrementalModelId = "m2.regression." + Guid.NewGuid().ToString("N");

            provisionRunner.WithSSOMFarmContext(farm =>
            {
                for (var i = 0; i < 3; i++)
                {
                    var incrementalProvisionConfig = new IncrementalProvisionConfig();
                    incrementalProvisionConfig.AutoDetectSharePointPersistenceStorage = true;

                    provisionService.SetIncrementalProvisionMode(incrementalProvisionConfig);

                    var model = SPMeta2Model.NewFarmModel(site =>
                    {
                    });

                    model.SetIncrementalProvisionModelId(incrementalModelId);


                    provisionService.DeployModel(SPMeta2.SSOM.ModelHosts.FarmModelHost.FromFarm(farm), model);
                }
            });


            provisionRunner.WebApplicationUrls.ForEach(url =>
            {
                provisionRunner.WithSSOMWebApplicationContext(url, spWebApp =>
                {
                    for (var i = 0; i < 3; i++)
                    {
                        var incrementalProvisionConfig = new IncrementalProvisionConfig();
                        incrementalProvisionConfig.AutoDetectSharePointPersistenceStorage = true;

                        provisionService.SetIncrementalProvisionMode(incrementalProvisionConfig);

                        var model = SPMeta2Model.NewWebApplicationModel(site =>
                        {
                        });

                        model.SetIncrementalProvisionModelId(incrementalModelId);


                        provisionService.DeployModel(SPMeta2.SSOM.ModelHosts.WebApplicationModelHost.FromWebApplication(spWebApp), model);
                    }
                });
            });

            provisionRunner.SiteUrls.ForEach(siteUrl =>
            {
                provisionRunner.WithSSOMSiteAndWebContext((spSite, spWeb) =>
                {
                    for (var i = 0; i < 3; i++)
                    {
                        var incrementalProvisionConfig = new IncrementalProvisionConfig();
                        incrementalProvisionConfig.AutoDetectSharePointPersistenceStorage = true;

                        provisionService.SetIncrementalProvisionMode(incrementalProvisionConfig);

                        var model = SPMeta2Model.NewSiteModel(site =>
                        {
                        });

                        model.SetIncrementalProvisionModelId(incrementalModelId);


                        provisionService.DeployModel(SPMeta2.SSOM.ModelHosts.WebModelHost.FromWeb(spWeb), model);
                    }
                });
            });
        }
Пример #7
0
 public SSOMTokenReplacementServiceTests()
 {
     Service         = new SSOMTokenReplacementService();
     ProvisionRunner = new SSOMProvisionRunner();
 }