public async Task Should_be_found()
        {
            SetInstanceSettings = ConfigureRemoteInstanceForMasterAsWellAsAuditAndErrorQueues;

            var response = new List <MessagesView>();

            var endpointName = Conventions.EndpointNamingConvention(typeof(ReceiverRemote));

            var context = await Define <MyContext>(Remote1, Master)
                          .WithEndpoint <Sender>(b => b.When((bus, c) => bus.Send(new MyMessage())))
                          .WithEndpoint <ReceiverRemote>()
                          .Done(async c =>
            {
                var result = await this.TryGetMany <MessagesView>($"/api/endpoints/{endpointName}/messages/", instanceName: Master);
                response   = result;
                return(result && response.Count == 1);
            })
                          .Run();

            var expectedRemote1InstanceId = InstanceIdGenerator.FromApiUrl(SettingsPerInstance[Remote1].ApiUrl);

            var remote1Message = response.SingleOrDefault(msg => msg.MessageId == context.Remote1MessageId);

            Assert.NotNull(remote1Message, "Remote1 message not found");
            Assert.AreEqual(expectedRemote1InstanceId, remote1Message.InstanceId, "Remote1 instance id mismatch");
        }
        public async Task Should_be_found()
        {
            var response = new List <MessagesView>();

            var endpointName = Conventions.EndpointNamingConvention(typeof(ReceiverRemote));

            //search for the message type
            var searchString = typeof(MyMessage).Name;

            var context = await Define <MyContext>()
                          .WithEndpoint <Sender>(b => b.When((bus, c) => bus.Send(new MyMessage())))
                          .WithEndpoint <ReceiverRemote>()
                          .Done(async c =>
            {
                var result = await this.TryGetMany <MessagesView>($"/api/endpoints/{endpointName}/messages/search/" + searchString, instanceName: ServiceControlInstanceName);
                response   = result;
                return(result && response.Count == 1);
            })
                          .Run();

            var expectedRemote1InstanceId = InstanceIdGenerator.FromApiUrl(SettingsPerInstance[ServiceControlAuditInstanceName].ApiUrl);

            var remote1Message = response.SingleOrDefault(msg => msg.MessageId == context.Remote1MessageId);

            Assert.NotNull(remote1Message, "Remote1 message not found");
            Assert.AreEqual(expectedRemote1InstanceId, remote1Message.InstanceId, "Remote1 instance id mismatch");
        }
    public async Task Should_deliver_the_reply_without_the_need_to_configure_the_hub()
    {
        var result = await Scenario.Define <Context>()
                     .WithComponent(new SwitchComponent(() =>
        {
            var cfg = new SwitchConfiguration();
            cfg.AddPort <TestTransport>("Port1", t => { t.ConfigureNoNativePubSubBrokerA(); }).UseSubscriptionPersistence(new InMemorySubscriptionStorage());
            cfg.AddPort <TestTransport>("Port2", t => { t.ConfigureNoNativePubSubBrokerA(); }).UseSubscriptionPersistence(new InMemorySubscriptionStorage());
            cfg.AddPort <TestTransport>("Port3", t => { t.ConfigureNoNativePubSubBrokerA(); }).UseSubscriptionPersistence(new InMemorySubscriptionStorage());

            cfg.PortTable[Conventions.EndpointNamingConvention(typeof(Sender1))] = "Port1";
            cfg.PortTable[Conventions.EndpointNamingConvention(typeof(Sender2))] = "Port2";
            //Sender3's port is configured manually in Sender2

            return(cfg);
        }))
                     .WithEndpoint <Sender1>(c => c.When(s => s.Send(new MyRequest())))
                     .WithEndpoint <Sender2>(c => c.When(s => s.Send(new MyRequest())))
                     .WithEndpoint <Sender3>(c => c.When(s => s.Send(new MyRequest())))
                     .Done(c => c.Response1Received && c.Response2Received && c.Response3Received)
                     .Run(TimeSpan.FromSeconds(20));

        Assert.IsTrue(result.Request1Received);
        Assert.IsTrue(result.Response1Received);
        Assert.IsTrue(result.Request2Received);
        Assert.IsTrue(result.Response2Received);
        Assert.IsTrue(result.Request3Received);
        Assert.IsTrue(result.Response3Received);
    }
