Skip to content

Commit 80adb31

Browse files
committed
Merge branch 'release/1.1.0' into main
2 parents 5c4b39d + 4113538 commit 80adb31

File tree

4 files changed

+65
-21
lines changed

4 files changed

+65
-21
lines changed

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

Lines changed: 2 additions & 2 deletions
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.0.1.0")]
36-
[assembly: AssemblyFileVersion("1.0.1.0")]
35+
[assembly: AssemblyVersion("1.1.0.0")]
36+
[assembly: AssemblyFileVersion("1.1.0.0")]

utPLSQL.Api/utPLSQL.Api/RealTimeTestRunner.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77

88
namespace utPLSQL
99
{
10+
/// <summary>
11+
/// Implementation of TestRunner that uses ut_realtime_reporter
12+
/// </summary>
1013
public class RealTimeTestRunner : TestRunner<@event>
1114
{
12-
public override void RunTests(string type, string owner, string name, string procedure)
15+
public override void RunTests(Type type, string owner, string name, string procedure)
1316
{
1417
var testsToRun = GetTestsToRun(type, owner, name, procedure);
1518

@@ -33,7 +36,7 @@ public override void RunTests(string type, string owner, string name, string pro
3336
}
3437

3538

36-
public override void RunTestsWithCoverage(string type, string owner, string name, string procedure, string coverageSchemas,
39+
public override void RunTestsWithCoverage(Type type, string owner, string name, string procedure, string coverageSchemas,
3740
string includeObjects, string excludeObjects)
3841
{
3942
var testsToRun = GetTestsToRun(type, owner, name, procedure);
@@ -104,7 +107,7 @@ public override void ConsumeResult(Action<@event> action)
104107
var cmd = new OracleCommand(proc, consumeConnection);
105108
cmd.Parameters.Add("id", OracleDbType.Varchar2, ParameterDirection.Input).Value = realtimeReporterId;
106109
cmd.Parameters.Add("lines_cursor", OracleDbType.RefCursor, ParameterDirection.Output);
107-
110+
108111
// https://stackoverflow.com/questions/2226769/bad-performance-with-oracledatareader
109112
cmd.InitialLOBFetchSize = -1;
110113

@@ -122,22 +125,22 @@ public override void ConsumeResult(Action<@event> action)
122125
reader.Close();
123126
}
124127

125-
private static string GetTestsToRun(string type, string owner, string name, string procedure)
128+
private static string GetTestsToRun(Type type, string owner, string name, string procedure)
126129
{
127130
string testsToRun = null;
128131

129132
switch (type)
130133
{
131-
case User:
134+
case Type.User:
132135
testsToRun = name;
133136
break;
134-
case Package:
137+
case Type.Package:
135138
testsToRun = $"{owner}.{name}";
136139
break;
137-
case Procedure:
140+
case Type.Procedure:
138141
testsToRun = $"{owner}.{name}.{procedure}";
139142
break;
140-
case All:
143+
case Type.All:
141144
testsToRun = owner;
142145
break;
143146
}

utPLSQL.Api/utPLSQL.Api/TestRunner.cs

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,25 @@
55

66
namespace utPLSQL
77
{
8+
/// <summary>
9+
/// Abstract base class for all TestRunner implementations
10+
/// </summary>
11+
/// <typeparam name="T">Type of result class used in callback action</typeparam>
812
public abstract class TestRunner<T>
913
{
10-
public const string User = "USER";
11-
public const string Package = "PACKAGE";
12-
public const string Procedure = "PROCEDURE";
13-
public const string All = "_ALL";
14-
1514
internal OracleConnection produceConnection;
1615
internal OracleConnection consumeConnection;
1716

1817
protected string realtimeReporterId;
1918
protected string coverageReporterId;
2019

20+
/// <summary>
21+
/// Connects to the database.
22+
/// The TestRunner uses two connections. One for executing the tests and one for consuming the reuslts
23+
/// </summary>
24+
/// <param name="username">Database username</param>
25+
/// <param name="password">Database password</param>
26+
/// <param name="database">Database name</param>
2127
public void Connect(string username, string password, string database)
2228
{
2329
var connectionString = $"User Id={username};Password={password};Data Source={database}";
@@ -28,13 +34,19 @@ public void Connect(string username, string password, string database)
2834
consumeConnection = new OracleConnection(connectionString);
2935
consumeConnection.Open();
3036
}
31-
37+
/// <summary>
38+
/// Closes both connections
39+
/// </summary>
3240
public void Close()
3341
{
3442
produceConnection?.Close();
3543
consumeConnection?.Close();
3644
}
3745

46+
/// <summary>
47+
/// Returns the installed utPLSQL version
48+
/// </summary>
49+
/// <returns>Version as string</returns>
3850
public String GetVersion()
3951
{
4052
var cmd = new OracleCommand("select ut.version() from dual", produceConnection);
@@ -45,13 +57,38 @@ public String GetVersion()
4557
return version;
4658
}
4759

48-
public abstract void RunTests(string type, string owner, string name, string procedure);
49-
50-
public abstract void RunTestsWithCoverage(string type, string owner, string name, string procedure, string coverageSchemas,
60+
/// <summary>
61+
/// Run tests
62+
/// </summary>
63+
/// <param name="type">The type to use</param>
64+
/// <param name="owner">Owner of the object</param>
65+
/// <param name="name">Name of the object</param>
66+
/// <param name="procedure">Procedure name</param>
67+
public abstract void RunTests(Type type, string owner, string name, string procedure);
68+
69+
/// <summary>
70+
/// Run tests with coveage
71+
/// </summary>
72+
/// <param name="type">The type to use</param>
73+
/// <param name="owner">Owner of the object</param>
74+
/// <param name="name">Name of the object</param>
75+
/// <param name="procedure">Procedure name</param>
76+
/// <param name="coverageSchemas">Schemas to cover</param>
77+
/// <param name="includeObjects">Objects to include</param>
78+
/// <param name="excludeObjects">Objects to exclude</param>
79+
public abstract void RunTestsWithCoverage(Type type, string owner, string name, string procedure, string coverageSchemas,
5180
string includeObjects, string excludeObjects);
5281

82+
/// <summary>
83+
/// Consumes the results and calls the callback action on each result
84+
/// </summary>
85+
/// <param name="consumer">Typed action that will get the results</param>
5386
public abstract void ConsumeResult(Action<T> consumer);
5487

88+
/// <summary>
89+
/// Returns the HTML coverage report
90+
/// </summary>
91+
/// <returns>HTML coverage report</returns>
5592
public string GetCoverageReport()
5693
{
5794
var sb = new StringBuilder();
@@ -83,4 +120,8 @@ public string GetCoverageReport()
83120
return sb.ToString();
84121
}
85122
}
123+
public enum Type
124+
{
125+
User, Package, Procedure, All
126+
}
86127
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<package >
33
<metadata>
44
<id>utPLSQL.Api</id>
5-
<version>1.0.1</version>
5+
<version>1.1.0</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>Run tests and code coverage and consume the results and the report</releaseNotes>
13+
<releaseNotes>Changed type to enum</releaseNotes>
1414
<copyright>Copyright © 2021</copyright>
1515
<tags>utPLSQL</tags>
1616
</metadata>

0 commit comments

Comments
 (0)