public void Should_Return_null_When_GetBooleanValue_is_Called_With_a_Element_Not_Null_But_With_No_Value() { var element = new XElement("Test"); var actual = XElementParserUtils.GetBoolValue(element); Assert.AreEqual(null, actual); }
public Activity Parse(XElement inputElement) { var activity = new RdvPublishActivity(); activity.Name = inputElement.Attribute("name").Value; activity.Type = (ActivityType)inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "type").Value; var configElement = inputElement.Element("config"); activity.Subject = XElementParserUtils.GetStringValue(configElement.Element("subject")); activity.SharedChannel = XElementParserUtils.GetStringValue(configElement.Element("sharedChannel")); activity.isXmlEncode = XElementParserUtils.GetBoolValue(configElement.Element("xmlEncoding")); var xsdStringElement = configElement.Element("xsdString"); if (xsdStringElement.Attribute("ref") != null) { activity.XsdString = xsdStringElement.Attribute("ref").ToString(); } else { activity.ObjectXNodes = xsdStringElement.Nodes(); } if (inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings") != null) { activity.InputBindings = inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Nodes(); activity.Parameters = new XslParser().Parse(activity.InputBindings); } return(activity); }
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 Should_Return_true_Value_When_Element_is_not_null_And_Has_a_Value_true() { var element = new XElement("Test"); element.Value = "True"; var actual = XElementParserUtils.GetBoolValue(element); Assert.AreEqual(true, actual); }
public Activity Parse(XElement inputElement) { var activity = new SetSharedVariableActivity(); activity.Name = inputElement.Attribute("name").Value; activity.Type = (ActivityType)inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "type").Value; var configElement = inputElement.Element("config"); activity.VariableConfig = XElementParserUtils.GetStringValue(configElement.Element("variableConfig")); activity.ShowResult = XElementParserUtils.GetBoolValue(configElement.Element("showResult")); if (inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings") != null) { activity.InputBindings = inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Nodes(); activity.Parameters = new XslParser().Build(activity.InputBindings); } return(activity); }
private TbwProcessContainerConfig GetTbxProcessConfig(XElement xElement) { var container = new TbwProcessContainerConfig(); container.Name = xElement.Attribute("name").Value; container.IsEnabled = XElementParserUtils.GetBoolValue(xElement.Element(XmlnsConstant.ConfigNamespace + "enabled")); var processesElements = xElement.Element(XmlnsConstant.ConfigNamespace + "bwprocesses").Elements(XmlnsConstant.ConfigNamespace + "bwprocess"); container.TbwProcessConfigs = new List <TbwProcessConfig>(); foreach (var processesElement in processesElements) { container.TbwProcessConfigs.Add(new TbwProcessConfig { Name = processesElement.Attribute("name").Value, IsEnabled = (bool)XElementParserUtils.GetBoolValue(processesElement.Element(XmlnsConstant.ConfigNamespace + "enabled")), Activation = (bool)XElementParserUtils.GetBoolValue(processesElement.Element(XmlnsConstant.ConfigNamespace + "activation")), MaxJob = (int)XElementParserUtils.GetIntValue(processesElement.Element(XmlnsConstant.ConfigNamespace + "maxJob")), FlowLimit = (int)XElementParserUtils.GetIntValue(processesElement.Element(XmlnsConstant.ConfigNamespace + "flowLimit")) }); } return(container); }
public Activity Parse(XElement inputElement) { var activity = new AdapterSubscriberActivity(); activity.Name = inputElement.Attribute("name").Value; activity.Type = (ActivityType)inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "type").Value; var configElement = inputElement.Element("config"); activity.TpPluginEndpointName = XElementParserUtils.GetStringValue(configElement.Element("tpPluginEndpointName")); activity.UseRequestReply = XElementParserUtils.GetBoolValue(configElement.Element(AeSubscriberPropertyPrefix + "useRequestReply")); activity.TransportChoice = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "transportChoice")); activity.AdapterService = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "adapterService")); activity.TransportType = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "transportType")); activity.RvSubject = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "rvSubject")); activity.RvSessionService = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "rvSessionService")); activity.RvSessionNetwork = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "rvSessionNetwork")); activity.RvSessionDaemon = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "rvSessionDaemon")); activity.MessageFormat = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "msgFormat")); activity.RvCmSessionDefaultTimeLimit = XElementParserUtils.GetIntValue(configElement.Element(AeSubscriberPropertyPrefix + "rvCmSessionDefaultTimeLimit")); activity.RvCmSessionSyncLedger = XElementParserUtils.GetBoolValue(configElement.Element(AeSubscriberPropertyPrefix + "rvCmSessionSyncLedger")); activity.RvCmSessionLedgerFile = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "rvCmSessionLedgerFile")); activity.RvCmSessionName = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "rvCmSessionName")); activity.RvCmSessionRelayAgent = XElementParserUtils.GetStringValue(configElement.Element(AeSubscriberPropertyPrefix + "rvCmSessionRelayAgent")); activity.RvCmSessionRequireOldMessages = XElementParserUtils.GetBoolValue(configElement.Element(AeSubscriberPropertyPrefix + "rvCmSessionRequireOldMessages")); var outputSchemaElement = configElement.Element(AeSubscriberPropertyPrefix + "outputMeta"); if (outputSchemaElement != null) { activity.OutputSchema = XElementParserUtils.GetStringValue(outputSchemaElement.Element("aeMeta")); } return(activity); }
public void Should_Return_null_If_bool_Element_is_null() { var actual = XElementParserUtils.GetBoolValue(null); Assert.IsNull(actual); }
public Activity Parse(XElement inputElement) { var jdbcQueryActivity = new JdbcQueryActivity(); jdbcQueryActivity.Name = inputElement.Attribute("name").Value; jdbcQueryActivity.Type = (ActivityType)inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "type").Value; var configElement = inputElement.Element("config"); jdbcQueryActivity.TimeOut = XElementParserUtils.GetIntValue(configElement.Element("timeout")); jdbcQueryActivity.Commit = XElementParserUtils.GetBoolValue(configElement.Element("commit")); jdbcQueryActivity.MaxRows = XElementParserUtils.GetIntValue(configElement.Element("maxRows")); jdbcQueryActivity.EmptyStringAsNull = XElementParserUtils.GetBoolValue(configElement.Element("emptyStrAsNil")); jdbcQueryActivity.JdbcSharedConfig = XElementParserUtils.GetStringValue(configElement.Element("jdbcSharedConfig")); if (jdbcQueryActivity.Type == ActivityType.jdbcCallActivityType) { jdbcQueryActivity.QueryStatement = XElementParserUtils.GetStringValue(configElement.Element("ProcedureName")); if (jdbcQueryActivity.QueryStatement.Contains(";")) { jdbcQueryActivity.QueryStatement = jdbcQueryActivity.QueryStatement.Remove(jdbcQueryActivity.QueryStatement.LastIndexOf(';'), 2); } var preparedParamDataTypeElement = configElement.Element("parameterTypes"); jdbcQueryActivity.QueryStatementParameters = new Dictionary <string, string>(); var parameterElements = preparedParamDataTypeElement.Elements("parameter"); jdbcQueryActivity.QueryOutputStatementParameters = new List <ClassParameter> { new ClassParameter { Name = "UnresolvedResultsets", Type = "VARCHAR" } }; foreach (var parameterElement in parameterElements) { string parameterName = (XElementParserUtils.GetStringValue(parameterElement.Element("colName")).Replace(".", string.Empty)); parameterName = VariableHelper.ToSafeType(parameterName.Substring(1, parameterName.Length - 1)); string parameterType = XElementParserUtils.GetStringValue(parameterElement.Element("typeName")); string colonneType = XElementParserUtils.GetStringValue(parameterElement.Element("colType")); //ColonneType= 1 : input parameter if (colonneType == "1") { jdbcQueryActivity.QueryStatementParameters.Add(parameterName, parameterType); } //ColonneType= 4 : output parameter else if (colonneType == "4" || colonneType == "2" || colonneType == "5") { jdbcQueryActivity.QueryOutputStatementParameters.Add(new ClassParameter { Name = parameterName, Type = parameterType }); } } var xElement = configElement.Element("ResultSets"); if (xElement != null) { jdbcQueryActivity.QueryOutputStatementParameters.AddRange(this.GetOutputParameters(xElement.Element("ResultSet"))); } if (inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings") != null && inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Element("inputs") != null && inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Element("inputs").Element("inputSet") != null) { //jdbcQueryActivity.InputBindings = inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Element("inputs").Element("inputSet").Nodes(); jdbcQueryActivity.InputBindings = inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Element("inputs").Nodes(); jdbcQueryActivity.Parameters = new XslParser().Parse(inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Element("inputs").Element("inputSet").Nodes()); } } else { jdbcQueryActivity.QueryStatement = XElementParserUtils.GetStringValue(configElement.Element("statement")).Replace("\n", " "); var preparedParamDataTypeElement = configElement.Element("Prepared_Param_DataType"); jdbcQueryActivity.QueryStatementParameters = new Dictionary <string, string>(); if (preparedParamDataTypeElement != null) { var parameterElements = preparedParamDataTypeElement.Elements("parameter"); foreach (var parameterElement in parameterElements) { jdbcQueryActivity.QueryStatementParameters.Add( VariableHelper.ToSafeType(XElementParserUtils.GetStringValue(parameterElement.Element("parameterName")).Replace(".", string.Empty)), XElementParserUtils.GetStringValue(parameterElement.Element("dataType"))); } } jdbcQueryActivity.QueryOutputStatementParameters = this.GetOutputParameters(configElement); if (inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings") != null && inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Element("jdbcQueryActivityInput") != null) { //jdbcQueryActivity.InputBindings = inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Element("jdbcQueryActivityInput").Nodes(); jdbcQueryActivity.InputBindings = inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Nodes(); jdbcQueryActivity.Parameters = new XslParser().Parse(inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Element("jdbcQueryActivityInput").Nodes()); } } return(jdbcQueryActivity); }