Esempio n. 1
0
        public static bool Run(string outputdirname, string xmePath, string absPath, bool copycomponents = true)
        {
            xmePath       = Path.GetFullPath(xmePath);
            outputdirname = Path.GetFullPath(outputdirname);
            bool   status = true;
            string ProjectConnStr;

            CyPhyGUIs.CyPhyDirectory.EnsureEmptyDirectory(outputdirname);

            MgaUtils.ImportXMEForTest(xmePath, Path.Combine(outputdirname, Path.GetFileNameWithoutExtension(xmePath) + "_CADtest.mga"), out ProjectConnStr);

            MgaProject project = new MgaProject();
            bool       ro_mode;

            project.Open(ProjectConnStr, out ro_mode);

            try
            {
                var terr    = project.BeginTransactionInNewTerr();
                var testObj = project.ObjectByPath[absPath] as MgaFCO;
                project.AbortTransaction();

                return(Run(Path.GetDirectoryName(xmePath), project, testObj, copycomponents));
            }
            catch (Exception)
            {
                status = false;
            }
            finally
            {
                project.Close();
            }

            return(status);
        }
Esempio n. 2
0
        public string ImportXME2Mga()
        {
            string projectConnStr;

            MgaUtils.ImportXMEForTest(xmeFilename, out projectConnStr);
            return(projectConnStr.Substring("MGA=".Length));
        }
Esempio n. 3
0
        private static void ImportTest(String p_test, String p_xme, out String p_mga)
        {
            try
            {
                String xmeName = Path.GetFileName(p_xme);
                Assert.True(File.Exists(p_xme), String.Format("{0} is missing", xmeName));

                p_mga = p_xme.Replace(".xme", "_test.mga");
                MgaUtils.ImportXME(p_xme, p_mga);

                // Assert that MGA file exists, and is relatively new
                String mgaName = Path.GetFileName(p_mga);
                Assert.True(File.Exists(p_mga), String.Format("{0} does not exist. It probably didn't import successfully.", mgaName));

                DateTime dt_mgaLastWrite = File.GetLastWriteTime(p_mga);
                var      threshold       = DateTime.Now.AddSeconds(-10.0);
                Assert.True(dt_mgaLastWrite > threshold, String.Format("{0} is older than 10 seconds. It probably didn't import successfully, and this is an old copy.", mgaName));

                // Delete temp file
                File.Delete(p_mga);
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
Esempio n. 4
0
        public static string ImportXME2Mga()
        {
            var    xmePath = Path.Combine("..", "..", "SubTreeMergeModel.xme");
            string projectConnStr;

            MgaUtils.ImportXMEForTest(xmePath, out projectConnStr);
            return(projectConnStr.Substring("MGA=".Length));
        }
Esempio n. 5
0
        /// <summary>
        /// Call this method for each test-case.
        /// </summary>
        /// <param name="projectDir"> e.g. DriveTrain_v3</param>
        /// <param name="xmeFileName">e.g. DriveLine_v3.xme</param>
        /// <returns>e.g. C:\META\meta_trunk\models\DynamicsTeam\DriveTrain_v3\DriveLine_v3_test.mga</returns>
        public static string ImportXME2Mga(string projectDir, string xmeFileName)
        {
            var    xmePath = Path.Combine("..", "..", "..", "..", "models", "DynamicsTeam", projectDir, xmeFileName);
            string projectConnStr;

            MgaUtils.ImportXMEForTest(xmePath, out projectConnStr);
            return(projectConnStr.Substring("MGA=".Length));
        }
Esempio n. 6
0
        public void DupIDs()
        {
            var    fullTestPath = Path.Combine(_exportModelDirectory, "DupIDs");
            var    xmeFilePath  = Path.Combine(fullTestPath, "DupIDs.xme");
            string connStr;

            MgaUtils.ImportXMEForTest(xmeFilePath, out connStr);
            var mgaFile = connStr.Substring("MGA=".Length);

            Assert.True(RunCyPhyDesignExporter(mgaFile) == 0, "Design Export Failed");

            var exportedADMs = Directory.GetFiles(fullTestPath, "*.adm");
            var results      = new Dictionary <String, String>();

            foreach (var adm in exportedADMs)
            {
                var doc = new XmlDocument();
                using (var reader = new XmlTextReader(adm))
                {
                    doc.Load(reader);
                    XmlNode root = doc.DocumentElement;

                    var ls_EncounteredIDs = new List <String>();
                    foreach (XmlAttribute node in root.SelectNodes("//@ID"))
                    {
                        ls_EncounteredIDs.Add(node.Value);
                    }

                    // Get all duplicate IDs that aren't empty/whitespace
                    var duplicates = ls_EncounteredIDs.Where(s => !String.IsNullOrWhiteSpace(s))
                                     .GroupBy(s => s)
                                     .Where(g => g.Count() > 1)
                                     .Select(g => g.Key)
                                     .ToList();
                    if (duplicates.Any())
                    {
                        String msg = "Duplicate IDs found in exported design: ";
                        foreach (var dupe in duplicates)
                        {
                            msg += String.Format("{0}\"{1}\", ", Environment.NewLine, dupe);
                        }

                        results.Add(Path.GetFileName(adm), msg);
                    }
                }
            }

            if (results.Any())
            {
                String finalMsg = String.Format("{0} exported ADM files had duplicate IDs" + Environment.NewLine, results.Count);
                foreach (var kvp in results)
                {
                    finalMsg += String.Format("{0}: {1}" + Environment.NewLine, kvp.Key, kvp.Value);
                }
                Assert.True(false, finalMsg);
            }
        }
Esempio n. 7
0
        public string ImportXME2Mga()
        {
            string projectConnStr;

            MgaUtils.ImportXMEForTest(Path.Combine(
                                          Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetAssembly(typeof(XmeImportFixture)).CodeBase).LocalPath),
                                          "..", "..", "..", "..", "models", "DynamicsTeam", xmeFilename), out projectConnStr);
            return(projectConnStr.Substring("MGA=".Length));
        }
