Beispiel #1
0
        public async Task ContentImport_Execute_EndToEnd()
        {
            var name1 = GetRandomSchemaName;
            await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1));

            await SchemaClient.PublishSchema("aut", name1);

            var expected1 = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[0];
            var expected2 = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[1];

            await ContentStories.ImportContent(ContentImportSystemUnderTest, "aut", name1, AssetLoader.AsPath(AssetLoader.Schema1DataImportName), publish : true);

            var actuals = await ContentClient.QueryContent("aut", name1, new QueryRequest()
            {
                Skip = 0,
                Top  = 100
            });

            var actualsTotal = actuals.Total;

            actualsTotal.Should().Be(2);

            var actual1 = actuals.Items[0];
            var actual2 = actuals.Items[1];

            // todo : verify

            await SchemaClient.DeleteSchema("aut", name1);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
Beispiel #2
0
        public async Task ContentDelete_Execute_EndToEnd()
        {
            var name1 = GetRandomSchemaName;
            await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1));

            await SchemaClient.PublishSchema("aut", name1);

            dynamic create1response = await ContentClient.CreateContent("aut", name1, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            dynamic create2response = await ContentClient.CreateContent("aut", name1, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            string create1id = Convert.ToString(create1response.id);
            string create2id = Convert.ToString(create2response.id);
            await ContentClient.PublishContent("aut", name1, create1id);

            await ContentClient.PublishContent("aut", name1, create2id);

            // act

            await ContentStories.DeleteContent(ContentDeleteSystemUnderTest, "aut", name1, create1id);

            // todo : verify export content

            await ContentClient.AssertContentMustNotExists("aut", name1, create1id, delay : TimeSpan.FromSeconds(0.5));

            await ContentClient.AssertContentMustExists("aut", name1, create2id, delay : TimeSpan.FromSeconds(0.5));

            // clean up

            await SchemaClient.DeleteSchema("aut", name1);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
Beispiel #3
0
        public async Task ContentPost_Execute_EndToEnd()
        {
            var name1 = GetRandomSchemaName;
            await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1));

            await SchemaClient.PublishSchema("aut", name1);

            var expectedFirst  = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[0];
            var expectedSecond = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[1];

            // act

            await ContentStories.PostContent(ContentPostSystemUnderTest, "aut", name1, AssetLoader.AsPath(AssetLoader.Schema1Data1PostName), publish : true);

            await ContentStories.PostContent(ContentPostSystemUnderTest, "aut", name1, AssetLoader.AsPath(AssetLoader.Schema1Data2PostName), publish : true);

            var content = await ContentClient.QueryContent("aut", name1, new QueryRequest()
            {
                Skip = 0,
                Top  = 100
            });

            int contentTotal = Convert.ToInt32(content.Total);

            contentTotal.Should().Be(2);
            var actualFirst  = content.Items[0];
            var actualSecond = content.Items[1];

            // todo : verify export content

            await SchemaClient.DeleteSchema("aut", name1);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
Beispiel #4
0
        public async Task Create_EndToEnd()
        {
            var schemaName = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var createschema = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName));

            var publishedschema = await SchemaClient.PublishSchema("aut", schemaName);

            // act

            dynamic create1response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            dynamic create2response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            string create1id = Convert.ToString(create1response.id);
            string create2id = Convert.ToString(create2response.id);
            await ContentClient.PublishContent("aut", schemaName, create1id);

            await ContentClient.PublishContent("aut", schemaName, create2id);

            // note : eventual consistency and all that sometimes we don't get away with validating right away.

            await Task.Delay(TimeSpan.FromSeconds(1));

            await ContentClient.AssertContentMustExists("aut", schemaName, create1id, delay : TimeSpan.FromSeconds(0.5));

            await ContentClient.AssertContentMustExists("aut", schemaName, create2id, delay : TimeSpan.FromSeconds(0.5));

            // todo : verify export content

            await SchemaClient.DeleteSchema("aut", schemaName);
        }
Beispiel #5
0
        public async Task Get_EndToEnd()
        {
            var schemaName = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var createschema = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName));

            var publishedschema = await SchemaClient.PublishSchema("aut", schemaName);

            dynamic create1response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            dynamic create2response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            string create1id = Convert.ToString(create1response.id);
            string create2id = Convert.ToString(create2response.id);
            await ContentClient.PublishContent("aut", schemaName, create1id);

            await ContentClient.PublishContent("aut", schemaName, create2id);

            // act

            var get1response = await ContentClient.GetContent("aut", schemaName, create1id);

            var get2response = await ContentClient.GetContent("aut", schemaName, create2id);

            // todo : verify export content

            await SchemaClient.DeleteSchema("aut", schemaName);
        }
