public void Internal_Can_Deploy_SolutionPackage_On_SharePoint_Farm_SSOM(MetaPackServiceContext s) { var regressionProfile = new RegressionDeploymentProfile(); regressionProfile.Sandbox = RegressionSandbox.SharePoint; regressionProfile.API = RegressionAPI.SSOM; regressionProfile.ModelLevel = RegressinModelLevel.Farm; Internal_Deploy_SolutionPackage(s, regressionProfile); }
private void Internal_Can_Deploy_SolutionPackage_On_O365_Site_CSOM(MetaPackServiceContext s) { var regressionProfile = new RegressionDeploymentProfile(); regressionProfile.Sandbox = RegressionSandbox.O365; regressionProfile.API = RegressionAPI.CSOM; regressionProfile.ModelLevel = RegressinModelLevel.Site; Internal_Deploy_SolutionPackage(s, regressionProfile); }
private void Internal_Can_Deploy_SolutionPackage_On_O365_Web_CSOM(MetaPackServiceContext s, bool isSubWeb) { var regressionProfile = new RegressionDeploymentProfile(); regressionProfile.Sandbox = RegressionSandbox.O365; regressionProfile.API = RegressionAPI.CSOM; regressionProfile.ModelLevel = RegressinModelLevel.Web; if (isSubWeb) { regressionProfile.ModelLevel = RegressinModelLevel.Subweb; } Internal_Deploy_SolutionPackage(s, regressionProfile); }
public void Internal_Can_Deploy_SolutionPackage_On_SharePoint_Web_SSOM(MetaPackServiceContext s, bool isSubweb) { var regressionProfile = new RegressionDeploymentProfile(); regressionProfile.Sandbox = RegressionSandbox.SharePoint; regressionProfile.API = RegressionAPI.SSOM; regressionProfile.ModelLevel = RegressinModelLevel.Web; if (isSubweb) { regressionProfile.ModelLevel = RegressinModelLevel.Subweb; } Internal_Deploy_SolutionPackage(s, regressionProfile); }
private void Internal_Deploy_SolutionPackage( MetaPackServiceContext regressionContext, RegressionDeploymentProfile regressionProfile) { var packagingService = regressionContext.PackagingService; var deploymentService = regressionContext.DeploymentService; // create new solution package for this deployment var ciSolutionPackage = CreateNewSolutionPackage(packagingService, regressionProfile.ModelLevel); UpdatePackageVersion(ciSolutionPackage); var packageId = ciSolutionPackage.Id; var packageVersion = ciSolutionPackage.Version; // push to repo PushPackageToCIRepository(ciSolutionPackage, null, packagingService); // find var ciPackage = FindPackageInCIRepository(packageId, packageVersion); Assert.IsNotNull(ciPackage, "Solution package"); var solutionOptions = new List <OptionValue>(); WithCIRepositoryContext(ciNuGetRepository => { // actual deployment callback Action <ClientContext, IPackage, List <OptionValue> > metapackDeployment = (clientContext, package, options) => { var packageManager = new DefaultMetaPackSolutionPackageManager(ciNuGetRepository, clientContext); // configura options packageManager.SolutionOptions.AddRange(options); // install package packageManager.InstallPackage(package, false, false); }; if (regressionProfile.Sandbox == RegressionSandbox.O365) { var siteUrl = O365RootWebUrl; var userName = O365UserName; var userPassword = O365UserPassword; // checking correct model if (regressionProfile.ModelLevel == RegressinModelLevel.Site) { siteUrl = O365RootWebUrl; } else if (regressionProfile.ModelLevel == RegressinModelLevel.Web) { siteUrl = O365RootWebUrl; } else if (regressionProfile.ModelLevel == RegressinModelLevel.Subweb) { siteUrl = O365SubWebUrl; } else { throw new NotImplementedException( string.Format("Unsupported ModelLevel type:[{0}]", regressionProfile.ModelLevel)); } // csom related options solutionOptions.Add(DefaultOptions.SharePoint.Api.CSOM); solutionOptions.Add(DefaultOptions.SharePoint.Edition.Standard); solutionOptions.Add(DefaultOptions.SharePoint.Version.O365); solutionOptions.Add(new OptionValue { Name = DefaultOptions.Site.Url.Id, Value = siteUrl }); solutionOptions.Add(new OptionValue { Name = DefaultOptions.User.Name.Id, Value = userName }); solutionOptions.Add(new OptionValue { Name = DefaultOptions.User.Password.Id, Value = userPassword }); WithCIO365ClientContext(siteUrl, userName, userPassword, context => { metapackDeployment(context, ciPackage, solutionOptions); }); } else if (regressionProfile.Sandbox == RegressionSandbox.SharePoint) { if (regressionProfile.API == RegressionAPI.CSOM) { // csom related options solutionOptions.Add(DefaultOptions.SharePoint.Api.CSOM); solutionOptions.Add(DefaultOptions.SharePoint.Edition.Standard); solutionOptions.Add(DefaultOptions.SharePoint.Version.SP2013); var siteUrl = SP2013RootWebUrl; // checking correct model if (regressionProfile.ModelLevel == RegressinModelLevel.Site) { siteUrl = SP2013RootWebUrl; } else if (regressionProfile.ModelLevel == RegressinModelLevel.Web) { siteUrl = SP2013RootWebUrl; } else if (regressionProfile.ModelLevel == RegressinModelLevel.Subweb) { siteUrl = SP2013SubWebUrl; } else { throw new NotImplementedException( string.Format("Unsupported ModelLevel type:[{0}]", regressionProfile.ModelLevel)); } solutionOptions.Add(new OptionValue { Name = DefaultOptions.Site.Url.Id, Value = siteUrl }); WithCISharePointClientContext(siteUrl, context => { metapackDeployment(context, ciPackage, solutionOptions); }); } else if (regressionProfile.API == RegressionAPI.SSOM) { // csom related options solutionOptions.Add(DefaultOptions.SharePoint.Api.SSOM); solutionOptions.Add(DefaultOptions.SharePoint.Edition.Standard); solutionOptions.Add(DefaultOptions.SharePoint.Version.SP2013); var siteUrl = SP2013RootWebUrl; // checking correct model if (regressionProfile.ModelLevel == RegressinModelLevel.Site) { siteUrl = SP2013RootWebUrl; } else if (regressionProfile.ModelLevel == RegressinModelLevel.Web) { siteUrl = SP2013RootWebUrl; } else if (regressionProfile.ModelLevel == RegressinModelLevel.Subweb) { siteUrl = SP2013SubWebUrl; } else { throw new NotImplementedException( string.Format("Unsupported ModelLevel type:[{0}]", regressionProfile.ModelLevel)); } solutionOptions.Add(new OptionValue { Name = DefaultOptions.Site.Url.Id, Value = siteUrl }); WithCISharePointClientContext(siteUrl, context => { metapackDeployment(context, ciPackage, solutionOptions); }); } else { throw new NotImplementedException( string.Format("Unsupported API type:[{0}]", regressionProfile.API)); } } else { throw new NotImplementedException( string.Format("Unsupported Sandbox type:[{0}]", regressionProfile.Sandbox)); } }); }