Esempio n. 8
0
        private void unpackXme(string xmeFilename)
        {
            if (!File.Exists(xmeFilename))
            {
                return;
            }
            var mgaFilename = Path.ChangeExtension(xmeFilename, "mga");

            MgaUtils.ImportXME(xmeFilename, mgaFilename);
        }
Esempio n. 9
0
        public LayoutFixture()
        {
            String connString;

            MgaUtils.ImportXMEForTest(xmePath, out connString);
            mgaPath = connString.Substring("MGA=".Length);
            Assert.True(File.Exists(mgaPath), "Input model not found; import may have failed.");

            project = CommonFunctions.GetProject(mgaPath);
        }
Esempio n. 10
0
        public void SetUnit()
        {
            File.Copy(orgXmePathInputModel, xmePathInputModel, true);

            String connString;

            MgaUtils.ImportXMEForTest(xmePathInputModel, out connString);
            var mgaPath = connString.Substring("MGA=".Length);

            Assert.True(File.Exists(mgaPath), "Input model not found; import may have failed.");

            var project = GetProject(mgaPath);

            var importer = new CyPhyComponentImporter.CyPhyComponentImporterInterpreter();

            importer.Initialize(project);

            project.BeginTransactionInNewTerr();
            try
            {
                var fco = importer.ImportFile(project, testPath, acmPath);
                ISIS.GME.Dsml.CyPhyML.Interfaces.Component comp = ISIS.GME.Dsml.CyPhyML.Classes.Component.Cast(fco);

                var millimeter = comp.Children.PropertyCollection
                                 .First(p => p.Name.Equals("mm"))
                                 .Referred.unit;
                Assert.NotNull(millimeter);
                Assert.Equal("Millimeter", millimeter.Name);

                var henry = comp.Children.PropertyCollection
                            .First(p => p.Name.Equals("Henry"))
                            .Referred.unit;
                Assert.NotNull(henry);
                Assert.Equal("Henry", henry.Name);

                var acre = comp.Children.PropertyCollection
                           .First(p => p.Name.Equals("acre"))
                           .Referred.unit;
                Assert.NotNull(acre);
                Assert.Equal("Acre", acre.Name);
            }
            finally
            {
                project.CommitTransaction();
            }

            project.Save();
            project.Close();
        }
