Ejemplo n.º 1
0
        internal static void InitSchedulerLogging()
        {
            LogManager.UnInitialize();
            //LogManager.LogConsumers.Add(new LogWriterToConsole());
            if (!LogManager.TelemetryConsumers.OfType <ConsoleTelemetryConsumer>().Any())
            {
                LogManager.TelemetryConsumers.Add(new ConsoleTelemetryConsumer());
            }

            var traceLevels = new[]
            {
                Tuple.Create("Scheduler", Severity.Verbose3),
                Tuple.Create("Scheduler.WorkerPoolThread", Severity.Verbose2),
            };

            LogManager.SetTraceLevelOverrides(new List <Tuple <string, Severity> >(traceLevels));

            var orleansConfig = new ClusterConfiguration();

            orleansConfig.StandardLoad();
            NodeConfiguration config = orleansConfig.CreateNodeConfigurationForSilo("Primary");

            StatisticsCollector.Initialize(config);
            SchedulerStatisticsGroup.Init();
        }
        internal static ILoggerFactory InitSchedulerLogging()
        {
            var filters = new LoggerFilterOptions();

            filters.AddFilter("Scheduler", LogLevel.Trace);
            filters.AddFilter("Scheduler.WorkerPoolThread", LogLevel.Trace);
            var orleansConfig = new ClusterConfiguration();

            orleansConfig.StandardLoad();
            NodeConfiguration config = orleansConfig.CreateNodeConfigurationForSilo("Primary");
            var loggerFactory        = TestingUtils.CreateDefaultLoggerFactory(TestingUtils.CreateTraceFileName(config.SiloName, orleansConfig.Globals.ClusterId), filters);

            return(loggerFactory);
        }
Ejemplo n.º 3
0
        public static void ClassInitialize(TestContext testContext)
        {
            hostName = Dns.GetHostName();
            logger   = TraceLogger.GetLogger("MembershipTablePluginTests", TraceLogger.LoggerType.Application);

            ClusterConfiguration cfg = new ClusterConfiguration();

            cfg.LoadFromFile("OrleansConfigurationForTesting.xml");
            TraceLogger.Initialize(cfg.CreateNodeConfigurationForSilo("Primary"));

            TraceLogger.AddTraceLevelOverride("AzureTableDataManager", Severity.Verbose3);
            TraceLogger.AddTraceLevelOverride("OrleansSiloInstanceManager", Severity.Verbose3);
            TraceLogger.AddTraceLevelOverride("Storage", Severity.Verbose3);
        }
Ejemplo n.º 4
0
        public void LogFileName()
        {
            var oc = new ClusterConfiguration();

            oc.StandardLoad();
            NodeConfiguration n     = oc.CreateNodeConfigurationForSilo("Node1");
            string            fname = n.TraceFileName;

            Assert.NotNull(fname);
            Assert.False(fname.Contains(":"), "Log file name should not contain colons.");

            // Check that .NET is happy with the file name
            var f = new FileInfo(fname);

            Assert.NotNull(f.Name);
            Assert.Equal(fname, f.Name);
        }
Ejemplo n.º 5
0
        public async Task SimpleUsageScenarioTest()
        {
            var endpoints = new EndpointsCollection
            {
                CreateEndpoint("OrleansSiloEndpoint", 9082),
                CreateEndpoint("OrleansProxyEndpoint", 8888)
            };

            activationContext.GetEndpoints().Returns(_ => endpoints);
            var siloHost = Substitute.For <ISiloHost>();
            var listener = new OrleansCommunicationListener(this.serviceContext, clusterConfig)
            {
                SiloHost = siloHost
            };

            siloHost.NodeConfig.Returns(_ => clusterConfig.CreateNodeConfigurationForSilo(listener.SiloName));

            var result = await listener.OpenAsync(CancellationToken.None);

            var publishedEndpoints = JsonConvert.DeserializeObject <OrleansFabricEndpoints>(result);

            var siloAddress = publishedEndpoints.SiloAddress;

            siloAddress.Generation.ShouldBeEquivalentTo(864);
            siloAddress.Endpoint.Port.ShouldBeEquivalentTo(9082);

            var gatewayAddress = publishedEndpoints.GatewayAddress;

            gatewayAddress.Generation.ShouldBeEquivalentTo(864);
            gatewayAddress.Endpoint.Port.ShouldBeEquivalentTo(8888);

            siloHost.ReceivedWithAnyArgs(1).Start(null, null);
            siloHost.DidNotReceive().Stop();

            siloHost.ClearReceivedCalls();
            await listener.CloseAsync(CancellationToken.None);

            siloHost.Received(1).Stop();
            siloHost.DidNotReceiveWithAnyArgs().Start(null, null);
        }