Skip to content

Commit

Permalink
Remove isolation code for netfx. Causes two loads of Java.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed May 13, 2024
1 parent f4798c6 commit 6937300
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 192 deletions.
2 changes: 2 additions & 0 deletions src/IKVM.JTReg.TestAdapter.Core/JTRegTestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace IKVM.JTReg.TestAdapter.Core
public class JTRegTestManager
{

public static readonly JTRegTestManager Instance = new();

public const string URI = "executor://ikvmjtregtestadapter/v1";

internal static readonly string JTREG_LIB = Path.Combine(Path.GetDirectoryName(typeof(JTRegTestManager).Assembly.Location), "jtreg");
Expand Down
92 changes: 0 additions & 92 deletions src/IKVM.JTReg.TestAdapter.Core/JTRegTestManagerProxy.cs

This file was deleted.

2 changes: 0 additions & 2 deletions src/IKVM.JTReg.TestAdapter.Tests/JTRegTestAdapterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

using IKVM.JTReg.TestAdapter.Core;

using javax.xml.bind;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Moq;
Expand Down
16 changes: 1 addition & 15 deletions src/IKVM.JTReg.TestAdapter/JTRegExecutionContextProxy.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;

using IKVM.JTReg.TestAdapter.Core;

Expand All @@ -13,11 +12,7 @@ namespace IKVM.JTReg.TestAdapter
/// <summary>
/// Proxies the <see cref="IJTRegExecutionContext"/> interface to the Visual Studio test adapter.
/// </summary>
class JTRegExecutionContextProxy :
#if NETFRAMEWORK
MarshalByRefObject,
#endif
IJTRegExecutionContext
class JTRegExecutionContextProxy : IJTRegExecutionContext
{

static readonly Dictionary<string, TestProperty> properties = new Dictionary<string, TestProperty>(StringComparer.OrdinalIgnoreCase);
Expand Down Expand Up @@ -101,15 +96,6 @@ public void SendMessage(JTRegTestMessageLevel level, string message)
frameworkHandle.SendMessage(JTRegProxyUtil.Convert(level), message);
}

#if NETFRAMEWORK

public override object InitializeLifetimeService()
{
return null;
}

#endif

}

}
4 changes: 1 addition & 3 deletions src/IKVM.JTReg.TestAdapter/JTRegTestDiscoverer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove

try
{
// setup isolation host for source
var proxy = JTRegTestIsolationHost.Instance.CreateManager();
proxy.DiscoverTests(source, new JTRegDiscoveryContextProxy(discoveryContext, logger, discoverySink), new CancellationTokenProxy(CancellationToken.None));
JTRegTestManager.Instance.DiscoverTests(source, new JTRegDiscoveryContextProxy(discoveryContext, logger, discoverySink), CancellationToken.None);
}
catch (Exception e)
{
Expand Down
9 changes: 3 additions & 6 deletions src/IKVM.JTReg.TestAdapter/JTRegTestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ public class JTRegTestExecutor : ITestExecutor
public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
cts = new CancellationTokenSource();
var ctp = new CancellationTokenProxy(cts.Token);

foreach (var group in tests.GroupBy(i => i.Source))
{
if (cts.Token.IsCancellationRequested)
break;

var proxy = JTRegTestIsolationHost.Instance.CreateManager();
proxy.RunTests(group.Key, JTRegProxyUtil.Convert(group).ToList(), new JTRegExecutionContextProxy(runContext, frameworkHandle), ctp);
JTRegTestManager.Instance.RunTests(group.Key, JTRegProxyUtil.Convert(group).ToList(), new JTRegExecutionContextProxy(runContext, frameworkHandle), cts.Token);
}
}

Expand All @@ -49,15 +47,13 @@ public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrame
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
{
cts = new CancellationTokenSource();
var ctp = new CancellationTokenProxy(cts.Token);

foreach (var source in sources)
{
if (cts.Token.IsCancellationRequested)
break;

var proxy = JTRegTestIsolationHost.Instance.CreateManager();
proxy.RunTests(source, new JTRegExecutionContextProxy(runContext, frameworkHandle), ctp);
JTRegTestManager.Instance.RunTests(source, null, new JTRegExecutionContextProxy(runContext, frameworkHandle), cts.Token);
}
}

Expand All @@ -68,6 +64,7 @@ public void Cancel()
{
cts?.Cancel();
}

}

}
74 changes: 0 additions & 74 deletions src/IKVM.JTReg.TestAdapter/JTRegTestIsolationHost.cs

This file was deleted.

0 comments on commit 6937300

Please sign in to comment.