Skip to content

Commit

Permalink
[Internal] Direct Package: Adds Support for Direct package version 3.…
Browse files Browse the repository at this point in the history
…33.0 (#4353)

* upgraded direct package version

* added Taiwan regions

* update contracts

* fix contracts

* fixed more contracts

* contracts change

* contract change remove

* changed baseline files

* added space

* added region name check test for future verification

* nits

---------

Co-authored-by: Sourabh Jain <sourabhjain@microsoft.com>
  • Loading branch information
NaluTripician and sourabh1007 authored Apr 3, 2024
1 parent 1106cd7 commit 80647ba
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ClientOfficialVersion>3.38.1</ClientOfficialVersion>
<ClientPreviewVersion>3.39.0</ClientPreviewVersion>
<ClientPreviewSuffixVersion>preview.1</ClientPreviewSuffixVersion>
<DirectVersion>3.32.1</DirectVersion>
<DirectVersion>3.33.0</DirectVersion>
<EncryptionOfficialVersion>2.0.4</EncryptionOfficialVersion>
<EncryptionPreviewVersion>2.1.0</EncryptionPreviewVersion>
<EncryptionPreviewSuffixVersion>preview4</EncryptionPreviewSuffixVersion>
Expand Down
10 changes: 10 additions & 0 deletions Microsoft.Azure.Cosmos/src/Regions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,5 +374,15 @@ public static class Regions
/// Name of the Azure Spain Central region in the Azure Cosmos DB service.
/// </summary>
public const string SpainCentral = "Spain Central";

/// <summary>
/// Name of the Azure Taiwan North region in the Azure Cosmos DB service.
/// </summary>
public const string TaiwanNorth = "Taiwan North";

/// <summary>
/// Name of the Azure Taiwan Northwest region in the Azure Cosmos DB service.
/// </summary>
public const string TaiwanNorthwest = "Taiwan Northwest";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,6 @@ GROUP BY c.age, c.name]]></RewrittenQuery>
<OrderByExpressions />
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>min_age</Alias>
<AggregateOperator>Min</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>max_age</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>count</Alias>
<AggregateOperator>Count</AggregateOperator>
Expand All @@ -331,6 +323,14 @@ GROUP BY c.age, c.name]]></RewrittenQuery>
<Alias>team</Alias>
<AggregateOperator>null</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>min_age</Alias>
<AggregateOperator>Min</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>max_age</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>avg_age</Alias>
<AggregateOperator>Average</AggregateOperator>
Expand Down Expand Up @@ -504,10 +504,6 @@ GROUP BY UPPER(c.name), SUBSTRING(c.address.city, 0, 3)]]></RewrittenQuery>
<OrderByExpressions />
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>group_name</Alias>
<AggregateOperator>null</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>count</Alias>
<AggregateOperator>Count</AggregateOperator>
Expand All @@ -516,6 +512,10 @@ GROUP BY UPPER(c.name), SUBSTRING(c.address.city, 0, 3)]]></RewrittenQuery>
<Alias>info</Alias>
<AggregateOperator>null</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>group_name</Alias>
<AggregateOperator>null</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
<GroupByAliases>
<Alias>info</Alias>
Expand Down Expand Up @@ -718,17 +718,13 @@ GROUP BY c.name]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>max_age</Alias>
<AggregateOperator>Max</AggregateOperator>
<Alias>count</Alias>
<AggregateOperator>Count</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>name</Alias>
<AggregateOperator>null</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>count</Alias>
<AggregateOperator>Count</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>$1</Alias>
<AggregateOperator>Min</AggregateOperator>
Expand All @@ -741,6 +737,10 @@ GROUP BY c.name]]></RewrittenQuery>
<Alias>$2</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>max_age</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>avg_age</Alias>
<AggregateOperator>Average</AggregateOperator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,11 @@ FROM c]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>min_blah2</Alias>
<Alias>min_blah</Alias>
<AggregateOperator>Min</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>min_blah</Alias>
<Alias>min_blah2</Alias>
<AggregateOperator>Min</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -557,11 +557,11 @@ FROM c]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>max_blah</Alias>
<Alias>max_blah2</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>max_blah2</Alias>
<Alias>max_blah</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -605,11 +605,11 @@ FROM c]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>avg_blah2</Alias>
<Alias>avg_blah</Alias>
<AggregateOperator>Average</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>avg_blah</Alias>
<Alias>avg_blah2</Alias>
<AggregateOperator>Average</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -989,11 +989,11 @@ FROM c]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>$1</Alias>
<Alias>count_blah</Alias>
<AggregateOperator>Count</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>count_blah</Alias>
<Alias>$1</Alias>
<AggregateOperator>Count</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -1181,11 +1181,11 @@ FROM c]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>max_blah</Alias>
<Alias>$1</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>$1</Alias>
<Alias>max_blah</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -1229,11 +1229,11 @@ FROM c]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>max_blah</Alias>
<Alias>$1</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>$1</Alias>
<Alias>max_blah</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -1428,15 +1428,15 @@ FROM c]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>$1</Alias>
<Alias>count_blah</Alias>
<AggregateOperator>Count</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>count_blah</Alias>
<Alias>count_blah2</Alias>
<AggregateOperator>Count</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>count_blah2</Alias>
<Alias>$1</Alias>
<AggregateOperator>Count</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -1486,11 +1486,11 @@ FROM c]]></RewrittenQuery>
<AggregateOperator>Min</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>min_blah2</Alias>
<Alias>min_blah</Alias>
<AggregateOperator>Min</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>min_blah</Alias>
<Alias>min_blah2</Alias>
<AggregateOperator>Min</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -1536,15 +1536,15 @@ FROM c]]></RewrittenQuery>
<Aggregates />
<GroupByAliasToAggregateType>
<AliasToAggregateType>
<Alias>max_blah</Alias>
<Alias>$1</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>max_blah2</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>$1</Alias>
<Alias>max_blah</Alias>
<AggregateOperator>Max</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down Expand Up @@ -1594,11 +1594,11 @@ FROM c]]></RewrittenQuery>
<AggregateOperator>Average</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>avg_blah2</Alias>
<Alias>avg_blah</Alias>
<AggregateOperator>Average</AggregateOperator>
</AliasToAggregateType>
<AliasToAggregateType>
<Alias>avg_blah</Alias>
<Alias>avg_blah2</Alias>
<AggregateOperator>Average</AggregateOperator>
</AliasToAggregateType>
</GroupByAliasToAggregateType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Cosmos.Contracts
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using Microsoft.Azure.Cosmos.Query.Core.Monads;
using Microsoft.Azure.Cosmos.Query.Core.QueryPlan;
using Microsoft.Azure.Documents;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;

