@Test public void testIsAggrDataId() { List<String> list = new ArrayList<String>(); list.add("com.taobao.jiuren.*"); list.add("NS_NACOS_SUBSCRIPTION_TOPIC_*"); list.add("com.taobao.tae.AppListOnGrid-*"); AggrWhitelist.compile(list); assertFalse(AggrWhitelist.isAggrDataId("com.abc")); assertFalse(AggrWhitelist.isAggrDataId("com.taobao.jiuren")); assertFalse(AggrWhitelist.isAggrDataId("com.taobao.jiurenABC")); assertTrue(AggrWhitelist.isAggrDataId("com.taobao.jiuren.abc")); assertTrue(AggrWhitelist.isAggrDataId("NS_NACOS_SUBSCRIPTION_TOPIC_abc")); assertTrue(AggrWhitelist.isAggrDataId("com.taobao.tae.AppListOnGrid-abc")); }
public static boolean isAggrDataId(String dataId) { if (null == dataId) { throw new IllegalArgumentException("dataId is null"); } for (Pattern pattern : AGGR_DATAID_WHITELIST.get()) { if (pattern.matcher(dataId).matches()) { return true; } } return false; }
AggrWhitelist { public static boolean isAggrDataId(String dataId) { if (null == dataId) { throw new IllegalArgumentException("dataId is null"); } for (Pattern pattern : AGGR_DATAID_WHITELIST.get()) { if (pattern.matcher(dataId).matches()) { return true; } } return false; } }
AggrWhitelist { public static boolean isAggrDataId(String dataId) { if (null == dataId) { throw new IllegalArgumentException("dataId is null"); } for (Pattern pattern : AGGR_DATAID_WHITELIST.get()) { if (pattern.matcher(dataId).matches()) { return true; } } return false; }  }
AggrWhitelist { public static boolean isAggrDataId(String dataId) { if (null == dataId) { throw new IllegalArgumentException("dataId is null"); } for (Pattern pattern : AGGR_DATAID_WHITELIST.get()) { if (pattern.matcher(dataId).matches()) { return true; } } return false; }  static boolean isAggrDataId(String dataId); static void load(String content); static List<Pattern> getWhiteList(); }
AggrWhitelist { public static boolean isAggrDataId(String dataId) { if (null == dataId) { throw new IllegalArgumentException("dataId is null"); } for (Pattern pattern : AGGR_DATAID_WHITELIST.get()) { if (pattern.matcher(dataId).matches()) { return true; } } return false; }  static boolean isAggrDataId(String dataId); static void load(String content); static List<Pattern> getWhiteList(); static final String AGGRIDS_METADATA; }