public void DisposeExpectsClear()
        {
            // bootstrap
            var  dto      = new Mock <DebugTO>();
            bool disposed = false;

            dto.CallBase = true;


            DebugTO to = dto.Object;

            dto.Setup(a => a.CleanUp()).Callback(() => disposed = true);
            string rootFolder = Path.GetTempPath() + Guid.NewGuid();
            IDev2StudioSessionBroker broker = Dev2StudioSessionFactory.CreateBroker();

            to.RememberInputs    = true;
            to.BaseSaveDirectory = rootFolder;
            to.DataList          = "<DataList><scalar1 ColumnIODirection=\"Input\"/><persistantscalar ColumnIODirection=\"Input\"/><rs><f1 ColumnIODirection=\"Input\"/><f2 ColumnIODirection=\"Input\"/></rs><recset><field1/><field2/></recset></DataList>";
            to.XmlData           = "<DataList><scalar1>s1</scalar1><persistantscalar>SomeValue</persistantscalar><rs><f1>f1Value</f1><f2>f2Value</f2></rs><recset><field1>somedata</field1><field2>moredata</field2></recset><recset><field1></field1><field2></field2></recset></DataList>";
            to.ServiceName       = "DummyService";
            to.WorkflowID        = "DummyService";
            to = broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            // just ensure the operation worked successfully with no errors
            to.DataList = "<DataList><persistantscalar ColumnIODirection=\"Input\"/><rs><field ColumnIODirection=\"Input\"/><f2 ColumnIODirection=\"Input\"/></rs><recset><newfield ColumnIODirection=\"Input\"/><field1 ColumnIODirection=\"Input\"/><changedfieldname ColumnIODirection=\"Input\"/></recset></DataList>";
            broker.InitDebugSession(to);

            broker.Dispose();
            Assert.IsTrue(disposed);
            DeleteDir(rootFolder);
        }
Example #2
0
        public void InitSessionWithNoDataBaseDirectoryIsNullStillInitialises()
        {
            DebugTO to         = new DebugTO();
            string  rootFolder = Path.GetTempPath() + Guid.NewGuid();
            IDev2StudioSessionBroker broker = Dev2StudioSessionFactory.CreateBroker();

            to.RememberInputs    = true;
            to.BaseSaveDirectory = null;
            to.DataList          = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData           = "<DataList><scalar1>s1</scalar1><rs><f1/>f1Value<f2/>f2Value</rs></DataList>";
            to.ServiceName       = "DummyService";
            to.WorkflowID        = "DummyService";
            broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);
            to.BaseSaveDirectory = null;
            PrivateObject p     = new PrivateObject(broker);
            var           field = p.GetField("_debugPersistSettings") as IDictionary <string, DebugTO>;

            Assert.IsNotNull(field);
            field.Add("bob", new DebugTO());
            to = broker.PersistDebugSession(to);

            Assert.AreEqual(string.Empty, to.Error);
            Assert.IsNotNull(to.BinaryDataList); // assert not null hence we created it ;)

            DeleteDir(rootFolder);
        }
        public void PersistSessionWithSavedData_ChangedDataList_Expect_MergedXmlData()
        {
            // bootstrap
            DebugTO to         = new DebugTO();
            string  rootFolder = Path.GetTempPath() + Guid.NewGuid();
            IDev2StudioSessionBroker broker = Dev2StudioSessionFactory.CreateBroker();

            to.RememberInputs    = true;
            to.BaseSaveDirectory = rootFolder;
            to.DataList          = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData           = "<DataList><scalar1>s1</scalar1><rs><f1>f1Value</f1><f2>f2Value</f2></rs></DataList>";
            to.ServiceName       = "DummyService";
            to.WorkflowID        = "DummyService";
            to = broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            // just ensure the operation worked successfully with no errors
            to.DataList = "<DataList><rs><field ColumnIODirection=\"Input\"/><f2 ColumnIODirection=\"Input\"/></rs></DataList>";
            to          = broker.InitDebugSession(to);

            Assert.AreEqual("<DataList><rs><field></field><f2>f2Value</f2></rs></DataList>", to.XmlData);
            Assert.IsNotNull(to.BinaryDataList); // assert not null binary datalist since it is used to create the input model ;)

            DeleteDir(rootFolder);
        }
        public void GetXmlForInputsExpectEmptyWithRandomDataList()
        {
            // bootstrap
            DebugTO to = new DebugTO();
            IDev2StudioSessionBroker broker = Dev2StudioSessionFactory.CreateBroker();
            string rootFolder = Path.GetTempPath() + Guid.NewGuid();

            to.RememberInputs    = false;
            to.BaseSaveDirectory = rootFolder;
            to.DataList          = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData           = "";
            to.ServiceName       = "DummyService";
            to.WorkflowID        = "DummyService";
            to         = broker.InitDebugSession(to);
            to.XmlData = "<DataList><scalar1>s1</scalar1><rs><f1>f1Value</f1><f2>f2Value</f2></rs></DataList>";
            to         = broker.PersistDebugSession(to);
            to.XmlData = "";
            to         = broker.InitDebugSession(to);
            var           compiler = DataListFactory.CreateDataListCompiler();
            ErrorResultTO errors;
            var           dl        = compiler.FetchBinaryDataList(to.BinaryDataList.UID, out errors);
            var           outputxml = broker.GetXMLForInputs(dl);

            Assert.AreEqual("<DataList></DataList>", outputxml);

            DeleteDir(rootFolder);
        }
        public void Dev2StudioSessionBroker_InitSessionWithNoDataAndNullBaseDirectory()
        {
            var serviceName = "DummyService" + Guid.NewGuid();
            var to          = new DebugTO();
            var rootFolder  = Guid.NewGuid().ToString();

            if (Path.GetTempPath() != "C:\\WINDOWS\\TEMP")
            {
                rootFolder = Path.GetTempPath() + rootFolder;
            }
            else
            {
                rootFolder = "C:\\WINDOWS\\system32\\config\\systemprofile\\AppData\\Local\\TEMP" + rootFolder;
            }

            var broker = Dev2StudioSessionFactory.CreateBroker();

            to.RememberInputs    = true;
            to.BaseSaveDirectory = null;
            to.DataList          = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData           = "<DataList><scalar1>s1</scalar1><rs><f1/>f1Value<f2/>f2Value</rs></DataList>";
            to.ServiceName       = serviceName;
            to.WorkflowID        = serviceName;
            broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            Assert.IsTrue(rootFolder.Contains(to.BaseSaveDirectory), "\"" + rootFolder + "\" does not contain: \"" + to.BaseSaveDirectory + "\"");
            DeleteDir(rootFolder);
        }
        /// <summary>
        /// Used for loading all the inputs from the saved data or the data list
        /// </summary>
        public void LoadWorkflowInputs()
        {
            WorkflowInputs.Clear();
            Broker         = Dev2StudioSessionFactory.CreateBroker();
            DebugTo        = Broker.InitDebugSession(DebugTo);
            XmlData        = DebugTo.XmlData;
            RememberInputs = DebugTo.RememberInputs;
            DataList       = DebugTo.BinaryDataList;

            // Flipping Jurie....
            var myList = _dataListConversionUtils.CreateListToBindTo(DebugTo.BinaryDataList);

            WorkflowInputs.AddRange(myList);
        }
