-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance Initialization and Resilience with Multiple Node URLs for Imp…
…roved Failover Handling (#8)
- Loading branch information
Showing
107 changed files
with
13,238 additions
and
6,805 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace Apache.IoTDB.Samples | ||
{ | ||
public class UtilsTest | ||
{ | ||
private Utils _utilFunctions = new Utils(); | ||
public void Test() | ||
{ | ||
TestParseEndPoint(); | ||
} | ||
|
||
public void TestParseEndPoint() | ||
{ | ||
TestIPv4Address(); | ||
TestIPv6Address(); | ||
TestInvalidInputs(); | ||
} | ||
|
||
private void TestIPv4Address() | ||
{ | ||
string correctEndpointIPv4 = "192.168.1.1:8080"; | ||
var endpoint = _utilFunctions.ParseTEndPointIpv4AndIpv6Url(correctEndpointIPv4); | ||
Debug.Assert(endpoint.Ip == "192.168.1.1", "IPv4 address mismatch."); | ||
Debug.Assert(endpoint.Port == 8080, "IPv4 port mismatch."); | ||
Console.WriteLine("TestIPv4Address passed."); | ||
} | ||
|
||
private void TestIPv6Address() | ||
{ | ||
string correctEndpointIPv6 = "[2001:db8:85a3::8a2e:370:7334]:443"; | ||
var endpoint = _utilFunctions.ParseTEndPointIpv4AndIpv6Url(correctEndpointIPv6); | ||
Debug.Assert(endpoint.Ip == "2001:db8:85a3::8a2e:370:7334", "IPv6 address mismatch."); | ||
Debug.Assert(endpoint.Port == 443, "IPv6 port mismatch."); | ||
Console.WriteLine("TestIPv6Address passed."); | ||
} | ||
|
||
private void TestInvalidInputs() | ||
{ | ||
string noPort = "192.168.1.1"; | ||
var endpointNoPort = _utilFunctions.ParseTEndPointIpv4AndIpv6Url(noPort); | ||
Debug.Assert(string.IsNullOrEmpty(endpointNoPort.Ip) && endpointNoPort.Port == 0, "Failed to handle missing port."); | ||
|
||
string emptyInput = ""; | ||
var endpointEmpty = _utilFunctions.ParseTEndPointIpv4AndIpv6Url(emptyInput); | ||
Debug.Assert(string.IsNullOrEmpty(endpointEmpty.Ip) && endpointEmpty.Port == 0, "Failed to handle empty input."); | ||
|
||
string invalidFormat = "192.168.1.1:port"; | ||
try | ||
{ | ||
var endpointInvalid = _utilFunctions.ParseTEndPointIpv4AndIpv6Url(invalidFormat); | ||
Debug.Fail("Should have thrown an exception due to invalid port."); | ||
} | ||
catch (FormatException) | ||
{ | ||
// Expected exception | ||
} | ||
Console.WriteLine("TestInvalidInputs passed."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net5.0;net6.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks> | ||
<LangVersion>latest</LangVersion> | ||
<PropertyGroup> | ||
<TargetFrameworks>net5.0;net6.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks> | ||
<LangVersion>latest</LangVersion> | ||
<Authors>eedalong, lausannel, MysticBoy, Aiemu, HTHou</Authors> | ||
<Company>LiuLin Lab</Company> | ||
<PackageDescription>C# client for Apache IoTDB</PackageDescription> | ||
<PackageProjectUrl>https://github.com/apache/iotdb-client-csharp</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/apache/iotdb-client-csharp</RepositoryUrl> | ||
|
||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ApacheThrift" Version="0.14.1" /> | ||
</ItemGroup> | ||
<ItemGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netstandard2.0'"> | ||
<PackageReference Include="IndexRange" Version="1.0.2" /> | ||
</ItemGroup> | ||
</PropertyGroup> | ||
|
||
</Project> | ||
<ItemGroup> | ||
<PackageReference Include="ApacheThrift" Version="0.14.1" /> | ||
</ItemGroup> | ||
<ItemGroup | ||
Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netstandard2.0'"> | ||
<PackageReference Include="IndexRange" Version="1.0.2" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.