Skip to content

Commit

Permalink
Fix fully specified namespaces
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed May 2, 2023
1 parent edf4d32 commit 9487032
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@

namespace Tests.CommonOptions.AutoExpandReplicas
{
using OpenSearch.Client.Specification.IndicesApi;

public class AutoExpandReplicasTests
{
[U]
public void ImplicitConversionFromNullString()
{
string nullString = null;
OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas autoExpandReplicas = nullString;
AutoExpandReplicas autoExpandReplicas = nullString;
autoExpandReplicas.Should().BeNull();
}

[U]
public void ImplicitConversionFromMinAndMaxString()
{
var minAndMax = "0-5";
OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas autoExpandReplicas = minAndMax;
AutoExpandReplicas autoExpandReplicas = minAndMax;
autoExpandReplicas.Should().NotBeNull();
autoExpandReplicas.Enabled.Should().BeTrue();
autoExpandReplicas.MinReplicas.Should().Be(0);
Expand All @@ -62,7 +64,7 @@ public void ImplicitConversionFromMinAndMaxString()
public void ImplicitConversionFromMinAndAllString()
{
var minAndMax = "0-all";
OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas autoExpandReplicas = minAndMax;
AutoExpandReplicas autoExpandReplicas = minAndMax;
autoExpandReplicas.Should().NotBeNull();
autoExpandReplicas.Enabled.Should().BeTrue();
autoExpandReplicas.MinReplicas.Should().Be(0);
Expand All @@ -76,7 +78,7 @@ public void ImplicitConversionFromMinAndAllString()
[U]
public void CreateWithMinAndMax()
{
var autoExpandReplicas = OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas.Create(2, 3);
var autoExpandReplicas = AutoExpandReplicas.Create(2, 3);
autoExpandReplicas.Should().NotBeNull();
autoExpandReplicas.Enabled.Should().BeTrue();
autoExpandReplicas.MinReplicas.Should().Be(2);
Expand All @@ -90,7 +92,7 @@ public void CreateWithMinAndMax()
[U]
public void CreateWithMinAndAll()
{
var autoExpandReplicas = OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas.Create(0);
var autoExpandReplicas = AutoExpandReplicas.Create(0);
autoExpandReplicas.Should().NotBeNull();
autoExpandReplicas.Enabled.Should().BeTrue();
autoExpandReplicas.MinReplicas.Should().Be(0);
Expand All @@ -104,7 +106,7 @@ public void CreateWithMinAndAll()
[U]
public void CreateWithFalse()
{
var autoExpandReplicas = OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas.Create("false");
var autoExpandReplicas = AutoExpandReplicas.Create("false");
autoExpandReplicas.Should().NotBeNull();
autoExpandReplicas.Enabled.Should().BeFalse();
autoExpandReplicas.MinReplicas.Should().BeNull();
Expand All @@ -115,7 +117,7 @@ public void CreateWithFalse()
[U]
public void Disabled()
{
var autoExpandReplicas = OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas.Disabled;
var autoExpandReplicas = AutoExpandReplicas.Disabled;
autoExpandReplicas.Should().NotBeNull();
autoExpandReplicas.Enabled.Should().BeFalse();
autoExpandReplicas.MinReplicas.Should().NotHaveValue();
Expand All @@ -126,18 +128,18 @@ public void Disabled()

[U]
public void MinMustBeEqualOrLessThanMax() =>
Assert.Throws<ArgumentException>(() => OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas.Create(2, 1));
Assert.Throws<ArgumentException>(() => AutoExpandReplicas.Create(2, 1));

[U]
public void MinMustBeGreaterThanOrEqualToZero() =>
Assert.Throws<ArgumentException>(() => OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas.Create(-1));
Assert.Throws<ArgumentException>(() => AutoExpandReplicas.Create(-1));

[U]
public void MinMustBeAnInteger() =>
Assert.Throws<FormatException>(() => OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas.Create("all-all"));
Assert.Throws<FormatException>(() => AutoExpandReplicas.Create("all-all"));

[U]
public void MaxMustBeAllOrAnInteger() =>
Assert.Throws<FormatException>(() => OpenSearch.Client.Specification.IndicesApi.AutoExpandReplicas.Create("2-boo"));
Assert.Throws<FormatException>(() => AutoExpandReplicas.Create("2-boo"));
}
}
9 changes: 5 additions & 4 deletions tests/Tests/IndexModules/IndexSettings/Merge/MergeSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
using System;
using System.Collections.Generic;
using OpenSearch.Client;
using OpenSearch.Client.Specification.IndicesApi;

namespace Tests.IndexModules.IndexSettings.Merge
{
using OpenSearch.Client.Specification.IndicesApi;

public class IndexMergeSettings
{
/**
*/

public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, OpenSearch.Client.Specification.IndicesApi.IndexSettings>
public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, IndexSettings>
{
protected override object ExpectJson => new Dictionary<string, object>
{
Expand Down Expand Up @@ -75,8 +76,8 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto

/**
*/
protected override OpenSearch.Client.Specification.IndicesApi.IndexSettings Initializer =>
new OpenSearch.Client.Specification.IndicesApi.IndexSettings
protected override IndexSettings Initializer =>
new()
{
Merge = new MergeSettings
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
using System.Collections.Generic;
using OpenSearch.OpenSearch.Xunit.XunitPlumbing;
using OpenSearch.Client;
using OpenSearch.Client.Specification.IndicesApi;

namespace Tests.IndexModules.IndexSettings.Settings
{
public class RoutingPartitionSizeIndexSettingsUsage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, OpenSearch.Client.Specification.IndicesApi.IndexSettings>
using OpenSearch.Client.Specification.IndicesApi;

public class RoutingPartitionSizeIndexSettingsUsage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, IndexSettings>
{
protected override object ExpectJson => new Dictionary<string, object>
{
Expand All @@ -49,8 +50,8 @@ public class RoutingPartitionSizeIndexSettingsUsage : PromiseUsageTestBase<IInde

/**
*/
protected override OpenSearch.Client.Specification.IndicesApi.IndexSettings Initializer =>
new OpenSearch.Client.Specification.IndicesApi.IndexSettings
protected override IndexSettings Initializer =>
new()
{
RoutingPartitionSize = 6,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
using System;
using System.Collections.Generic;
using OpenSearch.Client;
using OpenSearch.Client.Specification.IndicesApi;

namespace Tests.IndexModules.IndexSettings.Settings
{
using OpenSearch.Client.Specification.IndicesApi;

public class TypedIndexSettings
{
/**
*/

public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, OpenSearch.Client.Specification.IndicesApi.IndexSettings>
public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, IndexSettings>
{
protected override object ExpectJson => new Dictionary<string, object>
{
Expand Down Expand Up @@ -95,8 +96,8 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto

/**
*/
protected override OpenSearch.Client.Specification.IndicesApi.IndexSettings Initializer =>
new OpenSearch.Client.Specification.IndicesApi.IndexSettings(new Dictionary<string, object>
protected override IndexSettings Initializer =>
new(new Dictionary<string, object>
{
{ "any.setting", "can be set" },
{ "doubles", 1.1 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
using System;
using System.Collections.Generic;
using OpenSearch.Client;
using OpenSearch.Client.Specification.IndicesApi;

namespace Tests.IndexModules.IndexSettings.SlowLog
{
using OpenSearch.Client.Specification.IndicesApi;

public class SlowLogSettings
{
/**
*/

public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, OpenSearch.Client.Specification.IndicesApi.IndexSettings>
public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, IndexSettings>
{
protected override object ExpectJson => new Dictionary<string, object>
{
Expand Down Expand Up @@ -91,10 +92,10 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto

/**
*/
protected override OpenSearch.Client.Specification.IndicesApi.IndexSettings Initializer =>
new OpenSearch.Client.Specification.IndicesApi.IndexSettings
protected override IndexSettings Initializer =>
new()
{
SlowLog = new OpenSearch.Client.Specification.IndicesApi.SlowLog
SlowLog = new SlowLog
{
Indexing = new SlowLogIndexing
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
using System;
using System.Collections.Generic;
using OpenSearch.Client;
using OpenSearch.Client.Specification.IndicesApi;

namespace Tests.IndexModules.IndexSettings.Sorting
{
using OpenSearch.Client.Specification.IndicesApi;

public class SortingSettingsSingleItem
{
private class TestClass
Expand All @@ -42,7 +43,7 @@ private class TestClass
public string field1 { get; set; }
}

public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, OpenSearch.Client.Specification.IndicesApi.IndexSettings>
public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, IndexSettings>
{
protected override object ExpectJson => new Dictionary<string, object>
{
Expand All @@ -60,8 +61,8 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
.Missing(IndexSortMissing.First)
);

protected override OpenSearch.Client.Specification.IndicesApi.IndexSettings Initializer =>
new OpenSearch.Client.Specification.IndicesApi.IndexSettings
protected override IndexSettings Initializer =>
new IndexSettings
{
Sorting = new SortingSettings
{
Expand All @@ -86,7 +87,7 @@ private class TestClass
public string field2 { get; set; }
}

public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, OpenSearch.Client.Specification.IndicesApi.IndexSettings>
public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, IndexSettings>
{
protected override object ExpectJson => new Dictionary<string, object>
{
Expand All @@ -104,8 +105,8 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto
.Missing(IndexSortMissing.First, IndexSortMissing.Last)
);

protected override OpenSearch.Client.Specification.IndicesApi.IndexSettings Initializer =>
new OpenSearch.Client.Specification.IndicesApi.IndexSettings
protected override IndexSettings Initializer =>
new()
{
Sorting = new SortingSettings
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
using System;
using System.Collections.Generic;
using OpenSearch.Client;
using OpenSearch.Client.Specification.IndicesApi;

namespace Tests.IndexModules.IndexSettings.Translog
{
using OpenSearch.Client.Specification.IndicesApi;

public class TranlogSettings
{
/**
*/

public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, OpenSearch.Client.Specification.IndicesApi.IndexSettings>
public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescriptor, IndexSettings>
{
protected override object ExpectJson => new Dictionary<string, object>
{
Expand All @@ -64,8 +65,8 @@ public class Usage : PromiseUsageTestBase<IIndexSettings, IndexSettingsDescripto

/**
*/
protected override OpenSearch.Client.Specification.IndicesApi.IndexSettings Initializer =>
new OpenSearch.Client.Specification.IndicesApi.IndexSettings
protected override IndexSettings Initializer =>
new()
{
Translog = new TranslogSettings
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@
using OpenSearch.Net;
using FluentAssertions;
using OpenSearch.Client;
using OpenSearch.Client.Specification.IndicesApi;
using Tests.Core.Extensions;
using Tests.Core.ManagedOpenSearch.Clusters;
using Tests.Framework.EndpointTests;
using Tests.Framework.EndpointTests.TestState;

namespace Tests.Indices.IndexManagement.CloneIndex
{
using OpenSearch.Client.Specification.IndicesApi;

public class CloneIndexApiTests
: ApiIntegrationTestBase<WritableCluster, CloneIndexResponse, ICloneIndexRequest, CloneIndexDescriptor, CloneIndexRequest>
{
Expand Down Expand Up @@ -108,9 +109,9 @@ protected override void IntegrationSetup(IOpenSearchClient client, CallUniqueVal

protected override HttpMethod HttpMethod => HttpMethod.PUT;

protected override CloneIndexRequest Initializer => new CloneIndexRequest(CallIsolatedValue, CallIsolatedValue + CloneSuffix)
protected override CloneIndexRequest Initializer => new(CallIsolatedValue, CallIsolatedValue + CloneSuffix)
{
Settings = new OpenSearch.Client.Specification.IndicesApi.IndexSettings
Settings = new IndexSettings
{
NumberOfReplicas = 0,
NumberOfShards = 1,
Expand All @@ -137,7 +138,7 @@ protected override LazyResponses ClientUsage() => Calls(
(client, r) => client.Indices.CloneAsync(r)
);

protected override CloneIndexDescriptor NewDescriptor() => new CloneIndexDescriptor(CallIsolatedValue, CallIsolatedValue + CloneSuffix);
protected override CloneIndexDescriptor NewDescriptor() => new(CallIsolatedValue, CallIsolatedValue + CloneSuffix);

protected override void ExpectResponse(CloneIndexResponse response)
{
Expand Down
Loading

0 comments on commit 9487032

Please sign in to comment.