コード例 #1
0
        public void CompareMaxIds_null_both()
        {
            string idA    = null;
            string idB    = null;
            var    result = RepoPollAgent.CompareMaxIds(idA, idB);

            Assert.IsTrue(result == 0);
        }
コード例 #2
0
        public void CompareMaxIds_null_right()
        {
            string idA    = "123";
            string idB    = null;
            var    result = RepoPollAgent.CompareMaxIds(idA, idB);

            Assert.IsTrue(result > 0);
        }
コード例 #3
0
        public void CompareMaxIds_null_left()
        {
            string idA    = null;
            string idB    = "-1123";
            var    result = RepoPollAgent.CompareMaxIds(idA, idB);

            Assert.IsTrue(result < 0);
        }
コード例 #4
0
        public void CompareMaxIds_date_right()
        {
            string idA    = "2019-05-28 11:01:47.499";
            string idB    = "2019-05-28 11:00:47.499";
            var    result = RepoPollAgent.CompareMaxIds(idA, idB);

            Assert.IsTrue(result > 0);
        }
コード例 #5
0
        public void CompareMaxIds_date_equal()
        {
            string idA    = "2019-05-28 11:00:47.499";
            string idB    = "2019-05-28 11:00:47.499";
            var    result = RepoPollAgent.CompareMaxIds(idA, idB);

            Assert.AreEqual(0, result);
        }
コード例 #6
0
        public void CompareMaxIds_int_equal()
        {
            string idA    = "123";
            string idB    = "123";
            var    result = RepoPollAgent.CompareMaxIds(idA, idB);

            Assert.AreEqual(0, result);
        }
コード例 #7
0
        public PaletteInsightAgent(bool loadOptionsFromConfig = true)
        {
            // Set the working directory
            Assembly assembly = Assembly.GetExecutingAssembly();

            Directory.SetCurrentDirectory(Path.GetDirectoryName(assembly.Location));

            APIClient.SetTrustSSL();

            // Load PaletteInsightAgentOptions.  In certain use cases we may not want to load options from the config, but provide them another way (such as via a UI).
            options = PaletteInsightAgentOptions.Instance;

            // Locate the Tableau data folder
            tableauDataFolder = Loader.FindTableauDataFolder();

            var configuration = Loader.LoadConfigFile("config/Config.yml");

            Loader.LoadConfigTo(configuration, tableauDataFolder, options);

            // Make sure that our HTTP client is initialized, because Splunk logger might be enabled
            // and it is using HTTP to send log messages to Splunk.
            APIClient.Init(options.WebserviceConfig);

            // Add the webservice username/auth token from the license
            Configuration.Loader.UpdateWebserviceConfigFromLicense(options);

            // NOTE: License check disabled as this project became open-source
            //// check the license after the configuration has been loaded.
            //licenseGuard = new LicenseGuard();
            //if (!licenseGuard.CheckLicense(options.LicenseKey))
            //{
            //    Log.Fatal("Invalid license! Exiting...");
            //    Environment.Exit(-1);
            //}

            // Showing the current version in the log
            FileVersionInfo fvi     = FileVersionInfo.GetVersionInfo(assembly.Location);
            string          version = fvi.FileVersion;

            Log.Info("Palette Insight Agent version: " + version);

            USE_LOGPOLLER      = options.UseLogPolling;
            USE_THREADINFO     = options.UseThreadInfo;
            USE_COUNTERSAMPLES = options.UseCounterSamples;

            USE_TABLEAU_REPO     = options.UseRepoPolling;
            USE_STREAMING_TABLES = options.UseStreamingTables;
            if (USE_TABLEAU_REPO != USE_STREAMING_TABLES)
            {
                // Having different setup for Tableau repo and streaming tables is not welcome
                Log.Error("Invalid repo poll configuration! Either both Tableau repo poll and streaming tables poll should be enabled, or neither! Repo poll: {0} vs. Streaming tables: {1}",
                          USE_TABLEAU_REPO, USE_STREAMING_TABLES);
            }

            if (USE_LOGPOLLER)
            {
                // Load the log poller config & start the agent
                logPollerAgent = new LogPollerAgent(options.LogFolders, options.LogLinesPerBatch);
            }

            if (USE_THREADINFO)
            {
                // start the thread info agent
                threadInfoAgent = new ThreadInfoAgent(options.ThreadInfoPollInterval);
            }

            Loader.AddRepoFromWorkgroupYaml(configuration, tableauDataFolder, options);
            tableauRepo   = new Tableau9RepoConn(options.RepositoryDatabase, options.StreamingTablesPollLimit);
            repoPollAgent = new RepoPollAgent();
        }