ClearSSLSessions now takes a regex to match agents.
Showing
1 changed file
with
20 additions
and
0 deletions
| ... | @@ -18,6 +18,7 @@ using System.ComponentModel; | ... | @@ -18,6 +18,7 @@ using System.ComponentModel; |
| 18 | using System.IO; | 18 | using System.IO; |
| 19 | using System.Collections.Specialized; | 19 | using System.Collections.Specialized; |
| 20 | using System.Net; | 20 | using System.Net; |
| 21 | using System.Text.RegularExpressions; | ||
| 21 | 22 | ||
| 22 | namespace LIL_VSTT_Plugins | 23 | namespace LIL_VSTT_Plugins |
| 23 | { | 24 | { |
| ... | @@ -28,8 +29,27 @@ namespace LIL_VSTT_Plugins | ... | @@ -28,8 +29,27 @@ namespace LIL_VSTT_Plugins |
| 28 | [Description("(C) Copyright 2018 LIGHTS IN LINE AB\r\nDisables SSL Session Cache and Reuse of handshakes during this loadtest. Beta.")] | 29 | [Description("(C) Copyright 2018 LIGHTS IN LINE AB\r\nDisables SSL Session Cache and Reuse of handshakes during this loadtest. Beta.")] |
| 29 | public class ClearSSLSessions : ILoadTestPlugin | 30 | public class ClearSSLSessions : ILoadTestPlugin |
| 30 | { | 31 | { |
| 32 | [DisplayName("Agents RegEx")] | ||
| 33 | [Description("The regular expression must match the Agent Name if specified. Empty matches all agents.")] | ||
| 34 | [DefaultValue("")] | ||
| 35 | public string AgentRegEx | ||
| 36 | { | ||
| 37 | get; set; | ||
| 38 | } | ||
| 39 | |||
| 31 | public void Initialize(LoadTest loadTest) | 40 | public void Initialize(LoadTest loadTest) |
| 32 | { | 41 | { |
| 42 | if(!String.IsNullOrEmpty(AgentRegEx)) | ||
| 43 | { | ||
| 44 | Regex r = new Regex(AgentRegEx); | ||
| 45 | if (!r.IsMatch(loadTest.Context.AgentName)) | ||
| 46 | { | ||
| 47 | // Just in case, run undoIt() restoring default behaviour | ||
| 48 | loadTest.LoadTestStarting += new EventHandler(mLoadTest_Finished); | ||
| 49 | return; | ||
| 50 | } | ||
| 51 | } | ||
| 52 | // If we get here, either the agent matches, or no regex has been given so we run on all agents. | ||
| 33 | loadTest.LoadTestStarting += new EventHandler(mLoadTest_Starting); | 53 | loadTest.LoadTestStarting += new EventHandler(mLoadTest_Starting); |
| 34 | loadTest.LoadTestFinished += new EventHandler(mLoadTest_Finished); | 54 | loadTest.LoadTestFinished += new EventHandler(mLoadTest_Finished); |
| 35 | loadTest.LoadTestAborted += new EventHandler<LoadTestAbortedEventArgs>(mLoadTest_Aborted); | 55 | loadTest.LoadTestAborted += new EventHandler<LoadTestAbortedEventArgs>(mLoadTest_Aborted); | ... | ... |
-
Please register or sign in to post a comment