Skip to content

Commit

Permalink
remove the over-designed version property (#2108)
Browse files Browse the repository at this point in the history
  • Loading branch information
terencefan authored Dec 5, 2024
1 parent 64b9805 commit af7141a
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ public Uri ClientEndpoint

internal string AudienceBaseUrl { get; }

internal string? Version { get; }

internal IAccessKey AccessKey
{
get
Expand Down Expand Up @@ -182,7 +180,6 @@ public ServiceEndpoint(ServiceEndpoint other)
ConnectionString = other.ConnectionString;
EndpointType = other.EndpointType;
Name = other.Name;
Version = other.Version;
Endpoint = other.Endpoint;
AudienceBaseUrl = other.AudienceBaseUrl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ internal static ParsedConnectionString Parse(string connectionString)
{
ClientEndpoint = clientEndpointUri,
AccessKey = accessKey,
Version = version,
ServerEndpoint = serverEndpointUri
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ internal class ParsedConnectionString

internal Uri? ServerEndpoint { get; set; }

internal string? Version { get; set; }

public ParsedConnectionString(Uri endpoint)
{
Endpoint = endpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ internal sealed class DefaultServiceEndpointGenerator : IServiceEndpointGenerato

private const string ServerPath = "server";

public string? Version { get; }

public string AudienceBaseUrl { get; }

public string ClientEndpoint { get; }
Expand All @@ -24,7 +22,6 @@ internal sealed class DefaultServiceEndpointGenerator : IServiceEndpointGenerato

public DefaultServiceEndpointGenerator(ServiceEndpoint endpoint)
{
Version = endpoint.Version;
AudienceBaseUrl = endpoint.AudienceBaseUrl;
ClientEndpoint = endpoint.ClientEndpoint.AbsoluteUri;
ServerEndpoint = endpoint.ServerEndpoint.AbsoluteUri;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ public void TestAzureApplication(string connectionString)
var key = Assert.IsType<MicrosoftEntraAccessKey>(r.AccessKey);
Assert.IsType<ClientSecretCredential>(key.TokenCredential);
Assert.Same(r.Endpoint, r.AccessKey.Endpoint);
Assert.Null(r.Version);
Assert.Null(r.ClientEndpoint);
}

Expand All @@ -139,15 +138,6 @@ public void TestServerEndpoint(string connectionString, string expectedServerEnd
Assert.Equal(expectedPort, r.ServerEndpoint?.Port);
}

[Theory]
[ClassData(typeof(VersionTestData))]
public void TestVersion(string connectionString, string expectedVersion)
{
var r = ConnectionStringParser.Parse(connectionString);
Assert.Same(r.Endpoint, r.AccessKey.Endpoint);
Assert.Equal(expectedVersion, r.Version);
}

[Theory]
[InlineData("https://aaa", "endpoint=https://aaa;AuthType=azure;clientId=xxxx;")] // should ignore the clientId
[InlineData("https://aaa", "endpoint=https://aaa;AuthType=azure;tenantId=xxxx;")] // should ignore the tenantId
Expand Down Expand Up @@ -219,16 +209,4 @@ public IEnumerator<object[]> GetEnumerator()

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}

public class VersionTestData : IEnumerable<object[]>
{
public IEnumerator<object[]> GetEnumerator()
{
yield return new object[] { $"endpoint={HttpEndpoint};accesskey={DefaultKey}", null };
yield return new object[] { $"endpoint={HttpEndpoint};accesskey={DefaultKey};version=1.0", "1.0" };
yield return new object[] { $"endpoint={HttpEndpoint};accesskey={DefaultKey};version=1.1-preview", "1.1-preview" };
}

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public void TestCreateServiceEndpointFromAnother()
Assert.Equal(serviceEndpoint.Name, cloned.Name);
Assert.Equal(serviceEndpoint.ConnectionString, cloned.ConnectionString);
Assert.Equal(serviceEndpoint.AudienceBaseUrl, cloned.AudienceBaseUrl);
Assert.Equal(serviceEndpoint.Version, cloned.Version);
Assert.Equal(serviceEndpoint.AccessKey, cloned.AccessKey);
}

Expand Down Expand Up @@ -285,7 +284,6 @@ private static void TestCopyConstructor(ServiceEndpoint endpoint)
Assert.Equal(endpoint.EndpointType, other.EndpointType);
Assert.Equal(endpoint.Endpoint, other.Endpoint);
Assert.Equal(endpoint.ClientEndpoint, other.ClientEndpoint);
Assert.Equal(endpoint.Version, other.Version);
Assert.Equal(endpoint.AccessKey, other.AccessKey);
}

Expand Down

0 comments on commit af7141a

Please sign in to comment.