Browse Source

Integration tests (#522)

* Integration tests

* Build improvements
pull/523/head
Sebastian Stehle 6 years ago
committed by GitHub
parent
commit
f3f37bfae8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 110
      .drone.yml
  2. 27
      Dockerfile
  3. 58
      backend/Squidex.sln
  4. 2
      backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs
  5. 6
      backend/src/Migrations/MigrationPath.cs
  6. 25
      backend/src/Migrations/Migrations.csproj
  7. 2
      backend/src/Migrations/Migrations/AddPatterns.cs
  8. 2
      backend/src/Migrations/Migrations/ClearSchemas.cs
  9. 2
      backend/src/Migrations/Migrations/ConvertEventStore.cs
  10. 2
      backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs
  11. 2
      backend/src/Migrations/Migrations/CreateAssetSlugs.cs
  12. 2
      backend/src/Migrations/Migrations/MongoDb/ConvertOldSnapshotStores.cs
  13. 2
      backend/src/Migrations/Migrations/MongoDb/ConvertRuleEventsJson.cs
  14. 2
      backend/src/Migrations/Migrations/MongoDb/DeleteContentCollections.cs
  15. 2
      backend/src/Migrations/Migrations/MongoDb/RenameAssetMetadata.cs
  16. 2
      backend/src/Migrations/Migrations/MongoDb/RenameAssetSlugField.cs
  17. 2
      backend/src/Migrations/Migrations/MongoDb/RestructureContentCollection.cs
  18. 2
      backend/src/Migrations/Migrations/PopulateGrainIndexes.cs
  19. 2
      backend/src/Migrations/Migrations/RebuildApps.cs
  20. 2
      backend/src/Migrations/Migrations/RebuildAssets.cs
  21. 2
      backend/src/Migrations/Migrations/RebuildContents.cs
  22. 2
      backend/src/Migrations/Migrations/RebuildSnapshots.cs
  23. 2
      backend/src/Migrations/Migrations/StartEventConsumers.cs
  24. 2
      backend/src/Migrations/Migrations/StopEventConsumers.cs
  25. 2
      backend/src/Migrations/OldEvents/AppClientChanged.cs
  26. 2
      backend/src/Migrations/OldEvents/AppClientPermission.cs
  27. 2
      backend/src/Migrations/OldEvents/AppClientUpdated.cs
  28. 2
      backend/src/Migrations/OldEvents/AppContributorAssigned.cs
  29. 2
      backend/src/Migrations/OldEvents/AppContributorPermission.cs
  30. 2
      backend/src/Migrations/OldEvents/AppPlanChanged.cs
  31. 2
      backend/src/Migrations/OldEvents/AppWorkflowConfigured.cs
  32. 2
      backend/src/Migrations/OldEvents/AssetCreated.cs
  33. 2
      backend/src/Migrations/OldEvents/AssetRenamed.cs
  34. 2
      backend/src/Migrations/OldEvents/AssetTagged.cs
  35. 2
      backend/src/Migrations/OldEvents/AssetUpdated.cs
  36. 2
      backend/src/Migrations/OldEvents/ContentArchived.cs
  37. 2
      backend/src/Migrations/OldEvents/ContentChangesDiscarded.cs
  38. 2
      backend/src/Migrations/OldEvents/ContentChangesPublished.cs
  39. 2
      backend/src/Migrations/OldEvents/ContentCreated.cs
  40. 2
      backend/src/Migrations/OldEvents/ContentPublished.cs
  41. 2
      backend/src/Migrations/OldEvents/ContentRestored.cs
  42. 2
      backend/src/Migrations/OldEvents/ContentStatusChanged.cs
  43. 2
      backend/src/Migrations/OldEvents/ContentUnpublished.cs
  44. 2
      backend/src/Migrations/OldEvents/ContentUpdateProposed.cs
  45. 2
      backend/src/Migrations/OldEvents/NoopConventEvent.cs
  46. 0
      backend/src/Migrations/OldEvents/NoopEvent.cs
  47. 2
      backend/src/Migrations/OldEvents/SchemaCreated.cs
  48. 2
      backend/src/Migrations/OldEvents/ScriptsConfigured.cs
  49. 2
      backend/src/Migrations/OldEvents/WebhookAdded.cs
  50. 2
      backend/src/Migrations/OldEvents/WebhookDeleted.cs
  51. 2
      backend/src/Migrations/OldTriggers/AssetChangedTrigger.cs
  52. 2
      backend/src/Migrations/OldTriggers/ContentChangedTrigger.cs
  53. 2
      backend/src/Migrations/OldTriggers/ContentChangedTriggerSchema.cs
  54. 2
      backend/src/Migrations/RebuildOptions.cs
  55. 4
      backend/src/Migrations/RebuildRunner.cs
  56. 2
      backend/src/Migrations/RebuilderExtensions.cs
  57. 2
      backend/src/Migrations/SquidexMigrations.cs
  58. 19
      backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InviteUserCommandMiddleware.cs
  59. 13
      backend/src/Squidex.Domain.Users/DefaultUserResolver.cs
  60. 4
      backend/src/Squidex/Config/Domain/MigrationServices.cs
  61. 2
      backend/src/Squidex/Config/Domain/SerializationServices.cs
  62. 2
      backend/src/Squidex/Config/Domain/StoreServices.cs
  63. 2
      backend/src/Squidex/Config/Startup/MigrationRebuilderHost.cs
  64. 4
      backend/src/Squidex/Squidex.csproj
  65. 4
      backend/src/Squidex/appsettings.json
  66. 4
      backend/tests/Squidex.Web.Tests/Squidex.Web.Tests.csproj
  67. 24
      backend/tests/docker-compose.yml
  68. 34
      backend/tools/Benchmarks/Benchmarks.sln
  69. 25
      backend/tools/Migrate_01/Migrate_01.csproj
  70. 0
      backend/tools/Migrator/Migrator.csproj
  71. 34
      backend/tools/Migrator/Migrator.sln
  72. 2
      backend/tools/Migrator/Program.cs
  73. 19
      backend/tools/TestSuite/TestSuite.ApiTests/AppTests.cs
  74. 3
      backend/tools/TestSuite/TestSuite.ApiTests/AssetTests.cs
  75. 1
      backend/tools/TestSuite/TestSuite.ApiTests/BackupTests.cs
  76. 2
      backend/tools/TestSuite/TestSuite.ApiTests/CDNTests.cs
  77. 6
      backend/tools/TestSuite/TestSuite.ApiTests/ContentCleanupTests.cs
  78. 1
      backend/tools/TestSuite/TestSuite.ApiTests/GraphQLTests.cs
  79. 2
      backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj
  80. 2
      backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj
  81. 29
      backend/tools/TestSuite/TestSuite.Shared/Fixtures/ClientFixture.cs
  82. 100
      backend/tools/TestSuite/TestSuite.Shared/Fixtures/ClientManagerFactory.cs
  83. 62
      backend/tools/TestSuite/TestSuite.Shared/Fixtures/ClientManagerFixture.cs
  84. 8
      backend/tools/TestSuite/TestSuite.Shared/Fixtures/ContentFixture.cs
  85. 11
      backend/tools/TestSuite/TestSuite.Shared/Fixtures/ContentReferencesFixture.cs
  86. 7
      backend/tools/TestSuite/TestSuite.Shared/Fixtures/CreatedAppFixture.cs
  87. 2
      backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj

110
.drone.yml

@ -3,10 +3,10 @@ kind: pipeline
name: default name: default
steps: steps:
- name: test_pull_request - name: build_release
image: docker image: docker
commands: commands:
- docker build -t squidex/squidex:test_pull_request . - docker build -t squidex --build-arg SQUIDEX__VERSION=4.0.0-dev-$${DRONE_BUILD_NUMBER} .
volumes: volumes:
- name: docker1 - name: docker1
path: /var/run/docker.sock path: /var/run/docker.sock
@ -14,13 +14,82 @@ steps:
path: /var/lib/docker path: /var/lib/docker
when: when:
event: event:
- push
- pull_request - pull_request
branch:
- master
- name: build_dev - name: build_dev
image: docker
commands:
- docker build -t squidex --build-arg SQUIDEX__VERSION=$${DRONE_TAG} .
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
event:
- tag
- name: test_start
image: docker/compose
commands:
- cd backend/tests
- docker-compose up -d
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
event:
- push
- pull_request
branch:
- master
- name: test_run
image: mcr.microsoft.com/dotnet/core/sdk:3.1-buster
environment:
CONFIG__SERVER__URL: http://localhost:8080
CONFIG__WAIT: 60
commands:
- dotnet test backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj --filter Category!=NotAutomated
network_mode: host
when:
event:
- push
- pull_request
branch:
- master
- name: test_cleanup
image: docker/compose
commands:
- cd backend/tests
- docker-compose down
volumes:
- name: docker1
path: /var/run/docker.sock
- name: docker2
path: /var/lib/docker
when:
status:
- failure
- success
event:
- push
- pull_request
branch:
- master
- name: push_dev
image: docker image: docker
commands: commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker build -t squidex/squidex:dev -t squidex/squidex:dev-$${DRONE_BUILD_NUMBER} --build-arg SQUIDEX__VERSION=4.0.0-dev-$${DRONE_BUILD_NUMBER} . - docker tag sq squidex/squidex:dev
- docker tag sq squidex/squidex:dev-$${DRONE_BUILD_NUMBER}
- docker push squidex/squidex:dev - docker push squidex/squidex:dev
- docker push squidex/squidex:dev-$${DRONE_BUILD_NUMBER} - docker push squidex/squidex:dev-$${DRONE_BUILD_NUMBER}
volumes: volumes:
@ -39,11 +108,12 @@ steps:
branch: branch:
- master - master
- name: build_release - name: push_release
image: docker image: docker
commands: commands:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker build -t squidex/squidex:latest -t squidex/squidex:$${DRONE_TAG} --build-arg SQUIDEX__VERSION=$${DRONE_TAG} . - docker tag sq squidex/squidex:latest
- docker tag sq squidex/squidex:$${DRONE_TAG}
- docker push squidex/squidex:latest - docker push squidex/squidex:latest
- docker push squidex/squidex:$${DRONE_TAG} - docker push squidex/squidex:$${DRONE_TAG}
volumes: volumes:
@ -63,9 +133,8 @@ steps:
- name: build_binaries - name: build_binaries
image: docker image: docker
commands: commands:
- docker build -t squidex-build-image --build-arg SQUIDEX__VERSION=$${DRONE_TAG} . - docker create --name squidex-container squidex
- docker create --name squidex-build-container squidex-build-image - docker cp squidex-container:/app/. /build
- docker cp squidex-build-container:/app/. /build
volumes: volumes:
- name: build - name: build
path: /build path: /build
@ -104,21 +173,10 @@ steps:
event: event:
- tag - tag
- name: slack - name: binaries_cleanup
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
when:
status:
- failure
- success
- name: cleanup-build
image: docker image: docker
commands: commands:
- docker rm squidex-build-container - docker rm squidex-container
- docker rmi squidex-build-image
volumes: volumes:
- name: docker1 - name: docker1
path: /var/run/docker.sock path: /var/run/docker.sock
@ -131,6 +189,16 @@ steps:
event: event:
- tag - tag
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
when:
status:
- failure
- success
volumes: volumes:
- name: build - name: build
temp: {} temp: {}

27
Dockerfile

@ -8,24 +8,29 @@ ARG SQUIDEX__VERSION=4.0.0
WORKDIR /src WORKDIR /src
# Copy nuget project files. # Copy nuget project files.
COPY backend/**/**/*.csproj /tmp/ COPY backend/*.sln backend/NuGet.Config ./
# Copy nuget.config for package sources.
COPY backend/NuGet.Config /tmp/
# Install nuget packages # Copy the main source project files
RUN bash -c 'pushd /tmp; for p in *.csproj; do dotnet restore $p --verbosity quiet; true; done; popd' COPY backend/src/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p src/${file%.*}/ && mv $file src/${file%.*}/; done
# Copy the test project files
COPY backend/tests/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p tests/${file%.*}/ && mv $file tests/${file%.*}/; done
# Copy the extension project files
COPY backend/extensions/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p extensions/${file%.*}/ && mv $file extensions/${file%.*}/; done
RUN dotnet restore
COPY backend . COPY backend .
# Test Backend # Test Backend
RUN dotnet test tests/Squidex.Infrastructure.Tests/Squidex.Infrastructure.Tests.csproj --filter Category!=Dependencies \ RUN dotnet test --no-restore --filter Category!=Dependencies
&& dotnet test tests/Squidex.Domain.Apps.Core.Tests/Squidex.Domain.Apps.Core.Tests.csproj --filter Category!=Dependencies \
&& dotnet test tests/Squidex.Domain.Apps.Entities.Tests/Squidex.Domain.Apps.Entities.Tests.csproj --filter Category!=Dependencies \
&& dotnet test tests/Squidex.Domain.Users.Tests/Squidex.Domain.Users.Tests.csproj --filter Category!=Dependencies \
&& dotnet test tests/Squidex.Web.Tests/Squidex.Web.Tests.csproj --filter Category!=Dependencies
# Publish # Publish
RUN dotnet publish src/Squidex/Squidex.csproj --output /build/ --configuration Release -p:version=$SQUIDEX__VERSION RUN dotnet publish --no-restore src/Squidex/Squidex.csproj --output /build/ --configuration Release -p:version=$SQUIDEX__VERSION
# #

58
backend/Squidex.sln

@ -24,8 +24,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Infrastructure.Goog
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{94207AA6-4923-4183-A558-E0F8196B8CA3}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{94207AA6-4923-4183-A558-E0F8196B8CA3}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migrate_00", "tools\Migrate_00\Migrate_00.csproj", "{B51126A8-0D75-4A79-867D-10724EC6AC84}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Shared", "src\Squidex.Shared\Squidex.Shared.csproj", "{5E75AB7D-6F01-4313-AFF1-7F7128FFD71F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Shared", "src\Squidex.Shared\Squidex.Shared.csproj", "{5E75AB7D-6F01-4313-AFF1-7F7128FFD71F}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Domain.Users", "src\Squidex.Domain.Users\Squidex.Domain.Users.csproj", "{F7771E22-47BD-45C4-A133-FD7F1DE27CA0}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Domain.Users", "src\Squidex.Domain.Users\Squidex.Domain.Users.csproj", "{F7771E22-47BD-45C4-A133-FD7F1DE27CA0}"
@ -53,8 +51,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Domain.Apps.Entitie
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Domain.Apps.Entities.MongoDb", "src\Squidex.Domain.Apps.Entities.MongoDb\Squidex.Domain.Apps.Entities.MongoDb.csproj", "{7DA5B308-D950-4496-93D5-21D6C4D91644}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Domain.Apps.Entities.MongoDb", "src\Squidex.Domain.Apps.Entities.MongoDb\Squidex.Domain.Apps.Entities.MongoDb.csproj", "{7DA5B308-D950-4496-93D5-21D6C4D91644}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migrate_01", "tools\Migrate_01\Migrate_01.csproj", "{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Web.Tests", "tests\Squidex.Web.Tests\Squidex.Web.Tests.csproj", "{7E8CC864-4C6E-496F-A672-9F9AD8874835}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Web.Tests", "tests\Squidex.Web.Tests\Squidex.Web.Tests.csproj", "{7E8CC864-4C6E-496F-A672-9F9AD8874835}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "extensions", "extensions", "{FB8BC3A2-2010-4C3C-A87D-D4A98C05EE52}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "extensions", "extensions", "{FB8BC3A2-2010-4C3C-A87D-D4A98C05EE52}"
@ -67,7 +63,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Web", "src\Squidex.
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Infrastructure.Amazon", "src\Squidex.Infrastructure.Amazon\Squidex.Infrastructure.Amazon.csproj", "{32DA4B56-7EFA-4E34-A29D-30E00579A894}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Squidex.Infrastructure.Amazon", "src\Squidex.Infrastructure.Amazon\Squidex.Infrastructure.Amazon.csproj", "{32DA4B56-7EFA-4E34-A29D-30E00579A894}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "tools\Benchmarks\Benchmarks.csproj", "{F36EF843-BDDD-45A8-B9C6-360001161AAA}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Migrations", "src\Migrations\Migrations.csproj", "{23615A39-F3FB-4575-A91C-535899DFB636}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -151,18 +147,6 @@ Global
{945871B1-77B8-43FB-B53C-27CF385AB756}.Release|x64.Build.0 = Release|Any CPU {945871B1-77B8-43FB-B53C-27CF385AB756}.Release|x64.Build.0 = Release|Any CPU
{945871B1-77B8-43FB-B53C-27CF385AB756}.Release|x86.ActiveCfg = Release|Any CPU {945871B1-77B8-43FB-B53C-27CF385AB756}.Release|x86.ActiveCfg = Release|Any CPU
{945871B1-77B8-43FB-B53C-27CF385AB756}.Release|x86.Build.0 = Release|Any CPU {945871B1-77B8-43FB-B53C-27CF385AB756}.Release|x86.Build.0 = Release|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Debug|x64.ActiveCfg = Debug|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Debug|x64.Build.0 = Debug|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Debug|x86.ActiveCfg = Debug|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Debug|x86.Build.0 = Debug|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Release|Any CPU.Build.0 = Release|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Release|x64.ActiveCfg = Release|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Release|x64.Build.0 = Release|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Release|x86.ActiveCfg = Release|Any CPU
{B51126A8-0D75-4A79-867D-10724EC6AC84}.Release|x86.Build.0 = Release|Any CPU
{5E75AB7D-6F01-4313-AFF1-7F7128FFD71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E75AB7D-6F01-4313-AFF1-7F7128FFD71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E75AB7D-6F01-4313-AFF1-7F7128FFD71F}.Debug|Any CPU.Build.0 = Debug|Any CPU {5E75AB7D-6F01-4313-AFF1-7F7128FFD71F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E75AB7D-6F01-4313-AFF1-7F7128FFD71F}.Debug|x64.ActiveCfg = Debug|Any CPU {5E75AB7D-6F01-4313-AFF1-7F7128FFD71F}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -295,18 +279,6 @@ Global
{7DA5B308-D950-4496-93D5-21D6C4D91644}.Release|x64.Build.0 = Release|Any CPU {7DA5B308-D950-4496-93D5-21D6C4D91644}.Release|x64.Build.0 = Release|Any CPU
{7DA5B308-D950-4496-93D5-21D6C4D91644}.Release|x86.ActiveCfg = Release|Any CPU {7DA5B308-D950-4496-93D5-21D6C4D91644}.Release|x86.ActiveCfg = Release|Any CPU
{7DA5B308-D950-4496-93D5-21D6C4D91644}.Release|x86.Build.0 = Release|Any CPU {7DA5B308-D950-4496-93D5-21D6C4D91644}.Release|x86.Build.0 = Release|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Debug|x64.ActiveCfg = Debug|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Debug|x64.Build.0 = Debug|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Debug|x86.ActiveCfg = Debug|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Debug|x86.Build.0 = Debug|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Release|Any CPU.Build.0 = Release|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Release|x64.ActiveCfg = Release|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Release|x64.Build.0 = Release|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Release|x86.ActiveCfg = Release|Any CPU
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7}.Release|x86.Build.0 = Release|Any CPU
{7E8CC864-4C6E-496F-A672-9F9AD8874835}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7E8CC864-4C6E-496F-A672-9F9AD8874835}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E8CC864-4C6E-496F-A672-9F9AD8874835}.Debug|Any CPU.Build.0 = Debug|Any CPU {7E8CC864-4C6E-496F-A672-9F9AD8874835}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E8CC864-4C6E-496F-A672-9F9AD8874835}.Debug|x64.ActiveCfg = Debug|Any CPU {7E8CC864-4C6E-496F-A672-9F9AD8874835}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -355,18 +327,18 @@ Global
{32DA4B56-7EFA-4E34-A29D-30E00579A894}.Release|x64.Build.0 = Release|Any CPU {32DA4B56-7EFA-4E34-A29D-30E00579A894}.Release|x64.Build.0 = Release|Any CPU
{32DA4B56-7EFA-4E34-A29D-30E00579A894}.Release|x86.ActiveCfg = Release|Any CPU {32DA4B56-7EFA-4E34-A29D-30E00579A894}.Release|x86.ActiveCfg = Release|Any CPU
{32DA4B56-7EFA-4E34-A29D-30E00579A894}.Release|x86.Build.0 = Release|Any CPU {32DA4B56-7EFA-4E34-A29D-30E00579A894}.Release|x86.Build.0 = Release|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Debug|Any CPU.Build.0 = Debug|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Debug|x64.ActiveCfg = Debug|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Debug|x64.ActiveCfg = Debug|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Debug|x64.Build.0 = Debug|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Debug|x64.Build.0 = Debug|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Debug|x86.ActiveCfg = Debug|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Debug|x86.ActiveCfg = Debug|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Debug|x86.Build.0 = Debug|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Debug|x86.Build.0 = Debug|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Release|Any CPU.ActiveCfg = Release|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Release|Any CPU.Build.0 = Release|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Release|Any CPU.Build.0 = Release|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Release|x64.ActiveCfg = Release|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Release|x64.ActiveCfg = Release|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Release|x64.Build.0 = Release|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Release|x64.Build.0 = Release|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Release|x86.ActiveCfg = Release|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Release|x86.ActiveCfg = Release|Any CPU
{F36EF843-BDDD-45A8-B9C6-360001161AAA}.Release|x86.Build.0 = Release|Any CPU {23615A39-F3FB-4575-A91C-535899DFB636}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -379,7 +351,6 @@ Global
{6A811927-3C37-430A-90F4-503E37123956} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF} {6A811927-3C37-430A-90F4-503E37123956} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF}
{C1E5BBB6-6B6A-4DE5-B19D-0538304DE343} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF} {C1E5BBB6-6B6A-4DE5-B19D-0538304DE343} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF}
{945871B1-77B8-43FB-B53C-27CF385AB756} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF} {945871B1-77B8-43FB-B53C-27CF385AB756} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF}
{B51126A8-0D75-4A79-867D-10724EC6AC84} = {94207AA6-4923-4183-A558-E0F8196B8CA3}
{5E75AB7D-6F01-4313-AFF1-7F7128FFD71F} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A} {5E75AB7D-6F01-4313-AFF1-7F7128FFD71F} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A}
{F7771E22-47BD-45C4-A133-FD7F1DE27CA0} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A} {F7771E22-47BD-45C4-A133-FD7F1DE27CA0} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A}
{27CF800D-890F-4882-BF05-44EC3233537D} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A} {27CF800D-890F-4882-BF05-44EC3233537D} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A}
@ -391,12 +362,11 @@ Global
{79FEF326-CA5E-4698-B2BA-C16A4580B4D5} = {4C6B06C2-6D77-4E0E-AE32-D7050236433A} {79FEF326-CA5E-4698-B2BA-C16A4580B4D5} = {4C6B06C2-6D77-4E0E-AE32-D7050236433A}
{AA003372-CD8D-4DBC-962C-F61E0C93CF05} = {4C6B06C2-6D77-4E0E-AE32-D7050236433A} {AA003372-CD8D-4DBC-962C-F61E0C93CF05} = {4C6B06C2-6D77-4E0E-AE32-D7050236433A}
{7DA5B308-D950-4496-93D5-21D6C4D91644} = {4C6B06C2-6D77-4E0E-AE32-D7050236433A} {7DA5B308-D950-4496-93D5-21D6C4D91644} = {4C6B06C2-6D77-4E0E-AE32-D7050236433A}
{A4823E14-C0E5-4A4D-B28F-27424C25C3C7} = {94207AA6-4923-4183-A558-E0F8196B8CA3}
{7E8CC864-4C6E-496F-A672-9F9AD8874835} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A} {7E8CC864-4C6E-496F-A672-9F9AD8874835} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A}
{F3C41B82-6A67-409A-B7FE-54543EE4F38B} = {FB8BC3A2-2010-4C3C-A87D-D4A98C05EE52} {F3C41B82-6A67-409A-B7FE-54543EE4F38B} = {FB8BC3A2-2010-4C3C-A87D-D4A98C05EE52}
{5B2D251F-46E3-486A-AE16-E3FE06B559ED} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A} {5B2D251F-46E3-486A-AE16-E3FE06B559ED} = {7EDE8CF1-B1E4-4005-B154-834B944E0D7A}
{32DA4B56-7EFA-4E34-A29D-30E00579A894} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF} {32DA4B56-7EFA-4E34-A29D-30E00579A894} = {8CF53B92-5EB1-461D-98F8-70DA9B603FBF}
{F36EF843-BDDD-45A8-B9C6-360001161AAA} = {94207AA6-4923-4183-A558-E0F8196B8CA3} {23615A39-F3FB-4575-A91C-535899DFB636} = {94207AA6-4923-4183-A558-E0F8196B8CA3}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {02F2E872-3141-44F5-BD6A-33CD84E9FE08} SolutionGuid = {02F2E872-3141-44F5-BD6A-33CD84E9FE08}

2
backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookAction.cs

@ -31,7 +31,7 @@ namespace Squidex.Extensions.Actions.Webhook
[DataType(DataType.Text)] [DataType(DataType.Text)]
public string SharedSecret { get; set; } public string SharedSecret { get; set; }
[Display(Name = "Payload (Optional)", Description = "Leave it empty to use the full event as payload.")] [Display(Name = "Payload (Optional)", Description = "Leave it empty to use the full event as body.")]
[DataType(DataType.MultilineText)] [DataType(DataType.MultilineText)]
[Formattable] [Formattable]
public string Payload { get; set; } public string Payload { get; set; }

6
backend/tools/Migrate_01/MigrationPath.cs → backend/src/Migrations/MigrationPath.cs

@ -9,12 +9,12 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Migrate_01.Migrations; using Migrations.Migrations;
using Migrate_01.Migrations.MongoDb; using Migrations.Migrations.MongoDb;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01 namespace Migrations
{ {
public sealed class MigrationPath : IMigrationPath public sealed class MigrationPath : IMigrationPath
{ {

25
backend/src/Migrations/Migrations.csproj

@ -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>

2
backend/tools/Migrate_01/Migrations/AddPatterns.cs → backend/src/Migrations/Migrations/AddPatterns.cs

@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Entities.Apps.Indexes;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class AddPatterns : IMigration public sealed class AddPatterns : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/ClearSchemas.cs → backend/src/Migrations/Migrations/ClearSchemas.cs

@ -11,7 +11,7 @@ using Squidex.Domain.Apps.Entities.Schemas.State;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.States; using Squidex.Infrastructure.States;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class ClearSchemas : IMigration public sealed class ClearSchemas : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/ConvertEventStore.cs → backend/src/Migrations/Migrations/ConvertEventStore.cs

@ -13,7 +13,7 @@ using Newtonsoft.Json.Linq;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class ConvertEventStore : IMigration public sealed class ConvertEventStore : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/ConvertEventStoreAppId.cs → backend/src/Migrations/Migrations/ConvertEventStoreAppId.cs

@ -16,7 +16,7 @@ using Squidex.Infrastructure;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class ConvertEventStoreAppId : IMigration public sealed class ConvertEventStoreAppId : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/CreateAssetSlugs.cs → backend/src/Migrations/Migrations/CreateAssetSlugs.cs

@ -12,7 +12,7 @@ using Squidex.Domain.Apps.Entities.Assets.State;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.States; using Squidex.Infrastructure.States;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class CreateAssetSlugs : IMigration public sealed class CreateAssetSlugs : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/MongoDb/ConvertOldSnapshotStores.cs → backend/src/Migrations/Migrations/MongoDb/ConvertOldSnapshotStores.cs

@ -11,7 +11,7 @@ using MongoDB.Bson;
using MongoDB.Driver; using MongoDB.Driver;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations.MongoDb namespace Migrations.Migrations.MongoDb
{ {
public sealed class ConvertOldSnapshotStores : IMigration public sealed class ConvertOldSnapshotStores : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/MongoDb/ConvertRuleEventsJson.cs → backend/src/Migrations/Migrations/MongoDb/ConvertRuleEventsJson.cs

@ -10,7 +10,7 @@ using MongoDB.Bson;
using MongoDB.Driver; using MongoDB.Driver;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations.MongoDb namespace Migrations.Migrations.MongoDb
{ {
public sealed class ConvertRuleEventsJson : IMigration public sealed class ConvertRuleEventsJson : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/MongoDb/DeleteContentCollections.cs → backend/src/Migrations/Migrations/MongoDb/DeleteContentCollections.cs

@ -9,7 +9,7 @@ using System.Threading.Tasks;
using MongoDB.Driver; using MongoDB.Driver;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations.MongoDb namespace Migrations.Migrations.MongoDb
{ {
public sealed class DeleteContentCollections : IMigration public sealed class DeleteContentCollections : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/MongoDb/RenameAssetMetadata.cs → backend/src/Migrations/Migrations/MongoDb/RenameAssetMetadata.cs

@ -10,7 +10,7 @@ using MongoDB.Bson;
using MongoDB.Driver; using MongoDB.Driver;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations.MongoDb namespace Migrations.Migrations.MongoDb
{ {
public sealed class RenameAssetMetadata : IMigration public sealed class RenameAssetMetadata : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/MongoDb/RenameAssetSlugField.cs → backend/src/Migrations/Migrations/MongoDb/RenameAssetSlugField.cs

@ -10,7 +10,7 @@ using MongoDB.Bson;
using MongoDB.Driver; using MongoDB.Driver;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations.MongoDb namespace Migrations.Migrations.MongoDb
{ {
public sealed class RenameAssetSlugField : IMigration public sealed class RenameAssetSlugField : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/MongoDb/RestructureContentCollection.cs → backend/src/Migrations/Migrations/MongoDb/RestructureContentCollection.cs

@ -11,7 +11,7 @@ using MongoDB.Driver;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.MongoDb; using Squidex.Infrastructure.MongoDb;
namespace Migrate_01.Migrations.MongoDb namespace Migrations.Migrations.MongoDb
{ {
public sealed class RestructureContentCollection : IMigration public sealed class RestructureContentCollection : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/PopulateGrainIndexes.cs → backend/src/Migrations/Migrations/PopulateGrainIndexes.cs

@ -19,7 +19,7 @@ using Squidex.Infrastructure;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public class PopulateGrainIndexes : IMigration public class PopulateGrainIndexes : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/RebuildApps.cs → backend/src/Migrations/Migrations/RebuildApps.cs

@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class RebuildApps : IMigration public sealed class RebuildApps : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/RebuildAssets.cs → backend/src/Migrations/Migrations/RebuildAssets.cs

@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class RebuildAssets : IMigration public sealed class RebuildAssets : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/RebuildContents.cs → backend/src/Migrations/Migrations/RebuildContents.cs

@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class RebuildContents : IMigration public sealed class RebuildContents : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/RebuildSnapshots.cs → backend/src/Migrations/Migrations/RebuildSnapshots.cs

@ -9,7 +9,7 @@ using System.Threading.Tasks;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class RebuildSnapshots : IMigration public sealed class RebuildSnapshots : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/StartEventConsumers.cs → backend/src/Migrations/Migrations/StartEventConsumers.cs

@ -11,7 +11,7 @@ using Squidex.Infrastructure.EventSourcing.Grains;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Orleans; using Squidex.Infrastructure.Orleans;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class StartEventConsumers : IMigration public sealed class StartEventConsumers : IMigration
{ {

2
backend/tools/Migrate_01/Migrations/StopEventConsumers.cs → backend/src/Migrations/Migrations/StopEventConsumers.cs

@ -11,7 +11,7 @@ using Squidex.Infrastructure.EventSourcing.Grains;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Orleans; using Squidex.Infrastructure.Orleans;
namespace Migrate_01.Migrations namespace Migrations.Migrations
{ {
public sealed class StopEventConsumers : IMigration public sealed class StopEventConsumers : IMigration
{ {

2
backend/tools/Migrate_01/OldEvents/AppClientChanged.cs → backend/src/Migrations/OldEvents/AppClientChanged.cs

@ -11,7 +11,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(AppClientChanged))] [EventType(nameof(AppClientChanged))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/AppClientPermission.cs → backend/src/Migrations/OldEvents/AppClientPermission.cs

@ -7,7 +7,7 @@
using System; using System;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[Obsolete] [Obsolete]
public enum AppClientPermission public enum AppClientPermission

2
backend/tools/Migrate_01/OldEvents/AppClientUpdated.cs → backend/src/Migrations/OldEvents/AppClientUpdated.cs

@ -13,7 +13,7 @@ using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using AppClientUpdatedV2 = Squidex.Domain.Apps.Events.Apps.AppClientUpdated; using AppClientUpdatedV2 = Squidex.Domain.Apps.Events.Apps.AppClientUpdated;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(AppClientUpdated))] [EventType(nameof(AppClientUpdated))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/AppContributorAssigned.cs → backend/src/Migrations/OldEvents/AppContributorAssigned.cs

@ -13,7 +13,7 @@ using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using AppContributorAssignedV2 = Squidex.Domain.Apps.Events.Apps.AppContributorAssigned; using AppContributorAssignedV2 = Squidex.Domain.Apps.Events.Apps.AppContributorAssigned;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(AppContributorAssigned))] [EventType(nameof(AppContributorAssigned))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/AppContributorPermission.cs → backend/src/Migrations/OldEvents/AppContributorPermission.cs

@ -7,7 +7,7 @@
using System; using System;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[Obsolete] [Obsolete]
public enum AppContributorPermission public enum AppContributorPermission

2
backend/tools/Migrate_01/OldEvents/AppPlanChanged.cs → backend/src/Migrations/OldEvents/AppPlanChanged.cs

@ -13,7 +13,7 @@ using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using AppPlanChangedV2 = Squidex.Domain.Apps.Events.Apps.AppPlanChanged; using AppPlanChangedV2 = Squidex.Domain.Apps.Events.Apps.AppPlanChanged;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[TypeName("AppPlanChanged")] [TypeName("AppPlanChanged")]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/AppWorkflowConfigured.cs → backend/src/Migrations/OldEvents/AppWorkflowConfigured.cs

@ -13,7 +13,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(AppWorkflowConfigured))] [EventType(nameof(AppWorkflowConfigured))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/AssetCreated.cs → backend/src/Migrations/OldEvents/AssetCreated.cs

@ -14,7 +14,7 @@ using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using AssetCreatedV2 = Squidex.Domain.Apps.Events.Assets.AssetCreated; using AssetCreatedV2 = Squidex.Domain.Apps.Events.Assets.AssetCreated;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(AssetCreated))] [EventType(nameof(AssetCreated))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/AssetRenamed.cs → backend/src/Migrations/OldEvents/AssetRenamed.cs

@ -11,7 +11,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(AssetRenamed))] [EventType(nameof(AssetRenamed))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/AssetTagged.cs → backend/src/Migrations/OldEvents/AssetTagged.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(AssetTagged))] [EventType(nameof(AssetTagged))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/AssetUpdated.cs → backend/src/Migrations/OldEvents/AssetUpdated.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using AssetUpdatedV2 = Squidex.Domain.Apps.Events.Assets.AssetUpdated; using AssetUpdatedV2 = Squidex.Domain.Apps.Events.Assets.AssetUpdated;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[TypeName("AssetUpdated")] [TypeName("AssetUpdated")]
public sealed class AssetUpdated : AssetEvent, IMigrated<IEvent> public sealed class AssetUpdated : AssetEvent, IMigrated<IEvent>

2
backend/tools/Migrate_01/OldEvents/ContentArchived.cs → backend/src/Migrations/OldEvents/ContentArchived.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentArchived))] [EventType(nameof(ContentArchived))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ContentChangesDiscarded.cs → backend/src/Migrations/OldEvents/ContentChangesDiscarded.cs

@ -11,7 +11,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentChangesDiscarded))] [EventType(nameof(ContentChangesDiscarded))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ContentChangesPublished.cs → backend/src/Migrations/OldEvents/ContentChangesPublished.cs

@ -13,7 +13,7 @@ using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using ContentStatusChangedV2 = Squidex.Domain.Apps.Events.Contents.ContentStatusChanged; using ContentStatusChangedV2 = Squidex.Domain.Apps.Events.Contents.ContentStatusChanged;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentChangesPublished))] [EventType(nameof(ContentChangesPublished))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ContentCreated.cs → backend/src/Migrations/OldEvents/ContentCreated.cs

@ -13,7 +13,7 @@ using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using ContentCreatedV2 = Squidex.Domain.Apps.Events.Contents.ContentCreated; using ContentCreatedV2 = Squidex.Domain.Apps.Events.Contents.ContentCreated;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentCreated))] [EventType(nameof(ContentCreated))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ContentPublished.cs → backend/src/Migrations/OldEvents/ContentPublished.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentPublished))] [EventType(nameof(ContentPublished))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ContentRestored.cs → backend/src/Migrations/OldEvents/ContentRestored.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentRestored))] [EventType(nameof(ContentRestored))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ContentStatusChanged.cs → backend/src/Migrations/OldEvents/ContentStatusChanged.cs

@ -13,7 +13,7 @@ using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using ContentStatusChangedV2 = Squidex.Domain.Apps.Events.Contents.ContentStatusChanged; using ContentStatusChangedV2 = Squidex.Domain.Apps.Events.Contents.ContentStatusChanged;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentStatusChanged))] [EventType(nameof(ContentStatusChanged))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ContentUnpublished.cs → backend/src/Migrations/OldEvents/ContentUnpublished.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentUnpublished))] [EventType(nameof(ContentUnpublished))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ContentUpdateProposed.cs → backend/src/Migrations/OldEvents/ContentUpdateProposed.cs

@ -12,7 +12,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ContentUpdateProposed))] [EventType(nameof(ContentUpdateProposed))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/NoopConventEvent.cs → backend/src/Migrations/OldEvents/NoopConventEvent.cs

@ -8,7 +8,7 @@
using Squidex.Domain.Apps.Events.Contents; using Squidex.Domain.Apps.Events.Contents;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[TypeName(nameof(NoopConventEvent))] [TypeName(nameof(NoopConventEvent))]
public sealed class NoopConventEvent : ContentEvent public sealed class NoopConventEvent : ContentEvent

0
backend/tools/Migrate_01/OldEvents/NoopEvent.cs → backend/src/Migrations/OldEvents/NoopEvent.cs

2
backend/tools/Migrate_01/OldEvents/SchemaCreated.cs → backend/src/Migrations/OldEvents/SchemaCreated.cs

@ -15,7 +15,7 @@ using Squidex.Infrastructure.Reflection;
using SchemaCreatedV2 = Squidex.Domain.Apps.Events.Schemas.SchemaCreated; using SchemaCreatedV2 = Squidex.Domain.Apps.Events.Schemas.SchemaCreated;
using SchemaFields = System.Collections.Generic.List<Squidex.Domain.Apps.Events.Schemas.SchemaCreatedField>; using SchemaFields = System.Collections.Generic.List<Squidex.Domain.Apps.Events.Schemas.SchemaCreatedField>;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(SchemaCreated))] [EventType(nameof(SchemaCreated))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/ScriptsConfigured.cs → backend/src/Migrations/OldEvents/ScriptsConfigured.cs

@ -13,7 +13,7 @@ using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(ScriptsConfigured))] [EventType(nameof(ScriptsConfigured))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/WebhookAdded.cs → backend/src/Migrations/OldEvents/WebhookAdded.cs

@ -9,7 +9,7 @@ using System;
using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(WebhookAdded))] [EventType(nameof(WebhookAdded))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldEvents/WebhookDeleted.cs → backend/src/Migrations/OldEvents/WebhookDeleted.cs

@ -9,7 +9,7 @@ using System;
using Squidex.Domain.Apps.Events; using Squidex.Domain.Apps.Events;
using Squidex.Infrastructure.EventSourcing; using Squidex.Infrastructure.EventSourcing;
namespace Migrate_01.OldEvents namespace Migrations.OldEvents
{ {
[EventType(nameof(WebhookDeleted))] [EventType(nameof(WebhookDeleted))]
[Obsolete] [Obsolete]

2
backend/tools/Migrate_01/OldTriggers/AssetChangedTrigger.cs → backend/src/Migrations/OldTriggers/AssetChangedTrigger.cs

@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.Rules.Triggers;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldTriggers namespace Migrations.OldTriggers
{ {
[TypeName(nameof(AssetChangedTrigger))] [TypeName(nameof(AssetChangedTrigger))]
public sealed class AssetChangedTrigger : RuleTrigger, IMigrated<RuleTrigger> public sealed class AssetChangedTrigger : RuleTrigger, IMigrated<RuleTrigger>

2
backend/tools/Migrate_01/OldTriggers/ContentChangedTrigger.cs → backend/src/Migrations/OldTriggers/ContentChangedTrigger.cs

@ -13,7 +13,7 @@ using Squidex.Domain.Apps.Core.Rules.Triggers;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
namespace Migrate_01.OldTriggers namespace Migrations.OldTriggers
{ {
[TypeName(nameof(ContentChangedTrigger))] [TypeName(nameof(ContentChangedTrigger))]
public sealed class ContentChangedTrigger : RuleTrigger, IMigrated<RuleTrigger> public sealed class ContentChangedTrigger : RuleTrigger, IMigrated<RuleTrigger>

2
backend/tools/Migrate_01/OldTriggers/ContentChangedTriggerSchema.cs → backend/src/Migrations/OldTriggers/ContentChangedTriggerSchema.cs

@ -11,7 +11,7 @@ using Squidex.Domain.Apps.Core;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;
using Squidex.Domain.Apps.Core.Rules.Triggers; using Squidex.Domain.Apps.Core.Rules.Triggers;
namespace Migrate_01.OldTriggers namespace Migrations.OldTriggers
{ {
public sealed class ContentChangedTriggerSchema : Freezable public sealed class ContentChangedTriggerSchema : Freezable
{ {

2
backend/tools/Migrate_01/RebuildOptions.cs → backend/src/Migrations/RebuildOptions.cs

@ -5,7 +5,7 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
namespace Migrate_01 namespace Migrations
{ {
public sealed class RebuildOptions public sealed class RebuildOptions
{ {

4
backend/tools/Migrate_01/RebuildRunner.cs → backend/src/Migrations/RebuildRunner.cs

@ -8,11 +8,11 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Migrate_01.Migrations; using Migrations.Migrations;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
namespace Migrate_01 namespace Migrations
{ {
public sealed class RebuildRunner public sealed class RebuildRunner
{ {

2
backend/tools/Migrate_01/RebuilderExtensions.cs → backend/src/Migrations/RebuilderExtensions.cs

@ -19,7 +19,7 @@ using Squidex.Domain.Apps.Entities.Schemas;
using Squidex.Domain.Apps.Entities.Schemas.State; using Squidex.Domain.Apps.Entities.Schemas.State;
using Squidex.Infrastructure.Commands; using Squidex.Infrastructure.Commands;
namespace Migrate_01 namespace Migrations
{ {
public static class RebuilderExtensions public static class RebuilderExtensions
{ {

2
backend/tools/Migrate_01/SquidexMigrations.cs → backend/src/Migrations/SquidexMigrations.cs

@ -9,7 +9,7 @@ using System.Reflection;
#pragma warning disable RECS0014 // If all fields, properties and methods members are static, the class can be made static. #pragma warning disable RECS0014 // If all fields, properties and methods members are static, the class can be made static.
namespace Migrate_01 namespace Migrations
{ {
public sealed class SquidexMigrations public sealed class SquidexMigrations
{ {

19
backend/src/Squidex.Domain.Apps.Entities/Apps/Invitation/InviteUserCommandMiddleware.cs

@ -26,9 +26,20 @@ namespace Squidex.Domain.Apps.Entities.Apps.Invitation
public async Task HandleAsync(CommandContext context, NextDelegate next) public async Task HandleAsync(CommandContext context, NextDelegate next)
{ {
if (context.Command is AssignContributor assignContributor && ShouldInvite(assignContributor)) if (context.Command is AssignContributor assignContributor && ShouldResolve(assignContributor))
{ {
var (user, created) = await userResolver.CreateUserIfNotExistsAsync(assignContributor.ContributorId, true); IUser? user;
var created = false;
if (assignContributor.Invite)
{
(user, created) = await userResolver.CreateUserIfNotExistsAsync(assignContributor.ContributorId, true);
}
else
{
user = await userResolver.FindByIdOrEmailAsync(assignContributor.ContributorId);
}
if (user != null) if (user != null)
{ {
@ -48,9 +59,9 @@ namespace Squidex.Domain.Apps.Entities.Apps.Invitation
} }
} }
private static bool ShouldInvite(AssignContributor assignContributor) private static bool ShouldResolve(AssignContributor assignContributor)
{ {
return assignContributor.Invite && assignContributor.ContributorId.IsEmail(); return assignContributor.ContributorId.IsEmail();
} }
} }
} }

13
backend/src/Squidex.Domain.Users/DefaultUserResolver.cs

@ -65,23 +65,16 @@ namespace Squidex.Domain.Users
} }
} }
public async Task<IUser?> FindByIdAsync(string idOrEmail) public async Task<IUser?> FindByIdAsync(string id)
{ {
Guard.NotNullOrEmpty(idOrEmail, nameof(idOrEmail)); Guard.NotNullOrEmpty(id, nameof(id));
using (var scope = serviceProvider.CreateScope()) using (var scope = serviceProvider.CreateScope())
{ {
var userFactory = scope.ServiceProvider.GetRequiredService<IUserFactory>(); var userFactory = scope.ServiceProvider.GetRequiredService<IUserFactory>();
var userManager = scope.ServiceProvider.GetRequiredService<UserManager<IdentityUser>>(); var userManager = scope.ServiceProvider.GetRequiredService<UserManager<IdentityUser>>();
if (userFactory.IsId(idOrEmail)) return await userManager.FindByIdWithClaimsAsync(id);
{
return await userManager.FindByIdWithClaimsAsync(idOrEmail);
}
else
{
return await userManager.FindByEmailWithClaimsAsync(idOrEmail);
}
} }
} }

4
backend/src/Squidex/Config/Domain/MigrationServices.cs

@ -7,8 +7,8 @@
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Migrate_01; using Migrations;
using Migrate_01.Migrations; using Migrations.Migrations;
using Squidex.Infrastructure.Migrations; using Squidex.Infrastructure.Migrations;
namespace Squidex.Config.Domain namespace Squidex.Config.Domain

2
backend/src/Squidex/Config/Domain/SerializationServices.cs

@ -6,7 +6,7 @@
// ========================================================================== // ==========================================================================
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Migrate_01; using Migrations;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using Squidex.Domain.Apps.Core; using Squidex.Domain.Apps.Core;

2
backend/src/Squidex/Config/Domain/StoreServices.cs

@ -11,7 +11,7 @@ using IdentityServer4.Stores;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Migrate_01.Migrations.MongoDb; using Migrations.Migrations.MongoDb;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.GridFS; using MongoDB.Driver.GridFS;
using Squidex.Domain.Apps.Entities.Assets.Repositories; using Squidex.Domain.Apps.Entities.Assets.Repositories;

2
backend/src/Squidex/Config/Startup/MigrationRebuilderHost.cs

@ -7,7 +7,7 @@
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Migrate_01; using Migrations;
using Squidex.Infrastructure.Log; using Squidex.Infrastructure.Log;
namespace Squidex.Config.Startup namespace Squidex.Config.Startup

4
backend/src/Squidex/Squidex.csproj

@ -14,7 +14,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\extensions\Squidex.Extensions\Squidex.Extensions.csproj" /> <ProjectReference Include="..\..\extensions\Squidex.Extensions\Squidex.Extensions.csproj" />
<ProjectReference Include="..\..\tools\Migrate_01\Migrate_01.csproj" /> <ProjectReference Include="..\Migrations\Migrations.csproj" />
<ProjectReference Include="..\Squidex.Domain.Apps.Core.Model\Squidex.Domain.Apps.Core.Model.csproj" /> <ProjectReference Include="..\Squidex.Domain.Apps.Core.Model\Squidex.Domain.Apps.Core.Model.csproj" />
<ProjectReference Include="..\Squidex.Domain.Apps.Core.Operations\Squidex.Domain.Apps.Core.Operations.csproj" /> <ProjectReference Include="..\Squidex.Domain.Apps.Core.Operations\Squidex.Domain.Apps.Core.Operations.csproj" />
<ProjectReference Include="..\Squidex.Domain.Apps.Entities\Squidex.Domain.Apps.Entities.csproj" /> <ProjectReference Include="..\Squidex.Domain.Apps.Entities\Squidex.Domain.Apps.Entities.csproj" />
@ -124,4 +124,6 @@
<PropertyGroup> <PropertyGroup>
<NoWarn>$(NoWarn);CS1591;1591;1573;1572;NU1605;IDE0060</NoWarn> <NoWarn>$(NoWarn);CS1591;1591;1573;1572;NU1605;IDE0060</NoWarn>
</PropertyGroup> </PropertyGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1development_1json__JsonSchema="http://json.schemastore.org/BizTalkServerApplicationSchema" /></VisualStudio></ProjectExtensions>
</Project> </Project>

4
backend/src/Squidex/appsettings.json

@ -240,7 +240,7 @@
/* /*
* True to delete assets recursively. * True to delete assets recursively.
*/ */
"deleteRecursive": false "deleteRecursive": true
}, },
"logging": { "logging": {
@ -623,7 +623,7 @@
* Kafka Producer configuration * Kafka Producer configuration
*/ */
"kafka": { "kafka": {
"bootstrapServers": "" "bootstrapServers": "adasdasdsd"
}, },
/* /*

4
backend/tests/Squidex.Web.Tests/Squidex.Web.Tests.csproj

@ -7,8 +7,8 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Squidex.Domain.Users\Squidex.Domain.Users.csproj" /> <ProjectReference Include="..\..\src\Squidex.Domain.Users\Squidex.Domain.Users.csproj" /> <ProjectReference Include="..\..\src\Squidex.Web\Squidex.Web.csproj" />
<ProjectReference Include="..\..\src\Squidex\Squidex.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FakeItEasy" Version="6.0.0" /> <PackageReference Include="FakeItEasy" Version="6.0.0" />

24
backend/tests/docker-compose.yml

@ -7,27 +7,15 @@ services:
networks: networks:
- internal - internal
squidex2: squidex:
image: "squidex-local" image: squidex
environment:
- URLS__BASEURL=http://localhost
- EVENTSTORE__MONGODB__CONFIGURATION=mongodb://mongo
- ORLEANS__HOSTNAMEORIPADDRESS=FirstOfHost
- STORE__MONGODB__CONFIGURATION=mongodb://mongo
- STORE__TYPE=MongoDB
networks:
- internal
depends_on:
- mongo
squidex1:
image: "squidex-local"
ports: ports:
- "80:80" - "8080:80"
environment: environment:
- URLS__BASEURL=http://localhost - URLS__BASEURL=http://localhost:8080
- EVENTSTORE__MONGODB__CONFIGURATION=mongodb://mongo - EVENTSTORE__MONGODB__CONFIGURATION=mongodb://mongo
- ORLEANS__HOSTNAMEORIPADDRESS=FirstOfHost - IDENTITY__ADMINCLIENTID=root
- IDENTITY__ADMINCLIENTSECRET=xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0=
- STORE__MONGODB__CONFIGURATION=mongodb://mongo - STORE__MONGODB__CONFIGURATION=mongodb://mongo
- STORE__TYPE=MongoDB - STORE__TYPE=MongoDB
networks: networks:

34
backend/tools/Benchmarks/Benchmarks.sln

@ -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

25
backend/tools/Migrate_01/Migrate_01.csproj

@ -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
backend/tools/Migrate_00/Migrate_00.csproj → backend/tools/Migrator/Migrator.csproj

34
backend/tools/Migrator/Migrator.sln

@ -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

2
backend/tools/Migrate_00/Program.cs → backend/tools/Migrator/Program.cs

@ -9,7 +9,7 @@ using System;
using MongoDB.Bson; using MongoDB.Bson;
using MongoDB.Driver; using MongoDB.Driver;
namespace Migrate_00 namespace Migrator
{ {
public class Program public class Program
{ {

19
backend/tools/TestSuite/TestSuite.ApiTests/AppTests.cs

@ -7,6 +7,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -31,9 +32,25 @@ namespace TestSuite.ApiTests
[Fact] [Fact]
public async Task Should_get_app() public async Task Should_get_app()
{ {
var w = Stopwatch.StartNew();
var app = await _.Apps.GetAppAsync(_.AppName); var app = await _.Apps.GetAppAsync(_.AppName);
Assert.Equal(_.AppName, app.Name); Assert.Equal(_.AppName, app.Name);
w.Stop();
Debug.WriteLine("ELAPSED: {0}", w.Elapsed);
var w2 = Stopwatch.StartNew();
app = await _.Apps.GetAppAsync(_.AppName);
Assert.Equal(_.AppName, app.Name);
w2.Stop();
Debug.WriteLine("ELAPSED: {0}", w2.Elapsed);
} }
[Fact] [Fact]
@ -186,7 +203,7 @@ namespace TestSuite.ApiTests
{ {
var roleName = Guid.NewGuid().ToString(); var roleName = Guid.NewGuid().ToString();
var roleClient = Guid.NewGuid().ToString(); var roleClient = Guid.NewGuid().ToString();
var roleContributor1 = "role@squidex.io"; var roleContributor1 = "role1@squidex.io";
var roleContributor2 = "role2@squidex.io"; var roleContributor2 = "role2@squidex.io";
// STEP 1: Add role. // STEP 1: Add role.

3
backend/tools/TestSuite/TestSuite.ApiTests/AssetTests.cs

@ -16,6 +16,7 @@ using Xunit;
#pragma warning disable SA1300 // Element should begin with upper-case letter #pragma warning disable SA1300 // Element should begin with upper-case letter
#pragma warning disable SA1507 // Code should not contain multiple blank lines in a row #pragma warning disable SA1507 // Code should not contain multiple blank lines in a row
#pragma warning disable SA1133 // Do not combine attributes
namespace TestSuite.ApiTests namespace TestSuite.ApiTests
{ {
@ -188,7 +189,7 @@ namespace TestSuite.ApiTests
Assert.Contains(assets_2.Items, x => x.Id == asset_1.Id); Assert.Contains(assets_2.Items, x => x.Id == asset_1.Id);
} }
[Fact] [Fact, Trait("Category", "NotAutomated")]
public async Task Should_delete_recursively() public async Task Should_delete_recursively()
{ {
// STEP 1: Create asset folder // STEP 1: Create asset folder

1
backend/tools/TestSuite/TestSuite.ApiTests/BackupTests.cs

@ -18,6 +18,7 @@ using Xunit;
namespace TestSuite.ApiTests namespace TestSuite.ApiTests
{ {
[Trait("Category", "NotAutomated")]
public class BackupTests : IClassFixture<ClientFixture> public class BackupTests : IClassFixture<ClientFixture>
{ {
public ClientFixture _ { get; } public ClientFixture _ { get; }

2
backend/tools/TestSuite/TestSuite.ApiTests/CDNTests.cs

@ -16,7 +16,7 @@ using Xunit;
namespace TestSuite.ApiTests namespace TestSuite.ApiTests
{ {
[Trait("Category", "Dependencies")] [Trait("Category", "NotAutomated")]
public class CDNTests : IClassFixture<CloudFixture> public class CDNTests : IClassFixture<CloudFixture>
{ {
public CloudFixture _ { get; } public CloudFixture _ { get; }

6
backend/tools/TestSuite/TestSuite.ApiTests/ContentCleanupTests.cs

@ -17,11 +17,11 @@ using Xunit;
namespace TestSuite.ApiTests namespace TestSuite.ApiTests
{ {
public class ContentCleanupTests : IClassFixture<ClientFixture> public class ContentCleanupTests : IClassFixture<CreatedAppFixture>
{ {
public ClientFixture _ { get; } public CreatedAppFixture _ { get; }
public ContentCleanupTests(ClientFixture fixture) public ContentCleanupTests(CreatedAppFixture fixture)
{ {
_ = fixture; _ = fixture;
} }

1
backend/tools/TestSuite/TestSuite.ApiTests/GraphQLTests.cs

@ -20,6 +20,7 @@ using Xunit;
namespace TestSuite.ApiTests namespace TestSuite.ApiTests
{ {
[Trait("Category", "NotAutomated")]
public sealed class GraphQLTests : IClassFixture<CreatedAppFixture> public sealed class GraphQLTests : IClassFixture<CreatedAppFixture>
{ {
public CreatedAppFixture _ { get; } public CreatedAppFixture _ { get; }

2
backend/tools/TestSuite/TestSuite.ApiTests/TestSuite.ApiTests.csproj

@ -4,7 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" /> <PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" /> <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />

2
backend/tools/TestSuite/TestSuite.LoadTests/TestSuite.LoadTests.csproj

@ -4,7 +4,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" /> <PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" /> <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />

29
backend/tools/TestSuite/TestSuite.Shared/Fixtures/ClientFixture.cs

@ -11,16 +11,33 @@ namespace TestSuite.Fixtures
{ {
public class ClientFixture : ClientManagerFixture public class ClientFixture : ClientManagerFixture
{ {
public IAppsClient Apps => ClientManager.CreateAppsClient(); public IAppsClient Apps { get; }
public IBackupsClient Backups => ClientManager.CreateBackupsClient(); public IBackupsClient Backups { get; }
public ILanguagesClient Languages => ClientManager.CreateLanguagesClient(); public ILanguagesClient Languages { get; }
public IPingClient Ping => ClientManager.CreatePingClient(); public IPingClient Ping { get; }
public IRulesClient Rules => ClientManager.CreateRulesClient(); public IRulesClient Rules { get; }
public ISchemasClient Schemas => ClientManager.CreateSchemasClient(); public ISchemasClient Schemas { get; }
public ClientFixture()
{
Apps = ClientManager.CreateAppsClient();
Backups = ClientManager.CreateBackupsClient();
Languages = ClientManager.CreateLanguagesClient();
Languages = ClientManager.CreateLanguagesClient();
Ping = ClientManager.CreatePingClient();
Rules = ClientManager.CreateRulesClient();
Schemas = ClientManager.CreateSchemasClient();
}
} }
} }

100
backend/tools/TestSuite/TestSuite.Shared/Fixtures/ClientManagerFactory.cs

@ -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;
}
}
}

62
backend/tools/TestSuite/TestSuite.Shared/Fixtures/ClientManagerFixture.cs

@ -6,77 +6,25 @@
// ========================================================================== // ==========================================================================
using System; using System;
using System.Threading;
using System.Threading.Tasks;
using Squidex.ClientLibrary; using Squidex.ClientLibrary;
using Squidex.ClientLibrary.Configuration;
namespace TestSuite.Fixtures namespace TestSuite.Fixtures
{ {
public class ClientManagerFixture : IDisposable public class ClientManagerFixture : IDisposable
{ {
public string AppName { get; } = GetValue("APP__NAME", "integration-tests"); public string AppName => ClientManager.Options.AppName;
public string ClientId { get; } = GetValue("CLIENT__ID", "root"); public string ClientId => ClientManager.Options.ClientId;
public string ClientSecret { get; } = GetValue("CLIENT__SECRET", "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0="); public string ClientSecret => ClientManager.Options.ClientSecret;
public string ServerUrl { get; } = GetValue("SERVER__URL", "https://localhost:5001"); public string ServerUrl => ClientManager.Options.Url;
public SquidexClientManager ClientManager { get; } public SquidexClientManager ClientManager { get; }
public ClientManagerFixture() public ClientManagerFixture()
{ {
ClientManager = new SquidexClientManager(new SquidexOptions ClientManager = ClientManagerFactory.CreateAsync().Result;
{
AppName = AppName,
ClientId = ClientId,
ClientSecret = ClientSecret,
Configurator = AcceptAllCertificatesConfigurator.Instance,
Url = ServerUrl
});
if (TryGetTimeout(out var waitSeconds))
{
Task.Run(async () =>
{
var pingClient = ClientManager.CreatePingClient();
using (var cts = new CancellationTokenSource(waitSeconds * 1000))
{
while (!cts.IsCancellationRequested)
{
try
{
await pingClient.GetPingAsync(cts.Token);
break;
}
catch
{
continue;
}
}
}
}).Wait();
}
}
private static bool TryGetTimeout(out int timeout)
{
return int.TryParse(Environment.GetEnvironmentVariable("TEST_WAIT"), out timeout) && timeout > 10;
}
private static string GetValue(string name, string defaultValue)
{
var variable = Environment.GetEnvironmentVariable($"CONFIG__{name}");
if (!string.IsNullOrWhiteSpace(variable))
{
return variable;
}
return defaultValue;
} }
public virtual void Dispose() public virtual void Dispose()

8
backend/tools/TestSuite/TestSuite.Shared/Fixtures/ContentFixture.cs

@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Squidex.ClientLibrary; using Squidex.ClientLibrary;
using Squidex.ClientLibrary.Management; using Squidex.ClientLibrary.Management;
@ -14,6 +15,8 @@ namespace TestSuite.Fixtures
{ {
public class ContentFixture : CreatedAppFixture public class ContentFixture : CreatedAppFixture
{ {
private static readonly HashSet<string> CreatedSchemas = new HashSet<string>();
public IContentsClient<TestEntity, TestEntityData> Contents { get; } public IContentsClient<TestEntity, TestEntityData> Contents { get; }
public string SchemaName { get; } public string SchemaName { get; }
@ -27,6 +30,8 @@ namespace TestSuite.Fixtures
{ {
SchemaName = schemaName; SchemaName = schemaName;
if (!CreatedSchemas.Contains(schemaName))
{
Task.Run(async () => Task.Run(async () =>
{ {
try try
@ -42,6 +47,9 @@ namespace TestSuite.Fixtures
} }
}).Wait(); }).Wait();
CreatedSchemas.Add(schemaName);
}
Contents = ClientManager.CreateContentsClient<TestEntity, TestEntityData>(SchemaName); Contents = ClientManager.CreateContentsClient<TestEntity, TestEntityData>(SchemaName);
} }
} }

11
backend/tools/TestSuite/TestSuite.Shared/Fixtures/ContentReferencesFixture.cs

@ -7,6 +7,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Squidex.ClientLibrary; using Squidex.ClientLibrary;
using Squidex.ClientLibrary.Management;
using TestSuite.Model; using TestSuite.Model;
namespace TestSuite.Fixtures namespace TestSuite.Fixtures
@ -20,8 +21,18 @@ namespace TestSuite.Fixtures
public ContentReferencesFixture() public ContentReferencesFixture()
{ {
Task.Run(async () => Task.Run(async () =>
{
try
{ {
await TestEntityWithReferences.CreateSchemaAsync(Schemas, AppName, SchemaName); await TestEntityWithReferences.CreateSchemaAsync(Schemas, AppName, SchemaName);
}
catch (SquidexManagementException ex)
{
if (ex.StatusCode != 400)
{
throw;
}
}
}).Wait(); }).Wait();
Contents = ClientManager.CreateContentsClient<TestEntityWithReferences, TestEntityWithReferencesData>(SchemaName); Contents = ClientManager.CreateContentsClient<TestEntityWithReferences, TestEntityWithReferencesData>(SchemaName);

7
backend/tools/TestSuite/TestSuite.Shared/Fixtures/CreatedAppFixture.cs

@ -12,7 +12,11 @@ namespace TestSuite.Fixtures
{ {
public class CreatedAppFixture : ClientFixture public class CreatedAppFixture : ClientFixture
{ {
private static bool isCreated;
public CreatedAppFixture() public CreatedAppFixture()
{
if (!isCreated)
{ {
Task.Run(async () => Task.Run(async () =>
{ {
@ -32,6 +36,9 @@ namespace TestSuite.Fixtures
await Apps.PostContributorAsync(AppName, invite); await Apps.PostContributorAsync(AppName, invite);
}).Wait(); }).Wait();
isCreated = true;
}
} }
} }
} }

2
backend/tools/TestSuite/TestSuite.Shared/TestSuite.Shared.csproj

@ -4,7 +4,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" /> <PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.ClientLibrary" Version="4.2.0" /> <PackageReference Include="Squidex.ClientLibrary" Version="5.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" /> <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />
</ItemGroup> </ItemGroup>

Loading…
Cancel
Save