public WorkflowExecutionLoggingSteps(ScenarioContext scenarioContext, FeatureContext featureContext) { _scenarioContext = scenarioContext ?? throw new ArgumentNullException(nameof(scenarioContext)); _environmentModel = featureContext.Get <IServer>("environmentModel") ?? throw new ArgumentNullException(nameof(featureContext)); _performanceCounterLocater = featureContext.Get <WarewolfPerformanceCounterManager>("performanceCounterLocater"); _principal = featureContext.Get <IPrincipal>("principal"); _environment = BuildExecutionEnvironmet(); }
private static void Setup() { ConnectAndLoadServer(); Assert.IsTrue(_environmentModel.ResourceRepository.All().Count >= EXPECTED_NUMBER_OF_RESOURCES, $"This test expects {EXPECTED_NUMBER_OF_RESOURCES} resources on localhost but there are only {_environmentModel.ResourceRepository.All().Count}."); _performanceCounterLocater = BuildPerfomanceCounter(); FeatureContext.Current.Add("performanceCounterLocater", _performanceCounterLocater); _principal = BuildPrincipal(); FeatureContext.Current.Add("principal", _principal); }
public void PerformanceCounterManager_CreateAndRetrieve_CreateUnknownCreatesEmpty() { WarewolfPerformanceCounterRegister register = new WarewolfPerformanceCounterRegister(new List <IPerformanceCounter> { new WarewolfCurrentExecutionsPerformanceCounter(), new WarewolfNumberOfErrors(), new WarewolfRequestsPerSecondPerformanceCounter(), new WarewolfAverageExecutionTimePerformanceCounter(), new WarewolfNumberOfAuthErrors(), new WarewolfServicesNotFoundCounter(), }, new List <IResourcePerformanceCounter>()); var manager = new WarewolfPerformanceCounterManager(register.Counters, new List <IResourcePerformanceCounter>(), register, new Mock <IPerformanceCounterPersistence>().Object); manager.CreateCounter(guid, WarewolfPerfCounterType.NotAuthorisedErrors, "bob"); var counter = manager.GetCounter(guid, WarewolfPerfCounterType.NotAuthorisedErrors).FromSafe() as IResourcePerformanceCounter; Assert.IsTrue(counter is EmptyCounter); }
public void TestManagerLocater_ReturnsSameCounter() { WarewolfPerformanceCounterRegister register = new WarewolfPerformanceCounterRegister(new List <IPerformanceCounter> { new WarewolfCurrentExecutionsPerformanceCounter(), new WarewolfNumberOfErrors(), new WarewolfRequestsPerSecondPerformanceCounter(), new WarewolfAverageExecutionTimePerformanceCounter(), new WarewolfNumberOfAuthErrors(), new WarewolfServicesNotFoundCounter(), }, new List <IResourcePerformanceCounter>()); var manager = new WarewolfPerformanceCounterManager(register.Counters, new List <IResourcePerformanceCounter>(), register, new Mock <IPerformanceCounterPersistence>().Object); var counter = manager.GetCounter(WarewolfPerfCounterType.ConcurrentRequests).FromSafe();; var counter2 = manager.GetCounter("Concurrent requests currently executing").FromSafe();; Assert.AreEqual(counter, counter2); }
public void Init() { try { try { PerformanceCounterCategory.Delete("Warewolf"); PerformanceCounterCategory.Delete("Warewolf Services"); } // ReSharper disable once EmptyGeneralCatchClause catch { } WarewolfPerformanceCounterRegister register = new WarewolfPerformanceCounterRegister(new List <IPerformanceCounter> { new WarewolfCurrentExecutionsPerformanceCounter(), new WarewolfNumberOfErrors(), new WarewolfRequestsPerSecondPerformanceCounter(), new WarewolfAverageExecutionTimePerformanceCounter(), new WarewolfNumberOfAuthErrors(), new WarewolfServicesNotFoundCounter(), }, new List <IResourcePerformanceCounter> { new WarewolfCurrentExecutionsPerformanceCounterByResource(Guid.Empty, ""), new WarewolfNumberOfErrorsByResource(Guid.Empty, ""), new WarewolfRequestsPerSecondPerformanceCounterByResource(Guid.Empty, ""), new WarewolfAverageExecutionTimePerformanceCounterByResource(Guid.Empty, ""), }); var manager = new WarewolfPerformanceCounterManager(register.Counters, new List <IResourcePerformanceCounter>(), register, new Mock <IPerformanceCounterPersistence>().Object); manager.CreateCounter(guid, WarewolfPerfCounterType.ExecutionErrors, "bob"); manager.CreateCounter(guid, WarewolfPerfCounterType.AverageExecutionTime, "bob"); manager.CreateCounter(guid, WarewolfPerfCounterType.RequestsPerSecond, "bob"); manager.CreateCounter(guid, WarewolfPerfCounterType.ConcurrentRequests, "bob"); CustomContainer.Register <IWarewolfPerformanceCounterLocater>(manager); } catch (Exception err) { // ignored Dev2Logger.Error(err); } }
public void Init() { try { try { PerformanceCounterCategory.Delete(CategoryName); PerformanceCounterCategory.Delete("Warewolf Services"); } catch { } var performanceCounterFactory = new Mock <IRealPerformanceCounterFactory>().Object; var register = new WarewolfPerformanceCounterRegister(new List <IPerformanceCounter> { new WarewolfCurrentExecutionsPerformanceCounter(performanceCounterFactory), new WarewolfNumberOfErrors(performanceCounterFactory), new WarewolfRequestsPerSecondPerformanceCounter(performanceCounterFactory), new WarewolfAverageExecutionTimePerformanceCounter(performanceCounterFactory), new WarewolfNumberOfAuthErrors(performanceCounterFactory), new WarewolfServicesNotFoundCounter(performanceCounterFactory), }, new List <IResourcePerformanceCounter> { new WarewolfCurrentExecutionsPerformanceCounterByResource(Guid.Empty, "", performanceCounterFactory), new WarewolfNumberOfErrorsByResource(Guid.Empty, "", performanceCounterFactory), new WarewolfRequestsPerSecondPerformanceCounterByResource(Guid.Empty, "", performanceCounterFactory), new WarewolfAverageExecutionTimePerformanceCounterByResource(Guid.Empty, "", performanceCounterFactory), }); var manager = new WarewolfPerformanceCounterManager(register.Counters, new List <IResourcePerformanceCounter>(), register, new Mock <IPerformanceCounterPersistence>().Object, performanceCounterFactory); manager.CreateCounter(ResourceGuid, WarewolfPerfCounterType.ExecutionErrors, "bob"); manager.CreateCounter(ResourceGuid, WarewolfPerfCounterType.AverageExecutionTime, "bob"); manager.CreateCounter(ResourceGuid, WarewolfPerfCounterType.RequestsPerSecond, "bob"); manager.CreateCounter(ResourceGuid, WarewolfPerfCounterType.ConcurrentRequests, "bob"); CustomContainer.Register <IWarewolfPerformanceCounterLocater>(manager); } catch (Exception err) { // ignored Dev2Logger.Error(err, GlobalConstants.WarewolfError); } }
public void PerformanceCounterManager_Remove_ExpectEmptyValidFromRetrieve() { var register = new WarewolfPerformanceCounterRegister(new List <IPerformanceCounter> { new WarewolfCurrentExecutionsPerformanceCounter(), new WarewolfNumberOfErrors(), new WarewolfRequestsPerSecondPerformanceCounter(), new WarewolfAverageExecutionTimePerformanceCounter(), new WarewolfNumberOfAuthErrors(), new WarewolfServicesNotFoundCounter(), }, new List <IResourcePerformanceCounter>()); var manager = new WarewolfPerformanceCounterManager(register.Counters, new List <IResourcePerformanceCounter>(), register, new Mock <IPerformanceCounterPersistence>().Object); manager.CreateCounter(guid, WarewolfPerfCounterType.ExecutionErrors, "bob"); manager.RemoverCounter(guid, WarewolfPerfCounterType.ExecutionErrors, "bob"); var counter = manager.GetCounter(guid, WarewolfPerfCounterType.ExecutionErrors).FromSafe() as IResourcePerformanceCounter; Assert.IsNotNull(manager.EmptyCounter); Assert.IsNotNull(counter); Assert.IsTrue(counter is EmptyCounter); }
static void LoadPerformanceCounters() { try { var perf = new PerformanceCounterPersistence(new FileWrapper()); var register = new WarewolfPerformanceCounterRegister(perf.LoadOrCreate(), perf.LoadOrCreateResourcesCounters(perf.DefaultResourceCounters)); var locater = new WarewolfPerformanceCounterManager(register.Counters, register.ResourceCounters, register, perf); locater.CreateCounter(Guid.Parse("a64fc548-3045-407d-8603-2a7337d874a6"), WarewolfPerfCounterType.ExecutionErrors, "workflow1"); locater.CreateCounter(Guid.Parse("a64fc548-3045-407d-8603-2a7337d874a6"), WarewolfPerfCounterType.AverageExecutionTime, "workflow1"); locater.CreateCounter(Guid.Parse("a64fc548-3045-407d-8603-2a7337d874a6"), WarewolfPerfCounterType.ConcurrentRequests, "workflow1"); locater.CreateCounter(Guid.Parse("a64fc548-3045-407d-8603-2a7337d874a6"), WarewolfPerfCounterType.RequestsPerSecond, "workflow1"); CustomContainer.Register <IWarewolfPerformanceCounterLocater>(locater); CustomContainer.Register <IPerformanceCounterRepository>(locater); } catch (Exception err) { // ignored Dev2Logger.Error(err, GlobalConstants.WarewolfError); } }
public void PerformanceCounterManager_CreateAndRetrieve_CreateAndRetrieve_ExpectValid() { WarewolfPerformanceCounterRegister register = new WarewolfPerformanceCounterRegister(new List <IPerformanceCounter> { new WarewolfCurrentExecutionsPerformanceCounter(), new WarewolfNumberOfErrors(), new WarewolfRequestsPerSecondPerformanceCounter(), new WarewolfAverageExecutionTimePerformanceCounter(), new WarewolfNumberOfAuthErrors(), new WarewolfServicesNotFoundCounter(), }, new List <IResourcePerformanceCounter>()); var manager = new WarewolfPerformanceCounterManager(register.Counters, new List <IResourcePerformanceCounter>(), register, new Mock <IPerformanceCounterPersistence>().Object); manager.CreateCounter(guid, WarewolfPerfCounterType.ExecutionErrors, "bob"); var counter = manager.GetCounter(guid, WarewolfPerfCounterType.ExecutionErrors).FromSafe() as IResourcePerformanceCounter; Assert.IsNotNull(manager.EmptyCounter); Assert.IsNotNull(counter); Assert.IsFalse(counter is EmptyCounter); Assert.AreEqual("bob", counter.CategoryInstanceName); Assert.AreEqual(counter.ResourceId, guid); }