Skip to content

Commit

Permalink
Use the latest hotchocolate and strawberryshake to support geometry a…
Browse files Browse the repository at this point in the history
…gain (#1638)
  • Loading branch information
david-driscoll authored Nov 11, 2023
1 parent fd13724 commit 920b7cb
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 72 deletions.
42 changes: 21 additions & 21 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,27 @@
<PackageVersion Include="Grpc.AspNetCore" Version="2.59.0" />
<PackageVersion Include="Humanizer.Core" Version="2.14.1" />
<PackageVersion Include="Hellang.Middleware.ProblemDetails" Version="6.5.1" />
<PackageVersion Include="HotChocolate" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Abstractions" Version="13.5.1" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Data" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Diagnostics" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Execution.Abstractions" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Data.AutoMapper" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Data.EntityFramework" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Data.Spatial" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Types.Analyzers" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Types.CursorPagination" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Types.OffsetPagination" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Types.NodaTime" Version="13.5.1" />
<PackageVersion Include="HotChocolate.Types.Spatial" Version="13.5.1" />
<PackageVersion Include="StrawberryShake.Transport.Http" Version="13.5.1" />
<PackageVersion Include="StrawberryShake" Version="13.5.1" />
<PackageVersion Include="StrawberryShake.Core" Version="13.5.1" />
<PackageVersion Include="StrawberryShake.Server" Version="13.5.1" />
<PackageVersion Include="StrawberryShake.Maui" Version="13.5.1" />
<PackageVersion Include="StrawberryShake.Blazor" Version="13.5.1" />
<PackageVersion Include="StrawberryShake.Razor" Version="13.5.1" />
<PackageVersion Include="HotChocolate" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Abstractions" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Data" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Diagnostics" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Execution.Abstractions" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Data.AutoMapper" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Data.EntityFramework" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Data.Spatial" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Types.Analyzers" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Types.CursorPagination" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Types.OffsetPagination" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Types.NodaTime" Version="14.0.0-p.8" />
<PackageVersion Include="HotChocolate.Types.Spatial" Version="14.0.0-p.8" />
<PackageVersion Include="StrawberryShake.Transport.Http" Version="14.0.0-p.8" />
<PackageVersion Include="StrawberryShake" Version="14.0.0-p.8" />
<PackageVersion Include="StrawberryShake.Core" Version="14.0.0-p.8" />
<PackageVersion Include="StrawberryShake.Server" Version="14.0.0-p.8" />
<PackageVersion Include="StrawberryShake.Maui" Version="14.0.0-p.8" />
<PackageVersion Include="StrawberryShake.Blazor" Version="14.0.0-p.8" />
<PackageVersion Include="StrawberryShake.Razor" Version="14.0.0-p.8" />
<PackageVersion Include="MediatR" Version="12.1.1" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.13" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.13" />
Expand Down
6 changes: 5 additions & 1 deletion src/AspNetCore.Testing/LaunchPadExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ public virtual IHostBuilder Configure(IHostBuilder builder)
builder.ConfigureRocketSurgery(z => z.ForTesting(_testAssemblyReference, _loggerFactory));
builder.ConfigureLogging((_, loggingBuilder) => loggingBuilder.Services.AddSingleton(_loggerFactory));
builder.ConfigureServices(s => s.AddSingleton<TestServer>(z => (TestServer)z.GetRequiredService<IServer>()));
builder.ConfigureServices(s => s.AddHttpLogging(options => options.LoggingFields = HttpLoggingFields.All));
builder.ConfigureServices(s => s.AddHttpLogging(
options =>
{
options.LoggingFields = HttpLoggingFields.All;
}));

return builder;
}
Expand Down
60 changes: 59 additions & 1 deletion src/AspNetCore.Testing/LaunchPadWebAppFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,15 @@ protected virtual void Dispose(bool disposing)
class AppFixtureLoggerFactory : ILoggerFactory
{
private ILoggerFactory? _innerLoggerFactory;
private List<DeferredLogger> _deferredLoggers = new();

public void SetLoggerFactory(ILoggerFactory loggerFactory)
{
_innerLoggerFactory = loggerFactory;
foreach (var logger in _deferredLoggers)
{
logger.SetLogger(loggerFactory.CreateLogger(logger.CategoryName));
}
}

public void Dispose()
Expand All @@ -132,7 +137,60 @@ public void AddProvider(ILoggerProvider provider)

public ILogger CreateLogger(string categoryName)
{
return _innerLoggerFactory?.CreateLogger(categoryName) ?? NullLogger.Instance;
return _innerLoggerFactory?.CreateLogger(categoryName) ?? AddDeferredLogger(categoryName);
}

private DeferredLogger AddDeferredLogger(string categoryName)
{
var logger = new DeferredLogger(categoryName);
_deferredLoggers.Add(logger);
return logger;
}
}

class DeferredLogger : ILogger
{
public string CategoryName { get; }
private List<(LogLevel logLevel, EventId eventId, string text)> _deferredLogs = new();
private ILogger? _logger;

public DeferredLogger(string categoryName)
{
CategoryName = categoryName;
}

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
if (_logger is null)
{
_deferredLogs.Add((logLevel, eventId, formatter(state, exception)));
return;
}
_logger.Log(logLevel, eventId, state, exception, formatter);
}

public bool IsEnabled(LogLevel logLevel)
{
return _logger?.IsEnabled(logLevel) ?? true;
}

public IDisposable? BeginScope<TState>(TState state) where TState : notnull
{
return _logger?.BeginScope(state);
}

public void SetLogger(ILogger logger)
{
_logger = logger;
foreach (var log in _deferredLogs)
{
#pragma warning disable CA1848
#pragma warning disable CA2254
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
_logger.Log(log.logLevel, log.eventId, log.text);
#pragma warning restore CA2254
#pragma warning restore CA1848
}
}
}

Expand Down
1 change: 0 additions & 1 deletion test/Sample.Graphql.Tests/Helpers/GraphQlExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public Task Start(IAlbaHost host)

public IHostBuilder Configure(IHostBuilder builder)
{
new TemporaryGraphQlExtension().Configure(builder);
builder.ConfigureServices(
z => z
.AddW3CLogging(_ => { })
Expand Down
48 changes: 0 additions & 48 deletions test/Sample.Graphql.Tests/Helpers/TemporaryGraphQlExtension.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@ enum SortEnumType {
"The `@specifiedBy` directive is used within the type system definition language to provide a URL for specifying the behavior of custom scalar definitions."
directive @specifiedBy("The specifiedBy URL points to a human-readable specification. This field will only read a result for scalar types." url: String!) on SCALAR

"The @tag directive is used to applies arbitrary string\nmetadata to a schema location. Custom tooling can use\nthis metadata during any step of the schema delivery flow,\nincluding composition, static analysis, and documentation.\n \n\ninterface Book {\n id: ID! @tag(name: \"your-value\")\n title: String!\n author: String!\n}"
directive @tag("The name of the tag." name: String!) repeatable on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

"A coordinate is an array of positions."
scalar Coordinates

Expand Down

0 comments on commit 920b7cb

Please sign in to comment.