Beispiel #6
0
        public async Task Restore_EndToEnd()
        {
            // Query only 'sees' published records so that is a quick way to determine publish state
            // - insert some records
            // - publish them
            // - archive them
            // - assert there are none (because we archived them)

            var schemaName = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var createschema = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName));

            var publishedschema = await SchemaClient.PublishSchema("aut", schemaName);

            var create1response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            var create2response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            await Task.Delay(TimeSpan.FromSeconds(1));

            await ContentClient.PublishContent("aut", schemaName, create1response.Id);

            await ContentClient.PublishContent("aut", schemaName, create2response.Id);

            await Task.Delay(TimeSpan.FromSeconds(1));

            await ContentClient.ArchiveContent("aut", schemaName, create1response.Id);

            await ContentClient.ArchiveContent("aut", schemaName, create2response.Id);

            // act

            // note : eventual consistency and all that sometimes we don't get away with validating right away.

            await Task.Delay(TimeSpan.FromSeconds(1));

            await ContentClient.RestoreContent("aut", schemaName, create1response.Id);

            await ContentClient.RestoreContent("aut", schemaName, create2response.Id);

            await Task.Delay(TimeSpan.FromSeconds(1));

            //var content = await ContentClient.Query<dynamic>("aut", schemaName, new QueryRequest()
            //{
            //  Skip = 0,
            //  Top = 100
            //});
            var content = await ContentClient.QueryContent("aut", schemaName, top : 100, skip : 0);

            // ma
            content.Total.Should().Be(2);

            // clean up

            await SchemaClient.DeleteSchema("aut", schemaName);
        }
        public async Task DeleteSchema_EndToEnd()
        {
            var schemaName = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var createresult = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName));

            var deleteresult = await SchemaClient.DeleteSchema("aut", schemaName);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
        public async Task PublishSchema_EndToEnd()
        {
            var schema1name = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var create1result = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schema1name));

            var result = await SchemaClient.PublishSchema("aut", schema1name);

            //int count = Convert.ToInt32(that.Count);
            //count.Should().Be(2);

            var delete1result = await SchemaClient.DeleteSchema("aut", schema1name);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
        public async Task SchemaDelete_Execute_EndToEnd()
        {
            var name1 = GetRandomSchemaName;

            await SchemaClient.AssertNoSchemasExist("aut");

            await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1));

            await SchemaClient.PublishSchema("aut", name1);

            await SchemaStories.DeleteSchema(SchemaDeleteSystemUnderTest, "aut", name1);

            await SchemaClient.AssertSchemaMustNotExist("aut", name1, delay : TimeSpan.FromSeconds(5));

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
Beispiel #10
0
        public async Task Patch_EndToEnd()
        {
            var schemaName = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var createschema = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName));

            var publishedschema = await SchemaClient.PublishSchema("aut", schemaName);

            dynamic create1response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            string  create1id      = Convert.ToString(create1response.id);
            dynamic patch1response = await ContentClient.PatchContent("aut", schemaName, create1id, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            // clean up

            await SchemaClient.DeleteSchema("aut", schemaName);
        }
Beispiel #11
0
        public async Task Publish_EndToEnd()
        {
            // Query only 'sees' published records so that is a quick way to determine publish state
            // - insert some records
            // - assert that there are none (because we havent published them)
            // - publish them
            // - assert there are two (because we published two)

            var schemaName = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var createschema = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName));

            var publishedschema = await SchemaClient.PublishSchema("aut", schemaName);

            dynamic create1response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            dynamic create2response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            string create1id = Convert.ToString(create1response.id);
            string create2id = Convert.ToString(create2response.id);


            // act

            // note : eventual consistency and all that sometimes we don't get away with validating right away.

            await Task.Delay(TimeSpan.FromSeconds(1));

            await ContentClient.PublishContent("aut", schemaName, create1id);

            await ContentClient.PublishContent("aut", schemaName, create2id);

            await Task.Delay(TimeSpan.FromSeconds(1));

            await ContentClient.AssertContentMustExists("aut", schemaName, create1id, delay : TimeSpan.FromSeconds(0.5));

            await ContentClient.AssertContentMustExists("aut", schemaName, create2id, delay : TimeSpan.FromSeconds(0.5));

            // clean up

            await SchemaClient.DeleteSchema("aut", schemaName);
        }
