/// <summary>
        /// Prints the extensible2 global parameters.
        /// </summary>
        protected void PrintExtensible2GlobalParameters()
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                var sectionTitle = "Global Parameters";

                this.WriteSectionHeader(sectionTitle, 3);

                if (this.DiffgramDataSet.Tables[0].Rows.Count != 0)
                {
                    var headerTable = Documenter.GetSimpleSettingsHeaderTable(new OrderedDictionary {
                        { "Setting", 25 }, { "Configuration", 65 }, { "Encrypted?", 10 }
                    });

                    this.WriteTable(this.DiffgramDataSet.Tables[0], headerTable);
                }
                else
                {
                    this.WriteContentParagraph("There are no Global parameters configured.");
                }
            }
            finally
            {
                this.ResetDiffgram(); // reset the diffgram variables
                Logger.Instance.WriteMethodExit();
            }
        }
Esempio n. 2
0
        private XElement MergeServiceConfigurationExports(bool?pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var configDirectory = pilotConfig == null ? this.changesConfigDirectory : (bool)pilotConfig ? this.pilotConfigDirectory : this.productionConfigDirectory;
                var elementName     = pilotConfig == null ? "Changes" : (bool)pilotConfig ? "Pilot" : "Production";
                var templateXml     = string.Format(CultureInfo.InvariantCulture, "<Root><ServiceConfig><{0}/></ServiceConfig></Root>", elementName);
                var configXml       = XElement.Parse(templateXml);

                var config = configXml.XPathSelectElement("*//" + elementName);

                var searchPatern = pilotConfig == null?Documenter.GetReportFileBaseName(this.pilotConfigRelativePath, this.productionConfigRelativePath) + "_changes_??????.xml" : "*.xml";

                foreach (var file in Directory.EnumerateFiles(configDirectory + "/ServiceConfig", searchPatern))
                {
                    config.Add(XElement.Load(file));
                }

                return(configXml);
            }
            finally
            {
                Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);
            }
        }
        /// <summary>
        /// Fills the extensible2 global parameters data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillExtensible2GlobalParametersDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement("//ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var table = dataSet.Tables[0];

                    var parameterDefinitions = connector.XPathSelectElements("private-configuration/MAConfig/parameter-definitions/parameter[use = 'global' and type != 'label' and type != 'divider']");
                    var parameterValues      = connector.XPathSelectElements("private-configuration/MAConfig/parameter-values/parameter[@use = 'global']");

                    var parameterTable = this.GetExtensible2ConfigParametersTable(parameterDefinitions, parameterValues);
                    foreach (DataRow row in parameterTable.Rows)
                    {
                        Documenter.AddRow(table, new object[] { row[0], row[1], row[2], row[3] });
                    }

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
        public AzureADConnectSyncDocumenter(string targetSystem, string referenceSystem)
        {
            Logger.Instance.WriteMethodEntry("TargetSystem: '{0}'. ReferenceSystem: '{1}'.", targetSystem, referenceSystem);

            try
            {
                this.pilotConfigRelativePath      = targetSystem;
                this.productionConfigRelativePath = referenceSystem;
                this.ReportFileName    = Documenter.GetTempFilePath("Report.tmp.html");
                this.ReportToCFileName = Documenter.GetTempFilePath("Report.TOC.tmp.html");

                var rootDirectory = Directory.GetCurrentDirectory().TrimEnd('\\');

                this.pilotConfigDirectory      = string.Format(CultureInfo.InvariantCulture, @"{0}\Data\{1}", rootDirectory, this.pilotConfigRelativePath);
                this.productionConfigDirectory = string.Format(CultureInfo.InvariantCulture, @"{0}\Data\{1}", rootDirectory, this.productionConfigRelativePath);
                this.configReportFilePath      = Documenter.ReportFolder + @"\" + (this.pilotConfigRelativePath ?? string.Empty).Replace(@"\", "_") + "_AppliedTo_" + (this.productionConfigRelativePath ?? string.Empty).Replace(@"\", "_") + "_AADConnectSync_report.html";

                this.ValidateInput();
                this.MergeSyncExports();
            }
            finally
            {
                Logger.Instance.WriteMethodExit("TargetSystem: '{0}'. ReferenceSystem: '{1}'.", targetSystem, referenceSystem);
            }
        }
        /// <summary>
        /// Fills the Generic SQL schema page data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        /// <param name="pageNumber">The page number.</param>
        protected void FillGenericSqlSchemaPageDataSet(bool pilotConfig, int pageNumber)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement(Documenter.GetConnectorXmlRootXPath(pilotConfig) + "/ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var table = dataSet.Tables[0];

                    var parameterDefinitions = connector.XPathSelectElements("private-configuration/MAConfig/parameter-definitions/parameter[use = 'schema' and type != 'label' and type != 'divider' and page-number = '" + pageNumber + "']");

                    var parameterIndex = -1;
                    foreach (var parameterDefinition in parameterDefinitions)
                    {
                        ++parameterIndex;
                        var parameterName = (string)parameterDefinition.Element("name");
                        var parameter     = connector.XPathSelectElement("private-configuration/MAConfig/parameter-values/parameter[@use = 'schema' and @name = '" + parameterName + "' and @page-number = '" + pageNumber + "']");
                        var encrypted     = (string)parameter.Attribute("encrypted") == "1";
                        Documenter.AddRow(table, new object[] { parameterIndex, (string)parameter.Attribute("name"), encrypted ? "******" : (string)parameter });
                    }

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
        /// <summary>
        /// Fills the connector password management configuration data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillActiveDirectoryPasswordManagementConfigurationDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var table = dataSet.Tables[0];

                var connector = config.XPathSelectElement("//ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var enablePasswordSync = !((string)connector.XPathSelectElement("password-sync-allowed") ?? string.Empty).Equals("1", StringComparison.OrdinalIgnoreCase) ? "No" : "Yes";

                    Documenter.AddRow(table, new object[] { 0, "Enable password management", enablePasswordSync });

                    if (enablePasswordSync.Equals("Yes", StringComparison.OrdinalIgnoreCase))
                    {
                        Documenter.AddRow(table, new object[] { 1, "Maximum retry count", (string)connector.XPathSelectElement("password-sync/maximum-retry-count") });
                        Documenter.AddRow(table, new object[] { 2, "Retry interval (seconds)", (string)connector.XPathSelectElement("password-sync/retry-interval") });
                        Documenter.AddRow(table, new object[] { 3, "Require secure connection for password synchronization options", !((string)connector.XPathSelectElement("password-sync/allow-low-security") ?? string.Empty).Equals("1", StringComparison.OrdinalIgnoreCase) ? "Yes" : "No" });
                        Documenter.AddRow(table, new object[] { 4, "Unlock locked accounts when resetting passwords", !((string)connector.XPathSelectElement("password-sync/unlock-account") ?? string.Empty).Equals("1", StringComparison.OrdinalIgnoreCase) ? "Yes" : "No" });
                    }

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'.", pilotConfig);
            }
        }
        /// <summary>
        /// Fills the extensible2 extension information data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillExtensible2ExtensionInformationDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement("//ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var table = dataSet.Tables[0];

                    var connectorAssembly        = (string)connector.XPathSelectElement("private-configuration/MAConfig/extension-config/filename");
                    var connectorAssemblyVersion = (string)connector.XPathSelectElement("private-configuration/MAConfig/extension-config/assembly-version");
                    var connectorCapabilityBits  = (string)connector.XPathSelectElement("private-configuration/MAConfig/extension-config/capability-bits");

                    Documenter.AddRow(table, new object[] { 1, "Connector Assembly Name", connectorAssembly });
                    Documenter.AddRow(table, new object[] { 2, "Connector Assembly Version", connectorAssemblyVersion });
                    Documenter.AddRow(table, new object[] { 3, "Connector Capability Bits", connectorCapabilityBits });

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Gets the connector GAL Exchange configuration print table.
        /// </summary>
        /// <returns>The connector GAL Exchange configuration print table.</returns>
        protected DataTable GetActiveDirectoryGALExchangeConfigurationPrintTable()
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                var printTable = Documenter.GetPrintTable();

                // Table 1
                // Display Order
                printTable.Rows.Add((new OrderedDictionary {
                    { "TableIndex", 0 }, { "ColumnIndex", 0 }, { "Hidden", true }, { "SortOrder", 0 }, { "BookmarkIndex", -1 }, { "JumpToBookmarkIndex", -1 }, { "ChangeIgnored", false }
                }).Values.Cast <object>().ToArray());

                // Setting
                printTable.Rows.Add((new OrderedDictionary {
                    { "TableIndex", 0 }, { "ColumnIndex", 1 }, { "Hidden", false }, { "SortOrder", -1 }, { "BookmarkIndex", -1 }, { "JumpToBookmarkIndex", -1 }, { "ChangeIgnored", false }
                }).Values.Cast <object>().ToArray());

                // Table 2
                // Configuration
                printTable.Rows.Add((new OrderedDictionary {
                    { "TableIndex", 1 }, { "ColumnIndex", 1 }, { "Hidden", false }, { "SortOrder", 0 }, { "BookmarkIndex", -1 }, { "JumpToBookmarkIndex", -1 }, { "ChangeIgnored", false }
                }).Values.Cast <object>().ToArray());

                printTable.AcceptChanges();

                return(printTable);
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }
        /// <summary>
        /// Fills the active directory connection information data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillActiveDirectoryConnectionInformationDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement("//ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var table = dataSet.Tables[0];

                    var forestName = (string)connector.XPathSelectElement("private-configuration/adma-configuration/forest-name");
                    var userName   = (string)connector.XPathSelectElement("private-configuration/adma-configuration/forest-login-user");
                    var userDomain = (string)connector.XPathSelectElement("private-configuration/adma-configuration/forest-login-domain");

                    Documenter.AddRow(table, new object[] { 1, "Forest Name", forestName });
                    Documenter.AddRow(table, new object[] { 2, "User Name", userName });
                    Documenter.AddRow(table, new object[] { 3, "Domain", userDomain });

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
Esempio n. 10
0
        public DocumenterTests()
        {
            Mock <IFileLoader> loader = new Mock <IFileLoader>();

            loader.Setup(fl => fl.LoadFiles("existing_path", "match", true)).Returns(new string[] { "DDL_1", "DDL_2" });
            loader.Setup(fl => fl.LoadFiles("existing_path", "no_match", true)).Returns(new string[] { });
            loader.Setup(fl => fl.LoadFiles("not_existing_path", It.IsAny <string>(), true)).Throws <InvalidOperationException>();
            loader.Setup(fl => fl.LoadFiles(It.IsAny <string>(), It.IsAny <string>(), false)).Throws <NotImplementedException>();

            SchemaInfo schema = new SchemaInfo();
            Mock <ISourceCodeParser> parser = new Mock <ISourceCodeParser>();

            parser.Setup(p => p.Parse(It.Is <IEnumerable <string> >(input => input.Any()), It.IsAny <Options>())).Returns(schema);
            parser.Setup(p => p.Parse(It.Is <IEnumerable <string> >(input => !input.Any()), It.IsAny <Options>())).Throws <ArgumentException>();

            Mock <IDocGenerator> gen = new Mock <IDocGenerator>();

            gen.Setup(g => g.Generate(schema)).Returns("=asciidoc output");

            Mock <IOutputWriter> writer = new Mock <IOutputWriter>();

            writer.Setup(w => w.WriteOutput(It.IsAny <string>(), It.Is <Options>(o => o.Output == "correct_output")));
            writer.Setup(w => w.WriteOutput(It.IsAny <string>(), It.Is <Options>(o => o.Output == "incorrect_output"))).Throws <SystemException>();

            Mock <ILogger> logger = new Mock <ILogger>();

            this.documenter = new Documenter(loader.Object, parser.Object, gen.Object, writer.Object, logger.Object);
        }
        /// <summary>
        /// Fills the global settings data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        private void FillGlobalSettingsDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var table = dataSet.Tables[0];

                var parameters = config.XPathSelectElements("//mv-data//parameter-values/parameter");

                // Sort by name
                parameters                       = from parameter in parameters
                                        let name = (string)parameter.Attribute("name")
                                                   orderby name
                                                   select parameter;

                for (var parameterIndex = 0; parameterIndex < parameters.Count(); ++parameterIndex)
                {
                    var parameter = parameters.ElementAt(parameterIndex);
                    Documenter.AddRow(table, new object[] { (string)parameter.Attribute("name"), (string)parameter });
                }

                table.AcceptChanges();
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
        /// <summary>
        /// Fills the database columns information data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillDatabaseColumnsInformationDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement(Documenter.GetConnectorXmlRootXPath(pilotConfig) + "/ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var table = dataSet.Tables[0];

                    var columns = connector.XPathSelectElements("private-configuration/oledbma-configuration/mms-info/column-info/column");
                    foreach (var column in columns)
                    {
                        var name     = (string)column.Element("name");
                        var dataType = (string)column.Element("data-type");
                        var length   = (string)column.Element("length");
                        var nullable = (string)column.Element("isnullable") == "1" ? "Yes" : "No";
                        var type     = column.Element("mms-type") != null && (string)column.Element("mms-type").Attribute("dn") == "1" ? "Reference DN" : (string)column.Element("mms-type");
                        Documenter.AddRow(table, new object[] { name, dataType, length, nullable, type });
                    }

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
        /// <summary>
        /// Prints the Generic SQL Schema information.
        /// </summary>
        /// <param name="pageNumber">The page number</param>
        protected void PrintGenericSqlSchemaPage(int pageNumber)
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                if (this.DiffgramDataSet.Tables[0].Rows.Count != 0)
                {
                    var sectionTitle = "Schema " + pageNumber;

                    this.WriteSectionHeader(sectionTitle, 4);

                    var headerTable = Documenter.GetSimpleSettingsHeaderTable(new OrderedDictionary {
                        { "Setting", 30 }, { "Configuration", 70 }
                    });

                    this.WriteTable(this.DiffgramDataSet.Tables[0], headerTable);
                }
            }
            finally
            {
                this.ResetDiffgram(); // reset the diffgram variables
                Logger.Instance.WriteMethodExit();
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MIMServiceConfigDocumenter"/> class.
        /// </summary>
        /// <param name="targetSystem">The target / pilot / test system.</param>
        /// <param name="referenceSystem">The reference / baseline / production system.</param>
        public MIMServiceConfigDocumenter(string targetSystem, string referenceSystem)
        {
            Logger.Instance.WriteMethodEntry("TargetSystem: '{0}'. ReferenceSystem: '{1}'.", targetSystem, referenceSystem);

            try
            {
                this.pilotConfigRelativePath      = targetSystem;
                this.productionConfigRelativePath = referenceSystem;
                this.ReportFileName    = Documenter.GetTempFilePath("Report.tmp.html");
                this.ReportToCFileName = Documenter.GetTempFilePath("Report.TOC.tmp.html");

                var rootDirectory = Directory.GetCurrentDirectory().TrimEnd('\\');

                this.pilotConfigDirectory      = string.Format(CultureInfo.InvariantCulture, @"{0}\Data\{1}", rootDirectory, this.pilotConfigRelativePath);
                this.productionConfigDirectory = string.Format(CultureInfo.InvariantCulture, @"{0}\Data\{1}", rootDirectory, this.productionConfigRelativePath);
                this.changesConfigDirectory    = string.Format(CultureInfo.InvariantCulture, @"{0}\Data\{1}", rootDirectory, "Changes");
                this.configReportFilePath      = Documenter.ReportFolder + @"\" + Documenter.GetReportFileBaseName(this.pilotConfigRelativePath, this.productionConfigRelativePath) + "_Service_report.html";

                this.ValidateInput();
                this.MergeServiceExports();
            }
            finally
            {
                Logger.Instance.WriteMethodExit("TargetSystem: '{0}'. ReferenceSystem: '{1}'.", targetSystem, referenceSystem);
            }
        }
        /// <summary>
        /// Fills the active directory connection option data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillActiveDirectoryConnectionOptionDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement("//ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var table = dataSet.Tables[0];

                    var signAndSeal = connector.XPathSelectElement("private-configuration/adma-configuration/sign-and-seal");

                    if ((string)signAndSeal == "1")
                    {
                        Documenter.AddRow(table, new object[] { 1, "Sign and Encrypt LDAP traffic", "Yes" });
                    }
                    else
                    {
                        Documenter.AddRow(table, new object[] { 1, "Sign and Encrypt LDAP traffic", "No" });

                        var sslBind = connector.XPathSelectElement("private-configuration/adma-configuration/ssl-bind");

                        if ((string)sslBind == "1")
                        {
                            Documenter.AddRow(table, new object[] { 2, "Enable SSL for the connection", "Yes" });

                            var crlCheck = sslBind.Attribute("crl-check");

                            var crlCheckEnabled = (string)crlCheck == "1" ? "Yes" : "No";
                            Documenter.AddRow(table, new object[] { 3, "Enable CRL Checking", crlCheckEnabled });
                        }
                        else
                        {
                            Documenter.AddRow(table, new object[] { 2, "Enable SSL for the connection", "No" });
                        }
                    }

                    // Only applicable for AD LDS connector
                    var simpleBind = connector.XPathSelectElement("private-configuration/adma-configuration/simple-bind");

                    if ((string)simpleBind == "1")
                    {
                        Documenter.AddRow(table, new object[] { 4, "Enable Simple Bind", "Yes" });
                    }

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
Esempio n. 16
0
        public void TableCustomizerTest(SqlEngineVersion version)
        {
            var db = new TestDatabaseFks();

            db.SetVersions(version.GetTypeMapper());
            var documenter = new Documenter(DataDefinitionDocumenterTestsHelper.CreateTestDocumenterContext(version, new TableCustomizer()), version, "TestDatabaseFks");

            documenter.Document(db);
        }
Esempio n. 17
0
        public void DocumentTestForeignKeyComposite(SqlEngineVersion version)
        {
            var db = new ForeignKeyComposite();

            db.SetVersions(version.GetTypeMapper());
            var documenter = new Documenter(DataDefinitionDocumenterTestsHelper.CreateTestDocumenterContext(version), version, "ForeignKeyComposite");

            documenter.Document(db);
        }
Esempio n. 18
0
        public void DocumentTestIndexMultiColumnAndInclude(SqlEngineVersion version)
        {
            var db = new TestDatabaseIndexMultiColumnAndInclude();

            db.SetVersions(version.GetTypeMapper());
            var documenter = new Documenter(DataDefinitionDocumenterTestsHelper.CreateTestDocumenterContext(version), version, "TestDatabaseIndexMultiColumnAndInclude");

            documenter.Document(db);
        }
Esempio n. 19
0
        public void DocumentTestUniqueConstraint(SqlEngineVersion version)
        {
            var db = new TestDatabaseUniqueConstraint();

            db.SetVersions(version.GetTypeMapper());
            var documenter = new Documenter(DataDefinitionDocumenterTestsHelper.CreateTestDocumenterContext(version), version, "TestDatabaseUniqueConstraint");

            documenter.Document(db);
        }
        /// <summary>
        /// Fills the database connection information data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillDatabaseConnectionInformationDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement(Documenter.GetConnectorXmlRootXPath(pilotConfig) + "/ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var table = dataSet.Tables[0];

                    var serverName          = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/server");
                    var database            = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/databasename");
                    var dataSource          = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/datasource");
                    var tableName           = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/tablename");
                    var deltaTableName      = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/delta-tablename");
                    var multivalueTableName = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/multivalued-tablename");
                    var integratedAuth      = ((string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/authentication") ?? string.Empty).Equals("integrated", StringComparison.OrdinalIgnoreCase);
                    var userName            = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/user");
                    var userDomain          = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/connection-info/domain");

                    Documenter.AddRow(table, new object[] { 1, "Server Name", serverName });
                    if (!string.IsNullOrEmpty(dataSource))
                    {
                        Documenter.AddRow(table, new object[] { 2, "Data Source", dataSource });
                    }
                    else
                    {
                        Documenter.AddRow(table, new object[] { 2, "Database", database });
                    }

                    Documenter.AddRow(table, new object[] { 3, "Table/View", tableName });
                    Documenter.AddRow(table, new object[] { 4, "Delta Table/View", deltaTableName });
                    Documenter.AddRow(table, new object[] { 5, "Multivalue Table", multivalueTableName });

                    if (!this.ConnectorCategory.Equals("DB2", StringComparison.OrdinalIgnoreCase))
                    {
                        Documenter.AddRow(table, new object[] { 6, "Authentication", integratedAuth ? "Windows integrated authentication" : this.ConnectorCategory.Equals("MSSQL", StringComparison.OrdinalIgnoreCase) ? "SQL authentication" : "Database authentication" });
                    }

                    Documenter.AddRow(table, new object[] { 7, "User Name", userName });
                    Documenter.AddRow(table, new object[] { 8, "Password", "******" });
                    Documenter.AddRow(table, new object[] { 9, "Domain", userDomain });

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
        public void CircularDdA0B1C1_B2C2(SqlEngineVersion version)
        {
            var dd = new CircularDdA0B1C1_B2C2();

            dd.SetVersions(version.GetTypeMapper());

            var documenter = new Documenter(DataDefinitionDocumenterTestsHelper.CreateTestDocumenterContext(version), version, "CircularDdA0B1C1_B2C2");

            documenter.Document(dd);
        }
        /// <summary>
        /// Fills the extensible2 run profile data set.
        /// </summary>
        /// <param name="runProfileName">Name of the run profile.</param>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected override void FillConnectorRunProfileDataSet(string runProfileName, bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Run Profile Name: '{0}'. Pilot Config: '{1}'.", runProfileName, pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement("//ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    base.FillConnectorRunProfileDataSet(runProfileName, pilotConfig);

                    var table  = dataSet.Tables[0];
                    var table2 = dataSet.Tables[1];

                    var runProfileSteps = connector.XPathSelectElements("ma-run-data/run-configuration[name = '" + runProfileName + "']/configuration/step");

                    for (var stepIndex = 1; stepIndex <= runProfileSteps.Count(); ++stepIndex)
                    {
                        var runProfileStep = runProfileSteps.ElementAt(stepIndex - 1);

                        var batchSize = (string)runProfileStep.XPathSelectElement("custom-data/extensible2-step-data/batch-size");
                        if (!string.IsNullOrEmpty(batchSize))
                        {
                            Documenter.AddRow(table2, new object[] { stepIndex, "Batch Size (objects)", batchSize, 1000 });
                        }

                        var timeout = (string)runProfileStep.XPathSelectElement("custom-data/extensible2-step-data/timeout");
                        if (!string.IsNullOrEmpty(timeout))
                        {
                            Documenter.AddRow(table2, new object[] { stepIndex, "Timeout (seconds)", timeout, 1001 });
                        }

                        var parameterDefinitions = connector.XPathSelectElements("private-configuration/MAConfig/parameter-definitions/parameter[use = 'run-step' and type != 'label' and type != 'divider']");
                        var parameterValues      = runProfileStep.XPathSelectElements("custom-data/parameter-values/parameter");

                        var parameterTable = this.GetExtensible2ConfigParametersTable(parameterDefinitions, parameterValues);
                        foreach (DataRow row in parameterTable.Rows)
                        {
                            Documenter.AddRow(table2, new object[] { stepIndex, row[1], row[2], 1000 + (int)row[0] });
                        }
                    }

                    table.AcceptChanges();
                    table2.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Run Profile Name: '{0}'. Pilot Config: '{1}'.", runProfileName, pilotConfig);
            }
        }
        /// <summary>
        /// Fills the database columns information data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillDatabaseSpecialAttributesDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement(Documenter.GetConnectorXmlRootXPath(pilotConfig) + "/ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var table = dataSet.Tables[0];

                    var anchorAttributes = connector.XPathSelectElements("private-configuration/oledbma-configuration/mms-info/anchor/attribute");
                    var anchor           = string.Empty;
                    foreach (var anchorAttribute in anchorAttributes)
                    {
                        anchor += (string)anchorAttribute + "+";
                    }

                    Documenter.AddRow(table, new object[] { 1, "Anchor", anchor.Trim('+') });

                    var objectTypeColumn = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/mms-info/object-type-info/object-type-column") ?? string.Empty;

                    if (string.IsNullOrEmpty(objectTypeColumn))
                    {
                        var objectType = (string)connector.XPathSelectElement("private-configuration/oledbma-configuration/mms-info/object-type");

                        Documenter.AddRow(table, new object[] { 2, "Fixed Object Type", (string)objectType });
                    }
                    else
                    {
                        Documenter.AddRow(table, new object[] { 3, "Object Type Column", (string)objectTypeColumn });

                        var objectTypes = connector.XPathSelectElements("private-configuration/oledbma-configuration/mms-info/object-type-info/object-type");
                        for (var objectTypeIndex = 0; objectTypeIndex < objectTypes.Count(); ++objectTypeIndex)
                        {
                            var objectType = (string)objectTypes.ElementAt(objectTypeIndex);

                            Documenter.AddRow(table, new object[] { 4 + objectTypeIndex, "Object Type", objectType });
                        }
                    }

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'", pilotConfig);
            }
        }
        /// <summary>
        /// Fills the Active Directory run profile data set.
        /// </summary>
        /// <param name="runProfileName">Name of the run profile.</param>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected override void FillConnectorRunProfileDataSet(string runProfileName, bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Run Profile Name: '{0}'. Pilot Config: '{1}'.", runProfileName, pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var connector = config.XPathSelectElement("//ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    base.FillConnectorRunProfileDataSet(runProfileName, pilotConfig);

                    var table  = dataSet.Tables[0];
                    var table2 = dataSet.Tables[1];

                    var runProfileSteps = connector.XPathSelectElements("ma-run-data/run-configuration[name = '" + runProfileName + "']/configuration/step");

                    for (var stepIndex = 1; stepIndex <= runProfileSteps.Count(); ++stepIndex)
                    {
                        var runProfileStep = runProfileSteps.ElementAt(stepIndex - 1);

                        var batchSize = (string)runProfileStep.XPathSelectElement("custom-data/adma-step-data/batch-size");
                        if (!string.IsNullOrEmpty(batchSize))
                        {
                            Documenter.AddRow(table2, new object[] { stepIndex, "Batch Size (objects)", batchSize, 1000 });
                        }

                        var pageSize = (string)runProfileStep.XPathSelectElement("custom-data/adma-step-data/page-size");
                        if (!string.IsNullOrEmpty(pageSize))
                        {
                            Documenter.AddRow(table2, new object[] { stepIndex, "Page Size (objects)", pageSize, 1001 });
                        }

                        var timeout = (string)runProfileStep.XPathSelectElement("custom-data/adma-step-data/time-limit");
                        if (!string.IsNullOrEmpty(timeout))
                        {
                            Documenter.AddRow(table2, new object[] { stepIndex, "Timeout (seconds)", timeout, 1002 });
                        }
                    }

                    table.AcceptChanges();
                    table2.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Run Profile Name: '{0}'. Pilot Config: '{1}'.", runProfileName, pilotConfig);
            }
        }
        /// <summary>
        /// Fills the AttributeTypeDescription summary dataset.
        /// </summary>
        protected void FillAttributeTypeDescriptionSummaryDiffgramDataSet()
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                var diffgramTable = this.DiffgramDataSet.Tables[0];

                var objectType = "AttributeTypeDescription";

                var changeObjects = this.GetChangedObjects(objectType);

                if (changeObjects.Count() == 0)
                {
                    this.WriteContentParagraph(string.Format(CultureInfo.CurrentUICulture, DocumenterResources.NoCustomizationsDetected, ServiceCommonDocumenter.GetObjectTypeDisplayName(objectType)));
                }
                else
                {
                    foreach (var changeObject in changeObjects)
                    {
                        this.CurrentChangeObject = changeObject;
                        var state = this.CurrentChangeObjectState;
                        var objectModificationType = state == "Create" ? DataRowState.Added : state == "Delete" ? DataRowState.Deleted : DataRowState.Modified;
                        var attributeObjectId      = this.GetAttributeChange("ObjectID");
                        var displayNameChange      = this.GetAttributeChange("DisplayName");
                        var systemNameChange       = this.GetAttributeChange("Name");
                        var dataTypeChange         = this.GetAttributeChange("DataType");
                        var descriptionChange      = this.GetAttributeChange("Description");

                        var objectId             = attributeObjectId.NewValue;
                        var objectIdOld          = attributeObjectId.OldValue;
                        var displayName          = displayNameChange.NewValue;
                        var displayNameOld       = displayNameChange.OldValue;
                        var displayNameMarkupNew = ServiceCommonDocumenter.GetJumpToBookmarkLocationMarkup(displayName, objectId, objectModificationType);
                        var displayNameMarkupOld = ServiceCommonDocumenter.GetJumpToBookmarkLocationMarkup(displayNameOld, objectIdOld, objectModificationType);
                        var systemName           = systemNameChange.NewValue;
                        var dataType             = dataTypeChange.NewValue;
                        var description          = descriptionChange.NewValue;
                        var descriptionOld       = descriptionChange.OldValue;

                        Documenter.AddRow(diffgramTable, new object[] { displayName, displayNameMarkupNew, systemName, dataType, description, objectModificationType, displayNameOld, displayNameMarkupOld, descriptionOld });
                    }

                    this.DiffgramDataSet = Documenter.SortDataSet(this.DiffgramDataSet);
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }
        /// <summary>
        /// Creates the extensible2 anchor configurations diffgram.
        /// </summary>
        protected void CreateExtensible2AnchorConfigurationsDiffgram()
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                this.DiffgramDataSet = Documenter.GetDiffgram(this.PilotDataSet, this.ProductionDataSet);
                this.DiffgramDataSets.Add(this.DiffgramDataSet);
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }
        public void CircularFKDetectorABC_X(SqlEngineVersion version)
        {
            var dd = new CircularDdABC_X();

            dd.SetVersions(version.GetTypeMapper());

            var documenter = new Documenter(DataDefinitionDocumenterTestsHelper.CreateTestDocumenterContext(version), version, "CircularDdABC_X");

            documenter.Document(dd);

            // TODO move to dd test
            // CircularFKDetector.DectectCircularFKs(dd.GetTables());
            // var cs = dd.GetTables().Select(t => t.Properties.OfType<CircularFK>()).ToList();
        }
