public MartenBackedListenerContext() { theStore = DocumentStore.For(_ => { _.Connection(ConnectionSource.ConnectionString); _.PLV8Enabled = false; _.Storage.Add <PostgresqlEnvelopeStorage>(); }); theStore.Advanced.Clean.CompletelyRemoveAll(); theStore.Schema.ApplyAllConfiguredChangesToDatabase(); theWorkerQueue = Substitute.For <IWorkerQueue>(); theSettings = new BusSettings(); var tables = new EnvelopeTables(theSettings, new StoreOptions()); var retries = new MartenRetries(theStore, tables, CompositeTransportLogger.Empty(), theSettings); theListener = new MartenBackedListener( Substitute.For <IListeningAgent>(), theWorkerQueue, theStore, CompositeTransportLogger.Empty(), theSettings, tables, retries); }
public run_scheduled_job_specs() { var logger = CompositeTransportLogger.Empty(); var envelopeTables = new EnvelopeTables(theSettings, new StoreOptions()); var retries = new MartenRetries(theStore, envelopeTables, logger, theSettings); theScheduledJob = new RunScheduledJobs(theWorkerQueue, theStore, envelopeTables, logger, retries); }
public async Task ping_sad_path_with_tcp() { var sender = new BatchedSender("tcp://localhost:2222".ToUri(), new SocketSenderProtocol(), CancellationToken.None, CompositeTransportLogger.Empty()); await Jasper.Testing.Exception <InvalidOperationException> .ShouldBeThrownByAsync(async() => { await sender.Ping(); }); }
public async Task ping_happy_path_with_tcp() { using (var runtime = JasperRuntime.For(_ => { _.Transports.LightweightListenerAt(2222); })) { var sender = new BatchedSender("tcp://localhost:2222".ToUri(), new SocketSenderProtocol(), CancellationToken.None, CompositeTransportLogger.Empty()); await sender.Ping(); } }
public MartenCallbackTests() { theRuntime = JasperRuntime.For(_ => { _.MartenConnectionStringIs(ConnectionSource.ConnectionString); _.ConfigureMarten(x => { x.Storage.Add <PostgresqlEnvelopeStorage>(); x.PLV8Enabled = false; }); }); theStore = theRuntime.Get <IDocumentStore>(); theStore.Advanced.Clean.CompletelyRemoveAll(); theStore.Schema.ApplyAllConfiguredChangesToDatabase(); theEnvelope = ObjectMother.Envelope(); theEnvelope.Status = TransportConstants.Incoming; var marker = new EnvelopeTables(new BusSettings(), new StoreOptions()); using (var session = theStore.OpenSession()) { session.StoreIncoming(marker, theEnvelope); session.SaveChanges(); } var logger = CompositeTransportLogger.Empty(); theRetries = new MartenRetries(theStore, marker, logger, new BusSettings()); theCallback = new MartenCallback(theEnvelope, Substitute.For <IWorkerQueue>(), theStore, marker, theRetries, logger); }
public async Task ping_happy_path_with_http_protocol() { var sender = new BatchedSender("http://localhost:5005/messages".ToUri(), new HttpSenderProtocol(new BusSettings()), CancellationToken.None, CompositeTransportLogger.Empty()); using (var runtime = JasperRuntime.For(_ => { _.Transports.Http.EnableListening(true); _.Http.UseUrls("http://localhost:5005").UseKestrel(); })) { await sender.Ping(); } }
public async Task ping_sad_path_with_http_protocol() { var sender = new BatchedSender("http://localhost:5005/messages".ToUri(), new HttpSenderProtocol(new BusSettings()), CancellationToken.None, CompositeTransportLogger.Empty()); await Jasper.Testing.Exception <HttpRequestException> .ShouldBeThrownByAsync(async() => { await sender.Ping(); }); }
public BatchedSenderTests() { theSender = new BatchedSender(TransportConstants.RepliesUri, theProtocol, theCancellation.Token, CompositeTransportLogger.Empty()); theSender.Start(theSenderCallback); theBatch = new OutgoingMessageBatch(theSender.Destination, new Envelope[] { Envelope.ForPing(), Envelope.ForPing(), Envelope.ForPing(), Envelope.ForPing(), Envelope.ForPing(), Envelope.ForPing() }); theBatch.Messages.Each(x => x.Destination = theBatch.Destination); }