Ejemplo n.º 4
0
    static BridgeConfiguration <AzureServiceBusTransport, TestTransport> PrepareBridgeConfiguration(ResubscriberComponent resubscriber)
    {
        var bridgeConfiguration = Bridge.Between <AzureServiceBusTransport>("Left", t =>
        {
            var connString = Environment.GetEnvironmentVariable("AzureServiceBus.ConnectionString");
            t.ConnectionString(connString);
            var settings = t.GetSettings();

            var builder = new ConventionsBuilder(settings);
            builder.DefiningEventsAs(x => x.Namespace == "Messages");
            settings.Set(builder.Conventions);

            var topology = t.UseEndpointOrientedTopology();
            topology.RegisterPublisher(typeof(MyAsbEvent), Conventions.EndpointNamingConvention(typeof(Publisher)));

            var serializer = Tuple.Create(new NewtonsoftSerializer() as SerializationDefinition, new SettingsHolder());
            settings.Set("MainSerializer", serializer);

            t.Transactions(TransportTransactionMode.SendsAtomicWithReceive);
        }).And <TestTransport>("Right", t =>
        {
            t.ConfigureNoNativePubSubBrokerA();
        });

        bridgeConfiguration.InterceptForwarding(resubscriber.InterceptMessageForwarding);
        bridgeConfiguration.LimitMessageProcessingConcurrencyTo(1); //To ensure when tracer arrives the subscribe request has already been processed.
        return(bridgeConfiguration);
    }
 void PreventInconclusiveTestsFromRunning(string endpointName)
 {
     if (endpointName == TestConventions.EndpointNamingConvention(typeof(When_deferring_to_non_local.Endpoint)) ||
         endpointName == TestConventions.EndpointNamingConvention(typeof(When_deferring_a_message.Endpoint)))
     {
         Assert.Inconclusive("Flaky test that relies on time and cannot be executed.");
     }
 }
Ejemplo n.º 6
0
 public BaseEventSubscriber()
 {
     EndpointSetup <DefaultServer>(c =>
     {
         var routing = c.UseTransport <TestTransport>().ConfigureNoNativePubSubBrokerA().Routing();
         var ramp    = routing.ConnectToBridge("Port2");
         ramp.RegisterPublisher(typeof(MyBaseEvent), Conventions.EndpointNamingConvention(typeof(Publisher)));
     });
 }
 public DerivedEventSubscriber()
 {
     EndpointSetup <DefaultServer>(c =>
     {
         var routing = c.UseTransport <RabbitMQTransport>().ConnectionString("host=localhost").Routing();
         var ramp    = routing.UseBridgeRamp("Right");
         ramp.RegisterPublisher(typeof(MyDerivedEvent), Conventions.EndpointNamingConvention(typeof(Publisher)));
     });
 }
Ejemplo n.º 8
0
 public Sender()
 {
     EndpointSetup <DefaultServer>(c =>
     {
         var routing = c.UseTransport <MsmqTransport>().Routing();
         var ramp    = routing.UseBridgeRamp("Left");
         ramp.RouteToEndpoint(typeof(MyRequest), Conventions.EndpointNamingConvention(typeof(Receiver)));
     });
 }
 public BaseEventSubscriber()
 {
     EndpointSetup <DefaultServer>(c =>
     {
         var routing = c.UseTransport <MsmqTransport>().Routing();
         var ramp    = routing.UseBridgeRamp("Right");
         ramp.RegisterPublisher(typeof(MyBaseEvent), Conventions.EndpointNamingConvention(typeof(Publisher)));
     });
 }
