public JwtCreateProviderService(Dictionary <string, IDataService <object> > dataServices, JwtProviderServiceConfig config, HystrixCommandFactory hystrixCommandFactory, ILogger <JwtCreateProviderService> logger) : base(dataServices, config, hystrixCommandFactory, logger) { _config = config; //_claimsDataService = // dataServices.GetValue<IDataService<Claim>>("ClaimsDataService"); }
public void Returns_Empty_List_If_No_HystrixCommand_Has_Been_Created() { var factory = new HystrixCommandFactory(defaultOptions); // Act IEnumerable <IHystrixCommand> list = factory.GetAllHystrixCommands(); Assert.Equal(0, list.Count()); }
public void Returns_Instance_Of_Type_IHystrixCommand() { var factory = new HystrixCommandFactory(defaultOptions); // Act var hystrixCommand = factory.GetHystrixCommand("groupA", "commandX"); Assert.NotNull(hystrixCommand); Assert.IsType <HystrixCommand>(hystrixCommand); }
public StoryService(Dictionary <string, IDataService <object> > dataServices, IDataServiceConfig config, HystrixCommandFactory hystrixCommandFactory, ILogger <IDataService <Story> > logger) : base(dataServices, config, hystrixCommandFactory, logger) { if (!dataServices.ContainsKey("StoryDataService")) { throw new ArgumentNullException("AuthenticatedIdentity", "AuthenticatedIdentity required in parameters"); } }
public void Returns_Instance_Of_Type_IHystrixCommand() { var factory = new HystrixCommandFactory(); // act var hystrixCommand = factory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); Assert.NotNull(hystrixCommand); Assert.IsType <HystrixCommand>(hystrixCommand); }
public void Returns_Different_Instance_For_Different_CommandIdentifier() { var factory = new HystrixCommandFactory(defaultOptions); var firstHystrixCommand = factory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); // Act var secondHystrixCommand = factory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandY")); Assert.NotSame(firstHystrixCommand, secondHystrixCommand); }
public void Returns_Same_Instance_For_CommandIdentifier_With_Same_GroupKey_And_CommandKey() { var factory = new HystrixCommandFactory(defaultOptions); var firstHystrixCommand = factory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); // Act var secondHystrixCommand = factory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); Assert.Same(firstHystrixCommand, secondHystrixCommand); }
public void Returns_Same_Instance_For_CommandIdentifier_With_Same_GroupKey_And_CommandKey_From_Different_Factories() { var firstFactory = new HystrixCommandFactory(); var firstHystrixCommand = firstFactory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); var secondFactory = new HystrixCommandFactory(); // act var secondHystrixCommand = secondFactory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); Assert.Same(firstHystrixCommand, secondHystrixCommand); }
public async Task Returns_Json_String_In_Hystrix_Format_For_HystrixCommand() { HystrixCommandFactory commandFactory = new HystrixCommandFactory(); int pollingInterval = 1000; var endpoint = new HystrixMetricsStreamEndpoint(commandFactory, pollingInterval); var hystrixCommand = commandFactory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); // act var commandJson = await endpoint.GetCommandJson(hystrixCommand); Assert.NotNull(commandJson); }
public async Task Writes_Command_Json_For_All_HystrixCommands_To_OutputStream() { HystrixCommandFactory commandFactory = new HystrixCommandFactory(new HystrixOptions()); int pollingInterval = 1000; var endpoint = new HystrixMetricsStreamEndpoint(commandFactory, pollingInterval); commandFactory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); commandFactory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandY")); // Act await endpoint.WriteAllCommandsJsonToOutputStream(new MemoryStream(), CancellationToken.None); }
public void Returns_List_With_All_Previously_Created_HystrixCommands() { var factory = new HystrixCommandFactory(defaultOptions); factory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); factory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandY")); // Act IEnumerable <IHystrixCommand> list = factory.GetAllHystrixCommands(); Assert.Equal(2, list.Count()); }
//[Fact] public void LoadTest() { IHystrixCommandFactory factory = new HystrixCommandFactory(defaultOptions); Stopwatch stopwatch = Stopwatch.StartNew(); for (int i = 0; i < 100000; i++) { var hystrixCommand = factory.GetHystrixCommand("group", "key" + (i % 10)); } stopwatch.Stop(); Assert.Equal(50, stopwatch.Elapsed.Milliseconds); // 540, 114 }
public async Task Writes_Command_Json_For_All_HystrixCommands_To_OutputStream() { HystrixCommandFactory commandFactory = new HystrixCommandFactory(); int pollingInterval = 1000; var endpoint = new HystrixMetricsStreamEndpoint(commandFactory, pollingInterval); commandFactory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandX")); commandFactory.GetHystrixCommand(new HystrixCommandIdentifier("groupA", "commandY")); var httpResponseMock = new Mock <HttpResponseBase>(); httpResponseMock.Setup(x => x.OutputStream).Returns(new MemoryStream()); // act await endpoint.WriteAllCommandsJsonToOutputStream(httpResponseMock.Object); }
public WriteAllCommandsJsonToOutputStream() { HystrixCommandFactory.Clear(); }
public GetCommandJson() { HystrixCommandFactory.Clear(); }
public Constructor() { HystrixCommandFactory.Clear(); }
public Container(Dictionary <string, IDataService <object> > dataServices, IDataServiceConfig config, HystrixCommandFactory hystrixCommandFactory, ILogger <IDataService <T> > logger) : base(config, hystrixCommandFactory, logger) { _dataServices = dataServices ?? throw new ArgumentNullException(nameof(dataServices)); }
public GetAllHystrixCommands() { HystrixCommandFactory.Clear(); }
public ProviderServiceBase(IDataServiceConfig config, HystrixCommandFactory hystrixCommandFactory, ILogger <IDataService <T> > logger) : base(config, hystrixCommandFactory, logger) { }
public GetHystrixCommand_With_GroupKey_And_CommandKey() { HystrixCommandFactory.Clear(); }
public GetHystrixCommand() { HystrixCommandFactory.Clear(); }