jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject [jmeter] 02/03: Minor cleanup + mention contributor
Date Sun, 25 Oct 2020 08:36:07 GMT
This is an automated email from the ASF dual-hosted git repository.

pmouawad pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit eb03d31a49ccae7781cea32df5da440894fec97e
Author: pmouawad <p.mouawad@ubik-ingenierie.com>
AuthorDate: Sun Oct 25 09:35:01 2020 +0100

    Minor cleanup + mention contributor
---
 .../org/apache/jmeter/util/SecurityProviderLoader.java    |  4 ++--
 .../apache/jmeter/util/SecurityProviderLoaderTest.java    | 15 +++++++--------
 xdocs/changes.xml                                         |  2 ++
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/core/src/main/java/org/apache/jmeter/util/SecurityProviderLoader.java b/src/core/src/main/java/org/apache/jmeter/util/SecurityProviderLoader.java
index 203dac7..656ee35 100644
--- a/src/core/src/main/java/org/apache/jmeter/util/SecurityProviderLoader.java
+++ b/src/core/src/main/java/org/apache/jmeter/util/SecurityProviderLoader.java
@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
 
 public class SecurityProviderLoader {
     private static final Logger log = LoggerFactory.getLogger(SecurityProviderLoader.class);
+    private static final Pattern CONFIGURATION_REGEX = Pattern.compile("^(?<classname>[^:]+)(:(?<position>\\d+)(:(?<config>.+))?)?$");
 
     public static void addSecurityProvider(Properties properties) {
         properties.keySet().stream()
@@ -39,8 +40,7 @@ public class SecurityProviderLoader {
     }
 
     public static void addSecurityProvider(String securityProviderConfig) {
-        Pattern regex = Pattern.compile("^(?<classname>[^:]+)(:(?<position>\\d+)(:(?<config>.+))?)?$");
-        Matcher matcher = regex.matcher(securityProviderConfig);
+        Matcher matcher = CONFIGURATION_REGEX.matcher(securityProviderConfig);
 
         if (matcher.matches()) {
             final String classname = matcher.group("classname");
diff --git a/src/core/src/test/java/org/apache/jmeter/util/SecurityProviderLoaderTest.java
b/src/core/src/test/java/org/apache/jmeter/util/SecurityProviderLoaderTest.java
index 38c9e45..8b9f110 100644
--- a/src/core/src/test/java/org/apache/jmeter/util/SecurityProviderLoaderTest.java
+++ b/src/core/src/test/java/org/apache/jmeter/util/SecurityProviderLoaderTest.java
@@ -32,7 +32,7 @@ import org.junit.jupiter.params.provider.ValueSource;
 public class SecurityProviderLoaderTest {
 
     @AfterEach
-    public void removeAllDummProviders() {
+    public void removeAllDummyProviders() {
         Security.removeProvider(DummyProvider.PROVIDER_NAME);
         Security.removeProvider(DummyProviderWithConfig.PROVIDER_NAME);
         Assert.assertNull(Security.getProvider(DummyProvider.PROVIDER_NAME));
@@ -41,11 +41,10 @@ public class SecurityProviderLoaderTest {
 
     @Test
     public void addSecurityProviderTest() {
-        removeAllDummProviders();
+        removeAllDummyProviders();
         Provider[] providers = Security.getProviders();
         int providersCountBefore = providers.length;
 
-
         SecurityProviderLoader.addSecurityProvider(DummyProvider.class.getName());
 
         Provider[] providers_after = Security.getProviders();
@@ -63,7 +62,7 @@ public class SecurityProviderLoaderTest {
 
     @Test
     public void addSecurityProviderTestWithConfigForUnconfigurableProvider() {
-        removeAllDummProviders();
+        removeAllDummyProviders();
         int providersCountBefore = Security.getProviders().length;
 
         SecurityProviderLoader.addSecurityProvider(DummyProvider.class.getName()+":0:Configure");
@@ -79,7 +78,7 @@ public class SecurityProviderLoaderTest {
 
     @Test
     public void addUnknownSecurityProviderTest() {
-        removeAllDummProviders();
+        removeAllDummyProviders();
         int providersCountBefore = Security.getProviders().length;
 
         SecurityProviderLoader.addSecurityProvider("org.apache.jmeter.util.SecurityProviderLoaderTest.UnknownProvider");
@@ -93,7 +92,7 @@ public class SecurityProviderLoaderTest {
     @ParameterizedTest
     @ValueSource(ints = {0, 1, 2, 3})
     public void addSecurityProviderWithPositionTest(int position) {
-        removeAllDummProviders();
+        removeAllDummyProviders();
         int providersCountBefore = Security.getProviders().length;
 
         SecurityProviderLoader.addSecurityProvider(DummyProvider.class.getName() + ":" +
position);
@@ -110,7 +109,7 @@ public class SecurityProviderLoaderTest {
     @ParameterizedTest
     @CsvSource({":0:TestConfig,0", ":2:TEST,2", ":3:TEST,3"})
     public void addSecurityProviderWithPositionAndConfigTest(String config, int position)
{
-        removeAllDummProviders();
+        removeAllDummyProviders();
         int providersCountBefore = Security.getProviders().length;
 
         SecurityProviderLoader.addSecurityProvider(DummyProviderWithConfig.class.getName()
+ config);
@@ -129,7 +128,7 @@ public class SecurityProviderLoaderTest {
 
     @Test
     public void addSecurityProvidersViaProperties() {
-        removeAllDummProviders();
+        removeAllDummyProviders();
         int providersCountBefore = Security.getProviders().length;
 
         Properties properties = new Properties();
diff --git a/xdocs/changes.xml b/xdocs/changes.xml
index 72da838..ec93955 100644
--- a/xdocs/changes.xml
+++ b/xdocs/changes.xml
@@ -123,6 +123,7 @@ applications when JMeter is starting up.</p>
   <li><bug>64581</bug>Allow SampleResult#setIgnore to influence behaviour
on Sampler Error</li>
   <li><bug>64680</bug>Fall back to <code>JMETER_HOME</code>
on startup to detect JMeter's installation directory</li>
   <li><bug>64787</bug><pr>630</pr>Add Korean translation. Contributed
by Woonsan Ko (woonsan at apache.org)</li>
+  <li><bug>64776</bug>Add the ability to install additional SecurityProvider.
Contributed by Timo (ASF.Software.Timo at Leefers.eu)</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>
@@ -239,6 +240,7 @@ applications when JMeter is starting up.</p>
   <li>Pooja Chandak (poojachandak002 at gmail.com)</li>
   <li>Vincent Daburon (vdaburon at gmail.com)</li>
   <li>Woonsan Ko (woonsan at apache.org)</li>
+  <li>Timo (ASF.Software.Timo at Leefers.eu)</li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter.</p>
 <ul>


Mime
View raw message