Example #7
0
        public void InitSessionWithNoDataBaseDirectoryIsNull()
        {
            DebugTO to         = new DebugTO();
            string  rootFolder = Path.GetTempPath() + Guid.NewGuid();
            IDev2StudioSessionBroker broker = Dev2StudioSessionFactory.CreateBroker();

            to.RememberInputs    = true;
            to.BaseSaveDirectory = null;
            to.DataList          = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData           = "<DataList><scalar1>s1</scalar1><rs><f1/>f1Value<f2/>f2Value</rs></DataList>";
            to.ServiceName       = "DummyService";
            to.WorkflowID        = "DummyService";
            broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            Assert.IsTrue(rootFolder.Contains(to.BaseSaveDirectory));
            DeleteDir(rootFolder);
        }
Example #8
0
        public void Dev2StudioSessionBroker_PersistSessionWithSavedData_ChangedDataList_ExpectPreviousXmlData()
        {
            var to         = new DebugTO();
            var rootFolder = Path.GetTempPath() + Guid.NewGuid();
            var broker     = Dev2StudioSessionFactory.CreateBroker();

            to.RememberInputs    = true;
            to.BaseSaveDirectory = rootFolder;
            to.DataList          = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData           = "<DataList><scalar1>s1</scalar1><rs><f1>f1Value</f1><f2>f2Value</f2></rs></DataList>";
            to.ServiceName       = "DummyService";
            to.WorkflowID        = "DummyService";
            to = broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            Assert.AreEqual("<DataList><scalar1>s1</scalar1><rs><f1>f1Value</f1><f2>f2Value</f2></rs></DataList>", to.XmlData);

            DeleteDir(rootFolder);
        }
        public void Dev2StudioSessionBroker_PersistSessionWithSavedData_RecordSet()
        {
            var to         = new DebugTO();
            var rootFolder = Path.GetTempPath() + Guid.NewGuid();
            var broker     = Dev2StudioSessionFactory.CreateBroker();

            to.RememberInputs    = true;
            to.BaseSaveDirectory = rootFolder;
            to.DataList          = "<DataList><rec><name></name><age></age></rec></DataList>";
            to.XmlData           = "<DataList><rec><name>Bob</name><age></age></rec><rec><name>Bob</name><age>30</age></rec></DataList>";
            to.ServiceName       = "DummyService";
            to.WorkflowID        = "DummyService";
            to = broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            Assert.AreEqual("<DataList><rec><name>Bob</name><age></age></rec><rec><name>Bob</name><age>30</age></rec></DataList>", to.XmlData);

            DeleteDir(rootFolder);
        }
