Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more tests for federated stitching. (#2474)
- Loading branch information
1 parent
32bfa7f
commit 0de8364
Showing
44 changed files
with
948 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/HotChocolate/Core/src/Execution/Configuration/INamedRequestExecutorFactoryOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace HotChocolate.Execution.Configuration | ||
{ | ||
/// <summary> | ||
/// Represents something that configures the <see cref="RequestExecutorFactoryOptions"/>. | ||
/// </summary> | ||
public interface INamedRequestExecutorFactoryOptions | ||
: IConfigureOptions<RequestExecutorFactoryOptions> | ||
{ | ||
/// <summary> | ||
/// The schema name to which this instance provides configurations to. | ||
/// </summary> | ||
NameString SchemaName { get; } | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/HotChocolate/Core/src/Execution/Configuration/IRequestExecutorOptionsProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace HotChocolate.Execution.Configuration | ||
{ | ||
/// <summary> | ||
/// Provides dynamic configurations. | ||
/// </summary> | ||
public interface IRequestExecutorOptionsProvider | ||
{ | ||
/// <summary> | ||
/// Gets named configuration options. | ||
/// </summary> | ||
/// <param name="cancellationToken"> | ||
/// The <see cref="CancellationToken"/>. | ||
/// </param> | ||
/// <returns> | ||
/// Returns the configuration options of this provider. | ||
/// </returns> | ||
ValueTask<IEnumerable<INamedRequestExecutorFactoryOptions>> GetOptionsAsync( | ||
CancellationToken cancellationToken); | ||
|
||
/// <summary> | ||
/// Registers a listener to be called whenever a named | ||
/// <see cref="RequestExecutorFactoryOptions"/> changes. | ||
/// </summary> | ||
/// <param name="listener"> | ||
/// The action to be invoked when <see cref="RequestExecutorFactoryOptions"/> has changed. | ||
/// </param> | ||
/// <returns> | ||
/// An <see cref="IDisposable"/> which should be disposed to stop listening for changes. | ||
/// </returns> | ||
IDisposable OnChange(Action<INamedRequestExecutorFactoryOptions> listener); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/HotChocolate/Core/src/Execution/Configuration/NamedRequestExecutorFactoryOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
|
||
namespace HotChocolate.Execution.Configuration | ||
{ | ||
public sealed class NamedRequestExecutorFactoryOptions | ||
: INamedRequestExecutorFactoryOptions | ||
{ | ||
private readonly Action<RequestExecutorFactoryOptions> _configure; | ||
|
||
public NamedRequestExecutorFactoryOptions( | ||
NameString schemaName, | ||
Action<RequestExecutorFactoryOptions> configure) | ||
{ | ||
SchemaName = schemaName.EnsureNotEmpty(nameof(schemaName)); | ||
_configure = configure ?? throw new ArgumentNullException(nameof(configure)); | ||
} | ||
|
||
/* | ||
public NamedRequestExecutorFactoryOptions( | ||
NameString schemaName, | ||
RequestExecutorFactoryOptions options) | ||
{ | ||
SchemaName = schemaName.EnsureNotEmpty(nameof(schemaName)); | ||
_configure = o => | ||
{ | ||
options.Pipeline | ||
} | ||
} | ||
*/ | ||
|
||
public NameString SchemaName { get; } | ||
|
||
public void Configure(RequestExecutorFactoryOptions options) | ||
{ | ||
if (options is null) | ||
{ | ||
throw new ArgumentNullException(nameof(options)); | ||
} | ||
|
||
_configure(options); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.