Esempio n. 11
0
        public void Refports()
        {
            var    fullTestPath = Path.Combine(_exportModelDirectory, "Refports");
            var    xmeFilePath  = Path.Combine(fullTestPath, "Refports.xme");
            string connstr;

            MgaUtils.ImportXMEForTest(xmeFilePath, out connstr);
            var mgaFile    = connstr.Substring("MGA=".Length);
            var designName = "CA";

            Assert.True(RunCyPhyDesignExporter(mgaFile, designName) == 0, "Design Export failed");

            var exportedXml = Path.Combine(fullTestPath, designName + ".adm");

            var design          = XSD2CSharp.AvmXmlSerializer.Deserialize <avm.Design>(File.ReadAllText(exportedXml));
            var valueExpression = design.RootContainer.Property.Cast <avm.PrimitiveProperty>().First().Value.ValueExpression;

            Assert.True(valueExpression is avm.FixedValue, valueExpression.GetType().Name);
        }
Esempio n. 12
0
        public DSFixtureBase(string xmePath)
        {
            try
            {
                string connection;
                MgaUtils.ImportXMEForTest(
                    Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(this.GetType()).CodeBase.Substring("file:///".Length)),
                                 xmePath),
                    out connection);

                Type type = Type.GetTypeFromProgID("Mga.MgaProject");
                proj_ = Activator.CreateInstance(type) as MgaProject;
                proj_.OpenEx(connection, "CyPhyML", null);
            }
            catch (Exception e)
            {
                this.exception = e;
            }
        }
Esempio n. 13
0
        public void Connector()
        {
            var    fullTestPath = Path.Combine(_exportModelDirectory, "Connector");
            var    xmeFilePath  = Path.Combine(fullTestPath, "Connector.xme");
            string connStr;

            MgaUtils.ImportXMEForTest(xmeFilePath, out connStr);
            var mgaFile = connStr.Substring("MGA=".Length);

            Assert.True(RunCyPhyDesignExporter(mgaFile) == 0, "Design Export failed");

            var exportedADMs = Directory.GetFiles(fullTestPath, "*expected.adm");

            foreach (var p_expected in exportedADMs)
            {
                var p_output = p_expected.Replace(".expected", "");
                Assert.True(File.Exists(p_output), "Output file missing: " + p_output);
                Assert.True(RunXmlComparator(p_expected, p_output) == 0, "Output did not match expected for " + p_expected);
            }
        }
Esempio n. 14
0
        public void Connectors_Invalid()
        {
            string XmePath          = Path.GetFullPath(@"..\..\..\..\models\CADTeam\MSD_CAD.xme");
            string OutputDir        = Path.Combine(Path.GetDirectoryName(XmePath), "Connectors_Invalid");
            var    generatedAsmPath = Path.Combine(OutputDir, generatedAsmFile);

            CyPhyGUIs.CyPhyDirectory.EnsureEmptyDirectory(OutputDir);

            string ProjectConnStr;

            MgaUtils.ImportXMEForTest(XmePath, Path.Combine(OutputDir, Path.GetFileNameWithoutExtension(XmePath) + "_CADtest.mga"), out ProjectConnStr);
            CyPhy2CADRun.CopyDirectory(Path.Combine(Path.GetDirectoryName(XmePath), "components"), Path.Combine(Path.Combine(OutputDir, "components")));

            MgaProject project = new MgaProject();
            bool       ro_mode;

            project.Open(ProjectConnStr, out ro_mode);
            try
            {
                // testbenchpath doesn't work:(
                var terr    = project.BeginTransactionInNewTerr();
                var testObj = project.RootFolder.GetObjectByPathDisp("/@Generated_configurations/MyMassSpringDamper/Config1/MyMassSpringDamper_cfg_broken");
                project.AbortTransaction();

                bool status = CyPhy2CADRun.Run(Path.GetDirectoryName(XmePath), project, (MgaFCO)testObj, false);

                string logfilename = Path.Combine(OutputDir, "log", CyPhy2CAD_CSharp.Logger.LogFileName);

                StreamReader r          = new StreamReader(logfilename);
                string       logcontent = r.ReadToEnd();

                Assert.True(logcontent.Contains("badname"));
            }
            finally
            {
                project.Close(abort: true);
            }
        }
