public void DeSerializeToXMLInputsOnlyFromBinary_ValidXML_Expect_Sucess() { IBinaryDataList dl = Dev2BinaryDataListFactory.CreateDataList(); List <Dev2Column> cols1 = new List <Dev2Column> { DataListFactory.CreateDev2Column("f1", ""), }; List <Dev2Column> cols2 = new List <Dev2Column> { DataListFactory.CreateDev2Column("f2", ""), }; string error; ErrorResultTO errors; IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormatInputsOnly); dl.TryCreateRecordsetTemplate("rs1", "", cols1, true, out error); dl.TryCreateRecordsetTemplate("rs2", "", cols2, true, true, enDev2ColumnArgumentDirection.Input, out error); dl.TryCreateScalarTemplate("", "scalar1", "", true, true, enDev2ColumnArgumentDirection.Input, out error); dl.TryCreateScalarTemplate("", "scalar2", "", true, true, enDev2ColumnArgumentDirection.Output, out error); dl.TryCreateScalarValue("scalar1Value", "scalar1", out error); dl.TryCreateScalarValue("scalar2Value", "scalar2", out error); dl.TryCreateRecordsetValue("rec1.f1.value", "f1", "rs1", 1, out error); dl.TryCreateRecordsetValue("rec1.f2.value", "f2", "rs2", 1, out error); dl.TryCreateRecordsetValue("rec2.f1.value", "f1", "rs1", 2, out error); dl.TryCreateRecordsetValue("rec2.f2.value", "f2", "rs2", 2, out error); DataListTranslatedPayloadTO tmp = xmlConverter.ConvertFrom(dl, out errors); string result = tmp.FetchAsString().ToString(); Assert.AreEqual("<DataList><scalar1>scalar1Value</scalar1></DataList>", result); }
public void MyTestInitialize() { string error; var dataListCompiler = DataListFactory.CreateDataListCompiler(); _dl1 = Dev2BinaryDataListFactory.CreateDataList(); _dl1.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dl1.TryCreateScalarValue("[[otherScalar]]", "myScalar", out error); _dl1.TryCreateScalarTemplate(string.Empty, "otherScalar", "A scalar", true, out error); _dl1.TryCreateScalarValue("testRegion", "otherScalar", out error); _dl1.TryCreateScalarTemplate(string.Empty, "scalar1", "A scalar", true, out error); _dl1.TryCreateScalarValue("foobar", "scalar1", out error); IList <Dev2Column> cols = new List <Dev2Column>(); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f1")); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f2")); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f3")); _dl1.TryCreateRecordsetTemplate("recset", "a recordset", cols, true, out error); _dl1.TryCreateRecordsetValue("r1.f1.value", "f1", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r1.f2.value", "f2", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r1.f3.value", "f3", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r2.f1.value", "f1", "recset", 2, out error); _dl1.TryCreateRecordsetValue("r2.f2.value", "f2", "recset", 2, out error); _dl1.TryCreateRecordsetValue("r2.f3.value", "f3", "recset", 2, out error); // skip 3 ;) _dl1.TryCreateRecordsetValue("r4.f1.value", "f1", "recset", 4, out error); _dl1.TryCreateRecordsetValue("r4.f2.value", "f2", "recset", 4, out error); _dl1.TryCreateRecordsetValue("r4.f3.value", "f3", "recset", 4, out error); dataListCompiler.PushBinaryDataList(_dl1.UID, _dl1, out _errors); //_compiler.UpsertSystemTag(dl1.UID, enSystemTag.EvaluateIteration, "true", out errors); /* list 2 */ _dl2 = Dev2BinaryDataListFactory.CreateDataList(); _dl2.TryCreateScalarTemplate(string.Empty, "idx", "A scalar", true, out error); _dl2.TryCreateScalarValue("1", "idx", out error); _dl2.TryCreateRecordsetTemplate("recset", "a recordset", cols, true, out error); _dl2.TryCreateRecordsetValue("r1.f1.value", "f1", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r1.f2.value", "f2", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r1.f3.value", "f3", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r2.f1.value", "f1", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r2.f2.value", "f2", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r2.f3.value", "f3", "recset", 2, out error); dataListCompiler.PushBinaryDataList(_dl2.UID, _dl2, out _errors); //_compiler.UpsertSystemTag(dl2.UID, enSystemTag.EvaluateIteration, "true", out errors); }
public void MyTestInitialize() { string error; var dataListCompiler = DataListFactory.CreateDataListCompiler(); _dl1 = Dev2BinaryDataListFactory.CreateDataList(); _dl1.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dl1.TryCreateScalarValue("[[otherScalar]]", "myScalar", out error); _dl1.TryCreateScalarTemplate(string.Empty, "otherScalar", "A scalar", true, out error); _dl1.TryCreateScalarValue("testRegion", "otherScalar", out error); _dl1.TryCreateScalarTemplate(string.Empty, "scalar1", "A scalar", true, out error); _dl1.TryCreateScalarValue("foobar", "scalar1", out error); IList<Dev2Column> cols = new List<Dev2Column>(); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f1")); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f2")); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f3")); _dl1.TryCreateRecordsetTemplate("recset", "a recordset", cols, true, out error); _dl1.TryCreateRecordsetValue("r1.f1.value", "f1", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r1.f2.value", "f2", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r1.f3.value", "f3", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r2.f1.value", "f1", "recset", 2, out error); _dl1.TryCreateRecordsetValue("r2.f2.value", "f2", "recset", 2, out error); _dl1.TryCreateRecordsetValue("r2.f3.value", "f3", "recset", 2, out error); // skip 3 ;) _dl1.TryCreateRecordsetValue("r4.f1.value", "f1", "recset", 4, out error); _dl1.TryCreateRecordsetValue("r4.f2.value", "f2", "recset", 4, out error); _dl1.TryCreateRecordsetValue("r4.f3.value", "f3", "recset", 4, out error); dataListCompiler.PushBinaryDataList(_dl1.UID, _dl1, out _errors); //_compiler.UpsertSystemTag(dl1.UID, enSystemTag.EvaluateIteration, "true", out errors); /* list 2 */ _dl2 = Dev2BinaryDataListFactory.CreateDataList(); _dl2.TryCreateScalarTemplate(string.Empty, "idx", "A scalar", true, out error); _dl2.TryCreateScalarValue("1", "idx", out error); _dl2.TryCreateRecordsetTemplate("recset", "a recordset", cols, true, out error); _dl2.TryCreateRecordsetValue("r1.f1.value", "f1", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r1.f2.value", "f2", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r1.f3.value", "f3", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r2.f1.value", "f1", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r2.f2.value", "f2", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r2.f3.value", "f3", "recset", 2, out error); dataListCompiler.PushBinaryDataList(_dl2.UID, _dl2, out _errors); //_compiler.UpsertSystemTag(dl2.UID, enSystemTag.EvaluateIteration, "true", out errors); }
public void DeSerializeToXMLFromBinary_InvertedIndexInsert_ValidXML_Expect_Sucess() { IBinaryDataList dl = Dev2BinaryDataListFactory.CreateDataList(); string error; List <Dev2Column> cols = new List <Dev2Column>(); ErrorResultTO errors; cols.Add(DataListFactory.CreateDev2Column("f1", "")); cols.Add(DataListFactory.CreateDev2Column("f2", "")); cols.Add(DataListFactory.CreateDev2Column("f3", "")); IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormat); dl.TryCreateRecordsetTemplate("rs1", "", cols, true, out error); dl.TryCreateScalarTemplate(string.Empty, "scalar1", "", true, out error); dl.TryCreateScalarValue("scalar1Value", "scalar1", out error); dl.TryCreateRecordsetValue("rec1.f2.vale", "f2", "rs1", 1, out error); dl.TryCreateRecordsetValue("rec1.f1.vale", "f1", "rs1", 1, out error); dl.TryCreateRecordsetValue("rec1.f3.vale", "f3", "rs1", 1, out error); dl.TryCreateRecordsetValue("rec2.f1.vale", "f1", "rs1", 2, out error); dl.TryCreateRecordsetValue("rec2.f2.vale", "f2", "rs1", 2, out error); dl.TryCreateRecordsetValue("rec2.f3.vale", "f3", "rs1", 2, out error); DataListTranslatedPayloadTO tmp = xmlConverter.ConvertFrom(dl, out errors); string result = tmp.FetchAsString().ToString(); Assert.AreEqual("<DataList><rs1><f1>rec1.f1.vale</f1><f2>rec1.f2.vale</f2><f3>rec1.f3.vale</f3></rs1><rs1><f1>rec2.f1.vale</f1><f2>rec2.f2.vale</f2><f3>rec2.f3.vale</f3></rs1><scalar1>scalar1Value</scalar1></DataList>", result); }
public void DeserializeToXMLFromBinaryDataListWhereDataListContainsInvalidXMLCharactersExpectedInvalidCharactersAreEscaped() { IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormat); IBinaryDataList dl1 = Dev2BinaryDataListFactory.CreateDataList(GlobalConstants.NullDataListID); string error; dl1.TryCreateScalarTemplate(string.Empty, "cake", "", false, true, enDev2ColumnArgumentDirection.Both, out error); dl1.TryCreateScalarValue("Travis Is \"Cool\"&>'nstuff'<", "cake", out error); ErrorResultTO errors; var payload = xmlConverter.ConvertFrom(dl1, out errors); string actual = payload.FetchAsString().ToString(); const string expected = "Travis Is \"Cool\"&>'nstuff'<"; StringAssert.Contains(actual, expected, "Not all XML special characters are escaped i.e \"'><&"); }
/// <summary> /// Gets the outputs. /// </summary> /// <param name="obj">The obj to get outputs for.</param> /// <returns></returns> public static IBinaryDataList GetSimpleOutputs(object obj) { IBinaryDataList binaryDL = Dev2BinaryDataListFactory.CreateDataList(); Type sourceType = obj.GetType(); foreach (PropertyInfo pi in sourceType.GetProperties()) { List <Outputs> listOfInputs = pi.GetCustomAttributes(typeof(Outputs), true).OfType <Outputs>().ToList(); if (listOfInputs.Count > 0) { string error; if (binaryDL.TryCreateScalarTemplate(string.Empty, listOfInputs[0].UserVisibleName, "", true, out error)) { binaryDL.TryCreateScalarValue(pi.GetValue(obj, null).ToString(), listOfInputs[0].UserVisibleName, out error); } } } return(binaryDL); }
public void XmlTranslator_ConvertAndFilter_WhenXMLSpecialCharsPresent_ExpectEscapedChars() { //------------Setup for test-------------------------- IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormatWithoutSystemTags); IBinaryDataList dl1 = Dev2BinaryDataListFactory.CreateDataList(GlobalConstants.NullDataListID); string error; dl1.TryCreateScalarTemplate(string.Empty, "cake", "", false, true, enDev2ColumnArgumentDirection.Both, out error); dl1.TryCreateScalarValue("Travis Is \"Cool\"&>'nstuff'<", "cake", out error); //------------Execute Test--------------------------- ErrorResultTO errors; var actual = xmlConverter.ConvertAndFilter(dl1, "<root><cake/></root>".ToStringBuilder(), out errors); //------------Assert Results------------------------- const string expected = "Travis Is "Cool"&>'nstuff'<"; StringAssert.Contains(actual.ToString(), expected, "Not all XML special characters are escaped i.e \"'><&"); }
public void MyTestInitialize() { string error; _dl1 = Dev2BinaryDataListFactory.CreateDataList(); _dl1.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dl1.TryCreateScalarValue("myValue", "myScalar", out error); IList<Dev2Column> cols = new List<Dev2Column>(); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f1")); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f2")); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f3")); _dl1.TryCreateRecordsetTemplate("recset", "a recordset", cols, true, out error); _dl1.TryCreateRecordsetValue("r1.f1.value", "f1", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r1.f2.value", "f2", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r1.f3.value", "f3", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r2.f1.value", "f1", "recset", 2, out error); _dl1.TryCreateRecordsetValue("r2.f2.value", "f2", "recset", 2, out error); _dl1.TryCreateRecordsetValue("r2.f3.value", "f3", "recset", 2, out error); // skip 3 ;) _dl1.TryCreateRecordsetValue("r4.f1.value", "f1", "recset", 4, out error); _dl1.TryCreateRecordsetValue("r4.f2.value", "f2", "recset", 4, out error); _dl1.TryCreateRecordsetValue("r4.f3.value", "f3", "recset", 4, out error); // create 2nd obj _dl2 = Dev2BinaryDataListFactory.CreateDataList(); _dl2.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dl2.TryCreateScalarValue("myValue2", "myScalar", out error); cols = new List<Dev2Column> { Dev2BinaryDataListFactory.CreateColumn("f1"), Dev2BinaryDataListFactory.CreateColumn("f2"), Dev2BinaryDataListFactory.CreateColumn("f3") }; _dl2.TryCreateRecordsetTemplate("recset", "a recordset", cols, true, out error); _dl2.TryCreateRecordsetValue("r1a.f1.value2", "f1", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r1a.f2.value2", "f2", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r1a.f3.value2", "f3", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r2a.f1.value2", "f1", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r2a.f2.value2", "f2", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r2a.f3.value2", "f3", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r3a.f1.value2", "f1", "recset", 3, out error); _dl2.TryCreateRecordsetValue("r3a.f2.value2", "f2", "recset", 3, out error); _dl2.TryCreateRecordsetValue("r3a.f3.value2", "f3", "recset", 3, out error); // create 3rd obj _dl3 = Dev2BinaryDataListFactory.CreateDataList(); _dl3.TryCreateScalarTemplate(string.Empty, "theScalar", "A scalar", true, out error); _dl3.TryCreateScalarValue("theValue", "theScalar", out error); cols = new List<Dev2Column> { Dev2BinaryDataListFactory.CreateColumn("f1"), Dev2BinaryDataListFactory.CreateColumn("f2"), Dev2BinaryDataListFactory.CreateColumn("f3") }; _dl3.TryCreateRecordsetTemplate("recset2", "a recordset", cols, true, out error); _dl3.TryCreateRecordsetValue("r1a.f1.value2", "f1", "recset2", 1, out error); _dl3.TryCreateRecordsetValue("r1a.f2.value2", "f2", "recset2", 1, out error); _dl3.TryCreateRecordsetValue("r1a.f3.value2", "f3", "recset2", 1, out error); _dl3.TryCreateRecordsetValue("r2a.f1.value2", "f1", "recset2", 2, out error); _dl3.TryCreateRecordsetValue("r2a.f2.value2", "f2", "recset2", 2, out error); _dl3.TryCreateRecordsetValue("r2a.f3.value2", "f3", "recset2", 2, out error); _dl3.TryCreateRecordsetValue("r3a.f1.value2", "f1", "recset2", 3, out error); _dl3.TryCreateRecordsetValue("r3a.f2.value2", "f2", "recset2", 3, out error); _dl3.TryCreateRecordsetValue("r3a.f3.value2", "f3", "recset2", 3, out error); // create 4th obj _dl4 = Dev2BinaryDataListFactory.CreateDataList(); _dl4.TryCreateScalarTemplate(string.Empty, "theScalar", "A scalar", true, out error); _dl4.TryCreateScalarValue("theValue4", "theScalar", out error); _dl4.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dl4.TryCreateScalarValue("myValue4", "myScalar", out error); cols = new List<Dev2Column> { Dev2BinaryDataListFactory.CreateColumn("f1"), Dev2BinaryDataListFactory.CreateColumn("f2"), Dev2BinaryDataListFactory.CreateColumn("f3") }; _dl4.TryCreateRecordsetTemplate("recset2", "a recordset", cols, true, out error); _dl4.TryCreateRecordsetValue("r1a.f1.value2", "f1", "recset2", 1, out error); _dl4.TryCreateRecordsetValue("r1a.f2.value2", "f2", "recset2", 1, out error); _dl4.TryCreateRecordsetValue("r1a.f3.value2", "f3", "recset2", 1, out error); _dl4.TryCreateRecordsetValue("r2a.f1.value2", "f1", "recset2", 2, out error); _dl4.TryCreateRecordsetValue("r2a.f2.value2", "f2", "recset2", 2, out error); _dl4.TryCreateRecordsetValue("r2a.f3.value2", "f3", "recset2", 2, out error); _dl4.TryCreateRecordsetValue("r3a.f1.value2", "f1", "recset2", 3, out error); _dl4.TryCreateRecordsetValue("r3a.f2.value2", "f2", "recset2", 3, out error); _dl4.TryCreateRecordsetValue("r3a.f3.value2", "f3", "recset2", 3, out error); // create 5th obj _dlWithBankScalar = Dev2BinaryDataListFactory.CreateDataList(); _dlWithBankScalar.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dlWithBankScalar.TryCreateScalarValue("", "myScalar", out error); _dlWithPopulatedScalar = Dev2BinaryDataListFactory.CreateDataList(); _dlWithPopulatedScalar.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dlWithPopulatedScalar.TryCreateScalarValue("CAKE!", "myScalar", out error); }
public void MyTestInitialize() { string error; _dl1 = Dev2BinaryDataListFactory.CreateDataList(); _dl1.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dl1.TryCreateScalarValue("myValue", "myScalar", out error); IList <Dev2Column> cols = new List <Dev2Column>(); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f1")); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f2")); cols.Add(Dev2BinaryDataListFactory.CreateColumn("f3")); _dl1.TryCreateRecordsetTemplate("recset", "a recordset", cols, true, out error); _dl1.TryCreateRecordsetValue("r1.f1.value", "f1", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r1.f2.value", "f2", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r1.f3.value", "f3", "recset", 1, out error); _dl1.TryCreateRecordsetValue("r2.f1.value", "f1", "recset", 2, out error); _dl1.TryCreateRecordsetValue("r2.f2.value", "f2", "recset", 2, out error); _dl1.TryCreateRecordsetValue("r2.f3.value", "f3", "recset", 2, out error); // skip 3 ;) _dl1.TryCreateRecordsetValue("r4.f1.value", "f1", "recset", 4, out error); _dl1.TryCreateRecordsetValue("r4.f2.value", "f2", "recset", 4, out error); _dl1.TryCreateRecordsetValue("r4.f3.value", "f3", "recset", 4, out error); // create 2nd obj _dl2 = Dev2BinaryDataListFactory.CreateDataList(); _dl2.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dl2.TryCreateScalarValue("myValue2", "myScalar", out error); cols = new List <Dev2Column> { Dev2BinaryDataListFactory.CreateColumn("f1"), Dev2BinaryDataListFactory.CreateColumn("f2"), Dev2BinaryDataListFactory.CreateColumn("f3") }; _dl2.TryCreateRecordsetTemplate("recset", "a recordset", cols, true, out error); _dl2.TryCreateRecordsetValue("r1a.f1.value2", "f1", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r1a.f2.value2", "f2", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r1a.f3.value2", "f3", "recset", 1, out error); _dl2.TryCreateRecordsetValue("r2a.f1.value2", "f1", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r2a.f2.value2", "f2", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r2a.f3.value2", "f3", "recset", 2, out error); _dl2.TryCreateRecordsetValue("r3a.f1.value2", "f1", "recset", 3, out error); _dl2.TryCreateRecordsetValue("r3a.f2.value2", "f2", "recset", 3, out error); _dl2.TryCreateRecordsetValue("r3a.f3.value2", "f3", "recset", 3, out error); // create 3rd obj _dl3 = Dev2BinaryDataListFactory.CreateDataList(); _dl3.TryCreateScalarTemplate(string.Empty, "theScalar", "A scalar", true, out error); _dl3.TryCreateScalarValue("theValue", "theScalar", out error); cols = new List <Dev2Column> { Dev2BinaryDataListFactory.CreateColumn("f1"), Dev2BinaryDataListFactory.CreateColumn("f2"), Dev2BinaryDataListFactory.CreateColumn("f3") }; _dl3.TryCreateRecordsetTemplate("recset2", "a recordset", cols, true, out error); _dl3.TryCreateRecordsetValue("r1a.f1.value2", "f1", "recset2", 1, out error); _dl3.TryCreateRecordsetValue("r1a.f2.value2", "f2", "recset2", 1, out error); _dl3.TryCreateRecordsetValue("r1a.f3.value2", "f3", "recset2", 1, out error); _dl3.TryCreateRecordsetValue("r2a.f1.value2", "f1", "recset2", 2, out error); _dl3.TryCreateRecordsetValue("r2a.f2.value2", "f2", "recset2", 2, out error); _dl3.TryCreateRecordsetValue("r2a.f3.value2", "f3", "recset2", 2, out error); _dl3.TryCreateRecordsetValue("r3a.f1.value2", "f1", "recset2", 3, out error); _dl3.TryCreateRecordsetValue("r3a.f2.value2", "f2", "recset2", 3, out error); _dl3.TryCreateRecordsetValue("r3a.f3.value2", "f3", "recset2", 3, out error); // create 4th obj _dl4 = Dev2BinaryDataListFactory.CreateDataList(); _dl4.TryCreateScalarTemplate(string.Empty, "theScalar", "A scalar", true, out error); _dl4.TryCreateScalarValue("theValue4", "theScalar", out error); _dl4.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dl4.TryCreateScalarValue("myValue4", "myScalar", out error); cols = new List <Dev2Column> { Dev2BinaryDataListFactory.CreateColumn("f1"), Dev2BinaryDataListFactory.CreateColumn("f2"), Dev2BinaryDataListFactory.CreateColumn("f3") }; _dl4.TryCreateRecordsetTemplate("recset2", "a recordset", cols, true, out error); _dl4.TryCreateRecordsetValue("r1a.f1.value2", "f1", "recset2", 1, out error); _dl4.TryCreateRecordsetValue("r1a.f2.value2", "f2", "recset2", 1, out error); _dl4.TryCreateRecordsetValue("r1a.f3.value2", "f3", "recset2", 1, out error); _dl4.TryCreateRecordsetValue("r2a.f1.value2", "f1", "recset2", 2, out error); _dl4.TryCreateRecordsetValue("r2a.f2.value2", "f2", "recset2", 2, out error); _dl4.TryCreateRecordsetValue("r2a.f3.value2", "f3", "recset2", 2, out error); _dl4.TryCreateRecordsetValue("r3a.f1.value2", "f1", "recset2", 3, out error); _dl4.TryCreateRecordsetValue("r3a.f2.value2", "f2", "recset2", 3, out error); _dl4.TryCreateRecordsetValue("r3a.f3.value2", "f3", "recset2", 3, out error); // create 5th obj _dlWithBankScalar = Dev2BinaryDataListFactory.CreateDataList(); _dlWithBankScalar.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dlWithBankScalar.TryCreateScalarValue("", "myScalar", out error); _dlWithPopulatedScalar = Dev2BinaryDataListFactory.CreateDataList(); _dlWithPopulatedScalar.TryCreateScalarTemplate(string.Empty, "myScalar", "A scalar", true, out error); _dlWithPopulatedScalar.TryCreateScalarValue("CAKE!", "myScalar", out error); }
public void WorkflowExecuted_Where_ExecutionStatusCallBackRegisteredAndDataListMergeRequested_Expected_DataMergedInAndOutOfWorkflow() { // // Create a reset event which is used to wait for callbacks form the server // ManualResetEventSlim resetEvent = new ManualResetEventSlim(false); // // Setup MEF context // ImportService.CurrentContext = CompositionInitializer.DefaultInitialize(); // // Setup test data // ErrorResultTO errors = new ErrorResultTO(); Guid callBackID = Guid.NewGuid(); string serviceName = "wizardtest"; IBinaryDataList dataList = Dev2BinaryDataListFactory.CreateDataList(); string error; dataList.TryCreateScalarTemplate("", "testvalue", "", true, out error); dataList.TryCreateScalarValue("321", "testvalue", out error); DataListMergeOpsTO dataListMergeOpsTO = new DataListMergeOpsTO(dataList.UID); ServiceLocator serviceLocator = new ServiceLocator(); ImportService.SatisfyImports(serviceLocator); // // Connect to the server // IEnvironmentConnection conn = new EnvironmentConnection(); conn.Address = new Uri(ServerSettings.DsfAddress); conn.Connect(); IEventAggregator eventAggregator = ImportService.GetExportValue <IEventAggregator>(); IFrameworkSecurityContext securityContext = ImportService.GetExportValue <IFrameworkSecurityContext>(); IEnvironmentConnection environmentConnection = ImportService.GetExportValue <IEnvironmentConnection>(); IEnvironmentModel environment = new EnvironmentModel(eventAggregator, securityContext, environmentConnection); environment.EnvironmentConnection = conn; // // Write the datalist to the server over the datalist channel // conn.DataListChannel.WriteDataList(dataList.UID, dataList, errors); // // Add an execution callback, the action of this call back will set the reset event allowing the test to continue // conn.ExecutionChannel.AddExecutionStatusCallback(callBackID, new Action <ExecutionStatusCallbackMessage>(m => { if (m.MessageType == ExecutionStatusCallbackMessageType.CompletedCallback) { resetEvent.Set(); } })); // // Get endpoint to query and make request to server // Uri enpoint = serviceLocator.GetEndpoint(WizardEndpointGenerationStrategyProvider.ServiceWithDataListMergeAndExecutionCallBackKey, new Tuple <string, IEnvironmentModel, DataListMergeOpsTO, Guid>(serviceName, environment, dataListMergeOpsTO, callBackID)); WebRequest wr = WebRequest.Create(enpoint); WebResponse wrsp = wr.GetResponse(); Stream s = wrsp.GetResponseStream(); StreamReader sr = new StreamReader(s); string payload = sr.ReadToEnd(); // // Wait for completed callback // resetEvent.Wait(10000); // // Get datalist from the server // IBinaryDataList resultDataList = conn.DataListChannel.ReadDatalist(dataList.UID, errors); // // Clean up // conn.Disconnect(); IBinaryDataListEntry testValueEntry; resultDataList.TryGetEntry("testvalue", out testValueEntry, out error); IBinaryDataListEntry inValueEntry; resultDataList.TryGetEntry("invalue", out inValueEntry, out error); string expected = "123|321"; string actual = testValueEntry.FetchScalar().TheValue + "|" + inValueEntry.FetchScalar().TheValue; Assert.AreEqual(expected, actual); }