public void Should_Return_ObjectXNodes_in_Element_config() { var xml = @"<pd:activity name=""Mappe Equity"" xmlns:pd=""http://xmlns.tibco.com/bw/process/2003"" xmlns:xsl=""http://w3.org/1999/XSL/Transform"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> <pd:type>com.tibco.plugin.mapper.MapperActivity</pd:type> <config> <element> <xsd:element name=""adminID"" type=""xsd:string"" /> </element> </config> <pd:inputBindings> <sqlParams> <FundName> <xsl:value-of select=""testvalue""/> </FundName> <AdminID> <xsl:value-of select=""EVL""/> </AdminID> </sqlParams> </pd:inputBindings> </pd:activity>"; var docz = XElement.Parse(xml); MapperActivity mapperActivity = (MapperActivity)mapperActivityParser.Parse(docz); Assert.IsTrue(mapperActivity.ObjectXNodes != null); }
public Activity Parse(XElement inputElement) { var mapperActivity = new MapperActivity(); mapperActivity.Name = inputElement.Attribute("name").Value; var xElement = inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "type"); if (xElement != null) { mapperActivity.Type = (ActivityType)xElement.Value; } var configElement = inputElement.Element("config"); // If the ref is not null the Xsd has been define somewhere else otherwise it's define in line if (configElement.Element("element").Attribute("ref") != null) { mapperActivity.XsdReference = configElement.Element("element").Attribute("ref").Value; } else { mapperActivity.ObjectXNodes = configElement.Element("element").Nodes(); } mapperActivity.InputBindings = inputElement.Element(XmlnsConstant.tibcoProcessNameSpace + "inputBindings").Nodes(); mapperActivity.Parameters = new XslParser().Parse(mapperActivity.InputBindings); return(mapperActivity); }
public void SetUp() { this.mapperActivityBuilder = new MapperActivityBuilder(new XslBuilder(new XpathBuilder()), new XsdBuilder(), new XsdParser()); this.activity = new MapperActivity("My Activity Name", ActivityType.mapperActivityType); this.activity.XsdReference = "pf4:EquityRecord"; var xml = @"<pd:inputBindings xmlns:pd=""http://xmlns.tibco.com/bw/process/2003"" xmlns:xsl=""http://w3.org/1999/XSL/Transform""> <EquityRecord> <xmlString> <xsl:value-of select=""'TestString'""/> </xmlString> </EquityRecord> </pd:inputBindings> "; XElement doc = XElement.Parse(xml); this.activity.InputBindings = doc.Nodes(); this.activity.Parameters = new List <ClassParameter> { new ClassParameter { Name = "EquityRecord", Type = "EquityRecord" } }; }
public void Should_Return_XsdReference_in_Element_config() { MapperActivity mapperActivity = (MapperActivity)mapperActivityParser.Parse(doc); Assert.AreEqual("pfx2:NTMMessage", mapperActivity.XsdReference); }
public void Should_Return_Activity_Type_Is_MapperActivity() { MapperActivity mapperActivity = (MapperActivity)mapperActivityParser.Parse(doc); Assert.AreEqual("com.tibco.plugin.mapper.MapperActivity", mapperActivity.Type.ToString()); }