Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 01cb13b

Browse filesBrowse files
committed
Cancel running commands on close
1 parent 8995e38 commit 01cb13b
Copy full SHA for 01cb13b

File tree

5 files changed

+43
-6
lines changed
Filter options

5 files changed

+43
-6
lines changed

‎utPLSQL.Api/utPLSQL.Api.Test/RealTimeTestRunnerTest.cs

Copy file name to clipboardExpand all lines: utPLSQL.Api/utPLSQL.Api.Test/RealTimeTestRunnerTest.cs
+14-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ public void TestRunTestsWithCoverage()
4949
System.Diagnostics.Trace.WriteLine(report);
5050
}
5151

52+
53+
[TestMethod]
54+
public void TestRunTestsAndAbort()
55+
{
56+
var testRunner = new RealTimeTestRunner();
57+
testRunner.Connect(username: "toscamtest", password: "toscamtest", database: "CA40");
58+
59+
testRunner.RunTests(paths: "toscamtest");
60+
61+
testRunner.Close();
62+
}
63+
5264
[TestMethod]
5365
public void TestGetVersion()
5466
{
@@ -60,11 +72,11 @@ public void TestGetVersion()
6072
Assert.AreEqual("v3.1.7.3096", version);
6173
}
6274

63-
[TestMethod]
75+
// [TestMethod] Disabled
6476
public void TestGetVersionWhenNotInstalled()
6577
{
6678
var testRunner = new RealTimeTestRunner();
67-
testRunner.Connect(username: "c##sakila", password: "sakila", database: "ORCLCDB");
79+
testRunner.Connect(username: "sakila", password: "sakila", database: "ORCLPDB1");
6880

6981
try
7082
{

‎utPLSQL.Api/utPLSQL.Api/Properties/AssemblyInfo.cs

Copy file name to clipboardExpand all lines: utPLSQL.Api/utPLSQL.Api/Properties/AssemblyInfo.cs
+2-2
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.4.0.0")]
36-
[assembly: AssemblyFileVersion("1.4.0.0")]
35+
[assembly: AssemblyVersion("1.4.1.0")]
36+
[assembly: AssemblyFileVersion("1.4.1.0")]

‎utPLSQL.Api/utPLSQL.Api/RealTimeTestRunner.cs

Copy file name to clipboardExpand all lines: utPLSQL.Api/utPLSQL.Api/RealTimeTestRunner.cs
+10
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ public override void RunTests(params string[] paths)
2828
END;";
2929

3030
var cmd = new OracleCommand(proc, produceConnection);
31+
runningCommands.Add(cmd);
32+
3133
cmd.Parameters.Add("id", OracleDbType.Varchar2, ParameterDirection.Input).Value = realtimeReporterId;
3234
cmd.ExecuteNonQuery();
3335

36+
runningCommands.Remove(cmd);
3437
cmd.Dispose();
3538
}
3639
}
@@ -73,11 +76,14 @@ public override void RunTestsWithCoverage(List<string> paths, List<string> cover
7376
END;";
7477

7578
var cmd = new OracleCommand(proc, produceConnection);
79+
runningCommands.Add(cmd);
80+
7681
cmd.Parameters.Add("id", OracleDbType.Varchar2, ParameterDirection.Input).Value = realtimeReporterId;
7782
cmd.Parameters.Add("coverage_id", OracleDbType.Varchar2, ParameterDirection.Input).Value = coverageReporterId;
7883

7984
cmd.ExecuteNonQuery();
8085

86+
runningCommands.Remove(cmd);
8187
cmd.Dispose();
8288
}
8389
}
@@ -97,6 +103,8 @@ public override void ConsumeResult(Action<@event> action)
97103
END;";
98104

99105
var cmd = new OracleCommand(proc, consumeConnection);
106+
runningCommands.Add(cmd);
107+
100108
cmd.Parameters.Add("id", OracleDbType.Varchar2, ParameterDirection.Input).Value = realtimeReporterId;
101109
cmd.Parameters.Add("lines_cursor", OracleDbType.RefCursor, ParameterDirection.Output);
102110

@@ -115,6 +123,8 @@ public override void ConsumeResult(Action<@event> action)
115123
}
116124

117125
reader.Close();
126+
127+
runningCommands.Remove(cmd);
118128
cmd.Dispose();
119129
}
120130
}

‎utPLSQL.Api/utPLSQL.Api/TestRunner.cs

Copy file name to clipboardExpand all lines: utPLSQL.Api/utPLSQL.Api/TestRunner.cs
+15
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public abstract class TestRunner<T>
1818
protected string realtimeReporterId;
1919
protected string coverageReporterId;
2020

21+
protected List<OracleCommand> runningCommands = new List<OracleCommand>();
22+
2123
/// <summary>
2224
/// Connects to the database.
2325
/// The TestRunner uses two connections. One for executing the tests and one for consuming the results
@@ -29,6 +31,11 @@ public void Connect(string username, string password, string database)
2931
{
3032
var connectionString = $"User Id={username};Password={password};Data Source={database}";
3133

34+
foreach(OracleCommand command in runningCommands)
35+
{
36+
command.Cancel();
37+
}
38+
3239
produceConnection = new OracleConnection(connectionString);
3340
produceConnection.Open();
3441

@@ -51,12 +58,16 @@ public void Close()
5158
public String GetVersion()
5259
{
5360
var cmd = new OracleCommand("select ut.version() from dual", produceConnection);
61+
runningCommands.Add(cmd);
62+
5463
OracleDataReader reader = cmd.ExecuteReader();
5564
reader.Read();
5665

5766
var version = reader.GetString(0);
5867

5968
reader.Close();
69+
70+
runningCommands.Remove(cmd);
6071
cmd.Dispose();
6172

6273
return version;
@@ -108,6 +119,8 @@ public string GetCoverageReport()
108119
END;";
109120

110121
var cmd = new OracleCommand(proc, consumeConnection);
122+
runningCommands.Add(cmd);
123+
111124
cmd.Parameters.Add("id", OracleDbType.Varchar2, ParameterDirection.Input).Value = coverageReporterId;
112125
cmd.Parameters.Add("lines_cursor", OracleDbType.RefCursor, ParameterDirection.Output);
113126

@@ -123,6 +136,8 @@ public string GetCoverageReport()
123136
}
124137

125138
reader.Close();
139+
140+
runningCommands.Remove(cmd);
126141
cmd.Dispose();
127142

128143
return sb.ToString();

‎utPLSQL.Api/utPLSQL.Api/utPLSQL.Api.nuspec

Copy file name to clipboardExpand all lines: utPLSQL.Api/utPLSQL.Api/utPLSQL.Api.nuspec
+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<package >
33
<metadata>
44
<id>utPLSQL.Api</id>
5-
<version>1.4.0</version>
5+
<version>1.4.1</version>
66
<title>utPLSQL API</title>
77
<authors>Simon Martinelli</authors>
88
<requireLicenseAcceptance>false</requireLicenseAcceptance>
99
<license type="expression">Apache-2.0+</license>
1010
<projectUrl>https://github.com/utPLSQL/utPLSQL-dotnet-api</projectUrl>
1111
<icon>images/blue-icon-transparent.png</icon>
1212
<description>.NET API for utPLSQL</description>
13-
<releaseNotes>Changed from fields to paths as one parameter</releaseNotes>
13+
<releaseNotes>Cancel running commands on close</releaseNotes>
1414
<copyright>Copyright © 2021</copyright>
1515
<tags>utPLSQL</tags>
1616
</metadata>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.