mirror of https://github.com/Squidex/squidex.git
committed by
GitHub
87 changed files with 513 additions and 297 deletions
@ -0,0 +1,25 @@ |
|||||
|
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
<PropertyGroup> |
||||
|
<TargetFramework>netcoreapp3.1</TargetFramework> |
||||
|
<LangVersion>8.0</LangVersion> |
||||
|
<Nullable>enable</Nullable> |
||||
|
</PropertyGroup> |
||||
|
<ItemGroup> |
||||
|
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" /> |
||||
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" /> |
||||
|
</ItemGroup> |
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\Squidex.Domain.Apps.Core.Model\Squidex.Domain.Apps.Core.Model.csproj" /> |
||||
|
<ProjectReference Include="..\Squidex.Domain.Apps.Entities.MongoDb\Squidex.Domain.Apps.Entities.MongoDb.csproj" /> |
||||
|
<ProjectReference Include="..\Squidex.Domain.Apps.Entities\Squidex.Domain.Apps.Entities.csproj" /> |
||||
|
<ProjectReference Include="..\Squidex.Domain.Apps.Events\Squidex.Domain.Apps.Events.csproj" /> |
||||
|
<ProjectReference Include="..\Squidex.Infrastructure.MongoDb\Squidex.Infrastructure.MongoDb.csproj" /> |
||||
|
<ProjectReference Include="..\Squidex.Infrastructure\Squidex.Infrastructure.csproj" /> |
||||
|
</ItemGroup> |
||||
|
<PropertyGroup> |
||||
|
<CodeAnalysisRuleSet>..\..\Squidex.ruleset</CodeAnalysisRuleSet> |
||||
|
</PropertyGroup> |
||||
|
<ItemGroup> |
||||
|
<AdditionalFiles Include="..\..\stylecop.json" Link="stylecop.json" /> |
||||
|
</ItemGroup> |
||||
|
</Project> |
||||
@ -0,0 +1,34 @@ |
|||||
|
|
||||
|
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||
|
# Visual Studio 15 |
||||
|
VisualStudioVersion = 15.0.26124.0 |
||||
|
MinimumVisualStudioVersion = 15.0.26124.0 |
||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmarks", "Benchmarks.csproj", "{976EDCCA-6E53-41E9-9279-B111ED68B79A}" |
||||
|
EndProject |
||||
|
Global |
||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
|
Debug|Any CPU = Debug|Any CPU |
||||
|
Debug|x64 = Debug|x64 |
||||
|
Debug|x86 = Debug|x86 |
||||
|
Release|Any CPU = Release|Any CPU |
||||
|
Release|x64 = Release|x64 |
||||
|
Release|x86 = Release|x86 |
||||
|
EndGlobalSection |
||||
|
GlobalSection(SolutionProperties) = preSolution |
||||
|
HideSolutionNode = FALSE |
||||
|
EndGlobalSection |
||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Debug|x64.ActiveCfg = Debug|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Debug|x64.Build.0 = Debug|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Debug|x86.Build.0 = Debug|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Release|x64.ActiveCfg = Release|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Release|x64.Build.0 = Release|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Release|x86.ActiveCfg = Release|Any CPU |
||||
|
{976EDCCA-6E53-41E9-9279-B111ED68B79A}.Release|x86.Build.0 = Release|Any CPU |
||||
|
EndGlobalSection |
||||
|
EndGlobal |
||||
@ -1,25 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|
||||
<LangVersion>8.0</LangVersion> |
|
||||
<Nullable>enable</Nullable> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" /> |
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\src\Squidex.Domain.Apps.Core.Model\Squidex.Domain.Apps.Core.Model.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Squidex.Domain.Apps.Entities.MongoDb\Squidex.Domain.Apps.Entities.MongoDb.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Squidex.Domain.Apps.Entities\Squidex.Domain.Apps.Entities.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Squidex.Domain.Apps.Events\Squidex.Domain.Apps.Events.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Squidex.Infrastructure.MongoDb\Squidex.Infrastructure.MongoDb.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Squidex.Infrastructure\Squidex.Infrastructure.csproj" /> |
|
||||
</ItemGroup> |
|
||||
<PropertyGroup> |
|
||||
<CodeAnalysisRuleSet>..\..\Squidex.ruleset</CodeAnalysisRuleSet> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<AdditionalFiles Include="..\..\stylecop.json" Link="stylecop.json" /> |
|
||||
</ItemGroup> |
|
||||
</Project> |
|
||||
@ -0,0 +1,34 @@ |
|||||
|
|
||||
|
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||
|
# Visual Studio 15 |
||||
|
VisualStudioVersion = 15.0.26124.0 |
||||
|
MinimumVisualStudioVersion = 15.0.26124.0 |
||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Migrator", "Migrator.csproj", "{94526967-6D82-4860-8220-80B8B176ABB6}" |
||||
|
EndProject |
||||
|
Global |
||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
|
Debug|Any CPU = Debug|Any CPU |
||||
|
Debug|x64 = Debug|x64 |
||||
|
Debug|x86 = Debug|x86 |
||||
|
Release|Any CPU = Release|Any CPU |
||||
|
Release|x64 = Release|x64 |
||||
|
Release|x86 = Release|x86 |
||||
|
EndGlobalSection |
||||
|
GlobalSection(SolutionProperties) = preSolution |
||||
|
HideSolutionNode = FALSE |
||||
|
EndGlobalSection |
||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Debug|x64.ActiveCfg = Debug|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Debug|x64.Build.0 = Debug|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Debug|x86.ActiveCfg = Debug|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Debug|x86.Build.0 = Debug|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Release|x64.ActiveCfg = Release|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Release|x64.Build.0 = Release|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Release|x86.ActiveCfg = Release|Any CPU |
||||
|
{94526967-6D82-4860-8220-80B8B176ABB6}.Release|x86.Build.0 = Release|Any CPU |
||||
|
EndGlobalSection |
||||
|
EndGlobal |
||||
@ -0,0 +1,100 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using Squidex.ClientLibrary; |
||||
|
using Squidex.ClientLibrary.Configuration; |
||||
|
|
||||
|
namespace TestSuite.Fixtures |
||||
|
{ |
||||
|
public static class ClientManagerFactory |
||||
|
{ |
||||
|
private static Task<SquidexClientManager> manager; |
||||
|
|
||||
|
public static Task<SquidexClientManager> CreateAsync() |
||||
|
{ |
||||
|
if (manager == null) |
||||
|
{ |
||||
|
manager = CreateInternalAsync(); |
||||
|
} |
||||
|
|
||||
|
return manager; |
||||
|
} |
||||
|
|
||||
|
private static async Task<SquidexClientManager> CreateInternalAsync() |
||||
|
{ |
||||
|
var appName = GetValue("APP__NAME", "integration-tests"); |
||||
|
var clientId = GetValue("CLIENT__ID", "root"); |
||||
|
var clientSecret = GetValue("CLIENT__SECRET", "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0="); |
||||
|
var serviceURl = GetValue("SERVER__URL", "https://localhost:5001"); |
||||
|
|
||||
|
var clientManager = new SquidexClientManager(new SquidexOptions |
||||
|
{ |
||||
|
AppName = appName, |
||||
|
ClientId = clientId, |
||||
|
ClientSecret = clientSecret, |
||||
|
ReadResponseAsString = true, |
||||
|
Configurator = AcceptAllCertificatesConfigurator.Instance, |
||||
|
Url = serviceURl |
||||
|
}); |
||||
|
|
||||
|
if (TryGetTimeout(out var waitSeconds)) |
||||
|
{ |
||||
|
Console.WriteLine("Waiting {0} seconds to access server", waitSeconds); |
||||
|
|
||||
|
var pingClient = clientManager.CreatePingClient(); |
||||
|
|
||||
|
using (var cts = new CancellationTokenSource(waitSeconds * 1000)) |
||||
|
{ |
||||
|
while (!cts.IsCancellationRequested) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
await pingClient.GetPingAsync(cts.Token); |
||||
|
|
||||
|
break; |
||||
|
} |
||||
|
catch |
||||
|
{ |
||||
|
await Task.Delay(100); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return clientManager; |
||||
|
} |
||||
|
|
||||
|
private static bool TryGetTimeout(out int timeout) |
||||
|
{ |
||||
|
var variable = Environment.GetEnvironmentVariable("CONFIG__WAIT"); |
||||
|
|
||||
|
if (!string.IsNullOrWhiteSpace(variable)) |
||||
|
{ |
||||
|
Console.WriteLine("Using: CONFIG__WAIT={0}", variable); |
||||
|
} |
||||
|
|
||||
|
return int.TryParse(variable, out timeout) && timeout > 10; |
||||
|
} |
||||
|
|
||||
|
private static string GetValue(string name, string defaultValue) |
||||
|
{ |
||||
|
var variable = Environment.GetEnvironmentVariable($"CONFIG__{name}"); |
||||
|
|
||||
|
if (!string.IsNullOrWhiteSpace(variable)) |
||||
|
{ |
||||
|
Console.WriteLine("Using: {0}={1}", name, variable); |
||||
|
|
||||
|
return variable; |
||||
|
} |
||||
|
|
||||
|
return defaultValue; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue