/// <summary>
        /// Attempts to create the composite component. Component is created only if definition is a CompositeComponentMetadataDefinition.
        /// Otherwise method returns false, and null node.
        /// </summary>
        /// <param name="experiment">The experiment to which new component is added.</param>
        /// <param name="metadataDefinition">The metadata definition which component is created based on.</param>
        /// <param name="data">The data containing position of new vertex</param>
        /// <param name="newCreatedNode">Output of new created node; null if metadatadefinition was not a CompositeComponentMetadataDefinition</param>
        /// <returns>
        /// true if metadatadefinition was a CompositeComponentMetadataDefinition and node has been created, otherwise false
        /// </returns>
        private static bool TryCreateCompositeComponent(IEditableExperiment experiment, MetadataDefinition metadataDefinition, SerializedVertexData data,
                                                        out ExperimentNode newCreatedNode)
        {
            bool isCreated = false;

            newCreatedNode = null;

            CompositeComponentMetadataDefinition compositeComponentMetadataDefinition = metadataDefinition as CompositeComponentMetadataDefinition;

            if (compositeComponentMetadataDefinition != null)
            {
                data.Metadata = new CompositeComponentMetadata(compositeComponentMetadataDefinition, System.IO.Path.GetDirectoryName(experiment.ExperimentInfo.FilePath));
                string componentNodeId = Guid.NewGuid().ToString();
                string componentName   = data.Metadata.Label;
                newCreatedNode = new CompositeComponentNode(componentNodeId, data, experiment.Settings);
                experiment.AddVertex(newCreatedNode);

                //set the log settings of the new component
                experiment.SetLogLevelSettings(newCreatedNode);

                isCreated = true;
            }

            return(isCreated);
        }
Exemple #2
0
        public void DefineCompositeComponentBasicTestSelectSubraphWithNoEndAndStart()
        {
            // load the experiment to be exported
            string     experimentFilename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "experiment_define_composite_component_basic_test.teml");
            Experiment experiment         = ExperimentManager.Load(experimentFilename, AppContext.Components);

            experiment.Settings = AppContext.Settings; //assure that we apply global settings

            //select just one node
            foreach (ExperimentNode node in experiment.Vertices)
            {
                if (node.ID == TestImporterID)
                {
                    node.IsSelected = true;
                }
            }

            DefiningCompositeComponentSetup setup = new DefiningCompositeComponentSetup(experiment);

            Assert.IsNotNull(setup);

            Assert.AreEqual(1, setup.InputSettings.Count);
            Assert.AreEqual(1, setup.OutputSettings.Count);
            Assert.AreEqual(0, setup.ConfigSettings.Count);
            Assert.IsTrue(setup.InputSettings["test1"].Include);
            Assert.IsTrue(setup.OutputSettings["test2"].Include);

            //rescan library to be sure it is fresh scan
            int numberOfComponentsInLibrary = GetCountOfComponentsInLibrary();

            //let's export the experiment as composite component
            setup.CompositeComponentLocationFilePath = exportFile;

            Assert.IsFalse(File.Exists(exportFile));
            setup.DefineComponent();

            Assert.IsTrue(File.Exists(exportFile));

            int updatedNumberOfComponents = GetCountOfComponentsInLibrary();

            //after rescan there should be one more component in the library
            Assert.AreEqual(numberOfComponentsInLibrary + 1, updatedNumberOfComponents);

            //iterate through all components until find new composite component
            CompositeComponentMetadataDefinition compositeComponentDefinition = FindCompositeComponent(exportFile);

            //assure that composite component definition has been found
            Assert.IsNotNull(compositeComponentDefinition); //if fails, composite component has not been found

            Assert.AreEqual(setup.Name, compositeComponentDefinition.Label);
            Assert.AreEqual(setup.Description, compositeComponentDefinition.Description);
            Assert.AreEqual(setup.Author, compositeComponentDefinition.Author);
            Assert.IsNotNull(compositeComponentDefinition.ComponentGraph);

            //the number of configuration properties should be the same
            Assert.AreEqual(setup.ConfigSettings.Count, compositeComponentDefinition.ConfigurationWrapperDefinition.Properties.Count);

            Assert.AreEqual(1, compositeComponentDefinition.IOSpecDefinition.Input.Count);  //one input was included
            Assert.AreEqual(1, compositeComponentDefinition.IOSpecDefinition.Output.Count); //one output was included
        }
