Skip to content

Commit 0cb55ef

Browse files
committed
Bug 37122823 - Fix and Re-enable .NET client SSL tests for Linux and Mac
[git-p4: depot-paths = "//dev/main.net/": change = 111754]
1 parent eeaf210 commit 0cb55ef

File tree

6 files changed

+328
-16
lines changed

6 files changed

+328
-16
lines changed

tests/Coherence.Tests/Net/Impl/SSLOneWayRemoteNamedCacheTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
* https://oss.oracle.com/licenses/upl.
66
*/
77
using System;
8+
using System.Runtime.InteropServices;
89

910
using NUnit.Framework;
10-
using Tangosol.Run.Xml;
1111

1212
namespace Tangosol.Net.Impl
1313
{
1414
[TestFixture]
15-
[Platform(Exclude="Unix,Linux,MacOsX")]
1615
public class SSLOneWayRemoteNamedCacheTests : RemoteNamedCacheTests
1716
{
1817
protected override String TestCacheName
@@ -23,8 +22,13 @@ protected override String TestCacheName
2322
[SetUp]
2423
public void SetUp()
2524
{
26-
var ccf = new DefaultConfigurableCacheFactory(
27-
"assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl.xml");
25+
var configFileName = "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl.xml";
26+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
27+
{
28+
configFileName = "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl-non-win.xml";
29+
}
30+
31+
var ccf = new DefaultConfigurableCacheFactory(configFileName);
2832
CacheFactory.ConfigurableCacheFactory = ccf;
2933
}
3034

tests/Coherence.Tests/Net/Impl/SSLRemoteNamedCacheTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
using System;
88
using System.IO;
99
using System.Collections.Specialized;
10+
using System.Runtime.InteropServices;
1011

1112
using NUnit.Framework;
12-
using Tangosol.Run.Xml;
1313

1414
namespace Tangosol.Net.Impl {
1515

1616
[TestFixture]
17-
[Platform(Exclude="Unix,Linux,MacOsX")]
1817
public class SSLRemoteNamedCacheTests
1918
{
2019

@@ -35,8 +34,13 @@ protected String TwoWayCacheName
3534
[SetUp]
3635
public void SetUp()
3736
{
38-
var ccf = new DefaultConfigurableCacheFactory(
39-
"assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl.xml");
37+
var configFileName = "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl.xml";
38+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
39+
{
40+
configFileName = "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl-non-win.xml";
41+
}
42+
43+
var ccf = new DefaultConfigurableCacheFactory(configFileName);
4044
CacheFactory.ConfigurableCacheFactory = ccf;
4145
}
4246

tests/Coherence.Tests/Net/Impl/SSLTwoWayRemoteNamedCacheTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
* https://oss.oracle.com/licenses/upl.
66
*/
77
using System;
8+
using System.Runtime.InteropServices;
89

910
using NUnit.Framework;
10-
using Tangosol.Run.Xml;
1111

1212
namespace Tangosol.Net.Impl
1313
{
1414
[TestFixture]
15-
[Platform(Exclude="Unix,Linux,MacOsX")]
1615
public class SSLTwoWayRemoteNamedCacheTests : RemoteNamedCacheTests
1716
{
1817
protected override String TestCacheName
@@ -23,8 +22,13 @@ protected override String TestCacheName
2322
[SetUp]
2423
public void SetUp()
2524
{
26-
var ccf = new DefaultConfigurableCacheFactory(
27-
"assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl.xml");
25+
var configFileName = "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl.xml";
26+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
27+
{
28+
configFileName = "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl-non-win.xml";
29+
}
30+
31+
var ccf = new DefaultConfigurableCacheFactory(configFileName);
2832
CacheFactory.ConfigurableCacheFactory = ccf;
2933
}
3034

tests/Coherence.Tests/Net/Impl/TLS12OneWayRemoteNamedCacheTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
* https://oss.oracle.com/licenses/upl.
66
*/
77
using System;
8+
using System.Runtime.InteropServices;
89

910
using NUnit.Framework;
10-
using Tangosol.Run.Xml;
1111

1212
namespace Tangosol.Net.Impl
1313
{
1414
[TestFixture]
15-
[Platform(Exclude="Unix,Linux,MacOsX")]
1615
public class TLS12OneWayRemoteNamedCacheTests : RemoteNamedCacheTests
1716
{
1817
protected override String TestCacheName
@@ -23,8 +22,13 @@ protected override String TestCacheName
2322
[SetUp]
2423
public void SetUp()
2524
{
26-
var ccf = new DefaultConfigurableCacheFactory(
27-
"assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl.xml");
25+
var configFileName = "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl.xml";
26+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
27+
{
28+
configFileName = "assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config-ssl-non-win.xml";
29+
}
30+
31+
var ccf = new DefaultConfigurableCacheFactory(configFileName);
2832
CacheFactory.ConfigurableCacheFactory = ccf;
2933
}
3034

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates.
3+
*
4+
* Licensed under the Universal Permissive License v 1.0 as shown at
5+
* https://oss.oracle.com/licenses/upl.
6+
*/
7+
using System;
8+
using System.Net.Security;
9+
using System.Security.Cryptography.X509Certificates;
10+
using System.Text;
11+
12+
namespace Tangosol.Net.Ssl
13+
{
14+
public sealed class CertificateValidatorNonWindows
15+
{
16+
public CertificateValidatorNonWindows()
17+
{
18+
}
19+
20+
/// <summary>
21+
/// Verifies the remote Secure Sockets Layer (SSL) certificate used for authentication. This callback
22+
/// ignores the content of the Common Name for the certificate during the validation.
23+
/// </summary>
24+
/// <param name="sender">An object that contains state information for this validation.</param>
25+
/// <param name="certificate">The certificate used to authenticate the remote party.</param>
26+
/// <param name="chain">The chain of certificate authorities associated with the remote certificate.</param>
27+
/// <param name="errors">One or more errors associated with the remote certificate.</param>
28+
/// <returns>A Boolean value that determines whether the specified certificate is accepted for authentication.</returns>
29+
public static bool IgnoreCommonNameCertificateValidation(object sender, X509Certificate certificate,
30+
X509Chain chain, SslPolicyErrors errors)
31+
{
32+
return true;
33+
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)