Beispiel #12
0
        public async Task Query_EndToEnd()
        {
            var schemaName = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var createschema = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName));

            var publishedschema = await SchemaClient.PublishSchema("aut", schemaName);

            dynamic create1response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            dynamic create2response = await ContentClient.CreateContent("aut", schemaName, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            string create1id = Convert.ToString(create1response.id);
            string create2id = Convert.ToString(create2response.id);
            await ContentClient.PublishContent("aut", schemaName, create1id);

            await ContentClient.PublishContent("aut", schemaName, create2id);

            // act

            // note : eventual consistency and all that sometimes we don't get away with validating right away.

            await Task.Delay(TimeSpan.FromSeconds(1));

            //var content = await ContentClient.Query<dynamic>("aut", schemaName, new QueryRequest()
            //{
            //  Skip = 0,
            //  Top = 100
            //});
            var content = await ContentClient.QueryContent("aut", schemaName, top : 100, skip : 0);

            int contenttotal = Convert.ToInt32(content.total);

            contenttotal.Should().Be(2);
            var actualFirst  = content.items[0];
            var actualSecond = content.items[1];

            // todo : verify export content

            await SchemaClient.DeleteSchema("aut", schemaName);
        }
Beispiel #13
0
        public async Task SchemaExists_EndToEnd()
        {
            var schemaName = GetRandomName;

            var nothingExists = await SchemaClient.SchemaExists("aut");

            nothingExists.Should().BeFalse();

            var somethingDoesNotExist = await SchemaClient.SchemaExists("aut", schemaName);

            somethingDoesNotExist.Should().BeFalse();

            var createresult = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schemaName));

            var somethingDefinatelyExist = await SchemaClient.SchemaExists("aut", schemaName);

            somethingDefinatelyExist.Should().BeTrue();

            var deleteresult = await SchemaClient.DeleteSchema("aut", schemaName);
        }
        public async Task GetAllSchemas_EndToEnd()
        {
            var schema1name = GetRandomName;
            var schema2name = GetRandomName;
            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));

            var create1result = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schema1name));

            var create2result = await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(schema2name));

            var all = await SchemaClient.GetAllSchemas("aut");

            int count = Convert.ToInt32(all.Count);

            count.Should().Be(2);

            var delete1result = await SchemaClient.DeleteSchema("aut", schema1name);

            var delete2result = await SchemaClient.DeleteSchema("aut", schema2name);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
        public async Task SchemaExport_Execute_EndToEnd()
        {
            var name1       = GetRandomSchemaName;
            var exportPath1 = Path.Combine(AssetLoader.ExportPath, $"{nameof(SchemaHandlersIntegrationTest)} {nameof(SchemaExport_Execute_EndToEnd)}-out.json");

            await SchemaClient.AssertNoSchemasExist("aut");

            await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1));

            await SchemaClient.PublishSchema("aut", name1);

            await SchemaStories.ExportSchema(SchemaExportSystemUnderTest, "aut", name1, exportPath1);

            var exportedFileExists = File.Exists(exportPath1);

            exportedFileExists.Should().BeTrue($"{nameof(SchemaExportRequest)} failed to export file");

            // todo validate export file

            await SchemaClient.DeleteSchema("aut", name1);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }
Beispiel #16
0
        public async Task ContentExport_Execute_EndToEnd()
        {
            var name1  = GetRandomSchemaName;
            var export = Path.Combine(AssetLoader.ExportPath, $"{nameof(ContentHandlersIntegrationTest)} {nameof(ContentExport_Execute_EndToEnd)}-out.json");

            await SchemaClient.CreateSchema("aut", AssetLoader.Schema1(name1));

            await SchemaClient.PublishSchema("aut", name1);

            dynamic create1response = await ContentClient.CreateContent("aut", name1, AssetLoader.AsDynamic(AssetLoader.Schema1Data1PostName));

            dynamic create2response = await ContentClient.CreateContent("aut", name1, AssetLoader.AsDynamic(AssetLoader.Schema1Data2PostName));

            string create1id = Convert.ToString(create1response.id);
            string create2id = Convert.ToString(create2response.id);
            await ContentClient.PublishContent("aut", name1, create1id);

            await ContentClient.PublishContent("aut", name1, create2id);

            var expected1 = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[0];
            var expected2 = AssetLoader.AsDynamic(AssetLoader.Schema1DataQueryResponseName).Items[1];

            // act

            await ContentStories.ExportContent(ContentExportSystemUnderTest, "aut", name1, export, top : "10", skip : "0");

            var exportExists = File.Exists(export);

            exportExists.Should().BeTrue($"{nameof(SchemaExportRequest)} failed to export file");

            // todo : verify export content

            await SchemaClient.DeleteSchema("aut", name1);

            await SchemaClient.AssertNoSchemasExist("aut", delay : TimeSpan.FromSeconds(0.5));
        }