Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace CodeGeneration.LowLevelClient
{
public static class ApiGenerator
{
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.2.0/rest-api-spec/api";
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.2.0/rest-api-spec/api/";
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.3.2/rest-api-spec/api";
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.3.2/rest-api-spec/api/";
private readonly static string _nestFolder = @"..\..\..\..\..\src\Nest\";
private readonly static string _esNetFolder = @"..\..\..\..\..\src\Elasticsearch.Net\";
private readonly static string _viewFolder = @"..\..\Views\";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ private static string PropertyPath(string value)
return "this._status";

value = Regex.Replace(value, @"\.(\d+)\.?", "[$1].");
//make sure we escape reserverd keywords
value = Regex.Replace(value, @"(^|\.)(class|params|default)(\.|$)", "$1@$2$3");
if (value.Length > 0)
value = "." + value;
if (Regex.IsMatch(value, @"([\s\-]|\\\.)"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static string SerializeToAnonymousObject(this object o, string indentatio
return "\t\t\t\t" + m.Value.Replace(" ", "\t");
}, RegexOptions.Multiline);
//escape c# keywords in the anon object
anon = anon.Replace("default=", "@default=").Replace("params=", "@params=");
anon = anon.Replace("default=", "@default=").Replace("params=", "@params=").Replace("class=", "@class=");
//docs contain different types of anon objects, quick fix by making them a dynamic[]
anon = anon.Replace("docs= new []", "docs= new dynamic[]");
//fix empty untyped arrays, default to string
Expand All @@ -145,6 +145,8 @@ public static string EscapeQuotes(this string s)

public static string SurroundWithQuotes(this string s)
{
if (Regex.IsMatch(s, @"^\d+(?:\.\d+)?$"))
return s;
return "@\"" + s.EscapeQuotes() + "\"";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ namespace CodeGeneration.YamlTestsRunner
using YamlTestSuite = Dictionary<string, object>;
public static class YamlTestsGenerator
{
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.2.1/rest-api-spec/test";
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.2.1/rest-api-spec/test/";
private readonly static string _listingUrl = "https://github.com/elasticsearch/elasticsearch/tree/v1.3.2/rest-api-spec/test";
private readonly static string _rawUrlPrefix = "https://raw.github.com/elasticsearch/elasticsearch/v1.3.2/rest-api-spec/test/";
private readonly static string _testProjectFolder = @"..\..\..\..\..\src\Tests\Elasticsearch.Net.Integration.Yaml\";
private readonly static string _rawClientInterface = @"..\..\..\..\..\src\Elasticsearch.Net\IElasticsearchClient.generated.cs";
private readonly static string _viewFolder = @"..\..\Views\";
Expand Down Expand Up @@ -96,7 +96,8 @@ public static YamlSpecification GetYamlTestSpecification(bool useCache = false)
"index/60_refresh.yaml",
"create/60_refresh.yaml",
"update/60_refresh.yaml",
"search_shards/10_basic.yaml"
"search_shards/10_basic.yaml",
"template/10_basic.yaml"
};

private static IList<YamlDefinition> GetFolderFiles(string folder, bool useCache = false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -95,7 +95,6 @@
<Compile Include="create\40_routing.yaml.cs" />
<Compile Include="create\50_parent.yaml.cs" />
<Compile Include="create\55_parent_with_routing.yaml.cs" />
<Compile Include="create\60_refresh.yaml.cs" />
<Compile Include="create\70_timestamp.yaml.cs" />
<Compile Include="create\75_ttl.yaml.cs" />
<Compile Include="delete\10_basic.yaml.cs" />
Expand Down Expand Up @@ -146,7 +145,6 @@
<Compile Include="index\40_routing.yaml.cs" />
<Compile Include="index\50_parent.yaml.cs" />
<Compile Include="index\55_parent_with_routing.yaml.cs" />
<Compile Include="index\60_refresh.yaml.cs" />
<Compile Include="index\70_timestamp.yaml.cs" />
<Compile Include="index\75_ttl.yaml.cs" />
<Compile Include="indices.analyze\10_analyze.yaml.cs" />
Expand Down Expand Up @@ -192,8 +190,12 @@
<Compile Include="indices.put_warmer\all_path_options.yaml.cs" />
<Compile Include="indices.recovery\10_basic.yaml.cs" />
<Compile Include="indices.segments\10_basic.yaml.cs" />
<Compile Include="indices.snapshot_index\10_basic.yaml.cs" />
<Compile Include="indices.stats\10_basic.yaml.cs" />
<Compile Include="indices.stats\10_index.yaml.cs" />
<Compile Include="indices.stats\11_metric.yaml.cs" />
<Compile Include="indices.stats\12_level.yaml.cs" />
<Compile Include="indices.stats\13_fields.yaml.cs" />
<Compile Include="indices.stats\14_groups.yaml.cs" />
<Compile Include="indices.stats\15_types.yaml.cs" />
<Compile Include="indices.status\10_basic.yaml.cs" />
<Compile Include="indices.update_aliases\10_basic.yaml.cs" />
<Compile Include="indices.update_aliases\20_routing.yaml.cs" />
Expand Down Expand Up @@ -223,27 +225,29 @@
<Compile Include="percolate\18_highligh_with_query.yaml.cs" />
<Compile Include="ping\10_ping.yaml.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="script\10_basic.yaml.cs" />
<Compile Include="scroll\10_basic.yaml.cs" />
<Compile Include="scroll\11_clear.yaml.cs" />
<Compile Include="search.aggregation\10_histogram.yaml.cs" />
<Compile Include="search\10_source_filtering.yaml.cs" />
<Compile Include="search\20_default_values.yaml.cs" />
<Compile Include="search\issue4895.yaml.cs" />
<Compile Include="search\test_sig_terms.yaml.cs" />
<Compile Include="snapshot.get_repository\10_basic.yaml.cs" />
<Compile Include="suggest\10_basic.yaml.cs" />
<Compile Include="suggest\20_context.yaml.cs" />
<Compile Include="template\20_search.yaml.cs" />
<Compile Include="termvector\10_basic.yaml.cs" />
<Compile Include="update\10_doc.yaml.cs" />
<Compile Include="update\15_script.yaml.cs" />
<Compile Include="update\20_doc_upsert.yaml.cs" />
<Compile Include="update\22_doc_as_upsert.yaml.cs" />
<Compile Include="update\25_script_upsert.yaml.cs" />
<Compile Include="update\30_internal_version.yaml.cs" />
<Compile Include="update\35_external_version.yaml.cs" />
<Compile Include="update\35_other_versions.yaml.cs" />
<Compile Include="update\40_routing.yaml.cs" />
<Compile Include="update\50_parent.yaml.cs" />
<Compile Include="update\55_parent_with_routing.yaml.cs" />
<Compile Include="update\60_refresh.yaml.cs" />
<Compile Include="update\70_timestamp.yaml.cs" />
<Compile Include="update\75_ttl.yaml.cs" />
<Compile Include="update\80_fields.yaml.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down Expand Up @@ -43,7 +46,7 @@ public void TestCatCountOutput2Test()

//match this._status:
this.IsMatch(this._status, @"/# epoch timestamp count
^ \d+ \s \d{2}:\d{2}:\d{2} \s 0 \s $/
^ \d+ \s \d{2}:\d{2}:\d{2} \s 0 \s+ \n $/
");

//do index
Expand All @@ -59,7 +62,7 @@ public void TestCatCountOutput2Test()

//match this._status:
this.IsMatch(this._status, @"/# epoch timestamp count
^ \d+ \s \d{2}:\d{2}:\d{2} \s 1 \s $/
^ \d+ \s \d{2}:\d{2}:\d{2} \s 1 \s+ \n $/
");

//do index
Expand All @@ -77,15 +80,15 @@ public void TestCatCountOutput2Test()

//match this._status:
this.IsMatch(this._status, @"/# count
^ 2 \s $/
^ 2 \s+ \n $/
");

//do cat.count
this.Do(()=> _client.CatCount("index1"));

//match this._status:
this.IsMatch(this._status, @"/# epoch timestamp count
^ \d+ \s \d{2}:\d{2}:\d{2} \s 1 \s $/
^ \d+ \s \d{2}:\d{2}:\d{2} \s 1 \s+ \n $/
");

//do cat.count
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down Expand Up @@ -40,7 +43,7 @@ public void TestPutSettings2Test()

//match _response.transient:
this.IsMatch(_response.transient, new Dictionary<string, object> {
{ @"discovery.zen.minimum_master_nodes", @"1" }
{ @"discovery.zen.minimum_master_nodes", 1 }
});

//do cluster.get_settings
Expand All @@ -50,7 +53,7 @@ public void TestPutSettings2Test()

//match _response.transient:
this.IsMatch(_response.transient, new Dictionary<string, object> {
{ @"discovery.zen.minimum_master_nodes", @"1" }
{ @"discovery.zen.minimum_master_nodes", 1 }
});

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down Expand Up @@ -98,6 +101,12 @@ public void FilteringTheClusterStateByBlocksShouldReturnTheBlocks3Test()
//length _response.blocks: 1;
this.IsLength(_response.blocks, 1);

//do indices.put_settings
_body = new Dictionary<string, object> {
{ @"index.blocks.read_only", @"false" }
};
this.Do(()=> _client.IndicesPutSettings("testidx", _body));

}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;


Expand Down
Loading