Beispiel #1
0
        public ServerTest(ITestOutputHelper output) : base(output)
        {
            _output = output;
            UserStateFactory.ResetId();

            _serverPort = BaseServerPort.GetAndIncrement();
            _server     = ServerFactory.StartWith(World.Stage, Resources, _serverPort, new Configuration.SizingConf(1, 1, 100, 10240), new Configuration.TimingConf(10, 1, 1000));
            Assert.True(_server.StartUp().Await(TimeSpan.FromMilliseconds(500L)));

            _progress = new Progress();

            _consumer = World.ActorFor <IResponseChannelConsumer>(() => new TestResponseChannelConsumer(_progress));

            _client = new BasicClientRequestResponseChannel(Address.From(Host.Of("localhost"), _serverPort, AddressType.None), _consumer, 100, 10240, World.DefaultLogger);
        }
    public FeedResourceTest(ITestOutputHelper output)
    {
        var converter = new Converter(output);

        Console.SetOut(converter);

        var world = World.StartWithDefaults("test-stream-userResource");

        var testServerPort = ServerPort.IncrementAndGet();

        var properties = new Dictionary <string, string>();

        properties.Add("server.http.port", testServerPort.ToString());
        properties.Add("server.dispatcher.pool", "10");
        properties.Add("server.buffer.pool.size", "100");
        properties.Add("server.message.buffer.size", "65535");
        properties.Add("server.probe.interval", "2");
        properties.Add("server.probe.timeout", "2");
        properties.Add("server.processor.pool.size", "10");
        properties.Add("server.request.missing.content.timeout", "100");

        properties.Add("feed.resource.name.events", FeedURI);
        properties.Add("feed.resource.events.producer.class", "Vlingo.Xoom.Http.Tests.Resource.Feed.EventsFeedProducerActor");
        properties.Add("feed.resource.events.elements", "5");
        properties.Add("feed.resource.events.pool", "10");

        var httpProperties = HttpProperties.Instance;

        httpProperties.SetCustomProperties(properties);

        var server = ServerFactory.StartWith(world.Stage, httpProperties);

        Assert.True(server.StartUp().Await(TimeSpan.FromMilliseconds(500)));

        _progress = new Progress();
        var consumer = world.ActorFor <IResponseChannelConsumer>(() => new TestResponseChannelConsumer(_progress));

        _client = new BasicClientRequestResponseChannel(Address.From(Host.Of("localhost"), testServerPort, AddressType.None), consumer, 100, 10240, world.DefaultLogger);
    }
Beispiel #3
0
        public SinglePageApplicationResourceTest(ITestOutputHelper output)
        {
            var converter = new Converter(output);

            Console.SetOut(converter);

            _world = World.StartWithDefaults("static-file-resources");

            var serverPort = BaseServerPort.GetAndIncrement();

            var resources = Resources.Are(new SinglePageApplicationResource(ContentRoot, ContextPath).Routes());
            var sizing    = Configuration.SizingConf.DefineWith(2, 10, 100, 65535);
            var timing    = Configuration.TimingConf.DefineWith(2, 2, 100);

            _server = ServerFactory.StartWith(_world.Stage, resources, serverPort, sizing, timing);
            Assert.True(_server.StartUp().Await(TimeSpan.FromMilliseconds(500)));

            _progress = new Progress();
            var consumer = _world.ActorFor <IResponseChannelConsumer>(() => new TestResponseChannelConsumer(_progress));

            _client = new BasicClientRequestResponseChannel(
                Address.From(Host.Of("localhost"), serverPort, AddressType.None), consumer, 100, 10240,
                _world.DefaultLogger);
        }
Beispiel #4
0
        public StaticFilesResourceTest(ITestOutputHelper output)
        {
            var converter = new Converter(output);

            Console.SetOut(converter);

            _world = World.StartWithDefaults("static-file-resources");

            var serverPort = BaseServerPort.GetAndIncrement();

            var properties = new Dictionary <string, string>();

            properties.Add("server.http.port", serverPort.ToString());
            properties.Add("server.dispatcher.pool", "10");
            properties.Add("server.buffer.pool.size", "100");
            properties.Add("server.message.buffer.size", "65535");
            properties.Add("server.probe.interval", "2");
            properties.Add("server.probe.timeout", "2");
            properties.Add("server.processor.pool.size", "10");
            properties.Add("server.request.missing.content.timeout", "100");

            properties.Add("static.files.resource.pool", "5");
            _contentRoot = $"Vlingo.Xoom.Http.Tests.Content";
            properties.Add("static.files.resource.root", _contentRoot);
            properties.Add("static.files.resource.subpaths", "[/, /css, /js, /views]");

            properties.Add("feed.producer.name.events", "/feeds/events");
            properties.Add("feed.producer.events.class", "Vlingo.Xoom.Http.Tests.Resource.Feed.EventsFeedProducerActor");
            properties.Add("feed.producer.events.payload", "20");
            properties.Add("feed.producer.events.pool", "10");

            properties.Add("sse.stream.name.all", "/eventstreams/all");
            properties.Add("sse.stream.all.feed.class", "Vlingo.Xoom.Http.Tests.Sample.User.AllSseFeedActor");
            properties.Add("sse.stream.all.feed.payload", "50");
            properties.Add("sse.stream.all.feed.interval", "1000");
            properties.Add("sse.stream.all.feed.default.id", "-1");
            properties.Add("sse.stream.all.pool", "10");

            properties.Add("resource.name.profile", "[define, query]");

            properties.Add("resource.profile.handler", "Vlingo.Xoom.Http.Tests.Sample.User.ProfileResource");
            properties.Add("resource.profile.pool", "5");
            properties.Add("resource.profile.disallowPathParametersWithSlash", "false");

            properties.Add("action.profile.define.method", "PUT");
            properties.Add("action.profile.define.uri", "/users/{userId}/profile");
            properties.Add("action.profile.define.to",
                           "define(string userId, body:Vlingo.Xoom.Http.Tests.Sample.User.ProfileData profileData)");
            properties.Add("action.profile.define.mapper", "Vlingo.Xoom.Http.Tests.Sample.User.ProfileDataMapper");

            properties.Add("action.profile.query.method", "GET");
            properties.Add("action.profile.query.uri", "/users/{userId}/profile");
            properties.Add("action.profile.query.to", "query(string userId)");
            properties.Add("action.profile.query.mapper", "Vlingo.Xoom.Http.Tests.Sample.User.ProfileDataMapper");

            var httpProperties = HttpProperties.Instance;

            httpProperties.SetCustomProperties(properties);

            var server = ServerFactory.StartWith(_world.Stage, httpProperties);

            Assert.True(server.StartUp().Await(TimeSpan.FromMilliseconds(500L)));

            _progress = new Progress();
            var consumer = _world.ActorFor <IResponseChannelConsumer>(
                () => new TestResponseChannelConsumer(_progress));

            _client = new BasicClientRequestResponseChannel(
                Address.From(Host.Of("localhost"), serverPort, AddressType.None), consumer, 100, 10240,
                _world.DefaultLogger);
        }