Example #1
0
        /// <summary>
        /// Reports if this set of configuration mix constraints can be satisfied on the specified
        /// machine. If no machine is specified, active machine is queried.
        /// </summary>
        /// <returns></returns>
        internal bool IsSatisfied(MachineRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }

            //Note - The query operators may be worth caching... Need to see how that plays out.
            if (!HasMatch(OperatingSystems, record.OperatingSystem))
            {
                Explanation = "Configuration OSes: " + OperatingSystems.ToCommaSeparatedList() + " did not match " + record.OperatingSystem;
                return(false);
            }
            else if (!HasMatch(Architectures, record.Architecture))
            {
                Explanation = "Configuration Architectures: " + Architectures.ToCommaSeparatedList() + " did not match: " + record.Architecture;
                return(false);
            }
            else if (Culture != null && !Culture.Equals(record.Culture, StringComparison.OrdinalIgnoreCase))
            {
                Explanation = "Configuration Culture: " + Culture + " did not match:" + record.Culture;
                return(false);
            }
            else if (!String.IsNullOrEmpty(MultiMonitor) &&
                     (String.Compare(MultiMonitor, "True", StringComparison.InvariantCultureIgnoreCase) == 0) &&
                     (record.MonitorCount < 2))
            {
                Explanation = "Configuration MultiMonitor did not match. Test need multiple monitors, actual monitors enabled: " + record.MonitorCount;
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #2
0
        private void HtmlLicznikToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MachineRecord record = (MachineRecord)fastObjectListView1.SelectedObjects[0];
            string        html   = record.GetCounter().full_counter;

            new FHTMLView(html).ShowDialog();
        }
        public void ReplaceMachineRecrod(MachineRecord r, RecordsCollection recordsCollection)
        {
            if (r != null)
            {
                IMongoCollection <MachineRecord> collection;
                if (recordsCollection == RecordsCollection.Normal)
                {
                    var filter = Builders <MachineRecord> .Filter.Eq(e => e.id, r.id);

                    collection = _database.GetCollection <MachineRecord>(Collections.machine_records.ToString());
                    collection.ReplaceOne(filter, r);
                }
                else if (recordsCollection == RecordsCollection.Others)
                {
                    var filter = Builders <MachineRecord> .Filter.Eq(e => e.id, r.id);

                    collection = _database.GetCollection <MachineRecord>(Collections.machine_records_other.ToString());
                    collection.ReplaceOne(filter, r);
                }
                else
                {
                    throw new ArgumentException();
                }
            }
        }
Example #4
0
        private void HtmlNumerSeryjnyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MachineRecord record = (MachineRecord)fastObjectListView1.SelectedObjects[0];
            string        html   = record.GetSerial().full_serialnumber;

            new FHTMLView(html).ShowDialog();
        }
Example #5
0
 private void FastObjectListViewMouseDoubleClick(object sender, EventArgs e)
 {
     if (fastObjectListView1.SelectedObjects.Count > 0)
     {
         MachineRecord record = (MachineRecord)fastObjectListView1.SelectedObjects[0];
         record.GetDevice()?.ShowDevice();
     }
 }
Example #6
0
 private void showDevice_Click(object sender, EventArgs e)
 {
     if (fastObjectListView1.SelectedObjects.Count > 0)
     {
         MachineRecord record = (MachineRecord)fastObjectListView1.SelectedObjects[0];
         record.ShowClient();
     }
 }
Example #7
0
        internal static MachineRecord QueryMachine()
        {
            MachineRecord record = new MachineRecord();

            record.Architecture    = QueryArchitecture();
            record.Culture         = QueryCulture();
            record.MonitorCount    = QueryMonitorCount();
            record.Name            = QueryName();
            record.OperatingSystem = QueryOperatingSystem();
            return(record);
        }
Example #8
0
 /// <summary>
 /// Encapsulates logic for reporting Machine centric information.
 /// For now, this is just the machine name, but may change in future.
 /// </summary>
 /// <param name="machine"></param>
 /// <returns></returns>
 internal static string ReportMachine(MachineRecord machine)
 {
     if (machine != null)
     {
         return(machine.Name);
     }
     else
     {
         return("[Did not Execute]");
     }
 }
