Exemplo n.º 1
0
        public void CreateFtpEndpointEmptyTransportData(RP001FtpReceivePortAnalyzer analyzer, ILogger logger, AzureIntegrationServicesModel model, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And a model"
            .x(() => model = new AzureIntegrationServicesModel());

            "And a model"
            .x(() => model = TestHelper.CreateDefaultModelForAnalyzing());

            "And the model receive location has no TransportTypeData"
            .x(() =>
            {
                model.GetSourceModel <ParsedBizTalkApplicationGroup>().Applications[0].Application.Bindings.BindingInfo.ReceivePortCollection[0].ReceiveLocations[0].ReceiveLocationTransportTypeData = "<CustomProps><AdapterConfig vt=\"8\"><Config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"></Config></AdapterConfig></CustomProps>";
            });

            "And the model has a migration target "
            .x(() =>
            {
                TestHelper.CopySourceToTarget(model, includeFtpReceive: true);
            });

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "And an analyzer"
            .x(() => analyzer = new RP001FtpReceivePortAnalyzer(model, context, logger));

            "When analyzing"
            .x(async() => e = await Record.ExceptionAsync(async() => await analyzer.AnalyzeAsync(CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false));

            "Then the constructor should NOT throw an exception"
            .x(() => e.Should().BeNull());

            "And the message bus will have been created"
            .x(() =>
            {
                model.Should().NotBeNull();
                model.MigrationTarget.Should().NotBeNull();
                model.MigrationTarget.MessageBus.Should().NotBeNull();
                model.MigrationTarget.MessageBus.Applications.Should().HaveCount(3);

                model.MigrationTarget.MessageBus.Applications[0].Endpoints.Should().HaveCount(1);
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Name.Should().Be("FTP Receive Adapter");
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Key.Should().Be("MessageBus:TestApp1:ReceivePort1:ReceiveLocation1:AdapterEndpoint");
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ResourceMapKey.Should().Be("ftpReceiveAdapterEndpointTestApp1FTPReceiveAdapter");

                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Properties.Should().HaveCount(13);
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ReportLinks.Should().HaveCount(1);
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ReportMessages.Should().HaveCount(1);
            });
        }
Exemplo n.º 2
0
        public void FtpEndpointMissingWithError(RP001FtpReceivePortAnalyzer analyzer, ILogger logger, AzureIntegrationServicesModel model, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And an empty model"
            .x(() => model = new AzureIntegrationServicesModel());

            "And a populated model"
            .x(() => model = TestHelper.CreateDefaultModelForAnalyzing());

            "And the model has a migration target"
            .x(() =>
            {
                TestHelper.CopySourceToTarget(model, includeFtpReceive: true);
            });

            "And the target model is missing the endpoint"
            .x(() =>
            {
                model.MigrationTarget.MessageBus.Applications[0].Endpoints.Clear();
            });

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "And an analyzer"
            .x(() => analyzer = new RP001FtpReceivePortAnalyzer(model, context, logger));

            "When analyzing"
            .x(async() => e = await Record.ExceptionAsync(async() => await analyzer.AnalyzeAsync(CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false));

            "Then the constructor should NOT throw an exception"
            .x(() => e.Should().BeNull());

            "And an error should be raised"
            .x(() =>
            {
                model.Should().NotBeNull();
                model.MigrationTarget.Should().NotBeNull();
                model.MigrationTarget.MessageBus.Should().NotBeNull();
                model.MigrationTarget.MessageBus.Applications.Should().HaveCount(3);

                model.MigrationTarget.MessageBus.Applications[0].Endpoints.Should().HaveCount(0);

                context.Errors.Should().HaveCount(1);
            });
        }
Exemplo n.º 3
0
        public void CreateFtpEndpointSuccess(RP001FtpReceivePortAnalyzer analyzer, ILogger logger, AzureIntegrationServicesModel model, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And a model"
            .x(() => model = new AzureIntegrationServicesModel());

            "And a model"
            .x(() => model = TestHelper.CreateDefaultModelForAnalyzing());

            "And the model has a migration target "
            .x(() =>
            {
                TestHelper.CopySourceToTarget(model, includeFtpReceive: true);
            });

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "And an analyzer"
            .x(() => analyzer = new RP001FtpReceivePortAnalyzer(model, context, logger));

            "When analyzing"
            .x(async() => e = await Record.ExceptionAsync(async() => await analyzer.AnalyzeAsync(CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false));

            "Then the constructor should NOT throw an exception"
            .x(() => e.Should().BeNull());

            "And the message bus will have been created"
            .x(() =>
            {
                model.Should().NotBeNull();
                model.MigrationTarget.Should().NotBeNull();
                model.MigrationTarget.MessageBus.Should().NotBeNull();
                model.MigrationTarget.MessageBus.Applications.Should().HaveCount(3);

                model.MigrationTarget.MessageBus.Applications[0].Endpoints.Should().HaveCount(1);
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Name.Should().Be("FTP Receive Adapter");
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Key.Should().Be("MessageBus:TestApp1:ReceivePort1:ReceiveLocation1:AdapterEndpoint");
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ResourceMapKey.Should().Be("ftpReceiveAdapterEndpointTestApp1FTPReceiveAdapter");

                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].Properties.Should().HaveCount(13);
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ReportLinks.Should().HaveCount(1);
                model.MigrationTarget.MessageBus.Applications[0].Endpoints[0].ReportMessages.Should().HaveCount(16);
            });
        }
Exemplo n.º 4
0
        public void ConstructWithNullContext(RP001FtpReceivePortAnalyzer analyzer, ILogger logger, IApplicationModel model, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And a model"
            .x(() => model = new AzureIntegrationServicesModel());

            "And null context"
            .x(() => context.Should().BeNull());

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "When constructing with a null context"
            .x(() => e = Record.Exception(() => new RP001FtpReceivePortAnalyzer(model, context, logger)));

            "Then the constructor should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("context"));
        }
Exemplo n.º 5
0
        public void ConstructWithSuccess(RP001FtpReceivePortAnalyzer analyzer, ILogger logger, IApplicationModel model, MigrationContext context, Exception e)
        {
            "Given an analyzer"
            .x(() => analyzer.Should().BeNull());

            "And a model"
            .x(() => model = new AzureIntegrationServicesModel());

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "When constructing"
            .x(() => e = Record.Exception(() => new RP001FtpReceivePortAnalyzer(model, context, logger)));

            "Then the constructor should NOT throw an exception"
            .x(() => e.Should().BeNull());
        }