Esempio n. 15
0
        //[Fact]
        public void TestCodeSample()
        {
            string ProjectConnStr;

            MgaUtils.ImportXMEForTest(Path.GetFullPath(@"..\..\..\..\models\DynamicsTeam\MasterInterpreter\MasterInterpreter.xme"), out ProjectConnStr);

            MgaProject project = new MgaProject();
            bool       ro_mode;

            project.Open(ProjectConnStr, out ro_mode);

            MgaHelper.CheckParadigmVersionUpgrade(project);

            try
            {
                List <IMgaFCO> objectsToGetConfigurations = null;

                project.BeginTransactionInNewTerr();
                try
                {
                    // discover objects

                    var allObjects = project
                                     .RootFolder
                                     .ChildFolders
                                     .Cast <MgaFolder>()
                                     .Where(x => x.Name.StartsWith("0"))
                                     .SelectMany(x => x.GetDescendantFCOs(project.CreateFilter()).Cast <IMgaFCO>())
                                     .Where(x => x.RootFCO == x);

                    // get all objects from folders starts with 0 within the root folder.
                    objectsToGetConfigurations = allObjects.Where(x => x.AbsPath.Contains("TestingGetConfigurations")).ToList();

                    objectsToGetConfigurations.Sort((x, y) =>
                    {
                        return(x.Meta.Name.CompareTo(y.Meta.Name) != 0 ?
                               x.Meta.Name.CompareTo(y.Meta.Name) :
                               x.AbsPath.CompareTo(y.AbsPath));
                    });
                }
                finally
                {
                    project.AbortTransaction();
                }

                Assert.True(objectsToGetConfigurations != null, "There are no object in the project that has to be checked.");

                int numContexts = objectsToGetConfigurations.Count;
                int numSuccess  = 0;
                int numFailures = 0;

                bool success = true;

                foreach (var subject in objectsToGetConfigurations)
                {
                    // single test
                    using (var masterInterpreter = new CyPhyMasterInterpreter.CyPhyMasterInterpreterAPI(project))
                    {
                        IMgaFCOs configurations = null;

                        Assert.ThrowsDelegate d = () =>
                        {
                            configurations = masterInterpreter.GetConfigurations(subject as MgaModel);
                        };

                        Assert.DoesNotThrow(d);
                        //Assert.True(configurations != null, "GetConfiguration returned with null.");

                        if (configurations == null)
                        {
                            numFailures++;
                        }
                        else
                        {
                            numSuccess++;
                        }

                        // print out nicely in the GME console
                        project.BeginTransactionInNewTerr();
                        try
                        {
                            Console.Out.WriteLine("{0} [{1}] has {2} configurations.", subject.Name, subject.Meta.Name, configurations.Count);
                            foreach (IMgaFCO configuration in configurations)
                            {
                                Console.Out.WriteLine(" > {0} - {1}", configuration.Name, configuration.ID);
                            }
                        }
                        finally
                        {
                            project.AbortTransaction();
                        }
                    }
                }

                if (success)
                {
                    Console.Out.WriteLine("[OK] Got configurations for: {0} test benches. Success: {1}, Failed {2}", numContexts, numSuccess, numFailures);
                }
                else
                {
                    Console.Error.WriteLine("[FAILED] Tried to get configurations for: {0} test benches. Success: {1}, Failed {2}", numContexts, numSuccess, numFailures);
                }

                Assert.True(success, "At least one context was failed to check against the expected results.");
            }
            finally
            {
                project.Close(true);
            }
        }
