public void TestProofOfConceptScenario() { var examineeAssemblyReference = new FileSystemAssemblyReference( @"C:\Src\Tfs\MobiControl\Common\DeploymentServerExtensions.Facade\v1\DeploymentServerExtensions.Facade\bin\Debug\Soti.MobiControl.DeploymentServerExtensions.Facade.dll"); var comparandAssemblyPaths = new[] { @"C:\Src\Tfs\MobiControl\DEV\MobiControl\Lib\Soti.MobiControl.Entities.dll", @"C:\Src\Tfs\MobiControl\DEV\MobiControl\Lib\Soti.MobiControl.Api.dll", @"C:\Src\Tfs\MobiControl\DEV\MobiControl\Lib\Soti.MobiControl.CoreFeatures.dll", @"C:\Src\Tfs\MobiControl\DEV\MobiControl\Lib\Soti.MobiControl.DeviceConfiguration.dll", @"C:\Src\Tfs\MobiControl\DEV\MobiControl\Lib\Soti.MobiControl.Entities.Providers.dll", @"C:\Src\Tfs\MobiControl\DEV\MobiControl\Lib\Soti.MobiControl.WindowsModern.Service.dll", @"C:\Src\Tfs\MobiControl\DEV\MobiControl\Lib\Soti.MobiControl.DeploymentServerExtensions.dll" }; var comparandAssemblyReferences = comparandAssemblyPaths .Select(path => new FileSystemAssemblyReference(path)) .ToArray(); var dependencyReferences = new DependencyReference[] { new DirectoryDependencyReference(@"C:\Src\Tfs\MobiControl\DEV\MobiControl\Packages", true) }; var parameters = new MetadataComparisonParameters(dependencyReferences: dependencyReferences); var comparer = new MetadataComparer(examineeAssemblyReference, comparandAssemblyReferences, parameters); var comparisonResult = comparer.Compare(); Assert.That(comparisonResult, Is.Not.Null); }
private void CreateListFromResults(Logic.SystemComparer emds) { SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(0, $"Generating List")); comparisonListView.Items.Clear(); /*OrganizationComparer orgComparer = new OrganizationComparer(); * MetadataComparison orgComparison = null; * orgComparison = orgComparer.Compare("Organization", emds._sourceCustomizationRoot.Organizations, * emds._targetCustomizationRoot.Organizations);*/ if (_configuration.IncludeViews) { SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(0, "Processing Views...")); EntityComparer viewComparer = new EntityComparer(); MetadataComparison viewComparison = viewComparer.Compare("Views", emds.SourceCustomizationRoot.Views, emds.TargetCustomizationRoot.Views); AddItem(viewComparison, null); } if (_configuration.IncludeForms) { SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(33, "Processing Forms...")); EntityComparer formComparer = new EntityComparer(); MetadataComparison formComparison = formComparer.Compare("Forms", emds.SourceCustomizationRoot.Forms, emds.TargetCustomizationRoot.Forms); AddItem(formComparison, null); } SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs(66, "Processing Forms...")); MetadataComparer comparer = new MetadataComparer(_configuration); MetadataComparison comparison = comparer.Compare("Entities", emds.SourceCustomizationRoot.EntitiesRaw, emds.TargetCustomizationRoot.EntitiesRaw); AddItem(comparison, null); SendMessageToStatusBar?.Invoke(this, new StatusBarMessageEventArgs("List generated!")); }
public void CompareTest() { var target = new MetadataComparer(); Assert.AreEqual(0, target.Compare(Metadata.Get(new MetadataTypeMock(), "aaa"), Metadata.Get(new MetadataTypeMock(), "aaa"))); Assert.AreEqual(-1, target.Compare(Metadata.Get(new MetadataTypeMock(), "aaa"), Metadata.Get(new MetadataTypeMock(), "bbb"))); Assert.AreEqual(1, target.Compare(Metadata.Get(new MetadataTypeMock(), "bbb"), Metadata.Get(new MetadataTypeMock(), "aaa"))); Assert.AreEqual(0, target.Compare(Metadata.Get(new MetadataTypeMock(), "AAA"), Metadata.Get(new MetadataTypeMock(), "aaa"))); Assert.AreEqual(-1, target.Compare(Metadata.Get(new MetadataTypeMock(), "AAA"), Metadata.Get(new MetadataTypeMock(), "bbb"))); Assert.AreEqual(1, target.Compare(Metadata.Get(new MetadataTypeMock(), "BBB"), Metadata.Get(new MetadataTypeMock(), "aaa"))); }
private void LoadEntities() { _systemComparer = new Logic.SystemComparer(_sourceConnection, _targetConnection); WorkAsync(new WorkAsyncInfo { Message = "Getting Metadata", Work = (worker, args) => { LogInfo("Start retrieving metadata on Source"); _systemComparer.RetrieveMetadata(ConnectionType.Source, _configuration.IncludeAttributeMetadata, worker.ReportProgress); //_systemComparer.RetrieveOrganization(ConnectionType.Source, worker.ReportProgress); _systemComparer.RetrieveForms(ConnectionType.Source, _configuration.IncludeForms, worker.ReportProgress); _systemComparer.RetrieveViews(ConnectionType.Source, _configuration.IncludeViews, worker.ReportProgress); LogInfo("Start retrieving metadata on Target"); _systemComparer.RetrieveMetadata(ConnectionType.Target, _configuration.IncludeAttributeMetadata, worker.ReportProgress); //_systemComparer.RetrieveOrganization(ConnectionType.Target, worker.ReportProgress); _systemComparer.RetrieveForms(ConnectionType.Target, _configuration.IncludeForms, worker.ReportProgress); _systemComparer.RetrieveViews(ConnectionType.Target, _configuration.IncludeViews, worker.ReportProgress); args.Result = _systemComparer; }, PostWorkCallBack = (args) => { LogInfo("Postprocessing Metadata"); if (args.Error != null) { LogError(args.Error.ToString(), args); MessageBox.Show(args.Error.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } var emds = (Logic.SystemComparer)args.Result; comparisonListView.Items.Clear(); /*OrganizationComparer orgComparer = new OrganizationComparer(); * MetadataComparison orgComparison = null; * orgComparison = orgComparer.Compare("Organization", emds._sourceCustomizationRoot.Organizations, * emds._targetCustomizationRoot.Organizations);*/ if (_configuration.IncludeViews) { EntityComparer viewComparer = new EntityComparer(); MetadataComparison viewComparison = viewComparer.Compare("Views", emds._sourceCustomizationRoot.Views, emds._targetCustomizationRoot.Views); AddItem(viewComparison, null); } if (_configuration.IncludeForms) { EntityComparer formComparer = new EntityComparer(); MetadataComparison formComparison = formComparer.Compare("Forms", emds._sourceCustomizationRoot.Forms, emds._targetCustomizationRoot.Forms); AddItem(formComparison, null); } MetadataComparer comparer = new MetadataComparer(); MetadataComparison comparison = comparer.Compare("Entities", emds._sourceCustomizationRoot.EntitiesRaw, emds._targetCustomizationRoot.EntitiesRaw); AddItem(comparison, null); }, ProgressChanged = e => { SetWorkingMessage(e.UserState.ToString()); } }); }