Ejemplo n.º 10
0
 public Sender()
 {
     EndpointSetup <DefaultServer>(c =>
     {
         var routing = c.UseTransport <TestTransport>().ConfigureNoNativePubSubBrokerA().Routing();
         var bridge  = routing.ConnectToBridge("LeftA");
         bridge.RouteToEndpoint(typeof(MyRequest), Conventions.EndpointNamingConvention(typeof(Receiver)));
     });
 }
Ejemplo n.º 11
0
        public DerivedEventSubscriber()
        {
            EndpointSetup <DefaultServer>(c =>
            {
                var routing = c.UseTransport <TestTransport>().ConfigureNativePubSubBrokerC()
                              .Routing();

                var bridge = routing.ConnectToBridge("Port3");
                bridge.RegisterPublisher(typeof(MyDerivedEvent3), Conventions.EndpointNamingConvention(typeof(Publisher)));
                bridge.RouteToEndpoint(typeof(TracerMessage), PublisherEndpointName);
            });
        }
        public Sender2()
        {
            EndpointSetup <DefaultServer>(c =>
            {
                var sender3 = Conventions.EndpointNamingConvention(typeof(Sender3));

                var routing = c.UseTransport <TestTransport>().ConfigureNoNativePubSubBrokerA().Routing();
                var bridge  = routing.ConnectToBridge("Port2");
                bridge.RouteToEndpoint(typeof(MyRequest), sender3);
                bridge.SetPort(sender3, "Port3");
            });
        }
        public async Task It_can_be_reimported()
        {
            CustomConfiguration = config =>
            {
                config.RegisterComponents(c =>
                {
                    //Make sure the error import attempt fails
                    c.ConfigureComponent <FailOnceEnricher>(DependencyLifecycle.SingleInstance);

                    //Register domain event spy
                    c.ConfigureComponent <MessageFailedHandler>(DependencyLifecycle.SingleInstance);
                });
            };

            SetSettings = settings =>
            {
                settings.ForwardErrorMessages = true;
                settings.ErrorLogQueue        = Conventions.EndpointNamingConvention(typeof(ErrorLogSpy));
            };

            var runResult = await Define <MyContext>()
                            .WithEndpoint <Sender>(b => b.When((bus, c) => bus.Send(new MyMessage())))
                            .WithEndpoint <Receiver>(b => b.DoNotFailOnErrorMessages())
                            .WithEndpoint <ErrorLogSpy>()
                            .Done(async c =>
            {
                if (c.UniqueMessageId == null)
                {
                    return(false);
                }

                if (!c.WasImportedAgain)
                {
                    var result = await this.TryGet <FailedErrorsCountReponse>("/api/failederrors/count");
                    FailedErrorsCountReponse failedAuditCountsResponse = result;
                    if (result && failedAuditCountsResponse.Count > 0)
                    {
                        c.FailedImport = true;
                        await this.Post <object>("/api/failederrors/import");
                        c.WasImportedAgain = true;
                    }

                    return(false);
                }

                return(await this.TryGet <FailedMessage>($"/api/errors/{c.UniqueMessageId}") && c.ErrorForwarded);
            })
                            .Run();

            Assert.IsTrue(runResult.ErrorForwarded);
            Assert.IsTrue(runResult.MessageFailedEventPublished);
        }
            public FunctionRunner(IList<object> messages,
                Action<ServiceBusTriggeredEndpointConfiguration> configurationCustomization,
                ScenarioContext scenarioContext,
                Type functionComponentType,
                bool doNotFailOnErrorMessages,
                bool sendsAtomicWithReceive,
                Func<ServiceBusReceiver, ScenarioContext, ServiceBusMessageActions> serviceBusMessageActionsFactory)
            {
                this.messages = messages;
                this.configurationCustomization = configurationCustomization;
                this.scenarioContext = scenarioContext;
                this.functionComponentType = functionComponentType;
                this.doNotFailOnErrorMessages = doNotFailOnErrorMessages;
                this.sendsAtomicWithReceive = sendsAtomicWithReceive;
                this.serviceBusMessageActionsFactory = serviceBusMessageActionsFactory;

                Name = Conventions.EndpointNamingConvention(functionComponentType);
            }
        public async Task It_can_be_reimported()
        {
            //Make sure the audit import attempt fails
            CustomConfiguration = config => { config.RegisterComponents(c => c.ConfigureComponent <FailOnceEnricher>(DependencyLifecycle.SingleInstance)); };

            SetSettings = settings =>
            {
                settings.ForwardAuditMessages = true;
                settings.AuditLogQueue        = Conventions.EndpointNamingConvention(typeof(AuditLogSpy));
            };

            var runResult = await Define <MyContext>()
                            .WithEndpoint <Sender>(b => b.When((bus, c) => bus.Send(new MyMessage())))
                            .WithEndpoint <Receiver>()
                            .WithEndpoint <AuditLogSpy>()
                            .Done(async c =>
            {
                if (c.MessageId == null)
                {
                    return(false);
                }

                if (!c.WasImportedAgain)
                {
                    var result = await this.TryGet <FailedAuditsCountReponse>("/api/failedaudits/count");
                    FailedAuditsCountReponse failedAuditCountsResponse = result;
                    if (result && failedAuditCountsResponse.Count > 0)
                    {
                        c.FailedImport = true;
                        await this.Post <object>("/api/failedaudits/import");
                        c.WasImportedAgain = true;
                    }

                    return(false);
                }

                return(await this.TryGetMany <MessagesView>($"/api/messages/search/{c.MessageId}") && c.AuditForwarded);
            })
                            .Run();

            Assert.IsTrue(runResult.AuditForwarded);
        }
