Skip to content

Commit 7b836e3

Browse files
committed
Merge pull request #916 from elasticsearch/feature/1-3-2-generation
generated source and yaml tests for 1.3.2
2 parents f50fa93 + f253dec commit 7b836e3

File tree

192 files changed

+2936
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+2936
-422
lines changed

src/CodeGeneration/CodeGeneration.LowLevelClient/ApiGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ namespace CodeGeneration.LowLevelClient
1818
{
1919
public static class ApiGenerator
2020
{
21-
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.2.0/rest-api-spec/api";
22-
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.2.0/rest-api-spec/api/";
21+
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.3.2/rest-api-spec/api";
22+
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.3.2/rest-api-spec/api/";
2323
private readonly static string _nestFolder = @"..\..\..\..\..\src\Nest\";
2424
private readonly static string _esNetFolder = @"..\..\..\..\..\src\Elasticsearch.Net\";
2525
private readonly static string _viewFolder = @"..\..\Views\";

src/CodeGeneration/CodeGeneration.YamlTestsRunner/Domain/TestSuite.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ private static string PropertyPath(string value)
134134
return "this._status";
135135

136136
value = Regex.Replace(value, @"\.(\d+)\.?", "[$1].");
137+
//make sure we escape reserverd keywords
138+
value = Regex.Replace(value, @"(^|\.)(class|params|default)(\.|$)", "$1@$2$3");
137139
if (value.Length > 0)
138140
value = "." + value;
139141
if (Regex.IsMatch(value, @"([\s\-]|\\\.)"))

src/CodeGeneration/CodeGeneration.YamlTestsRunner/Extensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static string SerializeToAnonymousObject(this object o, string indentatio
124124
return "\t\t\t\t" + m.Value.Replace(" ", "\t");
125125
}, RegexOptions.Multiline);
126126
//escape c# keywords in the anon object
127-
anon = anon.Replace("default=", "@default=").Replace("params=", "@params=");
127+
anon = anon.Replace("default=", "@default=").Replace("params=", "@params=").Replace("class=", "@class=");
128128
//docs contain different types of anon objects, quick fix by making them a dynamic[]
129129
anon = anon.Replace("docs= new []", "docs= new dynamic[]");
130130
//fix empty untyped arrays, default to string
@@ -145,6 +145,8 @@ public static string EscapeQuotes(this string s)
145145

146146
public static string SurroundWithQuotes(this string s)
147147
{
148+
if (Regex.IsMatch(s, @"^\d+(?:\.\d+)?$"))
149+
return s;
148150
return "@\"" + s.EscapeQuotes() + "\"";
149151
}
150152
}

src/CodeGeneration/CodeGeneration.YamlTestsRunner/YamlTestsGenerator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ namespace CodeGeneration.YamlTestsRunner
2525
using YamlTestSuite = Dictionary<string, object>;
2626
public static class YamlTestsGenerator
2727
{
28-
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.2.1/rest-api-spec/test";
29-
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.2.1/rest-api-spec/test/";
28+
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.3.2/rest-api-spec/test";
29+
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.3.2/rest-api-spec/test/";
3030
private readonly static string _testProjectFolder = @"..\..\..\..\..\src\Tests\Elasticsearch.Net.Integration.Yaml\";
3131
private readonly static string _rawClientInterface = @"..\..\..\..\..\src\Elasticsearch.Net\IElasticsearchClient.generated.cs";
3232
private readonly static string _viewFolder = @"..\..\Views\";
@@ -96,7 +96,8 @@ public static YamlSpecification GetYamlTestSpecification(bool useCache = false)
9696
"index/60_refresh.yaml",
9797
"create/60_refresh.yaml",
9898
"update/60_refresh.yaml",
99-
"search_shards/10_basic.yaml"
99+
"search_shards/10_basic.yaml",
100+
"template/10_basic.yaml"
100101
};
101102

102103
private static IList<YamlDefinition> GetFolderFiles(string folder, bool useCache = false)