Esempio n. 16
0
        protected void RunCyPhyMLSync(System.Action <MgaProject, CyPhyMetaLink.CyPhyMetaLinkAddon, CyPhyMetaLink.CyPhyMetalinkInterpreter> testAction)
        {
            try
            {
                if (debugMetalinkStartup)
                {
                    metalink.WaitForExit();
                    string stderr = metalink.StandardError.ReadToEnd();
                    string stdout = metalink.StandardOutput.ReadToEnd();
                }
                Exception      exception = null;
                AutoResetEvent workEvent = new AutoResetEvent(false);
                Thread         work      = new Thread(new ThreadStart(delegate
                {
                    try
                    {
                        // Import XME file to create an MGA
                        String xmeFullPath = Path.Combine(TestModelDir, testXMEFilename);
                        String mgaFullPath = TestModelDir + testInputFilename;
                        MgaUtils.ImportXME(xmeFullPath, mgaFullPath);
                        Assert.True(File.Exists(mgaFullPath), "MGA file not found. XME import may have failed.");

                        MgaProject project = new MgaProject();
                        project.EnableAutoAddOns(true);
                        project.OpenEx("MGA=" + mgaFullPath, "", true);
                        CyPhyMetaLink.CyPhyMetaLinkAddon propagate = null;
                        try
                        {
                            Assert.Contains("MGA.Addon.CyPhyMLPropagate", project.AddOnComponents.Cast <IMgaComponentEx>().Select(x => x.ComponentProgID));
                            propagate = (CyPhyMetaLink.CyPhyMetaLinkAddon)project.AddOnComponents.Cast <IMgaComponent>().Where(comp => comp is CyPhyMetaLink.CyPhyMetaLinkAddon).FirstOrDefault();
                            CyPhyMetaLink.CyPhyMetalinkInterpreter interpreter = new CyPhyMetaLink.CyPhyMetalinkInterpreter();
                            propagate.TestMode = true;
                            propagate.TestMode_NoAutomaticCreoStart = true;
                            propagate.TestMode_CreoJobObject        = JobObjectPinvoke.CreateKillOnCloseJob();
                            interpreter.GMEConsole = GME.CSharp.GMEConsole.CreateFromProject(project);
                            interpreter.MgaGateway = new MgaGateway(project);

                            var task = Task.Run(async() => await interpreter.ConnectToMetaLinkBridge(project, 128));
                            task.Wait();
                            propagate.bridgeClient.SocketQueue.EditMessageReceived += msg => addonMessagesQueue.Add(msg);
                            testAction(project, propagate, interpreter);
                        }
                        finally
                        {
                            if (propagate != null)
                            {
                                JobObjectPinvoke.CloseHandle(propagate.TestMode_CreoJobObject);
                                propagate.TestMode_CreoJobObject = IntPtr.Zero;
                            }
                            project.Save(project.ProjectConnStr + "_posttest.mga", true);
                            project.Close(true);
                        }
                    }
                    catch (Exception e)
                    {
                        exception = e;
                        KillMetaLink();
                    }
                    finally
                    {
                        workEvent.Set();
                    }
                }));
                work.SetApartmentState(ApartmentState.STA);
                work.Start();

                ManualResetEvent metalinkEvent = new ManualResetEvent(true);
                metalinkEvent.SafeWaitHandle = new SafeWaitHandle(metalink.Handle, false);

                int handle = WaitHandle.WaitAny(new WaitHandle[] { metalinkEvent, workEvent });
                if (exception != null)
                {
                    throw new Exception("Test failed", exception);
                }
                if (handle == 0)
                {
                    work.Abort();
                    throw new Exception("metalink exited");
                }
            }
            finally
            {
                KillMetaLink();
                lock (metalinkLogStream)
                    metalinkLogStream.Dispose();
            }
        }