Exemple #3
0
        public void AddCompositeComponent_Bug77()
        {
            // load the experiment to be exported
            string     experimentFilename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "experiment_to_test_bug77.gml");
            Experiment experiment         = ExperimentManager.Load(experimentFilename, AppContext.Components);

            experiment.Settings = AppContext.Settings;

            //create ExperimentViewModel for the experiment - the crash happen in the experiment view model, so it has to be initialized
            var experimentViewModel = new TraceLab.UI.WPF.ViewModels.ExperimentViewModel_Accessor(experiment);

            CompositeComponentMetadataDefinition compositeComponentDefinition = null;

            //find the composite component to test bug 77
            foreach (MetadataDefinition definition in AppContext.Components.Components)
            {
                if (definition.Classname.Equals("Component to test bug 77"))
                {
                    compositeComponentDefinition = definition as CompositeComponentMetadataDefinition;
                    break;
                }
            }

            //check if definition has been found in library
            Assert.IsNotNull(compositeComponentDefinition);

            Assert.AreEqual(3, experiment.VertexCount);
            ExperimentNode node = ((IEditableExperiment)experiment).AddComponentFromDefinition(compositeComponentDefinition, -5, 5);

            Assert.IsNotNull(node);
            Assert.AreEqual(4, experiment.VertexCount);
            Assert.IsTrue(experiment.IsModified);
        }
Exemple #4
0
        private CompositeComponentMetadataDefinition FindCompositeComponent(string exportFile)
        {
            CompositeComponentMetadataDefinition compositeComponentDefinition = null;

            foreach (MetadataDefinition definition in AppContext.Components.Components)
            {
                compositeComponentDefinition = definition as CompositeComponentMetadataDefinition;
                //find the composite component that was just exported
                if (compositeComponentDefinition != null && compositeComponentDefinition.Assembly.Equals(exportFile))
                {
                    break;
                }
            }
            return(compositeComponentDefinition);
        }
        public void AddReplaceCompositeComponentMetadataDefinition(CompositeComponentMetadataDefinition metadataDefinition)
        {
            var library = (ComponentsLibrary)m_componentsLibraryViewModel;

            //if there is old composite component definition that had the same source, remove it from library
            CompositeComponentMetadataDefinition oldMetadataDefinition;

            if (library.TryFindCompositeComponentMetadataDefinition(metadataDefinition.Assembly, out oldMetadataDefinition))
            {
                RemoveFromCLVHierarchy(oldMetadataDefinition, m_nodeCollection);
                library.Remove(oldMetadataDefinition);
            }

            library.Add(metadataDefinition);
            AddNodeTag(metadataDefinition);
        }
Exemple #6
0
        public void TestLoadCompositeComponents()
        {
            Library.Clear();
            Assert.AreEqual(0, Library.Components.Count());

            //set library components to new directory
            string testComponentsPath = System.IO.Path.Combine(AppContext.BaseTestDirectory, "TestLoadCompositeComponents");

            AppContext.Settings.ComponentPaths.Clear();
            AppContext.Settings.ComponentPaths.Add(new SettingsPath(true, testComponentsPath));

            string outputAssemblyPath = System.IO.Path.Combine(testComponentsPath, "MockComponents.dll");

            //compile Mock Components to the test directory
            TraceLabTestApplication.CompileMockComponents(outputAssemblyPath);

            //try to load
            var libraryAccessor = new ComponentsLibrary_Accessor(new PrivateObject(Library));

            libraryAccessor.LoadComponentsDefinitions(AppContext.WorkspaceInstance.TypeDirectories);

            //if successful there should be two composite components loaded in the library
            int counter = 0;

            foreach (MetadataDefinition definition in Library.Components)
            {
                CompositeComponentMetadataDefinition compositeCompDefinition = definition as CompositeComponentMetadataDefinition;
                if (compositeCompDefinition != null)
                {
                    //assert its graph is not empty
                    Assert.IsNotNull(compositeCompDefinition.ComponentGraph);
                    counter++;
                }
            }

            Assert.AreEqual(10, counter);
            Assert.AreEqual(15, Library.Components.Count()); //10 composite components + 5 primitive components from MockComponents.dll

            Library.Clear();
        }