[TestCategory("Windows")]
[TestClass]
Expand Down Expand Up @@ -81,6 +79,21 @@ public void MappedRegionsTest()
CollectionAssert.AreEquivalent(locationNames, cosmosRegions);
}

[TestMethod]
public void RegionValueCheck()
{
string[] cosmosRegions = typeof(Regions)
.GetMembers(BindingFlags.Static | BindingFlags.Public)
.Select(e => e.Name)
.ToArray();
foreach (string region in cosmosRegions)
{
string locationNameValue = typeof(LocationNames).GetField(region).GetValue(null).ToString();
string regionNameValue = typeof(Regions).GetField(region).GetValue(null).ToString();
Assert.AreEqual(locationNameValue, regionNameValue);
}
}

[TestMethod]
public void RMContractTest()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7100,6 +7100,16 @@
"Attributes": [],
"MethodInfo": "System.String SwitzerlandWest;IsInitOnly:False;IsStatic:True;"
},
"System.String TaiwanNorth": {
"Type": "Field",
"Attributes": [],
"MethodInfo": "System.String TaiwanNorth;IsInitOnly:False;IsStatic:True;"
},
"System.String TaiwanNorthwest": {
"Type": "Field",
"Attributes": [],
"MethodInfo": "System.String TaiwanNorthwest;IsInitOnly:False;IsStatic:True;"
},
"System.String UAECentral": {
"Type": "Field",
"Attributes": [],
Expand Down

0 comments on commit 80647ba

Please sign in to comment.