Skip to content

Commit

Permalink
Merge pull request #41 from nsip/release-19
Browse files Browse the repository at this point in the history
Enable application settings to be read from a database
  • Loading branch information
rafidzal authored Dec 29, 2020
2 parents 32258ef + 4b762ea commit dfd0285
Show file tree
Hide file tree
Showing 110 changed files with 4,564 additions and 1,983 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ AppPackages/
[Bb]in
[Oo]bj
# sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
Expand All @@ -113,5 +112,6 @@ Backup*/
UpgradeLog*.XML

# Log files
*.log
*.log.[123456789]
*.db-shm
*.db-wal
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<!--<add name="SettingsDb"
connectionString="Data Source=EntityFrameworkTest.db"
providerName="System.Data.SQLite" />-->
<add name="SettingsDb"
connectionString="Data Source=|DataDirectory|EntityFrameworkTest.db"
providerName="System.Data.SQLite" />
</connectionStrings>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
</configuration>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright 2020 Systemic Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using Sif.Framework.Settings;
using Sif.Framework.Model.Infrastructure;
using Sif.Framework.Model.Requests;
using Sif.Framework.Model.Settings;
using Tardigrade.Framework.Configurations;
using Tardigrade.Framework.EntityFramework.Configurations;
using Xunit;

namespace Sif.Framework.EntityFramework.Tests
{
public class FrameworkSettingsTest
{
private readonly IFrameworkSettings settings;

public FrameworkSettingsTest()
{
settings = new ConsumerSettings(
new ApplicationConfiguration(new AppSettingsConfigurationSource("name=SettingsDb")));
}

[Fact]
public void GetSettings_ValidSettings_Success()
{
Assert.Equal(Accept.XML, settings.Accept);
Assert.Equal("Sif3DemoConsumer", settings.ApplicationKey);
Assert.Equal("SIF_HMACSHA256", settings.AuthenticationMethod);
Assert.False(settings.CompressPayload);
Assert.Equal("DemoConsumer", settings.ConsumerName);
Assert.Equal(ContentType.XML, settings.ContentType);
Assert.Equal("http://www.sifassociation.org/datamodel/au/3.4", settings.DataModelNamespace);
Assert.False(settings.DeleteOnUnregister);
Assert.Equal(EnvironmentType.DIRECT, settings.EnvironmentType);
Assert.Equal("http://localhost:62921/api/environments/environment", settings.EnvironmentUrl);
Assert.Equal(10, settings.EventProcessingWaitTime);
Assert.Equal("http://www.sifassociation.org/infrastructure/3.2.1", settings.InfrastructureNamespace);
Assert.Null(settings.InstanceId);
Assert.True(settings.JobBinding);
Assert.Equal("any", settings.JobClasses);
Assert.True(settings.JobTimeoutEnabled);
Assert.Equal(60, settings.JobTimeoutFrequency);
Assert.Equal(5, settings.NavigationPageSize);
Assert.Equal("SecretDem0", settings.SharedSecret);
Assert.Equal("Sif3Framework", settings.SolutionId);
Assert.Equal(10, settings.StartupDelay);
Assert.Equal("3.2.1", settings.SupportedInfrastructureVersion);
Assert.Null(settings.UserToken);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Sif.Framework.EntityFramework.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sif.Framework.EntityFramework.Tests")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f4546d54-e46e-4d8d-9a8f-ffdc67c54e1d")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F4546D54-E46E-4D8D-9A8F-FFDC67C54E1D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sif.Framework.EntityFramework.Tests</RootNamespace>
<AssemblyName>Sif.Framework.EntityFramework.Tests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FrameworkSettingsTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="System.Data.SQLite">
<Version>1.0.113.7</Version>
</PackageReference>
<PackageReference Include="Tardigrade.Framework.EntityFramework">
<Version>11.1.0</Version>
</PackageReference>
<PackageReference Include="xunit">
<Version>2.4.1</Version>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio">
<Version>2.4.3</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="EntityFrameworkTest.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Sif3Framework\Sif.Framework\Sif.Framework.csproj">
<Project>{2b13d050-aa2c-45a6-ba26-8b2706b7e227}</Project>
<Name>Sif.Framework</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
37 changes: 37 additions & 0 deletions Code/Sif.Framework.Tests/Sif.Framework.Tests.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30717.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sif.Framework.EntityFramework.Tests", "Sif.Framework.EntityFramework.Tests\Sif.Framework.EntityFramework.Tests.csproj", "{F4546D54-E46E-4D8D-9A8F-FFDC67C54E1D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sif.Framework.Tests", "Sif.Framework.Tests\Sif.Framework.Tests.csproj", "{2BCC7798-CA9C-42B5-971B-4374DB30D4F6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sif.Framework", "..\Sif3Framework\Sif.Framework\Sif.Framework.csproj", "{2B13D050-AA2C-45A6-BA26-8B2706B7E227}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F4546D54-E46E-4D8D-9A8F-FFDC67C54E1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4546D54-E46E-4D8D-9A8F-FFDC67C54E1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4546D54-E46E-4D8D-9A8F-FFDC67C54E1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4546D54-E46E-4D8D-9A8F-FFDC67C54E1D}.Release|Any CPU.Build.0 = Release|Any CPU
{2BCC7798-CA9C-42B5-971B-4374DB30D4F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BCC7798-CA9C-42B5-971B-4374DB30D4F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BCC7798-CA9C-42B5-971B-4374DB30D4F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BCC7798-CA9C-42B5-971B-4374DB30D4F6}.Release|Any CPU.Build.0 = Release|Any CPU
{2B13D050-AA2C-45A6-BA26-8B2706B7E227}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B13D050-AA2C-45A6-BA26-8B2706B7E227}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B13D050-AA2C-45A6-BA26-8B2706B7E227}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B13D050-AA2C-45A6-BA26-8B2706B7E227}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F1A78DA-B94C-422F-A1A0-88D153DD81FE}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions Code/Sif.Framework.Tests/Sif.Framework.Tests/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace Sif.Framework.Tests
{
public class Class1
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

</Project>
Loading

0 comments on commit dfd0285

Please sign in to comment.