Exemple #7
0
        public void DefineCompositeComponentBasicTestSelectAllNodes()
        {
            // load the experiment to be exported
            string     experimentFilename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "experiment_define_composite_component_basic_test.teml");
            Experiment experiment         = ExperimentManager.Load(experimentFilename, AppContext.Components);

            experiment.Settings = AppContext.Settings; //assure that we apply global settings

            //in first basic test select all nodes
            foreach (ExperimentNode node in experiment.Vertices)
            {
                node.IsSelected = true;
            }

            DefiningCompositeComponentSetup setup = new DefiningCompositeComponentSetup(experiment);

            Assert.IsNotNull(setup);

            Assert.AreEqual(1, setup.InputSettings.Count);
            Assert.AreEqual(2, setup.OutputSettings.Count);
            Assert.AreEqual(1, setup.ConfigSettings.Count);

            Assert.IsTrue(setup.InputSettings["test1"].Include);
            Assert.IsTrue(setup.OutputSettings["test1"].Include);
            Assert.IsTrue(setup.OutputSettings["test2"].Include);

            //note, if there are two components with the same label and same config name, the expected behaviour is to add
            Assert.IsTrue(setup.ConfigSettings["Test writer Value"].Include);

            //get real names of the config values
            string configName1 = setup.ConfigSettings["Test writer Value"].PropertyObject.Name;

            //change settings to sth different values
            setup.Name        = "Test Composite Component";
            setup.Author      = "Author XYZ";
            setup.Description = "Composite Component to test export";

            //don't include following in the export
            setup.InputSettings["test1"].Include  = false;
            setup.OutputSettings["test1"].Include = false;

            //rescan library to be sure it is fresh scan
            int numberOfComponentsInLibrary = GetCountOfComponentsInLibrary();

            //set file path to composite component
            setup.CompositeComponentLocationFilePath = exportFile;
            Assert.IsFalse(File.Exists(setup.CompositeComponentLocationFilePath));

            setup.DefineComponent();

            Assert.IsTrue(File.Exists(exportFile));

            //rescan the library
            int updatedNumberOfComponents = GetCountOfComponentsInLibrary();

            //after rescan there should be one more component in the library
            Assert.AreEqual(numberOfComponentsInLibrary + 1, updatedNumberOfComponents);

            //iterate through all components until find new composite component
            CompositeComponentMetadataDefinition compositeComponentDefinition = FindCompositeComponent(exportFile);

            //assure that composite component definition has been found
            Assert.IsNotNull(compositeComponentDefinition); //if fails, composite component has not been found

            Assert.AreEqual(setup.Name, compositeComponentDefinition.Label);
            Assert.AreEqual(setup.Description, compositeComponentDefinition.Description);
            Assert.AreEqual(setup.Author, compositeComponentDefinition.Author);
            Assert.IsNotNull(compositeComponentDefinition.ComponentGraph);

            //the number of configuration properties should be the same
            Assert.AreEqual(setup.ConfigSettings.Count, compositeComponentDefinition.ConfigurationWrapperDefinition.Properties.Count);

            ConfigPropertyObject config1 = compositeComponentDefinition.ConfigurationWrapperDefinition.Properties[configName1];

            Assert.AreEqual("Test writer Value", config1.DisplayName);

            Assert.IsTrue(config1.Visible);                                                 //config1 should  be visible, because Include was set to false

            Assert.AreEqual(0, compositeComponentDefinition.IOSpecDefinition.Input.Count);  //no input was included
            Assert.AreEqual(1, compositeComponentDefinition.IOSpecDefinition.Output.Count); //only one output was included
        }
