diff --git a/CosmosClone/CosmicCloneUI/CloneOptionsPage.xaml b/CosmosClone/CosmicCloneUI/CloneOptionsPage.xaml
index aacdc40..ad82e33 100644
--- a/CosmosClone/CosmicCloneUI/CloneOptionsPage.xaml
+++ b/CosmosClone/CosmicCloneUI/CloneOptionsPage.xaml
@@ -19,5 +19,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/CosmosClone/CosmicCloneUI/CloneOptionsPage.xaml.cs b/CosmosClone/CosmicCloneUI/CloneOptionsPage.xaml.cs
index 6cf4eef..df68cdb 100644
--- a/CosmosClone/CosmicCloneUI/CloneOptionsPage.xaml.cs
+++ b/CosmosClone/CosmicCloneUI/CloneOptionsPage.xaml.cs
@@ -27,5 +27,31 @@ namespace CosmicCloneUI
{
InitializeComponent();
}
+
+
+ public bool TestCloneOptions()
+ {
+ var result = true;
+ if (!int.TryParse(OfferThroughput.Text, out int RU))
+ result = false;
+
+ if (RU < 400) result = false;
+ if (RU % 100 != 0) result = false;
+
+ if (result)
+ {
+ var connectionIcon = (Image)this.FindName("ConnectionIcon");
+ ConnectionIcon.Source = new BitmapImage(new Uri("/Images/success.png", UriKind.Relative));
+ ConnectionTestMsg.Text = "Validation Passed";
+ }
+ else
+ {
+ var connectionIcon = (Image)this.FindName("ConnectionIcon");
+ ConnectionIcon.Source = new BitmapImage(new Uri("/Images/fail.png", UriKind.Relative));
+ ConnectionTestMsg.Text = "Invalid Throughput provided. Make sure it's a number greater than 400 and multiple of 100.";
+ }
+
+ return result;
+ }
}
}
diff --git a/CosmosClone/CosmicCloneUI/MainWindow.xaml.cs b/CosmosClone/CosmicCloneUI/MainWindow.xaml.cs
index f4ebe8b..0434c17 100644
--- a/CosmosClone/CosmicCloneUI/MainWindow.xaml.cs
+++ b/CosmosClone/CosmicCloneUI/MainWindow.xaml.cs
@@ -157,12 +157,17 @@ namespace CosmicCloneUI
}
else if (GetPageNumber(currentPage) == 2)
{
- CloneSettings.CopyStoredProcedures = ((CheckBox)currentPage.FindName("SPs")).IsChecked.Value;
- CloneSettings.CopyUDFs = ((CheckBox)currentPage.FindName("UDFs")).IsChecked.Value;
- CloneSettings.CopyTriggers = ((CheckBox)currentPage.FindName("CosmosTriggers")).IsChecked.Value;
- CloneSettings.CopyDocuments = ((CheckBox)currentPage.FindName("Documents")).IsChecked.Value;
- CloneSettings.CopyIndexingPolicy = ((CheckBox)currentPage.FindName("IPs")).IsChecked.Value;
- CloneSettings.CopyPartitionKey = ((CheckBox)currentPage.FindName("PKs")).IsChecked.Value;
+ var page = ((CloneOptionsPage)currentPage);
+ var valid = page.TestCloneOptions();
+ if (!valid) return false;
+
+ CloneSettings.CopyStoredProcedures = page.SPs.IsChecked.Value;
+ CloneSettings.CopyUDFs = page.UDFs.IsChecked.Value;
+ CloneSettings.CopyTriggers = page.CosmosTriggers.IsChecked.Value;
+ CloneSettings.CopyDocuments = page.Documents.IsChecked.Value;
+ CloneSettings.CopyIndexingPolicy = page.IPs.IsChecked.Value;
+ CloneSettings.CopyPartitionKey = page.PKs.IsChecked.Value;
+ CloneSettings.TargetMigrationOfferThroughputRUs = int.Parse(page.OfferThroughput.Text);
return true;
}
diff --git a/CosmosClone/CosmosCloneCommon/Model/RandomNumberGenerator.cs b/CosmosClone/CosmosCloneCommon/Model/RandomNumberGenerator.cs
index c7e8d1a..8f33615 100644
--- a/CosmosClone/CosmosCloneCommon/Model/RandomNumberGenerator.cs
+++ b/CosmosClone/CosmosCloneCommon/Model/RandomNumberGenerator.cs
@@ -8,7 +8,7 @@ namespace CosmosCloneCommon.Model
public static class RandomNumberGenerator
{
- private static readonly Random _random = new Random(unchecked(Environment.TickCount * 31 + Thread.CurrentThread.ManagedThreadId));;
+ private static readonly Random _random = new Random(unchecked(Environment.TickCount * 31 + Thread.CurrentThread.ManagedThreadId));
public static int GetNext(int maxValue)
{
diff --git a/CosmosClone/CosmosCloneCommon/Utility/CloneSettings.cs b/CosmosClone/CosmosCloneCommon/Utility/CloneSettings.cs
index 7fb7d53..0eae3c1 100644
--- a/CosmosClone/CosmosCloneCommon/Utility/CloneSettings.cs
+++ b/CosmosClone/CosmosCloneCommon/Utility/CloneSettings.cs
@@ -69,8 +69,8 @@ namespace CosmosCloneCommon.Utility
EndpointUrl = targetConfigs["EndpointUrl"],
AccessKey = targetConfigs["AccessKey"],
DatabaseName = targetConfigs["DatabaseName"],
- CollectionName = targetConfigs["CollectionName"]
- // OfferThroughputRUs = int.Parse(sourceConfigs["OfferThroughputRUs"])
+ CollectionName = targetConfigs["CollectionName"],
+ OfferThroughputRUs = int.Parse(targetConfigs["OfferThroughputRUs"])
};
}
@@ -95,6 +95,6 @@ namespace CosmosCloneCommon.Utility
public string AccessKey { get; set; }
public string DatabaseName { get; set; }
public string CollectionName { get; set; }
-
+ public int OfferThroughputRUs { get; set; }
}
}