Skip to content

Commit 34d8b78

Browse files
committed
keep certificate path builder shim
1 parent ad7040d commit 34d8b78

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

src/Apache.IoTDB/SessionPool.Builder.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* under the License.
1818
*/
1919

20+
using System;
2021
using System.Collections.Generic;
2122

2223
namespace Apache.IoTDB;
@@ -108,6 +109,12 @@ public Builder SetClientCertificatePath(string clientCertificatePath)
108109
return this;
109110
}
110111

112+
[Obsolete("Use SetClientCertificatePath instead.")]
113+
public Builder SetCertificatePath(string certificatePath)
114+
{
115+
return SetClientCertificatePath(certificatePath);
116+
}
117+
111118
public Builder SetClientCertificatePassword(string clientCertificatePassword)
112119
{
113120
_clientCertificatePassword = clientCertificatePassword;

src/Apache.IoTDB/TableSessionPool.Builder.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ public Builder SetClientCertificatePath(string clientCertificatePath)
111111
return this;
112112
}
113113

114+
[Obsolete("Use SetClientCertificatePath instead.")]
115+
public Builder SetCertificatePath(string certificatePath)
116+
{
117+
return SetClientCertificatePath(certificatePath);
118+
}
119+
114120
public Builder SetClientCertificatePassword(string clientCertificatePassword)
115121
{
116122
_clientCertificatePassword = clientCertificatePassword;

tests/Apache.IoTDB.Tests/MtlsConfigurationTests.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ public void SessionPoolBuilder_AcceptsClientCertificateConfiguration()
4040
Assert.That(sessionPool, Is.Not.Null);
4141
}
4242

43+
[Test]
44+
public void SessionPoolBuilder_AcceptsObsoleteCertificatePath()
45+
{
46+
#pragma warning disable CS0618
47+
var sessionPool = new SessionPool.Builder()
48+
.SetHost("localhost")
49+
.SetPort(6667)
50+
.SetUseSsl(true)
51+
.SetCertificatePath("/tmp/client.pfx")
52+
.SetClientCertificatePassword("secret")
53+
.SetRootCertificatePath("/tmp/root-ca.pem")
54+
.Build();
55+
#pragma warning restore CS0618
56+
57+
Assert.That(sessionPool, Is.Not.Null);
58+
}
59+
4360
[Test]
4461
public void TableSessionPoolBuilder_AcceptsClientCertificateConfiguration()
4562
{
@@ -55,6 +72,23 @@ public void TableSessionPoolBuilder_AcceptsClientCertificateConfiguration()
5572
Assert.That(tableSessionPool, Is.Not.Null);
5673
}
5774

75+
[Test]
76+
public void TableSessionPoolBuilder_AcceptsObsoleteCertificatePath()
77+
{
78+
#pragma warning disable CS0618
79+
var tableSessionPool = new TableSessionPool.Builder()
80+
.SetHost("localhost")
81+
.SetPort(6667)
82+
.SetUseSsl(true)
83+
.SetCertificatePath("/tmp/client.pfx")
84+
.SetClientCertificatePassword("secret")
85+
.SetRootCertificatePath("/tmp/root-ca.pem")
86+
.Build();
87+
#pragma warning restore CS0618
88+
89+
Assert.That(tableSessionPool, Is.Not.Null);
90+
}
91+
5892
[Test]
5993
public void ConnectionStringBuilder_ParsesMtlsConfiguration()
6094
{

0 commit comments

Comments
 (0)