[Adapdev-commits] Adapdev/src/Adapdev.UnitTest.Core AutoCommitCommand.cs,1.1,1.2 AutoRollbackCommand
Status: Beta
Brought to you by:
intesar66
From: Sean M. <int...@us...> - 2005-11-14 04:14:20
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15710/src/Adapdev.UnitTest.Core Modified Files: AutoCommitCommand.cs AutoRollbackCommand.cs IThreadWorkItemCommand.cs RunTestCommand.cs RunTestIterationCommand.cs TestRunner.cs TextFormatter.cs Log Message: Added new objects for multi-threading Modified ForeignKeyAssociation to display the full foreign key name Fixed some bugs w/ the unit test multi-threading Index: IThreadWorkItemCommand.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/IThreadWorkItemCommand.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IThreadWorkItemCommand.cs 11 Nov 2005 04:52:46 -0000 1.1 --- IThreadWorkItemCommand.cs 14 Nov 2005 04:14:10 -0000 1.2 *************** *** 9,13 **** public interface IThreadWorkItemCommand : ICommand { ! void Execute(object o); } } --- 9,13 ---- public interface IThreadWorkItemCommand : ICommand { ! object Execute(object o); } } Index: TextFormatter.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/TextFormatter.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TextFormatter.cs 26 Oct 2005 05:27:45 -0000 1.7 --- TextFormatter.cs 14 Nov 2005 04:14:10 -0000 1.8 *************** *** 83,89 **** if(!(tar.State == TestState.Ignore)) { foreach(AbstractTestIteration ati in tar.Iterations) { ! if(tar.Iterations.Count > 1) sb.Append(this.GetNesting(nesting) + "Iteration: " + ati.Iteration + "\r\n"); sb.AppendFormat(this.GetNesting(nesting + 1) + this.GetMarker(tar) + "{0} - {1}\r\n", tar.Name, tar.State); //sb.AppendFormat(this.GetNesting(nesting + 1) + this.GetMarker(tar) + "Time: {0}s\r\n", tar.GetTotalDuration()); --- 83,93 ---- if(!(tar.State == TestState.Ignore)) { + if(tar.Iterations.Count > 1) nesting += 1; foreach(AbstractTestIteration ati in tar.Iterations) { ! if(tar.Iterations.Count > 1) ! { ! sb.Append(this.GetNesting(nesting) + "Iteration: " + ati.Iteration + "\r\n"); ! } sb.AppendFormat(this.GetNesting(nesting + 1) + this.GetMarker(tar) + "{0} - {1}\r\n", tar.Name, tar.State); //sb.AppendFormat(this.GetNesting(nesting + 1) + this.GetMarker(tar) + "Time: {0}s\r\n", tar.GetTotalDuration()); *************** *** 93,96 **** --- 97,106 ---- } + if(ati is TestIteration) + { + sb.Append(this.GetNesting(nesting + 2) + "Thread Id: " + (ati as TestIteration).Thread + Environment.NewLine); + sb.Append(this.GetNesting(nesting + 2) + "Time: " + (ati as TestIteration).Duration + Environment.NewLine); + } + if(showFailure && (ati is TestIteration)) { *************** *** 100,108 **** } - if(ati is TestIteration) - { - sb.Append(this.GetNesting(nesting + 2) + "Thread Id: " + (ati as TestIteration).Thread + Environment.NewLine); - sb.Append(this.GetNesting(nesting + 2) + "Time: " + (ati as TestIteration).Duration + Environment.NewLine); - } if(showOutput && ati.ConsoleOutput.Length > 0) --- 110,113 ---- Index: RunTestIterationCommand.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/RunTestIterationCommand.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunTestIterationCommand.cs 11 Nov 2005 04:52:46 -0000 1.2 --- RunTestIterationCommand.cs 14 Nov 2005 04:14:10 -0000 1.3 *************** *** 236,240 **** ! public void Execute(object o){this.Execute();} } } --- 236,240 ---- ! public object Execute(object o){this.Execute();return 1;} } } Index: AutoRollbackCommand.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/AutoRollbackCommand.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AutoRollbackCommand.cs 11 Nov 2005 04:52:46 -0000 1.1 --- AutoRollbackCommand.cs 14 Nov 2005 04:14:10 -0000 1.2 *************** *** 29,33 **** #endregion ! public void Execute(object o){this.Execute();} } --- 29,33 ---- #endregion ! public object Execute(object o){this.Execute();return 1;} } Index: TestRunner.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/TestRunner.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TestRunner.cs 26 Oct 2005 05:27:45 -0000 1.9 --- TestRunner.cs 14 Nov 2005 04:14:10 -0000 1.10 *************** *** 100,103 **** --- 100,104 ---- public TestAssemblyResult[] Run(TestSuite ts) { + Thread.CurrentThread.ApartmentState = ApartmentState.MTA; this._mode = RunMode.Running; ArrayList al = new ArrayList(); Index: RunTestCommand.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/RunTestCommand.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunTestCommand.cs 1 Nov 2005 05:41:40 -0000 1.1 --- RunTestCommand.cs 14 Nov 2005 04:14:10 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- using Adapdev.Diagnostics; using Adapdev.Threading; + using Adapdev.Threading; using log4net; *************** *** 83,96 **** if(this._testFixture.IsMultiThreaded) { ! using(ThreadPoolWait threadPool = new ThreadPoolWait()) { ! for (int i = 1; i <= _test.RepeatCount; i++) { RunTestIterationCommand command = new RunTestIterationCommand(this._dispatcher, this._test, this._testFixture, this._type, this.o, this._testFixtureIteration, method, i, testResult); ! threadPool.QueueUserWorkItem(new WaitCallback(command.Execute)); ! } ! threadPool.WaitOne(); } } else --- 84,111 ---- if(this._testFixture.IsMultiThreaded) { ! SmartThreadPool smartThreadPool = new SmartThreadPool(); ! ! try { ! IWorkItemResult [] wirs = new IWorkItemResult[_test.RepeatCount]; ! ! for(int i = 0; i < wirs.Length; ++i) { RunTestIterationCommand command = new RunTestIterationCommand(this._dispatcher, this._test, this._testFixture, this._type, this.o, this._testFixtureIteration, method, i, testResult); ! wirs[i] = smartThreadPool.QueueWorkItem(new WorkItemCallback(command.Execute), null); } ! ! SmartThreadPool.WaitAll(wirs); ! } ! catch(Exception ex) ! { ! Console.WriteLine(ex.Message); ! Console.WriteLine(ex.StackTrace); ! } ! finally ! { ! smartThreadPool.Shutdown(); } + } else Index: AutoCommitCommand.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.UnitTest.Core/AutoCommitCommand.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AutoCommitCommand.cs 11 Nov 2005 04:52:46 -0000 1.1 --- AutoCommitCommand.cs 14 Nov 2005 04:14:10 -0000 1.2 *************** *** 28,32 **** #endregion ! public void Execute(object o){this.Execute();} } --- 28,32 ---- #endregion ! public object Execute(object o){this.Execute();return 1;} } |