Esempio n. 17
0
        //[Fact]
        public void TestCodeSample()
        {
            string ProjectConnStr;

            MgaUtils.ImportXMEForTest(Path.GetFullPath(@"..\..\..\..\models\DynamicsTeam\MasterInterpreter\MasterInterpreter.xme"), out ProjectConnStr);

            MgaProject project = new MgaProject();
            bool       ro_mode;

            project.Open(ProjectConnStr, out ro_mode);

            MgaHelper.CheckParadigmVersionUpgrade(project);

            try
            {
                List <IMgaFCO> objectsToCheck = null;

                project.BeginTransactionInNewTerr();
                try
                {
                    // discover objects

                    var allObjects = project
                                     .RootFolder
                                     .ChildFolders
                                     .Cast <MgaFolder>()
                                     .Where(x => x.Name.StartsWith("0"))
                                     .SelectMany(x => x.GetDescendantFCOs(project.CreateFilter()).Cast <IMgaFCO>())
                                     .Where(x => x.RootFCO == x);

                    // get all objects from folders starts with 0 within the root folder.
                    objectsToCheck = allObjects.Where(x => x.AbsPath.Contains("TestingContextChecker") && x.Name.Contains("ReadOnly") == false).ToList();

                    objectsToCheck.Sort((x, y) =>
                    {
                        return(x.Meta.Name.CompareTo(y.Meta.Name) != 0 ?
                               x.Meta.Name.CompareTo(y.Meta.Name) :
                               x.AbsPath.CompareTo(y.AbsPath));
                    });
                }
                finally
                {
                    project.AbortTransaction();
                }

                Assert.True(objectsToCheck != null, "There are no object in the project that has to be checked.");

                int numContexts = objectsToCheck.Count;
                int numSuccess  = 0;
                int numFailures = 0;

                bool success = true;

                foreach (var subject in objectsToCheck)
                {
                    // single test
                    using (var masterInterpreter = new CyPhyMasterInterpreter.CyPhyMasterInterpreterAPI(project))
                    {
                        CyPhyMasterInterpreter.Rules.ContextCheckerResult[] contextCheckerResults = null;

                        // check context
                        var checkerSuccess = masterInterpreter.TryCheckContext(subject as MgaModel, out contextCheckerResults);

                        List <CyPhyMasterInterpreter.Rules.ContextCheckerResult> sortedResults = contextCheckerResults.ToList();

                        // sort results Passed, Failed, then alphabetically based on message.
                        sortedResults.Sort((x, y) => { return(x.Success == y.Success ? x.Message.CompareTo(y.Message) : y.Success.CompareTo(x.Success)); });

                        project.BeginTransactionInNewTerr();
                        try
                        {
                            MgaObject parent = null;
                            GME.MGA.Meta.objtype_enum type;
                            subject.GetParent(out parent, out type);

                            var successExpected = parent.Name.ToLowerInvariant() == "invalid" ? false : true;

                            if (successExpected == checkerSuccess)
                            {
                                numSuccess++;
                                //GMEConsole.Info.WriteLine("OK");
                            }
                            else
                            {
                                success = false;

                                foreach (var result in sortedResults)
                                {
                                    TextWriter    tw = null;
                                    StringBuilder sb = new StringBuilder();
                                    if (result.Success)
                                    {
                                        sb.Append("[Passed]");
                                        tw = Console.Out;
                                    }
                                    else
                                    {
                                        sb.Append("[Failed]");
                                        tw = Console.Error;
                                    }

                                    sb.AppendFormat(" {0} - {1} ", result.Subject.Name, result.Subject.AbsPath);

                                    sb.Append(result.Message);

                                    tw.WriteLine(sb);
                                }

                                numFailures++;
                                Console.Error.WriteLine("========= FAILED ==========");
                                Console.Error.WriteLine("= {0}", subject.Name);
                                Console.Error.WriteLine("= {0}", subject.AbsPath);
                                Console.Error.WriteLine("===========================");
                            }
                        }
                        finally
                        {
                            project.AbortTransaction();
                        }
                    }
                }

                if (success)
                {
                    Console.Out.WriteLine("[OK] Checked contexts: {0}, Success: {1}, Failed: {2}", numContexts, numSuccess, numFailures);
                }
                else
                {
                    Console.Error.WriteLine("[FAILED] Checked contexts: {0}, Success: {1}, Failed: {2}", numContexts, numSuccess, numFailures);
                }

                Assert.True(success, "At least one context was failed to check against the expected results.");
            }
            finally
            {
                project.Close(true);
            }
        }