Ejemplo n.º 16
0
    public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata)
    {
        var connectionString = ConnectionString;

        var transportConfig = configuration
                              .UseTransport <AzureStorageQueueTransport>()
                              .ConnectionString(connectionString)
                              .MessageInvisibleTime(TimeSpan.FromSeconds(30));

        transportConfig.SanitizeQueueNamesWith(BackwardsCompatibleQueueNameSanitizerForTests.Sanitize);

        transportConfig.DelayedDelivery().DisableTimeoutManager();

        var routingConfig = transportConfig.Routing();

        foreach (var publisher in publisherMetadata.Publishers)
        {
            foreach (var eventType in publisher.Events)
            {
                routingConfig.RegisterPublisher(eventType, publisher.PublisherName);
            }
        }

        if (endpointName.StartsWith(Conventions.EndpointNamingConvention(typeof(When_unsubscribing_from_event.Publisher))))
        {
            Assert.Ignore("Ignored until issue #173 is resolved.");
        }

        if (endpointName.StartsWith("RegisteringAdditionalDeserializers.CustomSerializationSender"))
        {
            Assert.Ignore("Ignored since this scenario is not supported by ASQ.");
        }

        configuration.UseSerialization <XmlSerializer>();

        configuration.Pipeline.Register("test-independence-skip", typeof(TestIndependence.SkipBehavior), "Skips messages from other runs");
        configuration.Pipeline.Register("test-independence-stamp", typeof(TestIndependence.StampOutgoingBehavior), "Stamps outgoing messages from this run");
        transportConfig.SerializeMessageWrapperWith <TestIndependence.TestIdAppendingSerializationDefinition <NewtonsoftSerializer> >();

        return(Task.FromResult(0));
    }
