/// <summary> /// Imports the subsequence stored in the database /// </summary> /// <param name="frame"></param> private void importSubSequence(DataDictionary.Tests.Frame frame) { string sql = "SELECT TestSequenceID, TestSequenceName FROM TSW_TestSequence"; OleDbDataAdapter adapter = new OleDbDataAdapter(sql, Connection); DataSet dataSet = new DataSet(); adapter.Fill(dataSet); if (dataSet.Tables.Count > 0) { foreach (DataRow dataRow in dataSet.Tables[0].Rows) { int subSequenceID = (int)dataRow.ItemArray.GetValue(0); string subSequenceName = (string)dataRow.ItemArray.GetValue(1); DataDictionary.Tests.SubSequence newSubSequence = (DataDictionary.Tests.SubSequence)DataDictionary.Generated.acceptor.getFactory().createSubSequence(); newSubSequence.Name = subSequenceName; importInitialValues(newSubSequence, subSequenceID); importSteps(newSubSequence); DataDictionary.Tests.SubSequence oldSubSequence = frame.findSubSequence(subSequenceName); if (oldSubSequence != null) { int cnt = 0; foreach (DataDictionary.Tests.TestCase oldTestCase in oldSubSequence.TestCases) { if (cnt < newSubSequence.TestCases.Count) { DataDictionary.Tests.TestCase newTestCase = newSubSequence.TestCases[cnt] as DataDictionary.Tests.TestCase; if (newTestCase != null) { if (oldTestCase.Name.Equals(newTestCase.Name)) { newTestCase.Merge(oldTestCase); } else { throw new Exception(newTestCase.FullName + " is found instead of " + oldTestCase.FullName + " while importing sub-sequence " + newSubSequence.FullName); } } } else { throw new Exception("The test case " + oldTestCase.FullName + " is not present in the new data base"); } cnt++; } oldSubSequence.Delete(); } frame.appendSubSequences(newSubSequence); } } else { Log.Error("Cannot find table TSW_TestSequence in database"); } }