Beispiel #1
0
        private void processAddBtn_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "application (*.exe) |*.exe";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    //var filePath = openFileDialog1.FileName;
                    string fileName = Path.GetFileNameWithoutExtension(openFileDialog1.FileName);
                    //MessageBox.Show(fileName);
                    ApplicationRule applicationObj = new ApplicationRule
                    {
                        processName = fileName,
                        sleep       = true
                    };
                    appList.Add(applicationObj);
                    SerializeObject(appList);

                    RefreshProcessListBox();
                    processListBox.SelectedIndex = appList.Count - 1;
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Error message: {ex.Message}\n\n" +
                                    $"Details:\n\n{ex.StackTrace}");
                }
            }
        }
Beispiel #2
0
        public void TestCurrentBackFact()
        {
            /*
             * Configuration : TEXT;APPLICATION_METRIC;SNAPSHOT=CURRENT,BFID=66061,FORMAT=N0
             * DreamTeamSnap4Sample12.json : AED3/applications/7/snapshots/15/results?sizing-measures=(10151,10107,10152,10154,10161)
             * DreamTeamSnap1Sample12.json : AED3/applications/7/snapshots/15/results?sizing-measures=(10151,10107,10152,10154,10161)
             */
            ReportData reportData = TestUtility.PrepaReportData("Dream Team",
                                                                null, @".\Data\DreamTeamSnap4Sample12.json", "AED3/applications/7/snapshots/15", "ADGAutoSnap_Dream Team_4", "4",
                                                                null, @".\Data\DreamTeamSnap1Sample12.json", "AED3/applications/7/snapshots/3", "ADGAutoSnap_Dream Team_1", "1");

            // Needed for background facts, as there are retrieved one by one by url request
            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);

            var component = new ApplicationRule();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "SNAPSHOT", "CURRENT" },
                { "BFID", "66061" },
                { "FORMAT", "N0" }
            };
            var str = component.Content(reportData, config);

            Assert.AreEqual("2", str);
        }
Beispiel #3
0
        /// <summary>
        /// Adds or Updates an Application Rule using the specified Qualifier, Suffix, and Parent Rule Id
        /// </summary>
        /// <param name="qualifier"></param>
        /// <param name="ruleName"></param>
        /// <param name="parentRuleId"></param>
        /// <returns></returns>
        public ApplicationRule AddOrUpdateRole(string qualifier, string ruleName, string parentRuleId = null)
        {
            var role = ApplicationRules.FirstOrDefault(i => i.Qualifier == qualifier && i.Name == ruleName);

            if (role == null)
            {
                role = new ApplicationRule(qualifier, ruleName, parentRuleId);
            }
            else
            {
                role.ParentRuleId = parentRuleId;
            }

            ApplicationRules.AddOrUpdate(role);
            return(role);
        }
Beispiel #4
0
        public void TestNoPreviousSizing()
        {
            /*
             * Configuration : TEXT;APPLICATION_METRIC;SNAPSHOT=PREVIOUS,SZID=10154,FORMAT=N0
             * DreamTeamSnap4Sample12.json : AED3/applications/7/snapshots/15/results?sizing-measures=(10151,10107,10152,10154,10161)
             */
            ReportData reportData = TestUtility.PrepaReportData("Dream Team",
                                                                null, @".\Data\DreamTeamSnap4Sample12.json", "AED3/applications/7/snapshots/15", "ADGAutoSnap_Dream Team_4", "4",
                                                                null, null, null, null, null);

            var component = new ApplicationRule();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "SNAPSHOT", "PREVIOUS" },
                { "SZID", "10154" },
                { "FORMAT", "N0" }
            };
            var str = component.Content(reportData, config);

            Assert.AreEqual("n/a", str);
        }
Beispiel #5
0
        public void TestCurrentQR()
        {
            /*
             * Configuration : TEXT;APPLICATION_METRIC;SNAPSHOT=CURRENT,ID=7254,FORMAT=N2
             * @".\Data\Snapshot_QIresults1.json" is the result of http://localhost:7070/CAST-AAD-AED/rest/AED2/applications/3/snapshots/4/results?quality-indicators=(60011,60012,60013,60014,60016,60017,61001,61003,61007,1576,1596,4656,7254)&modules=$all&technologies=$all&categories=$all
             * @".\Data\Snapshot_QIresults2.json" is the result of http://localhost:7070/CAST-AAD-AED/rest/AED2/applications/3/snapshots/3/results?quality-indicators=(60011,60012,60013,60014,60016,60017,61001,61003,61007,1576,1596,4656,7254)&modules=$all&technologies=$all&categories=$all
             */
            ReportData reportData = TestUtility.PrepaReportData("AppliAEP",
                                                                null, @".\Data\Snapshot_QIresults1.json", "AED3/applications/3/snapshots/4", "Snap_v1.1.4", "v1.1.4",
                                                                null, @".\Data\Snapshot_QIresults2.json", "AED3/applications/3/snapshots/3", "Snap_v1.1.3", "v1.1.3");

            var component = new ApplicationRule();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "SNAPSHOT", "CURRENT" },
                { "ID", "7254" },
                { "FORMAT", "N2" }
            };
            var str = component.Content(reportData, config);

            Assert.AreEqual("3.71", str);
        }
Beispiel #6
0
        public void TestMillionId()
        {
            /*
             * Configuration : TEXT;APPLICATION_METRIC;SNAPSHOT=CURRENT,ID=60014,FORMAT=N2
             * @".\Data\Sample1Current.json" => http://localhost:7070/CAST-AAD-AED/rest/AED/applications/3/snapshots/6/results?quality-indicators=(60013,60014,60017)
             * @".\Data\Sample1Previous.json" => http://localhost:7070/CAST-AAD-AED/rest/AED/applications/3/snapshots/3/results?quality-indicators=(60013,60014,60017)
             */
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            var component = new ApplicationRule();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "SNAPSHOT", "CURRENT" },
                { "ID", "11203569" },
                { "FORMAT", "N2" }
            };
            var str = component.Content(reportData, config);

            Assert.AreEqual("1.92", str);
        }