Example #9
0
        private void emailMessageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MachineRecord record    = (MachineRecord)fastObjectListView1.SelectedObjects[0];
            string        emailText = record.GetEmail().GetEmail();

            //new FHTMLView(html).ShowDialog();
            //new FRichTextView(html).ShowDialog();
            FEmailView view = new FEmailView();

            view.cEmailView1.SetText(emailText);
            view.cEmailView1.AddAttachments(record.GetEmail().GetAttachments());
            view.Show();
        }
        public MachineRecord GetFirstInMonth(string serial_number, DateTime month)
        {
            MachineRecord record = null;

            if (string.IsNullOrEmpty(serial_number) == false)
            {
                var collection = _database.GetCollection <MachineRecord>(Collections.machine_records.ToString());
                var filter     = Builders <MachineRecord> .Filter.Gte(e => e.datetime, month) & Builders <MachineRecord> .Filter.Eq(e => e.serial_number, serial_number);

                record = collection.Find(filter).FirstOrDefault();
                record?.InitValues();
            }
            return(record);
        }
        public MachineRecord GetLatestForDevice(string serial_number)
        {
            MachineRecord record = null;

            if (serial_number != null)
            {
                var collection = _database.GetCollection <MachineRecord>(Collections.machine_records.ToString());
                var sort       = Builders <MachineRecord> .Sort.Descending(e => e.datetime);

                var filter = Builders <MachineRecord> .Filter.Eq(e => e.serial_number, serial_number);

                record = collection.Find <MachineRecord>(filter)?.Sort(sort)?.FirstOrDefault();

                record?.InitValues();
            }
            return(record);
        }
 private bool MachineCanRunTest(TestRecord testRecord, MachineRecord machine, DirectoryInfo testBinariesDirectory)
 {
     // Tests with no Configuration Mixes automatically pass this filter.
     if (testRecord.TestInfo.Configurations != null && testRecord.TestInfo.Configurations.Count != 0)
     {
         //Find a configuration mix which the machine satisfies, in order to run the test.
         foreach (string configurationMix in testRecord.TestInfo.Configurations)
         {
             Configuration mix = Configuration.LoadConfigurationMix(configurationMix, testBinariesDirectory);
             if (mix.IsSatisfied(machine))
             {
                 return(true);
             }
         }
         return(false);
     }
     else
     {
         return(true);
     }
 }
Example #13
0
 private void listView1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if (fastObjectListView1.FocusedItem.Bounds.Contains(e.Location) == true)
         {
             MachineRecord record = (MachineRecord)fastObjectListView1.SelectedObjects[0];
             if (record.parsed_by_email)
             {
                 contextMenuStrip1.Items["emailMessageToolStripMenuItem"].Enabled     = true;
                 contextMenuStrip1.Items["hTMLLicznikToolStripMenuItem"].Enabled      = false;
                 contextMenuStrip1.Items["hTMLNumerSeryjnyToolStripMenuItem"].Enabled = false;
             }
             else
             {
                 contextMenuStrip1.Items["emailMessageToolStripMenuItem"].Enabled     = false;
                 contextMenuStrip1.Items["hTMLLicznikToolStripMenuItem"].Enabled      = true;
                 contextMenuStrip1.Items["hTMLNumerSeryjnyToolStripMenuItem"].Enabled = true;
             }
             contextMenuStrip1.Show(Cursor.Position);
         }
     }
 }