src/Tests/Elasticsearch.Net.Integration.Yaml/Elasticsearch.Net.Integration.Yaml.csproj

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
@@ -95,7 +95,6 @@
9595
<Compile Include="create\40_routing.yaml.cs" />
9696
<Compile Include="create\50_parent.yaml.cs" />
9797
<Compile Include="create\55_parent_with_routing.yaml.cs" />
98-
<Compile Include="create\60_refresh.yaml.cs" />
9998
<Compile Include="create\70_timestamp.yaml.cs" />
10099
<Compile Include="create\75_ttl.yaml.cs" />
101100
<Compile Include="delete\10_basic.yaml.cs" />
@@ -146,7 +145,6 @@
146145
<Compile Include="index\40_routing.yaml.cs" />
147146
<Compile Include="index\50_parent.yaml.cs" />
148147
<Compile Include="index\55_parent_with_routing.yaml.cs" />
149-
<Compile Include="index\60_refresh.yaml.cs" />
150148
<Compile Include="index\70_timestamp.yaml.cs" />
151149
<Compile Include="index\75_ttl.yaml.cs" />
152150
<Compile Include="indices.analyze\10_analyze.yaml.cs" />
@@ -192,8 +190,12 @@
192190
<Compile Include="indices.put_warmer\all_path_options.yaml.cs" />
193191
<Compile Include="indices.recovery\10_basic.yaml.cs" />
194192
<Compile Include="indices.segments\10_basic.yaml.cs" />
195-
<Compile Include="indices.snapshot_index\10_basic.yaml.cs" />
196-
<Compile Include="indices.stats\10_basic.yaml.cs" />
193+
<Compile Include="indices.stats\10_index.yaml.cs" />
194+
<Compile Include="indices.stats\11_metric.yaml.cs" />
195+
<Compile Include="indices.stats\12_level.yaml.cs" />
196+
<Compile Include="indices.stats\13_fields.yaml.cs" />
197+
<Compile Include="indices.stats\14_groups.yaml.cs" />
198+
<Compile Include="indices.stats\15_types.yaml.cs" />
197199
<Compile Include="indices.status\10_basic.yaml.cs" />
198200
<Compile Include="indices.update_aliases\10_basic.yaml.cs" />
199201
<Compile Include="indices.update_aliases\20_routing.yaml.cs" />
@@ -223,27 +225,29 @@
223225
<Compile Include="percolate\18_highligh_with_query.yaml.cs" />
224226
<Compile Include="ping\10_ping.yaml.cs" />
225227
<Compile Include="Properties\AssemblyInfo.cs" />
228+
<Compile Include="script\10_basic.yaml.cs" />
226229
<Compile Include="scroll\10_basic.yaml.cs" />
227230
<Compile Include="scroll\11_clear.yaml.cs" />
231+
<Compile Include="search.aggregation\10_histogram.yaml.cs" />
228232
<Compile Include="search\10_source_filtering.yaml.cs" />
229233
<Compile Include="search\20_default_values.yaml.cs" />
230234
<Compile Include="search\issue4895.yaml.cs" />
235+
<Compile Include="search\test_sig_terms.yaml.cs" />
231236
<Compile Include="snapshot.get_repository\10_basic.yaml.cs" />
232237
<Compile Include="suggest\10_basic.yaml.cs" />
233238
<Compile Include="suggest\20_context.yaml.cs" />
239+
<Compile Include="template\20_search.yaml.cs" />
234240
<Compile Include="termvector\10_basic.yaml.cs" />
235241
<Compile Include="update\10_doc.yaml.cs" />
236242
<Compile Include="update\15_script.yaml.cs" />
237243
<Compile Include="update\20_doc_upsert.yaml.cs" />
238244
<Compile Include="update\22_doc_as_upsert.yaml.cs" />
239245
<Compile Include="update\25_script_upsert.yaml.cs" />
240246
<Compile Include="update\30_internal_version.yaml.cs" />
241-
<Compile Include="update\35_external_version.yaml.cs" />
242247
<Compile Include="update\35_other_versions.yaml.cs" />
243248
<Compile Include="update\40_routing.yaml.cs" />
244249
<Compile Include="update\50_parent.yaml.cs" />
245250
<Compile Include="update\55_parent_with_routing.yaml.cs" />
246-
<Compile Include="update\60_refresh.yaml.cs" />
247251
<Compile Include="update\70_timestamp.yaml.cs" />
248252
<Compile Include="update\75_ttl.yaml.cs" />
249253
<Compile Include="update\80_fields.yaml.cs" />

src/Tests/Elasticsearch.Net.Integration.Yaml/bulk/10_basic.yaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.Specialized;
34
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
47
using NUnit.Framework;
58

69

src/Tests/Elasticsearch.Net.Integration.Yaml/bulk/20_list_of_strings.yaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.Specialized;
34
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
47
using NUnit.Framework;
58

69

src/Tests/Elasticsearch.Net.Integration.Yaml/bulk/30_big_string.yaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.Specialized;
34
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
47
using NUnit.Framework;
58

69

src/Tests/Elasticsearch.Net.Integration.Yaml/cat.aliases/10_basic.yaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.Specialized;
34
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
47
using NUnit.Framework;
58

69

src/Tests/Elasticsearch.Net.Integration.Yaml/cat.allocation/10_basic.yaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.Specialized;
34
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
47
using NUnit.Framework;
58

69

0 commit comments

Comments
 (0)