コード例 #1
0
 public static void MyClassInitialize(TestContext testContext)
 {
     ConParams = new ConnectionParameters
     {
         Type     = "MS-SQL",
         Name     = "MS-SQL Connection",
         Host     = Settings.Default.mssql_host,
         Database = Settings.Default.mssql_database,
         Port     = Settings.Default.mssql_port,
         User     = Settings.Default.mssql_user,
         Password = Settings.Default.mssql_password
     };
     DBWorker.ConfigureDBConnection(ConParams);
     DBWorker.OpenConnection();
     DBWorker.BuildMetadataRepository();
     Model = Serializer.Deserialize <MatrixSelectionModel>(@"Files\MS-SQLResults.mpm");
 }
コード例 #2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            string testDbPath = AppDomain.CurrentDomain.BaseDirectory + @"\Files\test.sqlite.db";

            // To enable tests in a virtual machine (change the letter accordingly)
            if (!Char.IsLetter(testDbPath.First()))
            {
                testDbPath = "Z:" + testDbPath.Substring(10);
            }

            ConParams = new ConnectionParameters("SQLite", "SQLite Connection", "", testDbPath);

            DBWorker.ConfigureDBConnection(ConParams);
            DBWorker.OpenConnection();

            DBWorker.BuildMetadataRepository();

            Model = Serializer.Deserialize <MatrixSelectionModel>(@"Files\MatrixSelection.mpm");
        }
コード例 #3
0
        public static void MyClassInitialize(TestContext testContext)
        {
            //Assert.Inconclusive("Oracle not yet tested");
            ConParams = new ConnectionParameters
            {
                Type     = "Oracle",
                Name     = "Oracle Connection",
                Host     = Settings.Default.oracle_host,
                Database = Settings.Default.oracle_service,
                Port     = Settings.Default.oracle_port,
                User     = Settings.Default.oracle_user,
                Password = Settings.Default.oracle_password
            };

            DBWorker.ConfigureDBConnection(ConParams);
            DBWorker.OpenConnection();

            DBWorker.BuildMetadataRepository();

            Model = Serializer.Deserialize <MatrixSelectionModel>(@"Files\OracleResults.mpm");
        }
コード例 #4
0
        public static void MyClassInitialize(TestContext testContext)
        {
            string testDbPath = AppDomain.CurrentDomain.BaseDirectory + @"\Files\test.sqlite.db";

            // To enable tests in a virtual machine (change the letter accordingly)
            if (!Char.IsLetter(testDbPath.First()))
            {
                testDbPath = "Z:" + testDbPath.Substring(10);
            }

            ConParams = new ConnectionParameters("SQLite", "SQLite Connection", "", testDbPath);

            String dbDatabaseWithoutPathName = ConParams.Database.Substring(ConParams.Database.LastIndexOf(("\\"), StringComparison.Ordinal) + 1);

            Path = AppDomain.CurrentDomain.BaseDirectory + @"\Metadata_" + dbDatabaseWithoutPathName + "@" + ConParams.Host + ".xml";

            DBWorker.ConfigureDBConnection(ConParams);
            DBWorker.OpenConnection();

            DBWorker.BuildMetadataRepository();
            XMLHelper.SerializeObjectToXML(Path, DBWorker.MetaData);

            XmlMetadata = XMLHelper.DeserializeObjectFromXML <MetaDataRepository>(Path);
        }
コード例 #5
0
        /// <summary>
        /// Configures and opens a database connection
        /// Builds the metadata repository and loads the xml-serialized metadata-file.
        /// Navigates to page P2Metadata
        /// </summary>
        /// <param name="conParams"></param>
        /// <returns></returns>
        /// <author>Bernhard Bruns, Moritz Eversmann, Bernd Nottbeck</author>
        public static bool EstablishDatabaseConnection(ConnectionParameters conParams)
        {
            try
            {
                if (DBWorker.ConfigureDBConnection(conParams))
                {
                    DBWorker.OpenConnection();

                    MainWindow.ConnectionName = DBWorker.GetConnectionName();

                    DBWorker.BuildMetadataRepository();

                    XMLHelper.SynchronizeFactTableWithXML(conParams);

                    DefaultEventClassifierIsSelected = false;

                    if (DBWorker.MetaData.EventClassifier == "")
                    {
                        DefaultEventClassifierIsSelected = true;
                        if (DBWorker.MetaData.ListOfEventsTableColumnNames.Contains("PROC_DESCRIPTION"))
                        {
                            DBWorker.MetaData.EventClassifier = "PROC_DESCRIPTION";
                        }
                        else if (DBWorker.MetaData.ListOfEventsTableColumnNames.Contains("activity"))
                        {
                            DBWorker.MetaData.EventClassifier = "activity";
                        }
                        else if (DBWorker.MetaData.ListOfEventsTableColumnNames.Contains("ACTIVITY"))
                        {
                            DBWorker.MetaData.EventClassifier = "ACTIVITY";
                        }
                        else
                        {
                            DefaultEventClassifierIsSelected = false;
                        }
                    }
                    NavigationCommands.GoToPage.Execute("/Pages/P2metadata.xaml", null);
                }

                return(true);
            }
            catch (TypeInitializationException ex)
            {
                ErrorHandling.ReportErrorToUser("Error: Type initialization. " + ex.Message);
            }
            catch (NoParamsGivenException)
            {
                ErrorHandling.ReportErrorToUser("Error: No databasefields are filled.");
            }
            catch (DBException ex)
            {
                ErrorHandling.ReportErrorToUser("Database error: " + ex.Message);
            }
            catch (TimeoutException ex)
            {
                ErrorHandling.ReportErrorToUser("Database Timeout: " + ex.Message);
            }
            catch (Exception ex)
            {
                ErrorHandling.ReportErrorToUser("Error: " + ex.Message + " " + ex.StackTrace);
            }
            return(false);
        }