Ejemplo n.º 17
0
    public async Task It_should_deliver_the_message_to_both_subscribers()
    {
        var result = await Scenario.Define <Context>()
                     .WithComponent(new SwitchComponent(() =>
        {
            var cfg = new SwitchConfiguration();
            cfg.AddPort <TestTransport>("Port1", t => { t.ConfigureNoNativePubSubBrokerA(); }).UseSubscriptionPersistence(new InMemorySubscriptionStorage());
            cfg.AddPort <TestTransport>("Port2", t => { t.ConfigureNoNativePubSubBrokerA(); }).UseSubscriptionPersistence(new InMemorySubscriptionStorage());
            cfg.AddPort <TestTransport>("Port3", t => { t.ConfigureNoNativePubSubBrokerA(); }).UseSubscriptionPersistence(new InMemorySubscriptionStorage());

            cfg.PortTable[Conventions.EndpointNamingConvention(typeof(Publisher))] = "Port1";
            return(cfg);
        }))
                     .WithEndpoint <Publisher>(c => c.When(x => x.BaseEventSubscribed && x.DerivedEventSubscribed, s => s.Publish(new MyDerivedEvent())))
                     .WithEndpoint <BaseEventSubscriber>()
                     .WithEndpoint <DerivedEventSubscriber>()
                     .Done(c => c.BaseEventDelivered && c.DerivedEventDeilvered)
                     .Run(TimeSpan.FromSeconds(20));

        Assert.IsTrue(result.BaseEventDelivered);
        Assert.IsTrue(result.DerivedEventDeilvered);
    }
Ejemplo n.º 18
0
        public async Task Should_register_a_new_endpoint()
        {
            var endpointName = Conventions.EndpointNamingConvention(typeof(Sender));

            EndpointsView endpoint = null;

            await Define <MyContext>()
            .WithEndpoint <Sender>(b => b.When((bus, c) => bus.Send(new MyMessage())))
            .WithEndpoint <Receiver>()
            .Done(async c =>
            {
                var result = await this.TryGetSingle <EndpointsView>("/api/endpoints", m => m.Name == endpointName);
                endpoint   = result;
                if (!result)
                {
                    return(false);
                }

                return(true);
            })
            .Run();

            Assert.AreEqual(endpointName, endpoint?.Name);
        }
Ejemplo n.º 19
0
    public async Task It_should_deliver_the_message_to_both_subscribers()
    {
        var result = await Scenario.Define <Context>()
                     .WithComponent(new SwitchComponent(() =>
        {
            var cfg = new SwitchConfiguration();

            //Publisher - Broker B. Limit concurrency to ensure when tracer arrives the subscribe request has already been processed.
            cfg.AddPort <TestTransport>("Port1", t => t.ConfigureNativePubSubBrokerB()).LimitMessageProcessingConcurrencyTo(1);

            //BaseEventSubscriber - Broker A
            cfg.AddPort <TestTransport>("Port2", t => t.ConfigureNoNativePubSubBrokerA()).UseSubscriptionPersistence(new InMemorySubscriptionStorage());

            //DerivedEventSubscriber - Broker C`
            cfg.AddPort <TestTransport>("Port3", t => t.ConfigureNativePubSubBrokerC());

            cfg.PortTable[Conventions.EndpointNamingConvention(typeof(Publisher))] = "Port1";
            return(cfg);
        }))
                     .WithEndpoint <Publisher>(c => c.When(x => x.BaseEventSubscribed && x.DerivedEventSubscribed, s => s.Publish(new MyDerivedEvent3())))
                     .WithEndpoint <BaseEventSubscriber>(c => c.When(async s =>
        {
            await s.Subscribe <MyBaseEvent3>().ConfigureAwait(false);
            await s.Send(new TracerMessage()).ConfigureAwait(false);
        }))
                     .WithEndpoint <DerivedEventSubscriber>(c => c.When(async s =>
        {
            await s.Subscribe <MyDerivedEvent3>().ConfigureAwait(false);
            await s.Send(new TracerMessage()).ConfigureAwait(false);
        }))
                     .Done(c => c.BaseEventDelivered && c.DerivedEventDeilvered)
                     .Run();

        Assert.IsTrue(result.BaseEventDelivered);
        Assert.IsTrue(result.DerivedEventDeilvered);
    }
