public static CommandsService CreateService(ServerConfiguration configuration) { var context = new ServerContext(configuration.Registry, configuration.Broker, configuration.StateProvider); var service = new CommandsService(context); return service; }
public void Given_command_server_runnig() { var instance = new CommandsService(); var config = ConfigurationHelper.CreateConfiguration(instance); _host = new HttpServiceHost(typeof(CommandsService), config, new Uri(URL)); _host.Open(); }
public void Given_command_server_runnig() { var instance = new CommandsService(new ServerContext ( registry: new ReflectionCommandRegistry(typeof(__SampleCommandsMarker).Assembly), broker: new LongCommandBroker() )); var config = ConfigurationHelper.CreateConfiguration(instance); _host = new HttpServiceHost(typeof(CommandsService), config, new Uri(URL)); _host.Open(); }
//[Obsolete("Use CreateServiceConfiguration")] public static HttpConfiguration CreateConfiguration(CommandsService service) { var config = new HttpConfiguration(); config.CreateInstance = (t, c, m) => service; config.Formatters.Insert(0, new JsonNetFormatter()); config.MaxReceivedMessageSize = 16777216; config.MaxBufferSize = 16777216; return config; }
public void Given_service_by_default() { _broker = new CommandBrokerStub(); var service = new CommandsService(new ServerContext(broker: _broker)); var cmdKey = typeof (FooCommand).FullName; var cmdContent = new StringContent("Zaz-Command-Id=" + cmdKey + "&Value1=Foo"); cmdContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); var cmdMessage = new HttpRequestMessage { Content = cmdContent }; _result = service.PostLegacy(cmdMessage); }
public void Given_service_by_default() { _broker = new CommandBrokerStub(); var service = new CommandsService(new ServerContext (broker: _broker )); var cmdKey = typeof (FooCommand).FullName; var cmdData = new JObject(); cmdData.Add("Value1", "Foo"); _result = service.Post(new PostCommandRequest { Key = cmdKey, Command = cmdData }); }
public void Given_command_server_runnig() { var instance = new CommandsService(new ServerContext( registry: new FooCommandRegistry(), broker: new DelegatingCommandBroker((cmd, ctx) => { return Task.Factory.StartNew(() => { }); }))); var config = ConfigurationHelper.CreateConfiguration(instance); SimpleBasicAuthenticationHandler.Configure(config, cred => false); _host = new HttpServiceHost(typeof(CommandsService), config, new Uri(URL)); _host.Open(); }
public void Given_command_server_runnig() { var instance = new CommandsService(new ServerContext ( registry: new FooCommandRegistry(), broker: new DelegatingCommandBroker((cmd, ctx) => { _postedCommand = cmd; _ctx = ctx; return Task.Factory.StartNew(() => {}); }) )); var config = ConfigurationHelper.CreateConfiguration(instance); SimpleBasicAuthenticationHandler.Configure(config, cred => cred.UserName == "supr" && cred.Password == "booper"); _host = new HttpServiceHost(typeof(CommandsService), config, new Uri(URL)); _host.Open(); // Client side var bus = new CommandBus(URL, new Client.Avanced.ZazConfiguration { ConfigureHttp = h => { h.Credentials = new NetworkCredential("supr", "booper"); } }); bus.Post(new FooCommand { Message = "Hello world" }); // Close host _host.Close(); }
public void Given_service_by_default() { var service = new CommandsService(new ServerContext( broker: new CommandBrokerStub() )); _result = service.Get(""); }