public Activity Parse(XElement inputElement) { var activity = new TimerEventActivity(); activity.Name = inputElement.Attribute("name").Value; activity.Type = (ActivityType)inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "type").Value; var configElement = inputElement.Element("config"); activity.IntervalUnit = (TimerUnit)Enum.Parse(typeof(TimerUnit), XElementParserUtils.GetStringValue(configElement.Element("FrequencyIndex"))); activity.RunOnce = XElementParserUtils.GetBoolValue(configElement.Element("Frequency")); activity.TimeInterval = XElementParserUtils.GetIntValue(configElement.Element("TimeInterval")); activity.StartTime = new DateTime(1970, 1, 1); try { activity.StartTime = activity.StartTime.AddMilliseconds(double.Parse(XElementParserUtils.GetStringValue(configElement.Element("StartTime")))); } catch (System.FormatException ex) { Console.WriteLine("An exception occurred:", ex); } return(activity); }
public void SetUp() { this.timerActivityParser = new TimerEventActivityParser(); var xml = @"<pd:activity name=""GetUndlCurrency"" xmlns:pd=""http://xmlns.tibco.com/bw/process/2003"" xmlns:xsl=""http://w3.org/1999/XSL/Transform""> <pd:type>com.tibco.plugin.timer.TimerEventSource</pd:type> <config> <FrequencyIndex>Minute</FrequencyIndex> <Frequency>false</Frequency> <TimeInterval>10</TimeInterval> <StartTime>86400000</StartTime> </config> </pd:activity>"; doc = XElement.Parse(xml); this.activity = (TimerEventActivity)this.timerActivityParser.Parse(doc); }