Example #10
0
        public void InitSessionWithNoData()
        {
            DebugTO to = new DebugTO();
            string rootFolder = Path.GetTempPath() + Guid.NewGuid();
            IDev2StudioSessionBroker broker = Dev2StudioSessionFactory.CreateBroker();
            to.RememberInputs = true;
            to.BaseSaveDirectory = rootFolder;
            to.DataList = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData = "<DataList><scalar1>s1</scalar1><rs><f1/>f1Value<f2/>f2Value</rs></DataList>";
            to.ServiceName = "DummyService";
            to.WorkflowID = "DummyService";
            broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            // just ensure the operation worked successfully with no errors
            Assert.AreEqual(string.Empty, to.Error);
            Assert.IsNotNull(to.BinaryDataList); // assert not null hence we created it ;)

            DeleteDir(rootFolder);
        }
Example #11
0
        // ReSharper disable InconsistentNaming
        public void PersistSessionWithSavedData_ExpectSavedData()
        // ReSharper restore InconsistentNaming
        {
            //DeleteDir();
            // bootstrap
            DebugTO to = new DebugTO();
            string rootFolder = Path.GetTempPath() + Guid.NewGuid();
            IDev2StudioSessionBroker broker = Dev2StudioSessionFactory.CreateBroker();
            to.RememberInputs = true;
            to.BaseSaveDirectory = rootFolder;
            to.DataList = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData = "<DataList><scalar1>s1</scalar1><rs><f1>f1Value</f1><f2>f2Value</f2></rs></DataList>";
            to.ServiceName = "DummyService";
            to.WorkflowID = "DummyService";
            to = broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            Assert.AreEqual("<DataList><scalar1>s1</scalar1><rs><f1>f1Value</f1><f2>f2Value</f2></rs></DataList>", to.XmlData);

            DeleteDir(rootFolder);
        }
Example #12
0
        public void Dev2StudioSessionBroker_InitSessionWithSingleScalar()
        {
            var to         = new DebugTO();
            var rootFolder = Path.GetTempPath() + Guid.NewGuid();
            var broker     = Dev2StudioSessionFactory.CreateBroker();

            to.RememberInputs    = true;
            to.BaseSaveDirectory = rootFolder;
            to.DataList          = "<DataList><scalar1/><rs><f1/><f2/></rs></DataList>";
            to.XmlData           = "<DataList><scalar1>s1</scalar1></DataList>";
            to.ServiceName       = "DummyService";
            to.WorkflowID        = "DummyService";
            broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            const string expected = "<DataList><scalar1>s1</scalar1></DataList>";

            Assert.AreEqual(string.Empty, to.Error);
            Assert.AreEqual(expected, to.XmlData, "Got  [ " + to.XmlData + "] , but expected [ " + expected + " ]");

            DeleteDir(rootFolder);
        }
Example #13
0
        public void PersistSessionWithAlotOfSavedData_RadicallyChangedDataList_Expect_MergedXmlData()
        {
            // bootstrap
            DebugTO to = new DebugTO();
            string rootFolder = Path.GetTempPath() + Guid.NewGuid();
            IDev2StudioSessionBroker broker = Dev2StudioSessionFactory.CreateBroker();
            to.RememberInputs = true;
            to.BaseSaveDirectory = rootFolder;
            to.DataList = "<DataList><scalar1 ColumnIODirection=\"Input\"/><persistantscalar ColumnIODirection=\"Input\"/><rs><f1 ColumnIODirection=\"Input\"/><f2 ColumnIODirection=\"Input\"/></rs><recset><field1/><field2/></recset></DataList>";
            to.XmlData = "<DataList><scalar1>s1</scalar1><persistantscalar>SomeValue</persistantscalar><rs><f1>f1Value</f1><f2>f2Value</f2></rs><recset><field1>somedata</field1><field2>moredata</field2></recset><recset><field1></field1><field2></field2></recset></DataList>";
            to.ServiceName = "DummyService";
            to.WorkflowID = "DummyService";
            to = broker.InitDebugSession(to);
            to = broker.PersistDebugSession(to);

            // just ensure the operation worked successfully with no errors
            to.DataList = "<DataList><persistantscalar ColumnIODirection=\"Input\"/><rs><field ColumnIODirection=\"Input\"/><f2 ColumnIODirection=\"Input\"/></rs><recset><newfield ColumnIODirection=\"Input\"/><field1 ColumnIODirection=\"Input\"/><changedfieldname ColumnIODirection=\"Input\"/></recset></DataList>";
            to = broker.InitDebugSession(to);

            Assert.AreEqual("<DataList><persistantscalar>SomeValue</persistantscalar><rs><field></field><f2>f2Value</f2></rs><recset><newfield></newfield><field1>somedata</field1><changedfieldname></changedfieldname></recset><recset><newfield></newfield><field1></field1><changedfieldname></changedfieldname></recset></DataList>", to.XmlData);

            DeleteDir(rootFolder);
        }