Exemplo n.º 1
0
        public override void Expand(CyPhy.ComponentAssembly configuration)
        {
            this.Configuration = configuration;

            if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID)
            {
                this.expandedTestBenchType = this.testBenchType;
            }
            else
            {
                // create temp folder for test bench
                CyPhy.Testing testing = CyPhyClasses.Testing.Cast(this.testBenchType.ParentContainer.Impl);

                var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.testBenchType.Impl);

                CyPhy.Testing tempFolder = testing.Children.TestingCollection.FirstOrDefault(x => x.Name == tempFolderName);
                if (tempFolder == null)
                {
                    tempFolder      = CyPhyClasses.Testing.Create(testing);
                    tempFolder.Name = tempFolderName;

                    this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false);
                }

                // copy test bench
                var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.testBenchType.Impl as MgaFCO);
                // fix name
                tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.testBenchType.Impl, configuration.Impl);

                this.AddToTraceabilityAndTemporary(tempCopy, this.testBenchType.Impl);

                // set expanded property to the expanded element
                this.expandedTestBenchType = CyPhyClasses.TestBenchType.Cast(tempCopy);

                var tlsut = this.expandedTestBenchType.Children.TopLevelSystemUnderTestCollection.FirstOrDefault();

                // switch references
                try
                {
                    // redirect SUT
                    var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                    switcher.SwitchReference(configuration.Impl as MgaFCO, tlsut.Impl as IMgaReference);
                }
                catch (Exception ex)
                {
                    // handle failures for this (use case we can lose ports/connections/
                    // what if something is an instance/subtype/readonly etc...
                    throw new AnalysisModelExpandFailedException("ReferenceSwitcher failed.", ex);
                }

                // redirect TIPs
                this.SwitchAllTipReferences();
            }
        }
Exemplo n.º 2
0
        public override void Expand(CyPhy.ComponentAssembly configuration)
        {
            this.Configuration = configuration;

            if (this.OriginalSystemUnderTest == null)
            {
                // don't need to do anything
            }
            else if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID)
            {
                this.expandedTestBenchSuite = this.testBenchSuite;
            }
            else
            {
                // create temp folder for test bench suite
                CyPhy.TestBenchSuiteFolder testing = CyPhyClasses.TestBenchSuiteFolder.Cast(this.testBenchSuite.ParentContainer.Impl);

                var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.testBenchSuite.Impl);

                CyPhy.TestBenchSuiteFolder tempFolder = testing.Children.TestBenchSuiteFolderCollection.FirstOrDefault(x => x.Name == tempFolderName);
                if (tempFolder == null)
                {
                    tempFolder      = CyPhyClasses.TestBenchSuiteFolder.Create(testing);
                    tempFolder.Name = tempFolderName;

                    this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false);
                }

                // copy test bench suite
                var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.testBenchSuite.Impl as MgaFCO);
                // fix name
                tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.testBenchSuite.Impl, configuration.Impl);

                this.AddToTraceabilityAndTemporary(tempCopy, this.testBenchSuite.Impl);

                // set expanded property to the expanded element
                this.expandedTestBenchSuite = CyPhyClasses.TestBenchSuite.Cast(tempCopy);
            }

            // expand all test benches
            foreach (var testBenchRef in this.expandedTestBenchSuite.Children.TestBenchRefCollection)
            {
                var testBenchTypeExpander = new TestBenchTypeProcessor(testBenchRef.Referred.TestBenchType);
                testBenchTypeExpander.Expand(configuration);

                // switch references
                var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                // TODO: handle failures for this
                switcher.SwitchReference(testBenchTypeExpander.expandedTestBenchType.Impl as MgaFCO, testBenchRef.Impl as IMgaReference);

                this.InnerExpanders.Push(testBenchTypeExpander);
            }
        }
Exemplo n.º 3
0
        public override void Expand(CyPhy.ComponentAssembly configuration)
        {
            this.Configuration = configuration;

            // FIXME: this test should be repaired. It does not work correctly if TBs have different SUTs. Be safe and make a copy always
            // if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID)
            if (false)
            {
                this.expandedParametricExploration = this.parametricExploration;
            }
            else
            {
                // create temp folder for parametric exploration
                CyPhy.ParametricExplorationFolder testing = CyPhyClasses.ParametricExplorationFolder.Cast(this.parametricExploration.ParentContainer.Impl);

                var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.parametricExploration.Impl);

                CyPhy.ParametricExplorationFolder tempFolder = testing.Children.ParametricExplorationFolderCollection.FirstOrDefault(x => x.Name == tempFolderName);
                if (tempFolder == null)
                {
                    tempFolder      = CyPhyClasses.ParametricExplorationFolder.Create(testing);
                    tempFolder.Name = tempFolderName;

                    this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false);
                }

                // copy parametric exploration
                var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.parametricExploration.Impl as MgaFCO);
                // fix name
                tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.parametricExploration.Impl, configuration.Impl);

                this.AddToTraceabilityAndTemporary(tempCopy, this.parametricExploration.Impl);

                // set expanded property to the expanded element
                this.expandedParametricExploration = CyPhyClasses.ParametricExploration.Cast(tempCopy);
            }

            // expand all test benches
            foreach (var testBenchRef in this.expandedParametricExploration.Children.TestBenchRefCollection)
            {
                var testBenchTypeExpander = new TestBenchTypeProcessor(testBenchRef.Referred.TestBenchType);
                testBenchTypeExpander.Expand(configuration);

                // switch references
                var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                // TODO: handle failures for this
                switcher.SwitchReference(testBenchTypeExpander.expandedTestBenchType.Impl as MgaFCO, testBenchRef.Impl as IMgaReference);

                this.InnerExpanders.Push(testBenchTypeExpander);
            }
        }
