private void FileMigrationTabLoaded() { this.textBoxFileMigrationWebs.Text = string.Empty; int bandwith = (int)this.numericUpDownBandwith.Value; int numberOfThreads = (int)this.numericUpDownNumberOfThreads.Value; try { this.migrationData.FileMigrator = FileMigrationBuilder.GetNewFileMigrationBuilder().WithLogger(this.log).WithNumberOfThreads(numberOfThreads).WithBandwith(bandwith).WithServiceAddress(new Uri(this.textBoxFileMigrationServiceURI.Text)).WithSourceClientContext(this.migrationData.SourceClientContext).WithTargetClientContext(this.migrationData.TargetClientContext).CreateMigrator(); } catch (FileMigrationException exception) { MessageBox.Show(exception.Message, "File-Migration-Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.textBoxFileMigrationBandwith.Text = bandwith + " %"; this.textBoxFileMigrationParallelThreads.Text = numberOfThreads.ToString(); this.textBoxFileMigrationWebServiceAddress.Text = this.textBoxFileMigrationServiceURI.Text; TreeNodeCollection treeNodeCollection = this.treeViewContentSelection.Nodes; this.migrationData.WebUrlsToMigrate = treeNodeCollection.GetSelectedWebUrls(); foreach (string item in this.migrationData.WebUrlsToMigrate) { Console.WriteLine("add site '{0}'", item); this.textBoxFileMigrationWebs.Text += item + "\n"; } }
public void TestBuildfileMigratorWithoutBandwith() { ClientContext clientContext = new ClientContext("http://blub"); FileMigrationBuilder builder = FileMigrationBuilder.GetNewFileMigrationBuilder(); builder.WithTargetClientContext(clientContext); builder.WithSourceClientContext(clientContext); builder.WithServiceAddress(new Uri("http://bulub")); SharePoint2010And2013Migrator migrator = builder.CreateMigrator(); Assert.IsNotNull(migrator); Assert.IsTrue(typeof(SharePoint2010And2013Migrator) == migrator.GetType()); }
public void TestBuildfileMigratorWithoutServiceAddress() { ClientContext clientContext = new ClientContext("http://blub"); FileMigrationBuilder builder = FileMigrationBuilder.GetNewFileMigrationBuilder(); builder.WithTargetClientContext(clientContext); builder.WithSourceClientContext(clientContext); builder.WithBandwith(10); try { SharePoint2010And2013Migrator migrator = builder.CreateMigrator(); Assert.Fail("Expected FileMigrationException"); } catch (ValidationException) { // ok } }