Skip to content

Commit 853630a

Browse files
committed
Moved TestRunner instance to TestRunnerWindow and update utPLSQL.API
1 parent 1f3bcbd commit 853630a

File tree

9 files changed

+33
-36
lines changed

9 files changed

+33
-36
lines changed

PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,9 @@ public class PlsqlDeveloperUtPlsqlPlugin
5555
internal static string database;
5656

5757
private static PlsqlDeveloperUtPlsqlPlugin _plugin;
58-
private static RealTimeTestRunner _testRunner;
5958

6059
private static readonly List<TestRunnerWindow> Windows = new List<TestRunnerWindow>();
6160

62-
private PlsqlDeveloperUtPlsqlPlugin()
63-
{
64-
_testRunner = new RealTimeTestRunner();
65-
}
66-
6761
#region DLL exported API
6862

6963
[DllExport("IdentifyPlugIn", CallingConvention = CallingConvention.Cdecl)]
@@ -206,7 +200,7 @@ public static void OnMenuClick(int index)
206200
{
207201
if (connected())
208202
{
209-
var testResultWindow = new TestRunnerWindow(_testRunner, _plugin);
203+
var testResultWindow = new TestRunnerWindow(_plugin, username, password, database);
210204
Windows.Add(testResultWindow);
211205
testResultWindow.RunTestsAsync("_ALL", username, null, null, false);
212206
}
@@ -215,7 +209,7 @@ public static void OnMenuClick(int index)
215209
{
216210
if (connected())
217211
{
218-
var testResultWindow = new TestRunnerWindow(_testRunner, _plugin);
212+
var testResultWindow = new TestRunnerWindow(_plugin, username, password, database);
219213
Windows.Add(testResultWindow);
220214
testResultWindow.RunTestsAsync("_ALL", username, null, null, true);
221215
}
@@ -226,7 +220,7 @@ public static void OnMenuClick(int index)
226220
{
227221
getPopupObject(out IntPtr type, out IntPtr owner, out IntPtr name, out IntPtr subType);
228222

229-
var testResultWindow = new TestRunnerWindow(_testRunner, _plugin);
223+
var testResultWindow = new TestRunnerWindow(_plugin, username, password, database);
230224
Windows.Add(testResultWindow);
231225
testResultWindow.RunTestsAsync(Marshal.PtrToStringAnsi(type), Marshal.PtrToStringAnsi(owner),
232226
Marshal.PtrToStringAnsi(name), Marshal.PtrToStringAnsi(subType), false);
@@ -238,7 +232,7 @@ public static void OnMenuClick(int index)
238232
{
239233
getPopupObject(out IntPtr type, out IntPtr owner, out IntPtr name, out IntPtr subType);
240234

241-
var testResultWindow = new TestRunnerWindow(_testRunner, _plugin);
235+
var testResultWindow = new TestRunnerWindow(_plugin, username, password, database);
242236
Windows.Add(testResultWindow);
243237
testResultWindow.RunTestsAsync(Marshal.PtrToStringAnsi(type), Marshal.PtrToStringAnsi(owner),
244238
Marshal.PtrToStringAnsi(name), Marshal.PtrToStringAnsi(subType), true);
@@ -265,17 +259,13 @@ private static void ConnectToDatabase()
265259
{
266260
try
267261
{
268-
_testRunner.Close();
269-
270262
if (connected())
271263
{
272264
getConnectionInfo(out IntPtr ptrUsername, out IntPtr ptrPassword, out IntPtr ptrDatabase);
273265

274266
username = Marshal.PtrToStringAnsi(ptrUsername);
275267
password = Marshal.PtrToStringAnsi(ptrPassword);
276268
database = Marshal.PtrToStringAnsi(ptrDatabase);
277-
278-
_testRunner.Connect(username, password, database);
279269
}
280270
}
281271
catch (Exception e)

PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@
105105
<Reference Include="System.Xml.Linq" />
106106
<Reference Include="Microsoft.CSharp" />
107107
<Reference Include="System.Xml" />
108-
<Reference Include="utPLSQL.Api, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
109-
<HintPath>..\packages\utPLSQL.Api.1.4.0\lib\net40\utPLSQL.Api.dll</HintPath>
108+
<Reference Include="utPLSQL.Api, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
109+
<HintPath>..\packages\utPLSQL.Api.1.4.1\lib\net40\utPLSQL.Api.dll</HintPath>
110110
</Reference>
111111
</ItemGroup>
112112
<ItemGroup>

PlsqlDeveloperUtPlsqlPlugin/PlsqlDeveloperUtPlsqlPlugin/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
<package id="Oracle.ManagedDataAccess" version="19.10.0" targetFramework="net40" />
77
<package id="UnmanagedExports" version="1.2.7" targetFramework="net40" />
88
<package id="UnmanagedExports.Repack" version="1.0.4" targetFramework="net40" />
9-
<package id="utPLSQL.Api" version="1.4.0" targetFramework="net40" />
9+
<package id="utPLSQL.Api" version="1.4.1" targetFramework="net40" />
1010
</packages>

PlsqlDeveloperUtPlsqlPlugin/utPLSQL.UI.Standalone/LoginForm.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,13 @@ public LoginForm()
1212

1313
private void BtnRunTests_Click(object sender, EventArgs e)
1414
{
15-
var realTimeTestRunner = new RealTimeTestRunner();
16-
realTimeTestRunner.Connect(txtUsername.Text, txtPassword.Text, txtDatabase.Text);
17-
18-
var testRunnerWindow = new TestRunnerWindow(realTimeTestRunner, null);
15+
var testRunnerWindow = new TestRunnerWindow(null, txtUsername.Text, txtPassword.Text, txtDatabase.Text);
1916
testRunnerWindow.RunTestsAsync("USER", null, txtUsername.Text, null, false);
2017
}
2118

2219
private void btnCodeCoverage_Click(object sender, EventArgs e)
2320
{
24-
var realTimeTestRunner = new RealTimeTestRunner();
25-
realTimeTestRunner.Connect(txtUsername.Text, txtPassword.Text, txtDatabase.Text);
26-
27-
var testRunnerWindow = new TestRunnerWindow(realTimeTestRunner, null);
21+
var testRunnerWindow = new TestRunnerWindow(null, txtUsername.Text, txtPassword.Text, txtDatabase.Text);
2822
testRunnerWindow.RunTestsAsync("USER", null, txtUsername.Text, null, true);
2923
}
3024
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Oracle.ManagedDataAccess" version="19.10.0" targetFramework="net40" />
4-
<package id="utPLSQL.Api" version="1.4.0" targetFramework="net40" />
4+
<package id="utPLSQL.Api" version="1.4.1" targetFramework="net40" />
55
</packages>

PlsqlDeveloperUtPlsqlPlugin/utPLSQL.UI.Standalone/utPLSQL.UI.Standalone.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
<Reference Include="System.Drawing" />
4646
<Reference Include="System.Windows.Forms" />
4747
<Reference Include="System.Xml" />
48-
<Reference Include="utPLSQL.Api, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
49-
<HintPath>..\packages\utPLSQL.Api.1.4.0\lib\net40\utPLSQL.Api.dll</HintPath>
48+
<Reference Include="utPLSQL.Api, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
49+
<HintPath>..\packages\utPLSQL.Api.1.4.1\lib\net40\utPLSQL.Api.dll</HintPath>
5050
</Reference>
5151
</ItemGroup>
5252
<ItemGroup>

PlsqlDeveloperUtPlsqlPlugin/utPLSQL.UI/TestRunnerWindow.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,24 @@ public partial class TestRunnerWindow : Form
2020

2121
private readonly RealTimeTestRunner testRunner;
2222
private readonly object pluginIntegration;
23-
23+
private readonly string username;
24+
private readonly string password;
25+
private readonly string database;
2426
private readonly List<TestResult> testResults = new List<TestResult>();
2527
BindingListView<TestResult> viewTestResults;
2628

2729
private int totalNumberOfTests;
2830
private int rowIndexOnRightClick;
2931

30-
public TestRunnerWindow(RealTimeTestRunner testRunner, object pluginIntegration)
32+
public TestRunnerWindow(object pluginIntegration, string username, string password, string database)
3133
{
32-
this.testRunner = testRunner;
3334
this.pluginIntegration = pluginIntegration;
35+
this.username = username;
36+
this.password = password;
37+
this.database = database;
38+
39+
this.testRunner = new RealTimeTestRunner();
40+
this.testRunner.Connect(username, password, database);
3441

3542
InitializeComponent();
3643

@@ -491,6 +498,12 @@ private void TestResultWindow_FormClosing(object sender, FormClosingEventArgs e)
491498
{
492499
e.Cancel = true;
493500
}
501+
else
502+
{
503+
txtStatus.Text = "Aborting...";
504+
testRunner.Close();
505+
Running = false;
506+
}
494507
}
495508
}
496509
}
@@ -557,15 +570,15 @@ private void menuItemRunTests_Click(object sender, EventArgs e)
557570
{
558571
var testResult = testResults[rowIndexOnRightClick];
559572

560-
var testResultWindow = new TestRunnerWindow(testRunner, pluginIntegration);
573+
var testResultWindow = new TestRunnerWindow(pluginIntegration, username, password, database);
561574
testResultWindow.RunTestsAsync("PROCEDURE", testResult.Owner, testResult.Package, testResult.Procedure, false);
562575
}
563576

564577
private void menuItemCoverage_Click(object sender, EventArgs e)
565578
{
566579
var testResult = testResults[rowIndexOnRightClick];
567580

568-
var testResultWindow = new TestRunnerWindow(testRunner, pluginIntegration);
581+
var testResultWindow = new TestRunnerWindow(pluginIntegration, username, password, database);
569582
testResultWindow.RunTestsAsync("PROCEDURE", testResult.Owner, testResult.Package, testResult.Procedure, true);
570583
}
571584

PlsqlDeveloperUtPlsqlPlugin/utPLSQL.UI/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<package id="FontAwesome.Sharp" version="5.15.3" targetFramework="net40" />
44
<package id="Geomatics.IO.BindingListView" version="1.3.2" targetFramework="net40" />
55
<package id="Oracle.ManagedDataAccess" version="19.10.0" targetFramework="net40" />
6-
<package id="utPLSQL.Api" version="1.4.0" targetFramework="net40" />
6+
<package id="utPLSQL.Api" version="1.4.1" targetFramework="net40" />
77
</packages>

PlsqlDeveloperUtPlsqlPlugin/utPLSQL.UI/utPLSQL.UI.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
<Reference Include="Microsoft.CSharp" />
5050
<Reference Include="System.Data" />
5151
<Reference Include="System.Xml" />
52-
<Reference Include="utPLSQL.Api, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
53-
<HintPath>..\packages\utPLSQL.Api.1.4.0\lib\net40\utPLSQL.Api.dll</HintPath>
52+
<Reference Include="utPLSQL.Api, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
53+
<HintPath>..\packages\utPLSQL.Api.1.4.1\lib\net40\utPLSQL.Api.dll</HintPath>
5454
</Reference>
5555
</ItemGroup>
5656
<ItemGroup>

0 commit comments

Comments
 (0)