void DoSequenceOrParallelOrAdd(IActivityMonitor monitor, Action <ActionConfiguration> collector, XElement xml) { if (xml.Name == "Parallel" || xml.Name == "Sequence") { Action <ActionConfiguration> elementCollector; if (xml.Name == "Parallel") { var p = new ActionParallelConfiguration(xml.AttributeRequired("Name").Value); elementCollector = a => p.AddAction(a); collector(p); } else { var s = new ActionSequenceConfiguration(xml.AttributeRequired("Name").Value); elementCollector = a => s.AddAction(a); collector(s); } foreach (var action in xml.Elements()) { DoSequenceOrParallelOrAdd(monitor, collector, action); } } else { if (xml.Name != "Add") { throw new XmlException(String.Format("Unknown element '{0}': only <Add>, <Parallel> or <Sequence>.", xml.Name)); } string type = xml.AttributeRequired("Type").Value; Type t = FindConfigurationType(type); HandlerConfiguration hC = (HandlerConfiguration)Activator.CreateInstance(t, xml.AttributeRequired("Name").Value); hC.DoInitialize(monitor, xml); collector(hC); } }
protected override HandlerBase DoCreateParallel(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionParallelConfiguration c, HandlerBase[] children) { return(new ParallelHandler(c, children)); }
protected override ITestIt DoCreateParallel(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionParallelConfiguration c, ITestIt[] children) { return(new TestParallel(monitor, c, children)); }
public ParallelHandler(ActionParallelConfiguration c, HandlerBase[] children) : base(c) { _children = children; }
internal TestParallel(IActivityMonitor m, ActionParallelConfiguration c, ITestIt[] children) { _name = c.Name; _children = children; m.Info().Send("Created Parallel '{0}' with {1} children.", _name, _children.Length); }