Exemple #8
0
        public void DefineCompositeComponentFromExperimentWithAnotherCompositeComponentTest()
        {
            // load the experiment to be exported
            string     experimentFilename = System.IO.Path.Combine(AppContext.BaseTestDirectory, "experiment_with_composite_component.teml");
            Experiment experiment         = ExperimentManager.Load(experimentFilename, AppContext.Components);

            experiment.Settings = AppContext.Settings; //applying these settings was causing the bug #74

            //select all nodes
            foreach (ExperimentNode node in experiment.Vertices)
            {
                node.IsSelected = true;
            }

            DefiningCompositeComponentSetup setup = new DefiningCompositeComponentSetup(experiment);

            Assert.IsNotNull(experiment);
            Assert.AreEqual(3, experiment.VertexCount);
            Assert.IsNotNull(setup);

            Assert.AreEqual(0, setup.InputSettings.Count);
            Assert.AreEqual(2, setup.OutputSettings.Count);
            Assert.AreEqual(2, setup.ConfigSettings.Count);

            //check if default name is the same as experiment info
            Assert.IsTrue(setup.OutputSettings["test_x"].Include);
            Assert.IsTrue(setup.OutputSettings["test_y"].Include);
            Assert.IsTrue(setup.ConfigSettings["Composite Component Test writer Value"].Include);
            Assert.IsTrue(setup.ConfigSettings["Composite Component Test writer Value 2"].Include);

            //get real names of the config values
            string configName1 = setup.ConfigSettings["Composite Component Test writer Value"].PropertyObject.Name;
            string configName2 = setup.ConfigSettings["Composite Component Test writer Value 2"].PropertyObject.Name;

            //change settings to sth different values
            setup.Name        = "Complex Composite Component";
            setup.Author      = "Author XYZ";
            setup.Description = "Complex Composite Component to test export";

            //don't include following in the export
            setup.OutputSettings["test_y"].Include = false;

            //change alias
            setup.ConfigSettings["Composite Component Test writer Value"].Alias     = "Config 1";
            setup.ConfigSettings["Composite Component Test writer Value 2"].Alias   = "Config 2";
            setup.ConfigSettings["Composite Component Test writer Value 2"].Include = false;

            //rescan library to be sure it is fresh scan
            int numberOfComponentsInLibrary = GetCountOfComponentsInLibrary();

            //let's export the experiment as composite component
            Assert.IsFalse(File.Exists(exportFile));
            setup.CompositeComponentLocationFilePath = exportFile;

            setup.DefineComponent();

            Assert.IsTrue(File.Exists(exportFile));

            //rescan the library
            int updatedNumberOfComponents = GetCountOfComponentsInLibrary();

            //after rescan there should be one more component in the library
            Assert.AreEqual(numberOfComponentsInLibrary + 1, updatedNumberOfComponents);

            //iterate through all components until find new composite component
            CompositeComponentMetadataDefinition compositeComponentDefinition = FindCompositeComponent(exportFile);

            //assure that composite component definition has been found
            Assert.IsNotNull(compositeComponentDefinition); //if fails, composite component has not been found

            Assert.AreEqual(setup.Name, compositeComponentDefinition.Label);
            Assert.AreEqual(setup.Description, compositeComponentDefinition.Description);
            Assert.AreEqual(setup.Author, compositeComponentDefinition.Author);
            Assert.IsNotNull(compositeComponentDefinition.ComponentGraph);

            //the number of configuration properties should be the same
            Assert.AreEqual(setup.ConfigSettings.Count, compositeComponentDefinition.ConfigurationWrapperDefinition.Properties.Count);

            ConfigPropertyObject config1 = compositeComponentDefinition.ConfigurationWrapperDefinition.Properties[configName1];
            ConfigPropertyObject config2 = compositeComponentDefinition.ConfigurationWrapperDefinition.Properties[configName2];

            Assert.AreEqual("Config 1", config1.DisplayName);
            Assert.AreEqual("Config 2", config2.DisplayName);

            Assert.IsTrue(config1.Visible);
            Assert.IsFalse(config2.Visible);                                                //config1 should not be visible, because Include was set to false

            Assert.AreEqual(0, compositeComponentDefinition.IOSpecDefinition.Input.Count);  //none input value were included
            Assert.AreEqual(1, compositeComponentDefinition.IOSpecDefinition.Output.Count); //one output value was included
        }
        /// <summary>
        /// Extracts the components/types assemblies from the given vertex.
        /// </summary>
        /// <param name="pVertex">Vertex from the experiment graph.</param>
        private void ExtractFilesFromNode(ExperimentNode pVertex)
        {
            if (pVertex is ComponentNode) // Regular component
            {
                ComponentMetadata metaData = (ComponentMetadata)pVertex.Data.Metadata;
                if (metaData != null)
                {
                    ComponentMetadataDefinition metaDataDef = metaData.ComponentMetadataDefinition;
                    if (metaDataDef != null)
                    {
                        bool include;
                        if (m_config.IncludeOtherPackagesAssemblies)
                        {
                            include = true;
                        }
                        else
                        {
                            //determine if component is independent or is coming from another package
                            include = !IsAssemblyInAnotherPackage(metaDataDef.Assembly);
                        }

                        if (include)
                        {
                            // Component assembly
                            this.m_componentAssemblies.Add(Path.GetFullPath(metaDataDef.Assembly));

                            // Extracting types from IOSpec
                            ExtractTypesFromIOSpec(metaDataDef.IOSpecDefinition);
                        }
                    }

                    ConfigWrapper config = metaData.ConfigWrapper;
                    if (config != null)
                    {
                        // Extracting paths for files/directories from components' configuration
                        foreach (ConfigPropertyObject configValue in config.ConfigValues.Values)
                        {
                            // Files
                            if (configValue.Type == "TraceLabSDK.Component.Config.FilePath" && configValue.Value != null)
                            {
                                // Independent files
                                if (configValue.Value is TraceLab.Core.Components.TraceLabFilePath == false)
                                {
                                    if (this.m_config.IncludeIndependentFilesDirs)
                                    {
                                        var filePath = (TraceLabSDK.Component.Config.FilePath)configValue.Value;
                                        if (File.Exists(filePath.Absolute))
                                        {
                                            PackageFileInfo packageFileInfo = new PackageFileInfo(filePath);
                                            m_files.Add(packageFileInfo);

                                            //Change config value relative path -> this path is saved within experiment (note, we operate on the experiment clone)
                                            //so that relative path is in the subfolder of Experiment folder
                                            filePath.Relative = packageFileInfo.RelativeLocation;
                                        }
                                    }
                                }
                                // Files contained in a package
                                else
                                {
                                    if (this.m_config.IncludeOtherPackagesFilesDirs)
                                    {
                                        //TraceLabFilePath represents the file reference located in the package
                                        var packageFilePath = (TraceLabFilePath)configValue.Value;
                                        if (File.Exists(packageFilePath.Absolute))
                                        {
                                            PackageFileInfo packageFileInfo = new PackageFileInfo(packageFilePath);
                                            m_files.Add(packageFileInfo);

                                            //change the configValue to basic FilePath, (not TraceLabFilePath in the package), with updated Relative Path
                                            //so that relative path is in the subfolder of Experiment folder
                                            TraceLabSDK.Component.Config.FilePath basicFilePath = new TraceLabSDK.Component.Config.FilePath();
                                            basicFilePath.Init(packageFilePath.Absolute, packageFilePath.DataRoot);
                                            basicFilePath.Relative = packageFileInfo.RelativeLocation;
                                            configValue.Value      = basicFilePath;
                                        }
                                    }
                                }
                            }
                            // Directories
                            else if (configValue.Type == "TraceLabSDK.Component.Config.DirectoryPath" && configValue.Value != null)
                            {
                                // Independent directories
                                if (configValue.Value is TraceLab.Core.Components.TraceLabDirectoryPath == false)
                                {
                                    if (this.m_config.IncludeIndependentFilesDirs)
                                    {
                                        var dirPath = (TraceLabSDK.Component.Config.DirectoryPath)configValue.Value;
                                        if (Directory.Exists(dirPath.Absolute))
                                        {
                                            PackageFileInfo packageDirectoryInfo = new PackageFileInfo(dirPath);
                                            m_directories.Add(packageDirectoryInfo);

                                            //Change config value relative path -> this path is saved within experiment (note, we operate on the experiment clone)
                                            //so that relative path is in the subfolder of Experiment folder
                                            dirPath.Relative = packageDirectoryInfo.RelativeLocation;
                                        }
                                    }
                                }
                                // Directories contained in a package
                                else
                                {
                                    if (this.m_config.IncludeOtherPackagesFilesDirs)
                                    {
                                        var packageDirPath = (TraceLabDirectoryPath)configValue.Value;
                                        if (Directory.Exists(packageDirPath.Absolute))
                                        {
                                            PackageFileInfo packageDirInfo = new PackageFileInfo(packageDirPath);
                                            m_directories.Add(packageDirInfo);

                                            //change the configValue to basic FilePath, (not TraceLabFilePath in the package), with updated Relative Path
                                            //so that relative path is in the subfolder of Experiment folder
                                            TraceLabSDK.Component.Config.DirectoryPath basicFilePath = new TraceLabSDK.Component.Config.DirectoryPath();
                                            basicFilePath.Init(packageDirPath.Absolute, packageDirPath.DataRoot);
                                            basicFilePath.Relative = packageDirInfo.RelativeLocation;
                                            configValue.Value      = basicFilePath;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else if (pVertex is CompositeComponentNode) // Composite Components, Loops & Scopes
            {
                CompositeComponentBaseMetadata metaData = (CompositeComponentBaseMetadata)pVertex.Data.Metadata;
                if (metaData != null)
                {
                    foreach (var vertex in metaData.ComponentGraph.Vertices)
                    {
                        ExtractFilesFromNode(vertex);
                    }

                    // Only composite components have MetadataDefinition
                    if (pVertex.Data.Metadata is CompositeComponentMetadata)
                    {
                        CompositeComponentMetadataDefinition metaDataDefinition = ((CompositeComponentMetadata)pVertex.Data.Metadata).ComponentMetadataDefinition;

                        this.m_componentAssemblies.Add(Path.GetFullPath(metaDataDefinition.Assembly));

                        // Extracting types from IOSpec
                        ExtractTypesFromIOSpec(metaDataDefinition.IOSpecDefinition);
                    }
                }
            }
        }
Exemple #10
0
        /// <summary>
        /// Prepares the benchmark experiment.
        /// </summary>
        /// <param name="experimentToBeBenchmarked">The experiment to be benchmarked.</param>
        /// <exception cref="TraceLab.Core.Exceptions.ExperimentLoadException">throws if experiment load fails</exception>
        /// <param name="library">The library.</param>
        public void PrepareBenchmarkExperiment(Experiment experimentToBeBenchmarked, ComponentsLibrary library)
        {
            //load benchmark experiment
            Experiment benchmarkExperiment = ExperimentManager.Load(BenchmarkInfo.FilePath, library);

            //update benchmark experiment info, so that it refers to the same benchmark info (LoadExperiment would not read BenchmarkInfo, as it only reads ExperimentInfo)
            benchmarkExperiment.ExperimentInfo = BenchmarkInfo;

            //2. find template node to be replaced
            ExperimentNode templateNode = null;

            foreach (ExperimentNode node in benchmarkExperiment.Vertices)
            {
                if (node.Data.Metadata is ComponentTemplateMetadata)
                {
                    templateNode = node;
                    break;
                }
            }
            if (templateNode == null)
            {
                throw new TraceLab.Core.Exceptions.BenchmarkException("Template node has not been found in the benchmark experiment. The benchmark experiment is corrupted.");
            }

            //3. export current experiment into composite component
            foreach (BenchmarkItemSetting <IOItem> item in BenchmarkInputSetting)
            {
                item.SelectedSetting.Include = true;
            }

            foreach (BenchmarkItemSetting <IOItem> item in BenchmarkOutputsSetting)
            {
                item.SelectedSetting.Include = true;
            }

            //create temporary component source - note it is just a assembly source name file to satisfy Metadata Assembly requirement
            //the file is not going to be created (this is UGLY - do refactoring)
            string tempSource = System.IO.Path.Combine(BenchmarkInfo.FilePath, "temporary");

            m_setup.CompositeComponentLocationFilePath = tempSource;

            CompositeComponentMetadataDefinition definition = m_setup.GenerateCompositeComponentDefinition();

            //4. Replace template node by removing it from graph, adding the new node, and reconnecting new not

            //Add composite component node
            ExperimentNode replacementNode = benchmarkExperiment.AddComponentFromDefinition(definition, templateNode.Data.X, templateNode.Data.Y);

            //connect replacement node to the same outgoing nodes as template node
            foreach (ExperimentNodeConnection nodeConnection in benchmarkExperiment.OutEdges(templateNode))
            {
                benchmarkExperiment.AddConnection(replacementNode, nodeConnection.Target);
            }

            //connect replacement node to the same incoming nodes as template node
            foreach (ExperimentNodeConnection nodeConnection in benchmarkExperiment.InEdges(templateNode))
            {
                benchmarkExperiment.AddConnection(nodeConnection.Source, replacementNode);

                //if the predecessor is a decision node update its decision code so that it matches new label
                FixDecisionCode(templateNode.Data.Metadata.Label, replacementNode.Data.Metadata.Label, nodeConnection.Source as ExperimentDecisionNode);
            }

            //finally remove the template node
            benchmarkExperiment.RemoveVertex(templateNode);

            //now remap io according to settings
            CompositeComponentMetadata compositeComponentDefinition = (CompositeComponentMetadata)replacementNode.Data.Metadata;

            foreach (BenchmarkItemSetting <IOItem> item in BenchmarkInputSetting)
            {
                item.SelectedSetting.Include = true;
                compositeComponentDefinition.IOSpec.Input[item.SelectedSetting.ItemSettingName].MappedTo = item.Item.MappedTo;
            }

            foreach (BenchmarkItemSetting <IOItem> item in BenchmarkOutputsSetting)
            {
                item.SelectedSetting.Include = true;
                compositeComponentDefinition.IOSpec.Output[item.SelectedSetting.ItemSettingName].MappedTo = item.Item.MappedTo;
            }

            BenchmarkExperiment = benchmarkExperiment;
        }