Example #14
0
        // Public members are specified in the order that they get called in the
        // workflow: RegisterKey -> Distribute -> GetDistributedDirectory -> Merge.
        // The distribution directory specified at each stage should be consistent.

        /// <summary>
        /// Registers a key to have tests distributed to.
        /// </summary>
        /// <param name="distributionKey">Distribution key, such as a machine name.</param>
        /// <param name="distributionDirectory">Directory where distribution is performed from.</param>
        public static void RegisterKey(string distributionKey, DirectoryInfo distributionDirectory)
        {
            // Make sure the top-level distribution directory exists - only the
            // first key being registered will need to create this.
            if (!distributionDirectory.Exists)
            {
                distributionDirectory.Create();
            }

            // Create a subdirectory for distribution key.
            DirectoryInfo subdirectory = ComputeDistributedDirectoryName(distributionDirectory, distributionKey);

            subdirectory.Create();

            MachineRecord record = Configuration.QueryMachine();

            FileInfo machineRecordFileInfo = new FileInfo(Path.Combine(subdirectory.FullName, "MachineRecord.xml"));

            using (XmlTextWriter textWriter = new XmlTextWriter(machineRecordFileInfo.Open(FileMode.Create, FileAccess.Write), System.Text.Encoding.UTF8))
            {
                textWriter.Formatting = Formatting.Indented;
                ObjectSerializer.Serialize(textWriter, record);
            }
        }
Example #15
0
        public void IsMachineRecordExcludedTest()
        {
            using (var db = new CSSDataContext())
            {
                MachineRecord machineRecord1 = new MachineRecord()
                {
                    Identifier   = "Volume0",
                    RecordTypeId = 2,
                    Login        = db.Logins.FirstOrDefault()
                };

                MachineRecord machineRecord2 = new MachineRecord()
                {
                    Identifier   = "Extra_Volume1",
                    RecordTypeId = 2,
                    Login        = db.Logins.FirstOrDefault()
                };

                MachineRecord machineRecord3 = new MachineRecord()
                {
                    Identifier   = "Volume2_Extra",
                    RecordTypeId = 2,
                    Login        = db.Logins.FirstOrDefault()
                };

                MachineRecord machineRecord4 = new MachineRecord()
                {
                    Identifier   = "Extra_Volume3_Extra",
                    RecordTypeId = 2,
                    Login        = db.Logins.FirstOrDefault()
                };

                MachineRecord machineRecord5 = new MachineRecord()
                {
                    Identifier   = "NoMatch",
                    RecordTypeId = 2,
                    Login        = db.Logins.FirstOrDefault()
                };

                MachineRecord machineRecord6 = new MachineRecord()
                {
                    Identifier   = "Volume1_NoMatch",
                    RecordTypeId = 2,
                    Login        = db.Logins.FirstOrDefault()
                };

                MachineRecord machineRecord7 = new MachineRecord()
                {
                    Identifier   = "NoMatch_Volume2",
                    RecordTypeId = 2,
                    Login        = db.Logins.FirstOrDefault()
                };

                MachineRecord machineRecord8 = new MachineRecord()
                {
                    Identifier   = "Volume0",
                    RecordTypeId = 1,
                    Login        = db.Logins.FirstOrDefault()
                };

                Assert.IsTrue(MachineRecordExclusion.IsMachineRecordExcluded(machineRecord1));
                Assert.IsTrue(MachineRecordExclusion.IsMachineRecordExcluded(machineRecord2));
                Assert.IsTrue(MachineRecordExclusion.IsMachineRecordExcluded(machineRecord3));
                Assert.IsTrue(MachineRecordExclusion.IsMachineRecordExcluded(machineRecord4));
                Assert.IsFalse(MachineRecordExclusion.IsMachineRecordExcluded(machineRecord5));
                Assert.IsFalse(MachineRecordExclusion.IsMachineRecordExcluded(machineRecord6));
                Assert.IsFalse(MachineRecordExclusion.IsMachineRecordExcluded(machineRecord7));
                Assert.IsFalse(MachineRecordExclusion.IsMachineRecordExcluded(machineRecord8));
            }
        }
 public bool DeleteMachineRecord(MachineRecord r)
 {
     return(DeleteOne(r.id, Collections.machine_records));
 }
Example #17
0
        private void showDeviceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MachineRecord record = (MachineRecord)fastObjectListView1.SelectedObjects[0];

            new FDeviceView(record.GetDevice()).Show();
        }
Example #18
0
        private void SearchInGoogleMaps(object sender, EventArgs e)
        {
            MachineRecord record = (MachineRecord)fastObjectListView1.SelectedObjects[0];

            record.GetDevice().address.SearchInGoogleMaps();
        }