@Test public void updateGlobalWhiteAddrsNormalTest() { System.setProperty("rocketmq.home.dir", "src/test/resources"); System.setProperty("rocketmq.acl.plain.file", "/conf/plain_acl_global_white_addrs.yml"); String targetFileName = "src/test/resources/conf/plain_acl_global_white_addrs.yml"; Map<String, Object> backUpAclConfigMap = AclUtils.getYamlDataObject(targetFileName, Map.class); PlainAccessValidator plainAccessValidator = new PlainAccessValidator(); List<String> globalWhiteAddrsList = new ArrayList<String>(); globalWhiteAddrsList.add("10.10.154.1"); globalWhiteAddrsList.add("10.10.154.2"); globalWhiteAddrsList.add("10.10.154.3"); plainAccessValidator.updateGlobalWhiteAddrsConfig(globalWhiteAddrsList); Map<String, Object> readableMap = AclUtils.getYamlDataObject(targetFileName, Map.class); List<String> globalWhiteAddrList = (List<String>)readableMap.get(AclConstants.CONFIG_GLOBAL_WHITE_ADDRS); Assert.assertTrue(globalWhiteAddrList.contains("10.10.154.1")); Assert.assertTrue(globalWhiteAddrList.contains("10.10.154.2")); Assert.assertTrue(globalWhiteAddrList.contains("10.10.154.3")); List<Map<String, Object>> dataVersions = (List<Map<String, Object>>) readableMap.get(AclConstants.CONFIG_DATA_VERSION); Assert.assertEquals(1,dataVersions.get(0).get(AclConstants.CONFIG_COUNTER)); AclUtils.writeDataObject(targetFileName, backUpAclConfigMap); }
@Override public boolean updateGlobalWhiteAddrsConfig(List<String> globalWhiteAddrsList) { return aclPlugEngine.updateGlobalWhiteAddrsConfig(globalWhiteAddrsList); }
PlainAccessValidator implements AccessValidator { @Override public boolean updateGlobalWhiteAddrsConfig(List<String> globalWhiteAddrsList) { return aclPlugEngine.updateGlobalWhiteAddrsConfig(globalWhiteAddrsList); } }
PlainAccessValidator implements AccessValidator { @Override public boolean updateGlobalWhiteAddrsConfig(List<String> globalWhiteAddrsList) { return aclPlugEngine.updateGlobalWhiteAddrsConfig(globalWhiteAddrsList); } PlainAccessValidator(); }
PlainAccessValidator implements AccessValidator { @Override public boolean updateGlobalWhiteAddrsConfig(List<String> globalWhiteAddrsList) { return aclPlugEngine.updateGlobalWhiteAddrsConfig(globalWhiteAddrsList); } 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 updateGlobalWhiteAddrsConfig(List<String> globalWhiteAddrsList) { return aclPlugEngine.updateGlobalWhiteAddrsConfig(globalWhiteAddrsList); } 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();  }