Skip to content
Draft
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
2 changes: 0 additions & 2 deletions example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ services:
- Semantics__SubmodelElementIndexContextPrefix=_aastwinengineindex_
- Semantics__InternalSemanticId=InternalSemanticId
- AasxOptions__RootFolder=aasx
- AasRegistryPreComputed__ShellDescriptorCron=0 */3 * * * *
- AasRegistryPreComputed__IsPreComputed=false
- MultiPluginConflictOption__HandlingMode=TakeFirst
- PluginConfig__Plugins__0__PluginName=Plugin1
- PluginConfig__Plugins__0__PluginUrl=http://dpp-plugin:8080
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using AAS.TwinEngine.DataEngine.ServiceConfiguration;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

using NSubstitute;

namespace AAS.TwinEngine.DataEngine.UnitTests.ServiceConfiguration;

public class ConfigurationWarningLoggerTests
{
[Fact]
public void LogDeprecatedSections_ShouldLogWarning_WhenPreComputedSectionExists()
{
// Arrange
var configuration = new ConfigurationBuilder()
.AddInMemoryCollection(new Dictionary<string, string?>
{
[$"{ConfigurationWarningLogger.PreComputedSection}:ShellDescriptorCron"] = "0 */3 * * * *"
})
.Build();
var logger = Substitute.For<ILogger>();

// Act
ConfigurationWarningLogger.LogDeprecatedSections(configuration, logger);

// Assert
logger.Received().Log(
LogLevel.Warning,
Arg.Any<EventId>(),
Arg.Is<object>(state => state.ToString()!.Contains(ConfigurationWarningLogger.PreComputedSection)),
Arg.Any<Exception>(),
Arg.Any<Func<object, Exception?, string>>());
}

[Fact]
public void LogDeprecatedSections_ShouldNotLogWarning_WhenPreComputedSectionIsMissing()
{
// Arrange
var configuration = new ConfigurationBuilder().Build();
var logger = Substitute.For<ILogger>();

// Act
ConfigurationWarningLogger.LogDeprecatedSections(configuration, logger);

// Assert
logger.DidNotReceive().Log(
LogLevel.Warning,
Arg.Any<EventId>(),
Arg.Any<object>(),
Arg.Any<Exception>(),
Arg.Any<Func<object, Exception?, string>>());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<PackageReference Include="AasCore.Aas3.Package" Version="1.0.2" />
<PackageReference Include="AasCore.Aas3_0" Version="1.0.4" />
<PackageReference Include="Asp.Versioning.Mvc" Version="8.1.0" />
<PackageReference Include="Cronos" Version="0.11.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.7" />
<PackageReference Include="MongoDB.Driver" Version="3.4.0" />
<PackageReference Include="NSwag.AspNetCore" Version="14.4.0" />
Expand Down

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions source/AAS.TwinEngine.DataEngine/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public static async Task Main(string[] args)

var app = builder.Build();

ConfigurationWarningLogger.LogDeprecatedSections(app.Configuration, app.Logger);

_ = app.MapHealthChecks("/healthz");

using (var scope = app.Services.CreateScope())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace AAS.TwinEngine.DataEngine.ServiceConfiguration;

public static class ConfigurationWarningLogger
{
public const string PreComputedSection = "AasRegistryPreComputed";

public static void LogDeprecatedSections(IConfiguration configuration, ILogger logger)
{
if (!configuration.GetSection(PreComputedSection).Exists())
{
return;
}

logger.LogWarning(
"Detected deprecated configuration section '{SectionName}'. The precomputed flow has been removed and this section is ignored. Please remove it from your configuration.",
PreComputedSection);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using AAS.TwinEngine.DataEngine.Infrastructure.Http.Config;
using AAS.TwinEngine.DataEngine.Infrastructure.Http.Extensions;
using AAS.TwinEngine.DataEngine.Infrastructure.Monitoring;
using AAS.TwinEngine.DataEngine.Infrastructure.Providers.AasRegistryProvider.Config;
using AAS.TwinEngine.DataEngine.Infrastructure.Providers.AasRegistryProvider.Services;
using AAS.TwinEngine.DataEngine.Infrastructure.Providers.PluginDataProvider.Config;
using AAS.TwinEngine.DataEngine.Infrastructure.Providers.PluginDataProvider.Helper;
Expand Down Expand Up @@ -61,9 +60,7 @@ public static void ConfigureInfrastructure(this IServiceCollection services, ICo
_ = services.Configure<HttpRetryPolicyOptions>(HttpRetryPolicyOptions.TemplateProvider, configuration.GetSection($"{HttpRetryPolicyOptions.Section}:{HttpRetryPolicyOptions.TemplateProvider}"));
_ = services.Configure<HttpRetryPolicyOptions>(HttpRetryPolicyOptions.SubmodelDescriptorProvider, configuration.GetSection($"{HttpRetryPolicyOptions.Section}:{HttpRetryPolicyOptions.SubmodelDescriptorProvider}"));
_ = services.Configure<HttpRetryPolicyOptions>(configuration.GetSection(HttpRetryPolicyOptions.Section));
_ = services.Configure<AasRegistryPreComputed>(configuration.GetSection(AasRegistryPreComputed.Section));
_ = services.Configure<MultiPluginConflictOptions>(configuration.GetSection(MultiPluginConflictOptions.Section));
_ = services.AddSingleton<IPluginManifestHealthStatus, PluginManifestHealthStatus>();
_ = services.AddHostedService<ShellDescriptorSyncHosted>();
}
}
4 changes: 0 additions & 4 deletions source/AAS.TwinEngine.DataEngine/appsettings.development.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
"AasxExportOptions": {
"RootFolder": "aasx"
},
"AasRegistryPreComputed": {
"ShellDescriptorCron": "0 */3 * * * *",
"IsPreComputed": true
},
"TemplateMappingRules": {
"SubmodelTemplateMappings": [
{
Expand Down
4 changes: 0 additions & 4 deletions source/AAS.TwinEngine.DataEngine/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
"AasxExportOptions": {
"RootFolder": "aasx"
},
"AasRegistryPreComputed": {
"ShellDescriptorCron": "0 */3 * * * *",
"IsPreComputed": false
},
"TemplateMappingRules": {
"SubmodelTemplateMappings": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ services:
- Semantics__SubmodelElementIndexContextPrefix=_aastwinengineindex_
- Semantics__InternalSemanticId=InternalSemanticId
- AasxOptions__RootFolder=aasx
- AasRegistryPreComputed__ShellDescriptorCron=0 */3 * * * *
- AasRegistryPreComputed__IsPreComputed=false
- MultiPluginConflictOption__HandlingMode=TakeFirst
- PluginConfig__Plugins__0__PluginName=Plugin
- PluginConfig__Plugins__0__PluginUrl=http://twinengine-plugin:8080
Expand Down
Loading