Skip to content

Commit 0bcccc1

Browse files
committed
Fixed failing unit/integration tests due to CLSCompliant refactor work
1 parent 92d42a4 commit 0bcccc1

File tree

6 files changed

+16
-3
lines changed

6 files changed

+16
-3
lines changed

src/Nest/DSL/Paths/QueryPathDescriptor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ public TDescriptor Index<TAlternative>() where TAlternative : class
184184
/// </summary>
185185
public TDescriptor Index(Type index)
186186
{
187+
if (index == null) return (TDescriptor)this;
187188
return this.Indices(index);
188189
}
189190

@@ -192,6 +193,7 @@ public TDescriptor Index(Type index)
192193
/// </summary>
193194
public TDescriptor Index(IndexNameMarker index)
194195
{
196+
if (index == null) return (TDescriptor)this;
195197
return this.Indices(index);
196198
}
197199

@@ -200,6 +202,7 @@ public TDescriptor Index(IndexNameMarker index)
200202
/// </summary>
201203
public TDescriptor Index(string index)
202204
{
205+
if (index == null) return (TDescriptor)this;
203206
return this.Indices(index);
204207
}
205208

@@ -262,6 +265,7 @@ public TDescriptor Types(params Type[] types)
262265
/// </summary>
263266
public TDescriptor Type(TypeNameMarker type)
264267
{
268+
if (type == null) return (TDescriptor)this;
265269
return this.Types(type);
266270
}
267271

@@ -271,6 +275,7 @@ public TDescriptor Type(TypeNameMarker type)
271275
/// </summary>
272276
public TDescriptor Type(string type)
273277
{
278+
if (type == null) return (TDescriptor)this;
274279
return this.Types(type);
275280
}
276281

@@ -280,6 +285,7 @@ public TDescriptor Type(string type)
280285
/// </summary>
281286
public TDescriptor Type(Type type)
282287
{
288+
if (type == null) return (TDescriptor)this;
283289
return this.Types(type);
284290
}
285291

src/Nest/ExposedInternals/NestSerializer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ public virtual Task<T> DeserializeAsync<T>(Stream stream)
125125

126126
internal JsonSerializerSettings CreateSettings(JsonConverter piggyBackJsonConverter = null)
127127
{
128-
if (piggyBackJsonConverter == null)
129-
return this._serializationSettings;
130128

131129
var piggyBackState = new JsonConverterPiggyBackState { ActualJsonConverter = piggyBackJsonConverter };
132130
var settings = new JsonSerializerSettings()

src/Nest/Resolvers/ElasticContractResolver.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ protected override IList<JsonProperty> CreateProperties(Type type, MemberSeriali
9595
var lookup = defaultProperties.ToLookup(p => p.PropertyName);
9696

9797
defaultProperties = PropertiesOf<IQuery>(type, memberSerialization, defaultProperties, lookup);
98+
defaultProperties = PropertiesOf<IAllFieldMapping>(type, memberSerialization, defaultProperties, lookup);
99+
defaultProperties = PropertiesOf<IExternalFieldDeclaration>(type, memberSerialization, defaultProperties, lookup);
98100
defaultProperties = PropertiesOf<IQueryContainer>(type, memberSerialization, defaultProperties, lookup);
99101
defaultProperties = PropertiesOf<IRequest>(type, memberSerialization, defaultProperties, lookup);
100102
defaultProperties = PropertiesOf<IFilter>(type, memberSerialization, defaultProperties, lookup, append: true);

src/Nest/Resolvers/IndexNameResolver.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public string GetIndexForType(Type type)
2626
if (defaultIndices == null)
2727
return this._connectionSettings.DefaultIndex;
2828

29+
if (type == null)
30+
return this._connectionSettings.DefaultIndex;
31+
2932
string value;
3033
if (defaultIndices.TryGetValue(type, out value) && !string.IsNullOrWhiteSpace(value))
3134
return value;
@@ -35,6 +38,8 @@ public string GetIndexForType(Type type)
3538

3639
internal string GetIndexForType(IndexNameMarker i)
3740
{
41+
if (i == null) return this.GetIndexForType((Type)null);
42+
3843
return i.Name ?? this.GetIndexForType(i.Type);
3944
}
4045
}

src/Nest/Resolvers/TypeNameResolver.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public string GetTypeNameFor(Type type)
4040

4141
internal string GetTypeNameFor(TypeNameMarker t)
4242
{
43+
if (t == null) return null;
44+
4345
return t.Name ?? this.GetTypeNameFor(t.Type);
4446
}
4547
}

src/Tests/Nest.Tests.Integration/ElasticsearchConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static ConnectionSettings Settings(int? port = null, Uri hostOverride = n
4444
.ExposeRawResponse();
4545
}
4646

47-
public static readonly Lazy<ElasticClient> Client = new Lazy<ElasticClient>(()=> new ElasticClient(Settings().EnableCompressedResponses()));
47+
public static readonly Lazy<ElasticClient> Client = new Lazy<ElasticClient>(()=> new ElasticClient(Settings()));
4848
public static readonly Lazy<ElasticClient> ClientNoRawResponse = new Lazy<ElasticClient>(()=> new ElasticClient(Settings().ExposeRawResponse(false)));
4949
public static readonly Lazy<ElasticClient> ClientThatThrows = new Lazy<ElasticClient>(()=> new ElasticClient(Settings().ThrowOnElasticsearchServerExceptions()));
5050
public static readonly Lazy<ElasticClient> ThriftClient = new Lazy<ElasticClient>(()=> new ElasticClient(Settings(9500), new ThriftConnection(Settings(9500))));

0 commit comments

Comments
 (0)