public void MSSITESS_S01_TC11_ImportingFailureImportWebNotEmpty()
{
Site.Assume.IsTrue(Common.IsRequirementEnabled(5311, this.Site) && Common.IsRequirementEnabled(5391, this.Site), @"Test is executed only when R5311Enabled and R5391Enabled are set to true.");
#region Variables
string exportUrl = Common.GetConfigurationPropertyValue(Constants.NormalSubsiteUrl, this.Site);
string importUrlExported = string.Empty;
string dataPath = Common.GetConfigurationPropertyValue(Constants.DataPath, this.Site);
string logPath = string.Empty;
string exportJobName = Constants.ExportJobName + Common.FormatCurrentDateTime();
string[] dataFiles = new string[] { exportUrl + "/" + Common.GetConfigurationPropertyValue(Constants.InvalidLibraryName, this.Site) + "/" + exportJobName + Constants.CmpExtension };
int cabSize = 50;
int exportWebResult = 0;
int importWebResult = 0;
string[] exportWebFiles = null;
string[] expectedWebFiles = null;
#endregion Variables
// Initialize the web service with an authenticated account.
this.sitessAdapter.InitializeWebService(UserAuthenticationOption.Authenticated);
// Invoke the ExportWeb operation with valid parameters, 1 is expected to be returned and only one cmp file is expected to be exported.
exportWebResult = this.sitessAdapter.ExportWeb(exportJobName, exportUrl, dataPath, true, true, true, cabSize);
#region Capture requirements
// If 1 is returned, requirements related with ExportWeb pending can be verified.
this.VerifyExportWebInProgress(exportWebResult);
#endregion Capture requirements
string files = TestSuiteHelper.VerifyExportAndImportFile(exportJobName, 2, this.Site, this.sutAdapter);
exportWebFiles = files == null ? null : files.TrimEnd(new char[] { ';' }).Split(';');
// Format the expected file names in the document library. Only one cmp file (i.e. ExportWeb.cmp) is expected to be exported in the document library.
expectedWebFiles = new string[]
{
exportJobName + Constants.SntExtension,
exportJobName + Constants.CmpExtension
};
Site.Assert.IsTrue(AdapterHelper.CompareStringArrays(expectedWebFiles, exportWebFiles), "Export web files' names should be {0} and {1}, and actually the exported file list is: {2}", expectedWebFiles[0], expectedWebFiles[1], files);
logPath = dataPath;
importUrlExported = exportUrl;
// Under SharePoint services 2007, the transport portion of the parameter webUrl should be lower case.
if (importUrlExported.StartsWith("HTTP:", StringComparison.Ordinal))
{
importUrlExported = importUrlExported.Replace("HTTP:", "http:");
}
else if (importUrlExported.StartsWith("HTTPS:", StringComparison.Ordinal))
{
importUrlExported = importUrlExported.Replace("HTTPS:", "https:");
}
// As specified in MS-SITESS, the server name portion of the parameter webUrl should be lower case.
string sutComputerName = Common.GetConfigurationPropertyValue(Constants.SutComputerName, this.Site);
importUrlExported = importUrlExported.Replace(sutComputerName, sutComputerName.ToLower(System.Globalization.CultureInfo.CurrentCulture));
// Invoke the ImportWeb operation with webUrl set to the site just exported, which is not a blank site, 8 is expected to be returned.
importWebResult = this.sitessAdapter.ImportWeb(Constants.ImportJobName, importUrlExported, dataFiles, logPath, true, true);
#region Capture requirements
this.VerifyImportWebErrorCode(importWebResult);
// If 8 is returned, R272 can be captured.
Site.Log.Add(LogEntryKind.Debug, "Verify MS-SITESS_R272");
// Verify MS-SITESS requirement: MS-SITESS_R272
Site.CaptureRequirementIfAreEqual<int>(
8,
importWebResult,
272,
@"[In ImportWebResponse] [ImportWebResult:] If the value of ImportWebResult is 8, it specifies ImportWebNotEmpty: The location specified by webUrl corresponds to an existing site that is not a blank site.");
#endregion Capture requirements
#region Capture requirements
// Verify that Microsoft Windows SharePoint Services 3.0 and above support operation ExportWeb.
this.VerifyOperationExportWeb();
// Verify that Microsoft Windows SharePoint Services 3.0 and above support operation ImportWeb.
this.VerifyOperationImportWeb();
#endregion Capture requirements
}