Ejemplo n.º 20
0
        public static void AuditProcessedMessagesTo <TAuditEndoint>(this EndpointConfiguration config)
        {
            var auditEndpointAddress = Conventions.EndpointNamingConvention(typeof(TAuditEndoint));

            config.AuditProcessedMessagesTo(auditEndpointAddress);
        }
    public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata)
    {
        PreventInconclusiveTestsFromRunning(endpointName);

        configuration.UseSerialization <NewtonsoftSerializer>();

        var connectionString = TestUtility.DefaultConnectionString;
        var topology         = EnvironmentHelper.GetEnvironmentVariable("AzureServiceBusTransport.Topology");

        configuration.GetSettings().Set("AzureServiceBus.AcceptanceTests.UsedTopology", topology);

        var transportConfig = configuration.UseTransport <AzureServiceBusTransport>();

        transportConfig.ConnectionString(connectionString);

        if (topology == "ForwardingTopology")
        {
            transportConfig.UseForwardingTopology();
        }
        else
        {
            var endpointOrientedTopology = transportConfig.UseEndpointOrientedTopology();
            if (topology == "EndpointOrientedMigrationTopology")
            {
                endpointOrientedTopology.EnableMigrationToForwardingTopology();
            }

            foreach (var publisher in publisherMetadata.Publishers)
            {
                foreach (var eventType in publisher.Events)
                {
                    endpointOrientedTopology.RegisterPublisher(eventType, publisher.PublisherName);
                }
            }

            // ATTs that that require publishers to be explicitly registered for the EndpointOrientedTopology
            endpointOrientedTopology.RegisterPublisher(typeof(When_multi_subscribing_to_a_polymorphic_event.MyEvent1), TestConventions.EndpointNamingConvention(typeof(When_multi_subscribing_to_a_polymorphic_event.Publisher1)));
            endpointOrientedTopology.RegisterPublisher(typeof(When_multi_subscribing_to_a_polymorphic_event.MyEvent2), TestConventions.EndpointNamingConvention(typeof(When_multi_subscribing_to_a_polymorphic_event.Publisher2)));

            endpointOrientedTopology.RegisterPublisher(typeof(When_publishing_to_scaled_out_subscribers.MyEvent), TestConventions.EndpointNamingConvention(typeof(When_publishing_to_scaled_out_subscribers.Publisher)));

            endpointOrientedTopology.RegisterPublisher(typeof(When_unsubscribing_from_event.Event), TestConventions.EndpointNamingConvention(typeof(When_unsubscribing_from_event.Publisher)));

            endpointOrientedTopology.RegisterPublisher(typeof(When_unsubscribing.MyEvent), TestConventions.EndpointNamingConvention(typeof(When_unsubscribing.Endpoint)));

            endpointOrientedTopology.RegisterPublisher(typeof(When_multiple_versions_of_a_message_is_published.V1Event), TestConventions.EndpointNamingConvention(typeof(When_multiple_versions_of_a_message_is_published.V2Publisher)));
            endpointOrientedTopology.RegisterPublisher(typeof(When_multiple_versions_of_a_message_is_published.V2Event), TestConventions.EndpointNamingConvention(typeof(When_multiple_versions_of_a_message_is_published.V2Publisher)));

            endpointOrientedTopology.RegisterPublisher(typeof(When_replying_to_saga_event.DidSomething), TestConventions.EndpointNamingConvention(typeof(When_replying_to_saga_event.SagaEndpoint)));

            endpointOrientedTopology.RegisterPublisher(typeof(When_started_by_base_event_from_other_saga.BaseEvent), TestConventions.EndpointNamingConvention(typeof(When_started_by_base_event_from_other_saga.Publisher)));
            endpointOrientedTopology.RegisterPublisher(typeof(When_started_by_event_from_another_saga.SomethingHappenedEvent), TestConventions.EndpointNamingConvention(typeof(When_started_by_event_from_another_saga.SagaThatPublishesAnEvent)));

            //When_two_sagas_subscribe_to_the_same_event
            endpointOrientedTopology.RegisterPublisher(typeof(When_two_sagas_subscribe_to_the_same_event.GroupPendingEvent), TestConventions.EndpointNamingConvention(typeof(When_two_sagas_subscribe_to_the_same_event.Publisher)));

            // TODO: investigate why these tests that are intended for the ForwradingTopology only fail w/o publisher registration on EndpointOrientedTopology execution on build server
            endpointOrientedTopology.RegisterPublisher(typeof(When_subscribing_to_base_and_derived_polymorphic_events_with_forwarding_topology.BaseEvent), TestConventions.EndpointNamingConvention(typeof(When_subscribing_to_base_and_derived_polymorphic_events_with_forwarding_topology.Publisher)));
            endpointOrientedTopology.RegisterPublisher(typeof(When_subscribing_to_base_and_derived_polymorphic_events_with_forwarding_topology.DerivedEvent), TestConventions.EndpointNamingConvention(typeof(When_subscribing_to_base_and_derived_polymorphic_events_with_forwarding_topology.Publisher)));
            endpointOrientedTopology.RegisterPublisher(typeof(When_unsubscribing_from_one_of_the_events_for_ForwardingTopology.MyEvent), TestConventions.EndpointNamingConvention(typeof(When_unsubscribing_from_one_of_the_events_for_ForwardingTopology.Endpoint)));
            endpointOrientedTopology.RegisterPublisher(typeof(When_unsubscribing_from_one_of_the_events_for_ForwardingTopology.MyOtherEvent), TestConventions.EndpointNamingConvention(typeof(When_unsubscribing_from_one_of_the_events_for_ForwardingTopology.Endpoint)));

            endpointOrientedTopology.RegisterPublisher(typeof(When_publishing_from_sendonly.MyEvent), TestConventions.EndpointNamingConvention(typeof(When_publishing_from_sendonly.SendOnlyPublisher)));
            endpointOrientedTopology.RegisterPublisher(typeof(When_subscribing_to_a_base_event.IBaseEvent), TestConventions.EndpointNamingConvention(typeof(When_subscribing_to_a_base_event.Publisher)));
            endpointOrientedTopology.RegisterPublisher(typeof(When_subscribing_to_a_derived_event.SpecificEvent), TestConventions.EndpointNamingConvention(typeof(When_subscribing_to_a_derived_event.Publisher)));

            endpointOrientedTopology.RegisterPublisher(typeof(When_publishing_with_overridden_local_address.MyEvent), TestConventions.EndpointNamingConvention(typeof(When_publishing_with_overridden_local_address.Publisher)));
            // Both publisher and subscriber are the same endpoint with overridden endpoint name. We can't detect both from the message type.
            endpointOrientedTopology.RegisterPublisher(typeof(When_publishing_and_subscribing_to_self_with_overridden_address.MyEvent), "myinputqueue");
        }

        transportConfig.Sanitization()
        .UseStrategy <ValidateAndHashIfNeeded>();

        configuration.RegisterComponents(c => { c.ConfigureComponent <TestIndependenceMutator>(DependencyLifecycle.SingleInstance); });

        configuration.Pipeline.Register("TestIndependenceBehavior", typeof(TestIndependenceSkipBehavior),
                                        "Skips messages not created during the current test.");

        // w/o retries ASB will move attempted messages to the error queue right away, which will cause false failure.
        // ScenarioRunner.PerformScenarios() verifies by default no messages are moved into error queue. If it finds any, it fails the test.
        configuration.Recoverability().Immediate(retriesSettings => retriesSettings.NumberOfRetries(3));

        return(Task.FromResult(0));
    }
Ejemplo n.º 22
0
        public static void SendFailedMessagesTo <TErrorEndpoint>(this EndpointConfiguration config)
        {
            var errorEndpointAddress = Conventions.EndpointNamingConvention(typeof(TErrorEndpoint));

            config.SendFailedMessagesTo(errorEndpointAddress);
        }
Ejemplo n.º 23
0
        public static void RouteToEndpoint(this RoutingSettings routingSettings, Type messageType, Type destinationEndpointType)
        {
            var destinationEndpointAddress = Conventions.EndpointNamingConvention(destinationEndpointType);

            routingSettings.RouteToEndpoint(messageType, destinationEndpointAddress);
        }