Esempio n. 28
0
        /// <summary>
        /// Creates the connector GAL Exchange configuration difference gram.
        /// </summary>
        protected void CreateActiveDirectoryGALExchangeConfigurationDiffgram()
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                this.DiffgramDataSet = Documenter.GetDiffgram(this.PilotDataSet, this.ProductionDataSet);
                this.DiffgramDataSets.Add(this.DiffgramDataSet);
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }
        /// <summary>
        /// Creates the metaverse object deletion rule difference gram.
        /// </summary>
        private void CreateMetaverseObjectDeletionRuleDiffgram()
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                this.DiffgramDataSet = Documenter.GetDiffgram(this.PilotDataSet, this.ProductionDataSet);
                this.DiffgramDataSets.Add(this.DiffgramDataSet);
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Fills the connector GAL Exchange configuration data set.
        /// </summary>
        /// <param name="pilotConfig">if set to <c>true</c>, the pilot configuration is loaded. Otherwise, the production configuration is loaded.</param>
        protected void FillActiveDirectoryGALExchangeConfigurationDataSet(bool pilotConfig)
        {
            Logger.Instance.WriteMethodEntry("Pilot Config: '{0}'.", pilotConfig);

            try
            {
                var config  = pilotConfig ? this.PilotXml : this.ProductionXml;
                var dataSet = pilotConfig ? this.PilotDataSet : this.ProductionDataSet;

                var table  = dataSet.Tables[0];
                var table2 = dataSet.Tables[1];

                var connector = config.XPathSelectElement("//ma-data[name ='" + this.ConnectorName + "']");

                if (connector != null)
                {
                    var smtpDomains = connector.XPathSelectElements("private-configuration/adma-configuration/ui-data/galma/smtp-mail-domains/domain");

                    Documenter.AddRow(table, new object[] { 0, "SMTP mail suffix(s) for mailbox and mail objects in this forest" });
                    if (smtpDomains.Count() == 0)
                    {
                        Documenter.AddRow(table2, new object[] { 0, "None" });
                    }
                    else
                    {
                        foreach (var smtpDomain in smtpDomains)
                        {
                            Documenter.AddRow(table2, new object[] { 0, smtpDomain.Value });
                        }
                    }

                    var mailRouting = ((string)connector.XPathSelectElement("private-configuration/adma-configuration/ui-data/galma/mail-routing") ?? string.Empty).Equals("true", StringComparison.OrdinalIgnoreCase) ? "Yes" : "No";

                    Documenter.AddRow(table, new object[] { 1, "Route mail through this forest for all contacts created from contacts in this forest" });
                    Documenter.AddRow(table2, new object[] { 1, mailRouting });

                    var crossForestDelegation = ((string)connector.XPathSelectElement("private-configuration/adma-configuration/ui-data/galma/cross-forest-delegation") ?? string.Empty).Equals("true", StringComparison.OrdinalIgnoreCase) ? "Yes" : "No";

                    Documenter.AddRow(table, new object[] { 2, "Support cross-forest delegation (Exchange 2007 or 2010 only)" });
                    Documenter.AddRow(table2, new object[] { 2, crossForestDelegation });

                    table.AcceptChanges();
                }
            }
            finally
            {
                Logger.Instance.WriteMethodExit("Pilot Config: '{0}'.", pilotConfig);
            }
        }