@Test public void deleteAccessAclYamlConfigNormalTest() { System.setProperty("rocketmq.home.dir", "src/test/resources"); System.setProperty("rocketmq.acl.plain.file", "/conf/plain_acl_delete.yml"); String targetFileName = "src/test/resources/conf/plain_acl_delete.yml"; Map<String, Object> backUpAclConfigMap = AclUtils.getYamlDataObject(targetFileName, Map.class); String accessKey = "rocketmq2"; PlainAccessValidator plainAccessValidator = new PlainAccessValidator(); plainAccessValidator.deleteAccessConfig(accessKey); 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(accessKey)) { verifyMap = account; break; } } Assert.assertEquals(verifyMap,null); 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 deleteAccessConfig(String accesskey) { return aclPlugEngine.deleteAccessConfig(accesskey); }
PlainAccessValidator implements AccessValidator { @Override public boolean deleteAccessConfig(String accesskey) { return aclPlugEngine.deleteAccessConfig(accesskey); } }
PlainAccessValidator implements AccessValidator { @Override public boolean deleteAccessConfig(String accesskey) { return aclPlugEngine.deleteAccessConfig(accesskey); } PlainAccessValidator(); }
PlainAccessValidator implements AccessValidator { @Override public boolean deleteAccessConfig(String accesskey) { return aclPlugEngine.deleteAccessConfig(accesskey); } 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 deleteAccessConfig(String accesskey) { return aclPlugEngine.deleteAccessConfig(accesskey); } 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();  }