This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new d09857e3c [type: refactor]mark as deprecated. (#3767)
d09857e3c is described below

commit d09857e3c5ee97cc1fbc721b487341fc05982bde
Author: Kevin Clair <[email protected]>
AuthorDate: Thu Jul 28 22:58:21 2022 +0800

    [type: refactor]mark as deprecated. (#3767)
    
    * mark as deprecated.
    
    * delete file.
---
 .../listener/consul/ConsulDataChangedInit.java     |  2 +
 .../admin/listener/consul/ConsulDataInit.java      | 57 ---------------
 .../admin/listener/etcd/EtcdDataChangedInit.java   |  2 +
 .../shenyu/admin/listener/etcd/EtcdDataInit.java   | 53 --------------
 .../admin/listener/nacos/NacosDataChangedInit.java |  2 +
 .../shenyu/admin/listener/nacos/NacosDataInit.java | 72 ------------------
 .../zookeeper/ZookeeperDataChangedInit.java        |  2 +
 .../listener/zookeeper/ZookeeperDataInit.java      | 61 ----------------
 .../admin/listener/consul/ConsulDataInitTest.java  | 62 ----------------
 .../admin/listener/etcd/EtcdDataInitTest.java      | 80 --------------------
 .../admin/listener/nacos/NacosDataInitTest.java    | 85 ----------------------
 .../listener/zookeeper/ZookeeperDataInitTest.java  | 76 -------------------
 12 files changed, 8 insertions(+), 546 deletions(-)

diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/consul/ConsulDataChangedInit.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/consul/ConsulDataChangedInit.java
index be060c1c7..1f26a4d75 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/consul/ConsulDataChangedInit.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/consul/ConsulDataChangedInit.java
@@ -25,6 +25,8 @@ import java.util.Objects;
 
 /**
  * The type Consul data changed init.
+ *
+ * @since 2.5.0
  */
 public class ConsulDataChangedInit extends AbstractDataChangedInit {
 
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/consul/ConsulDataInit.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/consul/ConsulDataInit.java
deleted file mode 100644
index 6aa0e0bdd..000000000
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/consul/ConsulDataInit.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shenyu.admin.listener.consul;
-
-import com.ecwid.consul.v1.ConsulClient;
-import org.apache.shenyu.admin.service.SyncDataService;
-import org.apache.shenyu.common.constant.ConsulConstants;
-import org.apache.shenyu.common.enums.DataEventTypeEnum;
-import org.springframework.boot.CommandLineRunner;
-
-/**
- * The type Consul data init.
- */
-public class ConsulDataInit implements CommandLineRunner {
-    private final ConsulClient consulClient;
-
-    private final SyncDataService syncDataService;
-
-    /**
-     * Instantiates a new Consul data init.
-     * @param consulClient the Consul client
-     * @param syncDataService the sync data service
-     */
-    public ConsulDataInit(final ConsulClient consulClient, final 
SyncDataService syncDataService) {
-        this.consulClient = consulClient;
-        this.syncDataService = syncDataService;
-    }
-
-    @Override
-    public void run(final String... args) {
-        String pluginData = ConsulConstants.PLUGIN_DATA;
-        String authData = ConsulConstants.AUTH_DATA;
-        String metaData = ConsulConstants.META_DATA;
-        if (dataKeyNotExist(pluginData) && dataKeyNotExist(authData) && 
dataKeyNotExist(metaData)) {
-            syncDataService.syncAll(DataEventTypeEnum.REFRESH);
-        }
-    }
-
-    private boolean dataKeyNotExist(final String dataKey) {
-        return consulClient.getKVValue(dataKey).getValue() == null;
-    }
-}
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataChangedInit.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataChangedInit.java
index 326b5a56f..820961178 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataChangedInit.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataChangedInit.java
@@ -22,6 +22,8 @@ import org.apache.shenyu.common.constant.DefaultPathConstants;
 
 /**
  * The type Etcd data changed init.
+ *
+ * @since 2.5.0
  */
 public class EtcdDataChangedInit extends AbstractDataChangedInit {
 
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInit.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInit.java
deleted file mode 100644
index 89a25bf00..000000000
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInit.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shenyu.admin.listener.etcd;
-
-import org.apache.shenyu.admin.service.SyncDataService;
-import org.apache.shenyu.common.constant.DefaultPathConstants;
-import org.apache.shenyu.common.enums.DataEventTypeEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.CommandLineRunner;
-
-/**
- * EtcdDataInit.
- */
-public class EtcdDataInit implements CommandLineRunner {
-
-    private static final Logger LOG = 
LoggerFactory.getLogger(EtcdDataInit.class);
-
-    private final EtcdClient etcdClient;
-
-    private final SyncDataService syncDataService;
-
-    public EtcdDataInit(final EtcdClient client, final SyncDataService 
syncDataService) {
-        this.etcdClient = client;
-        this.syncDataService = syncDataService;
-    }
-
-    @Override
-    public void run(final String... args) {
-        final String pluginPath = DefaultPathConstants.PLUGIN_PARENT;
-        final String authPath = DefaultPathConstants.APP_AUTH_PARENT;
-        final String metaDataPath = DefaultPathConstants.META_DATA;
-        if (!etcdClient.exists(pluginPath) && !etcdClient.exists(authPath) && 
!etcdClient.exists(metaDataPath)) {
-            LOG.info("Init all data from database");
-            syncDataService.syncAll(DataEventTypeEnum.REFRESH);
-        }
-    }
-}
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataChangedInit.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataChangedInit.java
index 2f84e552c..30f82f6d1 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataChangedInit.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataChangedInit.java
@@ -29,6 +29,8 @@ import java.util.Objects;
 
 /**
  * The type Nacos data changed init.
+ *
+ * @since 2.5.0
  */
 public class NacosDataChangedInit extends AbstractDataChangedInit {
 
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataInit.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataInit.java
deleted file mode 100644
index dc22c9d0d..000000000
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataInit.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shenyu.admin.listener.nacos;
-
-import com.alibaba.nacos.api.config.ConfigService;
-import com.alibaba.nacos.api.exception.NacosException;
-import org.apache.shenyu.admin.service.SyncDataService;
-import org.apache.shenyu.common.constant.NacosPathConstants;
-import org.apache.shenyu.common.enums.DataEventTypeEnum;
-import org.apache.shenyu.common.exception.ShenyuException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.CommandLineRunner;
-import java.util.Objects;
-
-/**
- * The type Nacos data init.
- */
-public class NacosDataInit implements CommandLineRunner {
-
-    private static final Logger LOG = 
LoggerFactory.getLogger(NacosDataInit.class);
-
-    private final ConfigService configService;
-
-    private final SyncDataService syncDataService;
-
-    /**
-     * Instantiates a new Nacos data init.
-     * @param configService the nacos config service
-     * @param syncDataService the sync data service
-     */
-    public NacosDataInit(final ConfigService configService, final 
SyncDataService syncDataService) {
-        this.configService = configService;
-        this.syncDataService = syncDataService;
-    }
-
-    @Override
-    public void run(final String... args) {
-        if (dataIdNotExist(NacosPathConstants.PLUGIN_DATA_ID)
-                && dataIdNotExist(NacosPathConstants.AUTH_DATA_ID)
-                && dataIdNotExist(NacosPathConstants.META_DATA_ID)) {
-            syncDataService.syncAll(DataEventTypeEnum.REFRESH);
-        }
-    }
-
-    private boolean dataIdNotExist(final String pluginDataId) {
-        try {
-            return Objects.isNull(
-                    configService.getConfig(pluginDataId,
-                            NacosPathConstants.GROUP,
-                            NacosPathConstants.DEFAULT_TIME_OUT));
-        } catch (NacosException e) {
-            LOG.error("Get data from nacos error.", e);
-            throw new ShenyuException(e.getMessage());
-        }
-    }
-}
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataChangedInit.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataChangedInit.java
index faee92bfe..efb511642 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataChangedInit.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataChangedInit.java
@@ -23,6 +23,8 @@ import 
org.apache.shenyu.register.client.server.zookeeper.ZookeeperClient;
 
 /**
  * The type Zookeeper data changed init.
+ *
+ * @since 2.5.0
  */
 public class ZookeeperDataChangedInit extends AbstractDataChangedInit {
 
diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataInit.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataInit.java
deleted file mode 100644
index f81fd1fa1..000000000
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataInit.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shenyu.admin.listener.zookeeper;
-
-import org.apache.shenyu.admin.service.SyncDataService;
-import org.apache.shenyu.common.constant.DefaultPathConstants;
-import org.apache.shenyu.common.enums.DataEventTypeEnum;
-import org.apache.shenyu.register.client.server.zookeeper.ZookeeperClient;
-import org.springframework.boot.CommandLineRunner;
-
-/**
- * The type Zookeeper data init.
- */
-public class ZookeeperDataInit implements CommandLineRunner {
-
-//    private final ZkClient zkClient;
-    private final ZookeeperClient zkClient;
-
-    private final SyncDataService syncDataService;
-
-    /**
-     * Instantiates a new Zookeeper data init.
-     *
-     * @param zkClient        the zk client
-     * @param syncDataService the sync data service
-     */
-    public ZookeeperDataInit(final ZookeeperClient zkClient, final 
SyncDataService syncDataService) {
-        this.zkClient = zkClient;
-        this.syncDataService = syncDataService;
-    }
-
-    @Override
-    public void run(final String... args) {
-        String pluginPath = DefaultPathConstants.PLUGIN_PARENT;
-        String authPath = DefaultPathConstants.APP_AUTH_PARENT;
-        String metaDataPath = DefaultPathConstants.META_DATA;
-
-        boolean zkPathNotExist = !zkClient.isExist(pluginPath)
-                && !zkClient.isExist(authPath)
-                && !zkClient.isExist(metaDataPath);
-
-        if (zkPathNotExist) {
-            syncDataService.syncAll(DataEventTypeEnum.REFRESH);
-        }
-    }
-}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/consul/ConsulDataInitTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/consul/ConsulDataInitTest.java
deleted file mode 100644
index c9931be32..000000000
--- 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/consul/ConsulDataInitTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shenyu.admin.listener.consul;
-
-import com.ecwid.consul.v1.ConsulClient;
-import com.ecwid.consul.v1.Response;
-import com.ecwid.consul.v1.kv.model.GetValue;
-import org.apache.shenyu.admin.service.SyncDataService;
-import org.apache.shenyu.common.enums.DataEventTypeEnum;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * Test cases for {@link ConsulDataInit}.
- */
-@ExtendWith(MockitoExtension.class)
-public class ConsulDataInitTest {
-
-    @Mock
-    private ConsulClient consulClient;
-
-    @Mock
-    private SyncDataService syncDataService;
-
-    @Test
-    public void testRun() {
-        ConsulDataInit consulDataInit = new ConsulDataInit(consulClient, 
syncDataService);
-
-        Response<GetValue> response = mock(Response.class);
-        when(consulClient.getKVValue(anyString())).thenReturn(response);
-        when(response.getValue()).thenReturn(null);
-        consulDataInit.run();
-        when(response.getValue()).thenReturn(new GetValue());
-        consulDataInit.run();
-
-        verify(syncDataService, 
times(1)).syncAll(any(DataEventTypeEnum.class));
-    }
-}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInitTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInitTest.java
deleted file mode 100644
index 6e109d23b..000000000
--- 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/etcd/EtcdDataInitTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shenyu.admin.listener.etcd;
-
-import org.apache.shenyu.admin.service.SyncDataService;
-import org.apache.shenyu.common.constant.DefaultPathConstants;
-import org.apache.shenyu.common.enums.DataEventTypeEnum;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * Test cases for {@link EtcdDataInit}.
- */
-@ExtendWith(MockitoExtension.class)
-public class EtcdDataInitTest {
-
-    @Mock
-    private EtcdClient etcdClient;
-
-    @Mock
-    private SyncDataService syncDataService;
-
-    @Test
-    public void testRun() throws Exception {
-        EtcdDataInit etcdDataInit = new EtcdDataInit(etcdClient, 
syncDataService);
-        assertNotNull(etcdDataInit);
-
-        when(etcdClient.exists(Mockito.anyString())).thenReturn(false);
-        etcdDataInit.run();
-
-        when(etcdClient.exists(Mockito.anyString()))
-                .then(invocation -> pathExist(invocation, 
Collections.singletonList(
-                        DefaultPathConstants.APP_AUTH_PARENT
-                )));
-        etcdDataInit.run();
-
-        when(etcdClient.exists(Mockito.anyString()))
-                .thenAnswer(invocation -> pathExist(invocation, Arrays.asList(
-                        DefaultPathConstants.PLUGIN_PARENT,
-                        DefaultPathConstants.APP_AUTH_PARENT
-                )));
-        etcdDataInit.run();
-
-        verify(syncDataService, 
times(1)).syncAll(any(DataEventTypeEnum.class));
-    }
-
-    private boolean pathExist(final InvocationOnMock invocation, final 
List<String> pathList) {
-        String arg = invocation.getArgument(0);
-        return pathList.contains(arg);
-    }
-}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/nacos/NacosDataInitTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/nacos/NacosDataInitTest.java
deleted file mode 100644
index 4f61c460b..000000000
--- 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/nacos/NacosDataInitTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shenyu.admin.listener.nacos;
-
-import com.alibaba.nacos.api.config.ConfigService;
-import com.alibaba.nacos.api.exception.NacosException;
-import org.apache.shenyu.admin.service.SyncDataService;
-import org.apache.shenyu.common.constant.NacosPathConstants;
-import org.apache.shenyu.common.enums.DataEventTypeEnum;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.mockito.junit.jupiter.MockitoSettings;
-import org.mockito.quality.Strictness;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * Test cases for {@link NacosDataInit}.
- */
-@ExtendWith(MockitoExtension.class)
-@MockitoSettings(strictness = Strictness.LENIENT)
-public class NacosDataInitTest {
-
-    private static final String PLUGIN_DATA_ID = "PLUGIN_DATA_ID";
-
-    private static final String AUTH_DATA_ID = "AUTH_DATA_ID";
-
-    private static final String META_DATA_ID = "META_DATA_ID";
-
-    @Mock
-    private ConfigService configService;
-
-    @Mock
-    private SyncDataService syncDataService;
-
-    @Test
-    public void testRun() throws NacosException {
-        String group = NacosPathConstants.GROUP;
-        long timeout = NacosPathConstants.DEFAULT_TIME_OUT;
-        NacosDataInit nacosDataInit = new NacosDataInit(configService, 
syncDataService);
-
-        String pluginDataId = NacosPathConstants.PLUGIN_DATA_ID;
-        when(configService.getConfig(pluginDataId, group, 
timeout)).thenReturn(null);
-        nacosDataInit.run();
-        when(configService.getConfig(pluginDataId, group, 
timeout)).thenReturn(PLUGIN_DATA_ID);
-        nacosDataInit.run();
-
-        reset(configService);
-        String authDataId = NacosPathConstants.AUTH_DATA_ID;
-        when(configService.getConfig(authDataId, group, 
timeout)).thenReturn(null);
-        nacosDataInit.run();
-        when(configService.getConfig(authDataId, group, 
timeout)).thenReturn(AUTH_DATA_ID);
-        nacosDataInit.run();
-
-        reset(configService);
-        String metaDataId = NacosPathConstants.META_DATA_ID;
-        when(configService.getConfig(metaDataId, group, 
timeout)).thenReturn(null);
-        nacosDataInit.run();
-        when(configService.getConfig(metaDataId, group, 
timeout)).thenReturn(META_DATA_ID);
-        nacosDataInit.run();
-
-        verify(syncDataService, 
times(3)).syncAll(any(DataEventTypeEnum.class));
-    }
-}
diff --git 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataInitTest.java
 
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataInitTest.java
deleted file mode 100644
index fcd5c17de..000000000
--- 
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/listener/zookeeper/ZookeeperDataInitTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shenyu.admin.listener.zookeeper;
-
-import org.apache.shenyu.admin.service.SyncDataService;
-import org.apache.shenyu.common.constant.DefaultPathConstants;
-import org.apache.shenyu.register.client.server.zookeeper.ZookeeperClient;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.mockito.Mockito.when;
-
-/**
- * Test cases for {@link ZookeeperDataInit}.
- */
-@ExtendWith(MockitoExtension.class)
-public final class ZookeeperDataInitTest {
-
-    @Mock
-    private ZookeeperClient zkClient;
-
-    @Mock
-    private SyncDataService syncDataService;
-
-    @Test
-    public void testRun() {
-        ZookeeperDataInit zookeeperDataInit = new ZookeeperDataInit(zkClient, 
syncDataService);
-
-        when(zkClient.isExist(Mockito.anyString())).thenReturn(false);
-        zookeeperDataInit.run();
-
-        when(zkClient.isExist(Mockito.anyString()))
-                .then(invocation -> pathExist(invocation, 
Collections.singletonList(
-                        DefaultPathConstants.APP_AUTH_PARENT
-                )));
-        zookeeperDataInit.run();
-
-        when(zkClient.isExist(Mockito.anyString()))
-                .thenAnswer(invocation -> pathExist(invocation, Arrays.asList(
-                        DefaultPathConstants.PLUGIN_PARENT,
-                        DefaultPathConstants.APP_AUTH_PARENT
-                )));
-        zookeeperDataInit.run();
-
-        assertNotNull(zookeeperDataInit);
-    }
-
-    private boolean pathExist(final InvocationOnMock invocation, final 
List<String> pathList) {
-        String arg = invocation.getArgument(0);
-        return pathList.contains(arg);
-    }
-}

Reply via email to