@Override
    @SuppressWarnings("unchecked")
    public void onApplicationEvent(@NotNull final DataChangedEvent event) {
        for (DataChangedListener listener : listeners) {
            if ((!(listener instanceof AbstractDataChangedListener))
                    && clusterProperties.isEnabled()
                    && Objects.nonNull(shenyuClusterSelectMasterService)
                    && !shenyuClusterSelectMasterService.isMaster()) {
                LOG.info("received DataChangedEvent, not master, pass");
                return;
            }
            if (LOG.isDebugEnabled()) {
                LOG.debug("received DataChangedEvent, dispatching, event:{}", JsonUtils.toJson(event));
            }
            switch (event.getGroupKey()) {
                case APP_AUTH:
                    listener.onAppAuthChanged((List<AppAuthData>) event.getSource(), event.getEventType());
                    break;
                case PLUGIN:
                    listener.onPluginChanged((List<PluginData>) event.getSource(), event.getEventType());
                    break;
                case RULE:
                    listener.onRuleChanged((List<RuleData>) event.getSource(), event.getEventType());
                    break;
                case SELECTOR:
                    listener.onSelectorChanged((List<SelectorData>) event.getSource(), event.getEventType());
                    break;
                case META_DATA:
                    listener.onMetaDataChanged((List<MetaData>) event.getSource(), event.getEventType());
                    break;
                case PROXY_SELECTOR:
                    listener.onProxySelectorChanged((List<ProxySelectorData>) event.getSource(), event.getEventType());
                    break;
                case DISCOVER_UPSTREAM:
                    listener.onDiscoveryUpstreamChanged((List<DiscoverySyncData>) event.getSource(), event.getEventType());
                    applicationContext.getBean(LoadServiceDocEntry.class).loadDocOnUpstreamChanged((List<DiscoverySyncData>) event.getSource(), event.getEventType());
                    break;
                default:
                    throw new IllegalStateException("Unexpected value: " + event.getGroupKey());
            }
        }
    }
@Test
    public void onApplicationEventWithMetaDataConfigGroupTest() {
        when(clusterProperties.isEnabled()).thenReturn(true);
        when(shenyuClusterSelectMasterService.isMaster()).thenReturn(true);
        ConfigGroupEnum configGroupEnum = ConfigGroupEnum.META_DATA;
        DataChangedEvent dataChangedEvent = new DataChangedEvent(configGroupEnum, null, new ArrayList<>());
        dataChangedEventDispatcher.onApplicationEvent(dataChangedEvent);
        verify(httpLongPollingDataChangedListener, times(1)).onMetaDataChanged(anyList(), any());
        verify(nacosDataChangedListener, times(1)).onMetaDataChanged(anyList(), any());
        verify(websocketDataChangedListener, times(1)).onMetaDataChanged(anyList(), any());
        verify(zookeeperDataChangedListener, times(1)).onMetaDataChanged(anyList(), any());
    }