diff --git a/acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/AuthenticationInfoManagementAclPlugEngine.java b/acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/AuthenticationInfoManagementAclPlugEngine.java index 44b5245ae55b7c4997d53f69873f4256a0499dd7..6aac6bd438e0406abacc92c7034bee53d3430af8 100644 --- a/acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/AuthenticationInfoManagementAclPlugEngine.java +++ b/acl-plug/src/main/java/org/apache/rocketmq/acl/plug/engine/AuthenticationInfoManagementAclPlugEngine.java @@ -63,7 +63,7 @@ public abstract class AuthenticationInfoManagementAclPlugEngine implements AclPl accessControlAddressMap.put(accessControl.getNetaddress(), authenticationInfo); log.info("authenticationInfo is {}", authenticationInfo.toString()); } catch (Exception e) { - throw new AclPlugRuntimeException(accessControl.toString(), e); + throw new AclPlugRuntimeException(String.format("Exception info %s %s" ,e.getMessage() , accessControl.toString()), e); } } diff --git a/acl-plug/src/test/java/org/apache/rocketmq/acl/plug/engine/PlainAclPlugEngineTest.java b/acl-plug/src/test/java/org/apache/rocketmq/acl/plug/engine/PlainAclPlugEngineTest.java index 1b1707d17f91cbce8119a7870f2d89f2c4e05d34..d4e856f8c2a2526b0283ec6bf7bd6dee14f84a79 100644 --- a/acl-plug/src/test/java/org/apache/rocketmq/acl/plug/engine/PlainAclPlugEngineTest.java +++ b/acl-plug/src/test/java/org/apache/rocketmq/acl/plug/engine/PlainAclPlugEngineTest.java @@ -98,6 +98,20 @@ public class PlainAclPlugEngineTest { } + accessControl = new BorkerAccessControl(); + accessControl.setAccount("onlyNetAddress"); + accessControl.setPassword("aliyun11"); + accessControl.setNetaddress("127.0.0.1"); + accessControl.setRecognition("127.0.0.1:1"); + + accessControlTwo = new BorkerAccessControl(); + accessControlTwo.setAccount("listtransport"); + accessControlTwo.setPassword("aliyun1"); + accessControlTwo.setNetaddress("127.0.0.1"); + accessControlTwo.setRecognition("127.0.0.1:2"); + transport = new BorkerAccessControlTransport(); + transport.setOnlyNetAddress((BorkerAccessControl) accessControl); + loginInfoMap = new ConcurrentHashMap<>(); FieldSetter.setField(plainAclPlugEngine, plainAclPlugEngine.getClass().getSuperclass().getDeclaredField("loginInfoMap"), loginInfoMap); @@ -261,18 +275,18 @@ public class PlainAclPlugEngineTest { @Test public void getAuthenticationInfo() { - AccessControl AccessControl = new AccessControl(); - AccessControl.setAccount("rokcetmq"); - AccessControl.setPassword("aliyun11"); - AccessControl.setNetaddress("127.0.0.1"); - AccessControl.setRecognition("127.0.0.1:1"); + AccessControl accessControl = new AccessControl(); + accessControl.setAccount("rokcetmq"); + accessControl.setPassword("aliyun11"); + accessControl.setNetaddress("127.0.0.1"); + accessControl.setRecognition("127.0.0.1:1"); AuthenticationResult authenticationResult = new AuthenticationResult(); - plainAclPlugEngine.getAuthenticationInfo(AccessControl, authenticationResult); + plainAclPlugEngine.getAuthenticationInfo(accessControl, authenticationResult); Assert.assertEquals("Login information does not exist, Please check login, password, IP", authenticationResult.getResultString()); - plainAclPlugEngine.setAccessControl(accessControl); - AuthenticationInfo authenticationInfo = plainAclPlugEngine.getAuthenticationInfo(AccessControl, authenticationResult); + plainAclPlugEngine.setAccessControl(this.accessControl); + AuthenticationInfo authenticationInfo = plainAclPlugEngine.getAuthenticationInfo(accessControl, authenticationResult); Assert.assertNotNull(authenticationInfo); }