Esempio n. 18
0
        //[Fact]
        public void TestCodeSample()
        {
            string ProjectConnStr;

            MgaUtils.ImportXMEForTest(Path.GetFullPath(@"..\..\..\..\models\DynamicsTeam\MasterInterpreter\MasterInterpreter.xme"), out ProjectConnStr);

            MgaProject project = new MgaProject();
            bool       ro_mode;

            project.Open(ProjectConnStr, out ro_mode);

            MgaHelper.CheckParadigmVersionUpgrade(project);

            try
            {
                List <IMgaFCO> objectsToCheck = null;

                project.BeginTransactionInNewTerr();
                try
                {
                    // discover objects

                    var allObjects = project
                                     .RootFolder
                                     .ChildFolders
                                     .Cast <MgaFolder>()
                                     .Where(x => x.Name.StartsWith("0"))
                                     .SelectMany(x => x.GetDescendantFCOs(project.CreateFilter()).Cast <IMgaFCO>())
                                     .Where(x => x.RootFCO == x);

                    // get all objects from folders starts with 0 within the root folder.
                    objectsToCheck = allObjects.Where(x => x.AbsPath.Contains("ProcessorTypesForContexts")).ToList();

                    objectsToCheck.Sort((x, y) =>
                    {
                        return(x.Meta.Name.CompareTo(y.Meta.Name) != 0 ?
                               x.Meta.Name.CompareTo(y.Meta.Name) :
                               x.AbsPath.CompareTo(y.AbsPath));
                    });
                }
                finally
                {
                    project.AbortTransaction();
                }

                Assert.True(objectsToCheck != null, "There are no object in the project that has to be checked.");

                int numContexts = objectsToCheck.Count;
                int numSuccess  = 0;
                int numFailures = 0;

                bool success = true;

                foreach (var subject in objectsToCheck)
                {
                    // single test
                    CyPhyMasterInterpreter.AnalysisModelProcessor analysisModelProcessor = null;

                    project.BeginTransactionInNewTerr();
                    try
                    {
                        Assert.ThrowsDelegate d = () =>
                        {
                            analysisModelProcessor = CyPhyMasterInterpreter.AnalysisModelProcessor.GetAnalysisModelProcessor(subject as MgaModel);
                        };

                        MgaObject parent = null;
                        GME.MGA.Meta.objtype_enum type;
                        subject.GetParent(out parent, out type);

                        var contextSupportExpected = parent.Name.ToLowerInvariant() == "invalid" ? false : true;
                        if (contextSupportExpected)
                        {
                            Assert.DoesNotThrow(d);
                            Assert.True(analysisModelProcessor != null, string.Format("Analysis model processor was not able to create the model processor for {0} {1}.", subject.Name, subject.Meta.Name));

                            if (subject.Name.Contains(analysisModelProcessor.GetType().Name))
                            {
                                numSuccess++;
                                Console.Out.WriteLine("[Passed] {0} was created for test bench {1} [{2}]", analysisModelProcessor.GetType().Name, subject.Name, subject.Meta.Name);
                            }
                            else
                            {
                                success = false;
                                numFailures++;
                                Console.Out.WriteLine("[Failed] {0} was created for test bench {1} [{2}]", analysisModelProcessor.GetType().Name, subject.Name, subject.Meta.Name);
                            }
                        }
                        else
                        {
                            Assert.Throws <CyPhyMasterInterpreter.AnalysisModelContextNotSupportedException>(d);
                            numSuccess++;
                            Console.Out.WriteLine("[Passed] Context not supported {0} [{1}]", subject.Name, subject.Meta.Name);
                        }
                    }
                    finally
                    {
                        project.AbortTransaction();
                    }
                }

                if (success)
                {
                    Console.Out.WriteLine("[OK] Analysis model processor creation was checked for: {0}, Success: {1}, Failed: {2}", numContexts, numSuccess, numFailures);
                }
                else
                {
                    Console.Error.WriteLine("[FAILED] Analysis model processor creation was checked for: {0}, Success: {1}, Failed: {2}", numContexts, numSuccess, numFailures);
                }

                Assert.True(success, "At least one analysis model processor was not instantiated as expected.");
            }
            finally
            {
                project.Close(true);
            }
        }