@Test public void updateAccessAclYamlConfigTest() { System.setProperty("rocketmq.home.dir", "src/test/resources"); System.setProperty("rocketmq.acl.plain.file", "/conf/plain_acl_update_create.yml"); String targetFileName = "src/test/resources/conf/plain_acl_update_create.yml"; Map<String, Object> backUpAclConfigMap = AclUtils.getYamlDataObject(targetFileName, Map.class); PlainAccessConfig plainAccessConfig = new PlainAccessConfig(); plainAccessConfig.setAccessKey("RocketMQ"); plainAccessConfig.setSecretKey("123456789111"); PlainAccessValidator plainAccessValidator = new PlainAccessValidator(); plainAccessValidator.updateAccessConfig(plainAccessConfig); Map<String, Object> readableMap = AclUtils.getYamlDataObject(targetFileName, Map.class); List<Map<String, Object>> accounts = (List<Map<String, Object>>)readableMap.get(AclConstants.CONFIG_ACCOUNTS); Map<String, Object> verifyMap = null; for (Map<String, Object> account : accounts) { if (account.get(AclConstants.CONFIG_ACCESS_KEY).equals(plainAccessConfig.getAccessKey())) { verifyMap = account; break; } } Assert.assertEquals(verifyMap.get(AclConstants.CONFIG_SECRET_KEY),"123456789111"); AclUtils.writeDataObject(targetFileName, backUpAclConfigMap); }
@Override public boolean updateAccessConfig(PlainAccessConfig plainAccessConfig) { return aclPlugEngine.updateAccessConfig(plainAccessConfig); }
PlainAccessValidator implements AccessValidator { @Override public boolean updateAccessConfig(PlainAccessConfig plainAccessConfig) { return aclPlugEngine.updateAccessConfig(plainAccessConfig); } }
PlainAccessValidator implements AccessValidator { @Override public boolean updateAccessConfig(PlainAccessConfig plainAccessConfig) { return aclPlugEngine.updateAccessConfig(plainAccessConfig); } PlainAccessValidator(); }
PlainAccessValidator implements AccessValidator { @Override public boolean updateAccessConfig(PlainAccessConfig plainAccessConfig) { return aclPlugEngine.updateAccessConfig(plainAccessConfig); } PlainAccessValidator(); @Override AccessResource parse(RemotingCommand request, String remoteAddr); @Override void validate(AccessResource accessResource); @Override boolean updateAccessConfig(PlainAccessConfig plainAccessConfig); @Override boolean deleteAccessConfig(String accesskey); @Override String getAclConfigVersion(); @Override boolean updateGlobalWhiteAddrsConfig(List<String> globalWhiteAddrsList); @Override AclConfig getAllAclConfig(); }
PlainAccessValidator implements AccessValidator { @Override public boolean updateAccessConfig(PlainAccessConfig plainAccessConfig) { return aclPlugEngine.updateAccessConfig(plainAccessConfig); } PlainAccessValidator(); @Override AccessResource parse(RemotingCommand request, String remoteAddr); @Override void validate(AccessResource accessResource); @Override boolean updateAccessConfig(PlainAccessConfig plainAccessConfig); @Override boolean deleteAccessConfig(String accesskey); @Override String getAclConfigVersion(); @Override boolean updateGlobalWhiteAddrsConfig(List<String> globalWhiteAddrsList); @Override AclConfig getAllAclConfig();  }