Exemplo n.º 4
0
        private void SwitchAllTipReferences()
        {
            HashSet <string> tipKinds = new HashSet <string>()
            {
                typeof(CyPhy.TestInjectionPoint).Name,
                typeof(CyPhy.BallisticTarget).Name,
                typeof(CyPhy.CriticalComponent).Name
            };

            List <IMgaReference> tips = (this.expandedTestBenchType.Impl as MgaModel)
                                        .ChildFCOs
                                        .OfType <IMgaReference>()
                                        .Where(x => tipKinds.Contains(x.MetaBase.Name))
                                        .ToList();

            foreach (var tip in tips)
            {
                // find new destination
                IMgaFCO newTipTarget = FindTestInjectionTarget(
                    this.testBenchType.Children.TopLevelSystemUnderTestCollection.FirstOrDefault(),
                    tip,
                    this.expandedTestBenchType.Children.TopLevelSystemUnderTestCollection.FirstOrDefault());

                if (newTipTarget == null)
                {
                    throw new AnalysisModelTipNotFoundException(string.Format("Referenced test injection entity {0} [{1}] was not found in the generated component assembly (design). {2}", tip.Name, tip.Meta.Name, this.Configuration.Path));
                }

                try
                {
                    var numObjectsBefore = (this.expandedTestBenchType.Impl as MgaModel).ChildObjects.Count;

                    var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                    switcher.SwitchReference(newTipTarget, tip);

                    var numObjectsAfter = (this.expandedTestBenchType.Impl as MgaModel).ChildObjects.Count;
                    if (numObjectsBefore != numObjectsAfter)
                    {
                        var message = string.Format("Some connections were lost for test injection point. Most likely becasue in the generated design the target object does not have the same interface (that are connected in the test bench) compare interfaces {0} [{1}] -> {2}", tip.Name, tip.Meta.Name, newTipTarget.AbsPath);

                        throw new AnalysisModelExpandFailedException(message);
                    }
                }
                catch (Exception ex)
                {
                    throw new AnalysisModelExpandFailedException("ReferenceSwitcher failed.", ex);
                }
            }
        }
        public override void Expand(CyPhy.ComponentAssembly configuration)
        {
            this.Configuration = configuration;

            if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID)
            {
                this.expandedTestBenchSuite = this.testBenchSuite;
            }
            else
            {
                // create temp folder for test bench suite
                CyPhy.TestBenchSuiteFolder testing = CyPhyClasses.TestBenchSuiteFolder.Cast(this.testBenchSuite.ParentContainer.Impl);

                var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.testBenchSuite.Impl);

                CyPhy.TestBenchSuiteFolder tempFolder = testing.Children.TestBenchSuiteFolderCollection.FirstOrDefault(x => x.Name == tempFolderName);
                if (tempFolder == null)
                {
                    tempFolder = CyPhyClasses.TestBenchSuiteFolder.Create(testing);
                    tempFolder.Name = tempFolderName;

                    this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false);
                }

                // copy test bench suite
                var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.testBenchSuite.Impl as MgaFCO);
                // fix name
                tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.testBenchSuite.Impl, configuration.Impl);

                this.AddToTraceabilityAndTemporary(tempCopy, this.testBenchSuite.Impl);

                // set expanded property to the expanded element
                this.expandedTestBenchSuite = CyPhyClasses.TestBenchSuite.Cast(tempCopy);
            }

            // expand all test benches
            foreach (var testBenchRef in this.expandedTestBenchSuite.Children.TestBenchRefCollection)
            {
                var testBenchTypeExpander = new TestBenchTypeProcessor(testBenchRef.Referred.TestBenchType);
                testBenchTypeExpander.Expand(configuration);

                // switch references
                var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                // TODO: handle failures for this
                switcher.SwitchReference(testBenchTypeExpander.expandedTestBenchType.Impl as MgaFCO, testBenchRef.Impl as IMgaReference);

                this.InnerExpanders.Push(testBenchTypeExpander);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Elaborates the give test bench.
        /// </summary>
        public override void Elaborate()
        {
            // gets all objects within the test bench in any depth.
            MgaFilter filter     = this.Subject.Project.CreateFilter();
            var       allObjects = this.Subject.GetDescendantFCOs(filter);

            // list of test injection points in the test bench
            List <MgaReference> tips = new List <MgaReference>();

            foreach (MgaFCO obj in allObjects)
            {
                // add object to traceability
                this.Traceability.Add(obj.ID, obj.ID);

                if (this.Factory.TestInjectionPointsMeta.Contains(obj.MetaBase.MetaRef))
                {
                    // if object is a kind of test injection point
                    if (obj is MgaReference)
                    {
                        // if it is a reference
                        if ((obj as MgaReference).Referred == null)
                        {
                            this.Logger.WriteWarning(string.Format("{0} [{1}] was ignored and skipped, because it points to a null reference.", obj.Name, obj.MetaBase.Name));
                        }
                        else
                        {
                            // has a valid reference which is not null
                            tips.Add(obj as MgaReference);
                        }
                    }
                    else
                    {
                        this.Logger.WriteError(string.Format("{0} [{1}] is not a reference, therefore it was ignored and skipped.", obj.Name, obj.MetaBase.Name));
                    }
                }
            }

            // get the top level system under test object for this test bench
            var tlsut = allObjects.OfType <MgaReference>().FirstOrDefault(x => x.MetaBase.Name == "TopLevelSystemUnderTest");

            // ASSUME we have exactly one

            // make sure it is not null
            if (tlsut == null)
            {
                this.Logger.WriteWarning(string.Format("No top level system under test object in {0} [{1}]", this.Subject.Name, this.Subject.MetaBase.Name));
                this.Logger.WriteWarning("Assumes [{0}] has been elaborated...", this.Subject.MetaBase.Name);
                this.IsElaborated = true;
                return;
            }

            // it has a null reference
            if (tlsut.Referred == null)
            {
                throw new ElaboratorException(string.Format("Top level system under test object in {0} [{1}] is a null reference.", this.Subject.Name, this.Subject.MetaBase.Name));
            }

            // switch the top level system under test to a Component Assembly
            // FIXME: what if it is not a component assembly ???
            string tlsu_referred_id = tlsut.Referred.ID;
            var    ca_tlsut         = this.SwitchReferenceToModel(this.Subject, tlsut, false);

            // delete the reference object.
            tlsut.DestroyObject();

            // component assembly elaborator used to elaborate the Top Level System Under Test object.
            ComponentAssemblyElaborator componentAssemblyElaborator = null;

            // get a Componenet assembly elaborator for the top level system under test object.
            componentAssemblyElaborator = Elaborator.GetElaborator <ComponentAssemblyElaborator>(ca_tlsut, this.Logger, UnrollConnectors);

            // pass our current traceability information
            componentAssemblyElaborator.Traceability   = this.Traceability;
            componentAssemblyElaborator.ComponentGUIDs = this.ComponentGUIDs;

            // elaborate the top level system under test object
            componentAssemblyElaborator.Elaborate();

            // TODO: Elaborate test components

            // get a look up map for all test injection point references
            var map = componentAssemblyElaborator.GetReverseLookupMap(tips.Select(x => x.Referred.ID));

            map[tlsu_referred_id] = new MgaFCO[] { (MgaFCO)ca_tlsut }.ToList();

            // gather all information about test injection points, pretend everything is ok.
            bool success = true;

            foreach (MgaReference tip in tips)
            {
                // get the new targets for this test injection point
                var tipTargets = map[tip.Referred.ID];

                // looking for exactly one target
                if (tipTargets.Count == 0)
                {
                    // no target mark it as failure
                    success = false;
                    this.Logger.WriteFailed("{0} [{1}] --> {2} [{3}] was not found in traceability.", tip.Name, tip.MetaBase.Name, tip.Referred.Name, tip.Referred.MetaBase.Name);
                }
                else if (tipTargets.Count == 1)
                {
                    // exactly one target
                    try
                    {
                        // redirect test injection point to the new target
                        var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                        switcher.SwitchReference(tipTargets[0] as IMgaFCO, tip as IMgaReference);
                    }
                    catch (Exception ex)
                    {
                        success = false;

                        // handle failures for this (use case we can lose ports/connections/
                        // what if something is an instance/subtype/readonly etc...
                        this.Logger.WriteFailed("{0} [{1}] --> {2} [{3}] redirecting to --> {4} [{5}]", tip.Name, tip.MetaBase.Name, tip.Referred.Name, tip.Referred.MetaBase.Name, tipTargets[0].Name, tipTargets[0].MetaBase.Name);
                        this.Logger.WriteDebug(ex.ToString());
                    }
                }
                else
                {
                    // tipTarget.Count > 1
                    // more than one possible targets, this case is ambiguous, therefore mark it as failure.
                    success = false;
                    this.Logger.WriteFailed("{0} [{1}] --> {2} [{3}] was found more than once in the system - the choice is ambiguous.", tip.Name, tip.MetaBase.Name, tip.Referred.Name, tip.Referred.MetaBase.Name);
                }
            }

            if (tips.Any())
            {
                if (success)
                {
                    // check if no problems
                    this.Logger.WriteInfo("All test injection points were redirected successfully.");
                }
                else
                {
                    // some problems occured, must raise an exception
                    throw new ElaboratorException("At least one test injection point was not redirected successfully. See log messages above.");
                }
            }

            // if this point is reached, mark it successful.
            this.IsElaborated = true;
        }
        private void SwitchAllTipReferences()
        {
            HashSet<string> tipKinds = new HashSet<string>()
            {
               typeof(CyPhy.TestInjectionPoint).Name,
               typeof(CyPhy.BallisticTarget).Name,
               typeof(CyPhy.CriticalComponent).Name
            };

            List<IMgaReference> tips = (this.expandedTestBenchType.Impl as MgaModel)
                .ChildFCOs
                .OfType<IMgaReference>()
                .Where(x => tipKinds.Contains(x.MetaBase.Name))
                .ToList();

            foreach (var tip in tips)
            {
                // find new destination
                IMgaFCO newTipTarget = FindTestInjectionTarget(
                    this.testBenchType.Children.TopLevelSystemUnderTestCollection.FirstOrDefault(),
                    tip,
                    this.expandedTestBenchType.Children.TopLevelSystemUnderTestCollection.FirstOrDefault());

                if (newTipTarget == null)
                {
                    throw new AnalysisModelTipNotFoundException(string.Format("Referenced test injection entity {0} [{1}] was not found in the generated component assembly (design). {2}", tip.Name, tip.Meta.Name, this.Configuration.Path));
                }

                try
                {
                    var numObjectsBefore = (this.expandedTestBenchType.Impl as MgaModel).ChildObjects.Count;

                    var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                    switcher.SwitchReference(newTipTarget, tip);

                    var numObjectsAfter = (this.expandedTestBenchType.Impl as MgaModel).ChildObjects.Count;
                    if (numObjectsBefore != numObjectsAfter)
                    {
                        var message = string.Format("Some connections were lost for test injection point. Most likely becasue in the generated design the target object does not have the same interface (that are connected in the test bench) compare interfaces {0} [{1}] -> {2}", tip.Name, tip.Meta.Name, newTipTarget.AbsPath);

                        throw new AnalysisModelExpandFailedException(message);
                    }
                }
                catch (Exception ex)
                {
                    throw new AnalysisModelExpandFailedException("ReferenceSwitcher failed.", ex);
                }
            }

        }
        public override void Expand(CyPhy.ComponentAssembly configuration)
        {
            this.Configuration = configuration;

            if (this.OriginalSystemUnderTest.Referred.DesignEntity.ID == configuration.ID)
            {
                this.expandedTestBenchType = this.testBenchType;
            }
            else
            {
                // create temp folder for test bench
                CyPhy.Testing testing = CyPhyClasses.Testing.Cast(this.testBenchType.ParentContainer.Impl);

                var tempFolderName = AnalysisModelProcessor.GetTemporaryFolderName(this.testBenchType.Impl);

                CyPhy.Testing tempFolder = testing.Children.TestingCollection.FirstOrDefault(x => x.Name == tempFolderName);
                if (tempFolder == null)
                {
                    tempFolder = CyPhyClasses.Testing.Create(testing);
                    tempFolder.Name = tempFolderName;

                    this.AddToTraceabilityAndTemporary(tempFolder.Impl, testing.Impl, recursive: false);
                }

                // copy test bench
                var tempCopy = (tempFolder.Impl as MgaFolder).CopyFCODisp(this.testBenchType.Impl as MgaFCO);
                // fix name
                tempCopy.Name = AnalysisModelProcessor.GetTemporaryObjectName(this.testBenchType.Impl, configuration.Impl);

                this.AddToTraceabilityAndTemporary(tempCopy, this.testBenchType.Impl);

                // set expanded property to the expanded element
                this.expandedTestBenchType = CyPhyClasses.TestBenchType.Cast(tempCopy);

                var tlsut = this.expandedTestBenchType.Children.TopLevelSystemUnderTestCollection.FirstOrDefault();

                // switch references
                try
                {
                    // redirect SUT
                    var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                    switcher.SwitchReference(configuration.Impl as MgaFCO, tlsut.Impl as IMgaReference);
                }
                catch (Exception ex)
                {
                    // handle failures for this (use case we can lose ports/connections/
                    // what if something is an instance/subtype/readonly etc...
                    throw new AnalysisModelExpandFailedException("ReferenceSwitcher failed.", ex);
                }

                // redirect TIPs
                this.SwitchAllTipReferences();
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Elaborates the give test bench.
        /// </summary>
        public override void Elaborate()
        {
            // gets all objects within the test bench in any depth.
            MgaFilter filter = this.Subject.Project.CreateFilter();
            var allObjects = this.Subject.GetDescendantFCOs(filter);

            // list of test injection points in the test bench
            List<MgaReference> tips = new List<MgaReference>();
            
            foreach (MgaFCO obj in allObjects)
            {
                // add object to traceability
                this.Traceability.Add(obj.ID, obj.ID);

                if (this.Factory.TestInjectionPointsMeta.Contains(obj.MetaBase.MetaRef))
                {
                    // if object is a kind of test injection point
                    if (obj is MgaReference)
                    {
                        // if it is a reference
                        if ((obj as MgaReference).Referred == null)
                        {
                            this.Logger.WriteWarning(string.Format("{0} [{1}] was ignored and skipped, because it points to a null reference.", obj.Name, obj.MetaBase.Name));
                        }
                        else
                        {
                            // has a valid reference which is not null
                            tips.Add(obj as MgaReference);
                        }
                    }
                    else
                    {
                        this.Logger.WriteError(string.Format("{0} [{1}] is not a reference, therefore it was ignored and skipped.", obj.Name, obj.MetaBase.Name));
                    }
                }
            }

            // get the top level system under test object for this test bench
            var tlsut = allObjects.OfType<MgaReference>().FirstOrDefault(x => x.MetaBase.Name == "TopLevelSystemUnderTest");
            
            // ASSUME we have exactly one
            
            // make sure it is not null
            if (tlsut == null)
            {
                this.Logger.WriteWarning(string.Format("No top level system under test object in {0} [{1}]", this.Subject.Name, this.Subject.MetaBase.Name));
                this.Logger.WriteWarning("Assumes [{0}] has been elaborated...", this.Subject.MetaBase.Name);
                this.IsElaborated = true;
                return;
            }

            // it has a null reference
            if (tlsut.Referred == null)
            {
                throw new ElaboratorException(string.Format("Top level system under test object in {0} [{1}] is a null reference.", this.Subject.Name, this.Subject.MetaBase.Name));
            }

            // switch the top level system under test to a Component Assembly
            // FIXME: what if it is not a component assembly ???
            string tlsu_referred_id = tlsut.Referred.ID;
            var ca_tlsut = this.SwitchReferenceToModel(this.Subject, tlsut, false);

            // delete the reference object.
            tlsut.DestroyObject();

            // component assembly elaborator used to elaborate the Top Level System Under Test object.
            ComponentAssemblyElaborator componentAssemblyElaborator = null;

            // get a Componenet assembly elaborator for the top level system under test object.
            componentAssemblyElaborator = Elaborator.GetElaborator<ComponentAssemblyElaborator>(ca_tlsut, this.Logger);

            // pass our current traceability information
            componentAssemblyElaborator.Traceability = this.Traceability;

            // elaborate the top level system under test object
            componentAssemblyElaborator.Elaborate();

            // TODO: Elaborate test components

            // get a look up map for all test injection point references
            var map = componentAssemblyElaborator.GetReverseLookupMap(tips.Select(x => x.Referred.ID));
            map[tlsu_referred_id] = new MgaFCO[] { (MgaFCO)ca_tlsut }.ToList();

            // gather all information about test injection points, pretend everything is ok.
            bool success = true;

            foreach (MgaReference tip in tips)
            {
                // get the new targets for this test injection point
                var tipTargets = map[tip.Referred.ID];

                // looking for exactly one target
                if (tipTargets.Count == 0)
                {
                    // no target mark it as failure
                    success = false;
                    this.Logger.WriteFailed("{0} [{1}] --> {2} [{3}] was not found in traceability.", tip.Name, tip.MetaBase.Name, tip.Referred.Name, tip.Referred.MetaBase.Name);
                }
                else if (tipTargets.Count == 1)
                {
                    // exactly one target
                    try
                    {
                        // redirect test injection point to the new target
                        var switcher = new ReferenceSwitcher.ReferenceSwitcherInterpreter();
                        switcher.SwitchReference(tipTargets[0] as IMgaFCO, tip as IMgaReference);
                    }
                    catch (Exception ex)
                    {
                        success = false;

                        // handle failures for this (use case we can lose ports/connections/
                        // what if something is an instance/subtype/readonly etc...
                        this.Logger.WriteFailed("{0} [{1}] --> {2} [{3}] redirecting to --> {4} [{5}]", tip.Name, tip.MetaBase.Name, tip.Referred.Name, tip.Referred.MetaBase.Name, tipTargets[0].Name, tipTargets[0].MetaBase.Name);
                        this.Logger.WriteDebug(ex.ToString());
                    }
                }
                else
                {
                    // tipTarget.Count > 1
                    // more than one possible targets, this case is ambiguous, therefore mark it as failure.
                    success = false;
                    this.Logger.WriteFailed("{0} [{1}] --> {2} [{3}] was found more than once in the system - the choice is ambiguous.", tip.Name, tip.MetaBase.Name, tip.Referred.Name, tip.Referred.MetaBase.Name);
                }
            }

            if (tips.Any())
            {
                if (success)
                {
                    // check if no problems
                    this.Logger.WriteInfo("All test injection points were redirected successfully.");
                }
                else
                {
                    // some problems occured, must raise an exception
                    throw new ElaboratorException("At least one test injection point was not redirected successfully. See log messages above.");
                }
            }

            // if this point is reached, mark it successful.
            this.IsElaborated = true;
        }