From c71e3729fc8cbc81badce6eab5aec59e186f46e9 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 11 May 2022 09:41:09 +0200 Subject: [PATCH] Remove old classes. --- .../Fixtures/SchemaFixtureBase.cs | 12 -- .../TestSuite.Shared/SharedInstances.cs | 133 ------------------ 2 files changed, 145 deletions(-) delete mode 100644 backend/tools/TestSuite/TestSuite.Shared/Fixtures/SchemaFixtureBase.cs delete mode 100644 backend/tools/TestSuite/TestSuite.Shared/SharedInstances.cs diff --git a/backend/tools/TestSuite/TestSuite.Shared/Fixtures/SchemaFixtureBase.cs b/backend/tools/TestSuite/TestSuite.Shared/Fixtures/SchemaFixtureBase.cs deleted file mode 100644 index d0c93f857..000000000 --- a/backend/tools/TestSuite/TestSuite.Shared/Fixtures/SchemaFixtureBase.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TestSuite.Fixtures -{ - internal class SchemaFixtureBase - { - } -} diff --git a/backend/tools/TestSuite/TestSuite.Shared/SharedInstances.cs b/backend/tools/TestSuite/TestSuite.Shared/SharedInstances.cs deleted file mode 100644 index a51b0884e..000000000 --- a/backend/tools/TestSuite/TestSuite.Shared/SharedInstances.cs +++ /dev/null @@ -1,133 +0,0 @@ -// ========================================================================== -// Squidex Headless CMS -// ========================================================================== -// Copyright (c) Squidex UG (haftungsbeschraenkt) -// All rights reserved. Licensed under the MIT license. -// ========================================================================== - -using System.Collections.Concurrent; -using Squidex.ClientLibrary; -using Squidex.ClientLibrary.Management; -using TestSuite.Model; - -namespace TestSuite -{ - public static class SharedInstances - { - private static readonly string[] Contributors = - { - "hello@squidex.io" - }; - - private static readonly Task ClientManager = CreateClientManagerInternalAsync(); - - private static readonly ConcurrentDictionary ReferenceSchemas = - new ConcurrentDictionary(); - - private static readonly ConcurrentDictionary DefaultSchemas = - new ConcurrentDictionary(); - - private static readonly Task App = CreateAppInternalAsync(); - - private static Task CreateClientManagerInternalAsync() - { - var clientManager = new ClientManagerWrapper(); - - return clientManager.ConnectAsync(); - } - - private static async Task CreateAppInternalAsync() - { - var wrapper = await ClientManager; - - try - { - await wrapper.Apps.PostAppAsync(new CreateAppDto { Name = wrapper.ClientManager.App }); - } - catch (SquidexManagementException ex) - { - if (ex.StatusCode != 400) - { - throw; - } - } - - var invite = new AssignContributorDto { Invite = true, Role = "Owner" }; - - foreach (var contributor in Contributors) - { - invite.ContributorId = contributor; - - await wrapper.Apps.PostContributorAsync(wrapper.ClientManager.App, invite); - } - - try - { - await wrapper.Apps.PostLanguageAsync(wrapper.ClientManager.App, new AddLanguageDto - { - Language = "de" - }); - } - catch (SquidexManagementException ex) - { - if (ex.StatusCode != 400) - { - throw; - } - } - } - - public static Task CreateClientManagerAsync() - { - return ClientManager; - } - - public static async Task> CreateReferenceSchema(string name) - { - var wrapper = await ClientManager; - - async Task CreateAsync() - { - try - { - await TestEntityWithReferences.CreateSchemaAsync(wrapper.Schemas, wrapper.ClientManager.App, name); - } - catch (SquidexManagementException ex) - { - if (ex.StatusCode != 400) - { - throw; - } - } - } - - await ReferenceSchemas.GetOrAdd(name, _ => CreateAsync()); - - return wrapper.ClientManager.CreateContentsClient(name); - } - - public static async Task> CreateDefaultSchema(string name) - { - var wrapper = await ClientManager; - - async Task CreateAsync() - { - try - { - await TestEntity.CreateSchemaAsync(wrapper.Schemas, wrapper.ClientManager.App, name); - } - catch (SquidexManagementException ex) - { - if (ex.StatusCode != 400) - { - throw; - } - } - } - - await DefaultSchemas.GetOrAdd(name, _ => CreateAsync()); - - return wrapper.ClientManager.CreateContentsClient(name); - } - } -}