Ejemplo n.º 1
0
        public RunnableNode CreateNode(string id, Metadata metadata, System.Threading.ManualResetEvent terminateExperimentExecutionResetEvent)
        {
            StartNodeMetadata startNodeMetadata = metadata as StartNodeMetadata;
            EndNodeMetadata endNodeMetadata = metadata as EndNodeMetadata;
            ComponentMetadata componentMetadata = metadata as ComponentMetadata;

            if (startNodeMetadata != null)
            {
                return new RunnableStartNode(id);
            }
            else if (endNodeMetadata != null)
            {
                return new RunnableEndNode(id, endNodeMetadata.WaitsForAllPredecessors);
            }
            else if (componentMetadata != null)
            {
                //mock failure
                if (componentMetadata.Label.Equals("Broken Component"))
                {
                    throw new ArgumentException("Failed");
                }

                //otherwise create a mock node and keep reference
                MockNode mockNode = new MockNode(id);
                CreatedNodes.Add(mockNode);

                return mockNode;
            }
            else
            {
                throw new ArgumentException("Could not identify node type.");
            }
        }