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

xiatian pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/eventmesh-dashboard.git


The following commit(s) were added to refs/heads/dev by this push:
     new 058ba06  [ISSUE #60] add SDK manager (#62)
058ba06 is described below

commit 058ba06fd23124588c1e4ac4c9aca8a48227339e
Author: Lambert Rao <[email protected]>
AuthorDate: Fri Mar 15 17:37:38 2024 +0800

    [ISSUE #60] add SDK manager (#62)
    
    * feat: add SDK manager
    
    * fix: SDKManagerTest
    
    * fix: use SimpleEntry to replace Pair
    
    * style: better name for SDK codes
    
    * style
    
    * style
    
    * style: just rename SDK
    
    * fix: checkstyle
---
 .../AbstractSDKOperation.java}                     |  11 +-
 .../dashboard/console/function/SDK/SDKManager.java | 116 +++++++++++++++++++++
 .../SDKOperation.java}                             |  18 +++-
 .../SDKTypeEnum.java}                              |  20 +++-
 .../config/CreateNacosConfig.java}                 |  15 ++-
 .../config/CreateRedisConfig.java}                 |  13 ++-
 .../function/SDK/config/CreateRocketmqConfig.java  |  55 ++++++++++
 .../config/CreateSDKConfig.java}                   |   8 +-
 .../operation/EtcdSDKOperation.java}               |  17 ++-
 .../SDK/operation/NacosConfigSDKOperation.java     |  58 +++++++++++
 .../SDK/operation/NacosNamingSDKOperation.java     |  59 +++++++++++
 .../function/SDK/operation/NacosSDKOperation.java  |  55 ++++++++++
 .../function/SDK/operation/RedisSDKOperation.java  |  42 ++++++++
 .../SDK/operation/RocketMQProduceSDKOperation.java |  53 ++++++++++
 .../RocketMQPushConsumerSDKOperation.java          |  55 ++++++++++
 .../operation/RocketMQRemotingSDKOperation.java    |  44 ++++++++
 .../operation/RuntimeSDKOperation.java}            |  17 ++-
 .../wrapper/NacosSDKWrapper.java}                  |  18 +++-
 .../console/function/SDK/SDKManagerTest.java       |  54 ++++++++++
 .../SDK/operation/RedisSDKCreateOperationTest.java |  53 ++++++++++
 .../console/unit/cluster/TestClusterMapper.java    |  17 +++
 .../console/unit/config/TestConfigMapper.java      |  20 +++-
 .../console/unit/runtime/TestRuntimeMapper.java    |  23 +++-
 .../console/unit/store/TestStoreMapper.java        |  25 ++++-
 24 files changed, 838 insertions(+), 28 deletions(-)

diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/AbstractSDKOperation.java
similarity index 68%
copy from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
copy to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/AbstractSDKOperation.java
index c200f07..c2e5b96 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/AbstractSDKOperation.java
@@ -15,8 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK;
 
-public class StorageRocketmqCheck {
+public abstract class AbstractSDKOperation<T> implements SDKOperation<T> {
 
+    protected T castClient(Object client) {
+        try {
+            return (T) client;
+        } catch (ClassCastException e) {
+            throw new IllegalArgumentException("Client is not of the expected 
type", e);
+        }
+    }
 }
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManager.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManager.java
new file mode 100644
index 0000000..9ac4dbd
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManager.java
@@ -0,0 +1,116 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.operation.NacosConfigSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.operation.NacosNamingSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.operation.NacosSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.operation.RedisSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.operation.RocketMQProduceSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.operation.RocketMQPushConsumerSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.operation.RocketMQRemotingSDKOperation;
+
+import java.util.AbstractMap.SimpleEntry;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+
+
+
+/**
+ * SDK manager is a singleton to manage all SDK clients, it is a facade to 
create, delete and get a client.
+
+ */
+public class SDKManager {
+
+    private static final SDKManager INSTANCE = new SDKManager();
+
+
+    public static SDKManager getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * inner key is the unique key of a client, such as (ip + port) they are 
defined in CreateClientConfig
+     *
+     * @see CreateSDKConfig#getUniqueKey()
+     */
+
+    private final Map<SDKTypeEnum, Map<String, Object>> clientMap = new 
ConcurrentHashMap<>();
+
+    private final Map<SDKTypeEnum, SDKOperation<?>> clientCreateOperationMap = 
new ConcurrentHashMap<>();
+
+    // register all client create operation
+    {
+        for (SDKTypeEnum clientTypeEnum : SDKTypeEnum.values()) {
+            clientMap.put(clientTypeEnum, new ConcurrentHashMap<>());
+        }
+
+        clientCreateOperationMap.put(SDKTypeEnum.STORAGE_REDIS, new 
RedisSDKOperation());
+
+        clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, 
new RocketMQRemotingSDKOperation());
+        clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_PRODUCER, 
new RocketMQProduceSDKOperation());
+        clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_CONSUMER, 
new RocketMQPushConsumerSDKOperation());
+
+        clientCreateOperationMap.put(SDKTypeEnum.META_NACOS, new 
NacosSDKOperation());
+        clientCreateOperationMap.put(SDKTypeEnum.META_NACOS_CONFIG, new 
NacosConfigSDKOperation());
+        clientCreateOperationMap.put(SDKTypeEnum.META_NACOS_NAMING, new 
NacosNamingSDKOperation());
+
+    }
+
+    private SDKManager() {
+    }
+
+    public <T> SimpleEntry<String, T> createClient(SDKTypeEnum clientTypeEnum, 
CreateSDKConfig config) {
+        return createClient(clientTypeEnum, config.getUniqueKey(), config);
+    }
+
+    public <T> SimpleEntry<String, T> createClient(SDKTypeEnum clientTypeEnum, 
String uniqueKey, CreateSDKConfig config) {
+
+        Map<String, Object> clients = this.clientMap.get(clientTypeEnum);
+
+        Object client = clients.get(uniqueKey);
+        SimpleEntry<String, ?> result = new SimpleEntry<>(uniqueKey, client);
+        if (Objects.isNull(client)) {
+            SDKOperation<?> clientCreateOperation = 
this.clientCreateOperationMap.get(clientTypeEnum);
+            result = clientCreateOperation.createClient(config);
+            clients.put(result.getKey(), result.getValue());
+        }
+        try {
+            return (SimpleEntry<String, T>) result;
+        } catch (Exception e) {
+            throw new RuntimeException("create client error", e);
+        }
+    }
+
+    public void deleteClient(SDKTypeEnum clientTypeEnum, String uniqueKey) {
+        Map<String, Object> clients = this.clientMap.get(clientTypeEnum);
+        SDKOperation<?> operation = 
this.clientCreateOperationMap.get(clientTypeEnum);
+        try {
+            operation.close(clients.get(uniqueKey));
+        } catch (Exception e) {
+            throw new RuntimeException("close client error", e);
+        }
+        clients.remove(uniqueKey);
+    }
+
+    public Object getClient(SDKTypeEnum clientTypeEnum, String uniqueKey) {
+        return this.clientMap.get(clientTypeEnum).get(uniqueKey);
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKOperation.java
similarity index 63%
copy from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
copy to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKOperation.java
index c200f07..19d264c 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKOperation.java
@@ -15,8 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK;
 
-public class StorageRocketmqCheck {
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+
+import java.util.AbstractMap.SimpleEntry;
+
+/**
+ * Operation to create and close a client, the operations will be store in the 
SDKManager
+ *
+ * @param <T> SDK client
+ */
+public interface SDKOperation<T> {
+
+    public SimpleEntry<String, T> createClient(CreateSDKConfig clientConfig);
+
+
+    public void close(Object client);
 
 }
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKTypeEnum.java
similarity index 74%
copy from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
copy to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKTypeEnum.java
index c200f07..9a44873 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKTypeEnum.java
@@ -15,8 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK;
+
+public enum SDKTypeEnum {
+
+    RUNTIME,
+
+    STORAGE_ROCKETMQ_REMOTING,
+
+    STORAGE_ROCKETMQ_PRODUCER,
+
+    STORAGE_ROCKETMQ_CONSUMER,
+
+    STORAGE_REDIS,
+
+    META_NACOS,
+    META_NACOS_CONFIG,
+
+    META_NACOS_NAMING,
 
-public class StorageRocketmqCheck {
 
 }
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateNacosConfig.java
similarity index 74%
copy from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
copy to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateNacosConfig.java
index c200f07..856d4de 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateNacosConfig.java
@@ -15,8 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK.config;
 
-public class StorageRocketmqCheck {
+import lombok.Data;
 
+@Data
+public class CreateNacosConfig implements CreateSDKConfig {
+
+    private String serverAddress;
+
+    @Override
+    public String getUniqueKey() {
+        return serverAddress;
+    }
 }
+
+
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRedisConfig.java
similarity index 75%
copy from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
copy to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRedisConfig.java
index c200f07..30c53b8 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRedisConfig.java
@@ -15,8 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK.config;
 
-public class StorageRocketmqCheck {
+import lombok.Data;
 
+@Data
+public class CreateRedisConfig implements CreateSDKConfig {
+
+    private String redisUrl;
+
+    @Override
+    public String getUniqueKey() {
+        return redisUrl;
+    }
 }
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRocketmqConfig.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRocketmqConfig.java
new file mode 100644
index 0000000..89424e7
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateRocketmqConfig.java
@@ -0,0 +1,55 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.config;
+
+import org.apache.rocketmq.client.consumer.listener.MessageListener;
+import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
+
+import lombok.Data;
+
+@Data
+public class CreateRocketmqConfig implements CreateSDKConfig {
+
+    // common
+    private String nameServerUrl;
+    private String brokerUrl;
+
+    //consumer
+    private String consumerGroup;
+    private MessageModel messageModel = MessageModel.CLUSTERING;
+
+    //producer
+    private String producerGroup;
+
+    //topic
+    private String topic;
+    private String subExpression = "*";
+
+    private MessageListener messageListener;
+
+
+    @Override
+    public String getUniqueKey() {
+        if (nameServerUrl != null) {
+            return nameServerUrl;
+        } else if (brokerUrl != null) {
+            return brokerUrl;
+        }
+        return null;
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateSDKConfig.java
similarity index 79%
copy from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
copy to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateSDKConfig.java
index c200f07..9a404f2 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/config/CreateSDKConfig.java
@@ -15,8 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK.config;
 
-public class StorageRocketmqCheck {
+/**
+ * Config to create an SDK client, usually contains an address url.
+ */
+public interface CreateSDKConfig {
 
+    String getUniqueKey();
 }
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/EtcdSDKOperation.java
similarity index 61%
copy from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
copy to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/EtcdSDKOperation.java
index c200f07..75beaf6 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/EtcdSDKOperation.java
@@ -15,8 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK.operation;
 
-public class StorageRocketmqCheck {
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
 
+import java.util.AbstractMap.SimpleEntry;
+
+public class EtcdSDKOperation extends AbstractSDKOperation {
+    @Override
+    public SimpleEntry createClient(CreateSDKConfig clientConfig) {
+        return null;
+    }
+
+    @Override
+    public void close(Object client) {
+
+    }
 }
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosConfigSDKOperation.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosConfigSDKOperation.java
new file mode 100644
index 0000000..0757f7b
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosConfigSDKOperation.java
@@ -0,0 +1,58 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.operation;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateNacosConfig;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+
+import java.util.AbstractMap.SimpleEntry;
+import java.util.Properties;
+
+import com.alibaba.nacos.api.NacosFactory;
+import com.alibaba.nacos.api.config.ConfigService;
+import com.alibaba.nacos.api.exception.NacosException;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class NacosConfigSDKOperation extends 
AbstractSDKOperation<ConfigService> {
+
+    @Override
+    public SimpleEntry<String, ConfigService> createClient(CreateSDKConfig 
clientConfig) {
+        ConfigService configService = null;
+        CreateNacosConfig config = (CreateNacosConfig) clientConfig;
+        try {
+            Properties properties = new Properties();
+            properties.put("serverAddr", config.getServerAddress());
+            configService = NacosFactory.createConfigService(properties);
+        } catch (NacosException e) {
+            log.error("NacosCheck init failed caused by {}", e.getErrMsg());
+        }
+        return new SimpleEntry<>(config.getServerAddress(), configService);
+    }
+
+    @Override
+    public void close(Object client) {
+        try {
+            castClient(client).shutDown();
+        } catch (NacosException e) {
+            log.error("NacosCheck close failed caused by {}", e.getErrMsg());
+        }
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosNamingSDKOperation.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosNamingSDKOperation.java
new file mode 100644
index 0000000..54fcd05
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosNamingSDKOperation.java
@@ -0,0 +1,59 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.operation;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateNacosConfig;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+
+import java.util.AbstractMap.SimpleEntry;
+import java.util.Properties;
+
+import com.alibaba.nacos.api.NacosFactory;
+import com.alibaba.nacos.api.config.ConfigService;
+import com.alibaba.nacos.api.exception.NacosException;
+import com.alibaba.nacos.api.naming.NamingService;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class NacosNamingSDKOperation extends 
AbstractSDKOperation<NamingService> {
+
+    @Override
+    public SimpleEntry<String, NamingService> createClient(CreateSDKConfig 
clientConfig) {
+        NamingService namingService = null;
+        CreateNacosConfig config = (CreateNacosConfig) clientConfig;
+        try {
+            Properties properties = new Properties();
+            properties.put("serverAddr", config.getServerAddress());
+            namingService = NacosFactory.createNamingService(properties);
+        } catch (NacosException e) {
+            log.error("NacosCheck init failed caused by {}", e.getErrMsg());
+        }
+        return new SimpleEntry<>(config.getUniqueKey(), namingService);
+    }
+
+    @Override
+    public void close(Object client) {
+        try {
+            ((ConfigService) client).shutDown();
+        } catch (NacosException e) {
+            log.error("NacosCheck close failed caused by {}", e.getErrMsg());
+        }
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosSDKOperation.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosSDKOperation.java
new file mode 100644
index 0000000..e0b326e
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/NacosSDKOperation.java
@@ -0,0 +1,55 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.operation;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.wrapper.NacosSDKWrapper;
+
+import java.util.AbstractMap.SimpleEntry;
+
+import com.alibaba.nacos.api.config.ConfigService;
+import com.alibaba.nacos.api.naming.NamingService;
+
+public class NacosSDKOperation extends AbstractSDKOperation<NacosSDKWrapper> {
+
+    private final NacosConfigSDKOperation nacosConfigClientCreateOperation = 
new NacosConfigSDKOperation();
+    private final NacosNamingSDKOperation nacosNamingClientCreateOperation = 
new NacosNamingSDKOperation();
+
+    @Override
+    public SimpleEntry<String, NacosSDKWrapper> createClient(CreateSDKConfig 
createClientConfig) {
+        SimpleEntry<String, ConfigService> configSimpleEntry = 
nacosConfigClientCreateOperation.createClient(createClientConfig);
+        SimpleEntry namingSimpleEntry = 
nacosNamingClientCreateOperation.createClient(createClientConfig);
+        if (configSimpleEntry.getKey() != namingSimpleEntry.getKey()) {
+            throw new RuntimeException("Nacos config and naming server address 
not match");
+        }
+        NacosSDKWrapper nacosClient = new NacosSDKWrapper(
+            (ConfigService) configSimpleEntry.getValue(), (NamingService) 
namingSimpleEntry.getValue()
+        );
+        return new SimpleEntry<>(configSimpleEntry.getKey(), nacosClient);
+    }
+
+    @Override
+    public void close(Object client) {
+        try {
+            castClient(client).shutdown();
+        } catch (Exception e) {
+            throw new RuntimeException("Nacos client close failed", e);
+        }
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKOperation.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKOperation.java
new file mode 100644
index 0000000..ec50d42
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKOperation.java
@@ -0,0 +1,42 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.operation;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRedisConfig;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+
+import java.util.AbstractMap.SimpleEntry;
+
+import io.lettuce.core.RedisClient;
+import io.lettuce.core.api.StatefulRedisConnection;
+
+public class RedisSDKOperation extends 
AbstractSDKOperation<StatefulRedisConnection<String, String>> {
+
+    @Override
+    public SimpleEntry<String, StatefulRedisConnection<String, String>> 
createClient(CreateSDKConfig clientConfig) {
+        String redisUrl = ((CreateRedisConfig) clientConfig).getRedisUrl();
+        RedisClient redisClient = RedisClient.create(redisUrl);
+        return new SimpleEntry<>(clientConfig.getUniqueKey(), 
redisClient.connect());
+    }
+
+    @Override
+    public void close(Object client) {
+        castClient(client).close();
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQProduceSDKOperation.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQProduceSDKOperation.java
new file mode 100644
index 0000000..2dde6c3
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQProduceSDKOperation.java
@@ -0,0 +1,53 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.operation;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRocketmqConfig;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+
+import java.util.AbstractMap.SimpleEntry;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class RocketMQProduceSDKOperation extends 
AbstractSDKOperation<DefaultMQProducer> {
+
+    @Override
+    public SimpleEntry<String, DefaultMQProducer> createClient(CreateSDKConfig 
clientConfig) {
+        DefaultMQProducer producer = null;
+        try {
+            CreateRocketmqConfig config = (CreateRocketmqConfig) clientConfig;
+            producer = new DefaultMQProducer(config.getProducerGroup());
+            producer.setNamesrvAddr(config.getNameServerUrl());
+            producer.setCompressMsgBodyOverHowmuch(16);
+            producer.start();
+        } catch (MQClientException e) {
+            log.error("create rocketmq producer failed", e);
+        }
+        return new SimpleEntry<>(clientConfig.getUniqueKey(), producer);
+    }
+
+    @Override
+    public void close(Object client) {
+        ((DefaultMQProducer) client).shutdown();
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQPushConsumerSDKOperation.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQPushConsumerSDKOperation.java
new file mode 100644
index 0000000..f25d4df
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQPushConsumerSDKOperation.java
@@ -0,0 +1,55 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.operation;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRocketmqConfig;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+
+import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
+import org.apache.rocketmq.client.exception.MQClientException;
+
+import java.util.AbstractMap.SimpleEntry;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class RocketMQPushConsumerSDKOperation extends 
AbstractSDKOperation<DefaultMQPushConsumer> {
+
+    @Override
+    public SimpleEntry<String, DefaultMQPushConsumer> 
createClient(CreateSDKConfig clientConfig) {
+        DefaultMQPushConsumer consumer = null;
+        try {
+            CreateRocketmqConfig config = (CreateRocketmqConfig) clientConfig;
+            consumer = new DefaultMQPushConsumer(config.getConsumerGroup());
+            consumer.setMessageModel(config.getMessageModel());
+            consumer.setNamesrvAddr(config.getNameServerUrl());
+            consumer.subscribe(config.getTopic(), config.getSubExpression());
+            consumer.registerMessageListener(config.getMessageListener());
+            consumer.start();
+        } catch (MQClientException e) {
+            log.error("create rocketmq push consumer failed", e);
+        }
+        return new SimpleEntry(((CreateRocketmqConfig) 
clientConfig).getNameServerUrl(), consumer);
+    }
+
+    @Override
+    public void close(Object client) {
+        ((DefaultMQPushConsumer) client).shutdown();
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQRemotingSDKOperation.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQRemotingSDKOperation.java
new file mode 100644
index 0000000..3c88ff4
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RocketMQRemotingSDKOperation.java
@@ -0,0 +1,44 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.operation;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
+
+import org.apache.rocketmq.remoting.RemotingClient;
+import org.apache.rocketmq.remoting.netty.NettyClientConfig;
+import org.apache.rocketmq.remoting.netty.NettyRemotingClient;
+
+import java.util.AbstractMap.SimpleEntry;
+
+public class RocketMQRemotingSDKOperation extends 
AbstractSDKOperation<RemotingClient> {
+
+    @Override
+    public SimpleEntry<String, RemotingClient> createClient(CreateSDKConfig 
clientConfig) {
+        NettyClientConfig config = new NettyClientConfig();
+        config.setUseTLS(false);
+        RemotingClient remotingClient = new NettyRemotingClient(config);
+        remotingClient.start();
+        return new SimpleEntry<>(clientConfig.getUniqueKey(), remotingClient);
+    }
+
+    @Override
+    public void close(Object client) {
+        ((RemotingClient) client).shutdown();
+    }
+}
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RuntimeSDKOperation.java
similarity index 61%
copy from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
copy to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RuntimeSDKOperation.java
index c200f07..65d358c 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RuntimeSDKOperation.java
@@ -15,8 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK.operation;
 
-public class StorageRocketmqCheck {
+import 
org.apache.eventmesh.dashboard.console.function.SDK.AbstractSDKOperation;
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateSDKConfig;
 
+import java.util.AbstractMap.SimpleEntry;
+
+public class RuntimeSDKOperation extends AbstractSDKOperation {
+    @Override
+    public SimpleEntry createClient(CreateSDKConfig clientConfig) {
+        return null;
+    }
+
+    @Override
+    public void close(Object client) {
+
+    }
 }
diff --git 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/wrapper/NacosSDKWrapper.java
similarity index 60%
rename from 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
rename to 
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/wrapper/NacosSDKWrapper.java
index c200f07..7f9e3ff 100644
--- 
a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/StorageRocketmqCheck.java
+++ 
b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/SDK/wrapper/NacosSDKWrapper.java
@@ -15,8 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.eventmesh.dashboard.console.function.health.check.impl;
+package org.apache.eventmesh.dashboard.console.function.SDK.wrapper;
 
-public class StorageRocketmqCheck {
+import com.alibaba.nacos.api.config.ConfigService;
+import com.alibaba.nacos.api.exception.NacosException;
+import com.alibaba.nacos.api.naming.NamingService;
 
+import lombok.AllArgsConstructor;
+
+@AllArgsConstructor
+public class NacosSDKWrapper {
+
+    public void shutdown() throws NacosException {
+        configService.shutDown();
+        namingService.shutDown();
+    }
+
+    private ConfigService configService;
+    private NamingService namingService;
 }
diff --git 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManagerTest.java
 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManagerTest.java
new file mode 100644
index 0000000..4eccdb0
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/SDKManagerTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRedisConfig;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+class SDKManagerTest {
+
+    private final CreateRedisConfig createRedisConfig = new 
CreateRedisConfig();
+    private String redisKey;
+
+    @BeforeEach
+    void setUp() {
+        try {
+            createRedisConfig.setRedisUrl("redis://localhost:6379");
+            redisKey = 
SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_REDIS, 
createRedisConfig).getKey();
+        } catch (Exception e) {
+            log.warn("SDK manager test init failed, possible reason: 
redis-server is offline. {}", this.getClass().getSimpleName(), e);
+        }
+    }
+
+    @Test
+    public void testGetClient() {
+        try {
+            Object redisClient = 
SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_REDIS, redisKey);
+            assertNotNull(redisClient);
+        } catch (Exception e) {
+            log.warn("SDK manager test failed, possible reason: redis-server 
is offline. {}", this.getClass().getSimpleName(), e);
+        }
+    }
+}
\ No newline at end of file
diff --git 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKCreateOperationTest.java
 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKCreateOperationTest.java
new file mode 100644
index 0000000..33a06b8
--- /dev/null
+++ 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/SDK/operation/RedisSDKCreateOperationTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.eventmesh.dashboard.console.function.SDK.operation;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import 
org.apache.eventmesh.dashboard.console.function.SDK.config.CreateRedisConfig;
+
+import java.util.AbstractMap.SimpleEntry;
+
+import org.junit.jupiter.api.Test;
+
+import io.lettuce.core.api.StatefulRedisConnection;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+
+@Slf4j
+class RedisSDKCreateOperationTest {
+
+    private RedisSDKOperation redisClientCreateOperation = new 
RedisSDKOperation();
+
+    @Test
+    void testCreateClient() {
+        CreateRedisConfig createClientConfig = new CreateRedisConfig();
+        createClientConfig.setRedisUrl("redis://localhost:6379");
+        try {
+            SimpleEntry<String, StatefulRedisConnection<String, String>> 
simpleEntry = redisClientCreateOperation.createClient(createClientConfig);
+            assertEquals("redis://localhost:6379", simpleEntry.getKey());
+            String response = simpleEntry.getValue().sync().ping();
+            log.info("response:{}", response);
+        } catch (Exception e) {
+            log.error("create redis client failed", e);
+        }
+
+    }
+}
\ No newline at end of file
diff --git 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java
 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java
index c8625aa..0cad435 100644
--- 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java
+++ 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java
@@ -1,3 +1,20 @@
+/*
+ * 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.eventmesh.dashboard.console.unit.cluster;
 
 import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
diff --git 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java
 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java
index 417d75e..97f5e11 100644
--- 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java
+++ 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java
@@ -1,3 +1,20 @@
+/*
+ * 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.eventmesh.dashboard.console.unit.config;
 
 
@@ -5,12 +22,9 @@ import 
org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
 import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
 import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
 
-
 import java.util.ArrayList;
-
 import java.util.List;
 
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java
 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java
index ad99e09..3baa57d 100644
--- 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java
+++ 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java
@@ -1,3 +1,20 @@
+/*
+ * 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.eventmesh.dashboard.console.unit.runtime;
 
 import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
@@ -23,7 +40,7 @@ public class TestRuntimeMapper {
 
     @Test
     public void testAddRuntimeMapper() {
-        RuntimeEntity runtimeEntity = new RuntimeEntity(null, 1l, "runtime1", 
2l, 1019, 1099, 1L, "null", 1, null, null, "null");
+        RuntimeEntity runtimeEntity = new RuntimeEntity(null, 1L, "runtime1", 
2L, 1019, 1099, 1L, "null", 1, null, null, "null");
         runtimeMapper.addRuntime(runtimeEntity);
         List<RuntimeEntity> runtimeEntities = 
runtimeMapper.selectRuntimeByCluster(runtimeEntity);
         RuntimeEntity runtimeEntity1 = runtimeEntities.get(0);
@@ -34,7 +51,7 @@ public class TestRuntimeMapper {
 
     @Test
     public void testUpdateRuntimeByCluster() {
-        RuntimeEntity runtimeEntity = new RuntimeEntity(null, 1l, "runtime1", 
2l, 1019, 1099, 1L, "null", 1, null, null, "null");
+        RuntimeEntity runtimeEntity = new RuntimeEntity(null, 1L, "runtime1", 
2L, 1019, 1099, 1L, "null", 1, null, null, "null");
         runtimeMapper.addRuntime(runtimeEntity);
         runtimeEntity.setPort(1000);
         runtimeEntity.setJmxPort(1099);
@@ -49,7 +66,7 @@ public class TestRuntimeMapper {
 
     @Test
     public void testDeleteRuntime() {
-        RuntimeEntity runtimeEntity = new RuntimeEntity(null, 1l, "runtime1", 
2l, 1019, 1099, 1L, "null", 1, null, null, "null");
+        RuntimeEntity runtimeEntity = new RuntimeEntity(null, 1L, "runtime1", 
2L, 1019, 1099, 1L, "null", 1, null, null, "null");
         runtimeMapper.addRuntime(runtimeEntity);
         runtimeMapper.deleteRuntimeByCluster(runtimeEntity);
         List<RuntimeEntity> runtimeEntities = 
runtimeMapper.selectRuntimeByCluster(runtimeEntity);
diff --git 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java
 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java
index 5876f82..4535547 100644
--- 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java
+++ 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java
@@ -1,3 +1,20 @@
+/*
+ * 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.eventmesh.dashboard.console.unit.store;
 
 import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication;
@@ -24,9 +41,9 @@ public class TestStoreMapper {
     @Test
     public void testAddStore() {
         StoreEntity storeEntity =
-            new StoreEntity(null, 1l, 2, "rocketmq", "run1", 1l, "n,j", 
(short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1l);
+            new StoreEntity(null, 1L, 2, "rocketmq", "run1", 1L, "n,j", 
(short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
         StoreEntity storeEntity1 =
-            new StoreEntity(null, 1l, 1, "rocketmq", "run1", 1l, "n,j", 
(short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1l);
+            new StoreEntity(null, 1L, 1, "rocketmq", "run1", 1L, "n,j", 
(short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
         storeMapper.addStore(storeEntity);
         storeMapper.addStore(storeEntity1);
         List<StoreEntity> storeEntities = 
storeMapper.selectStoreByCluster(storeEntity);
@@ -41,7 +58,7 @@ public class TestStoreMapper {
     @Test
     public void testDeleteStoreByUnique() {
         StoreEntity storeEntity =
-            new StoreEntity(null, 1l, 2, "rocketmq", "run1", 1l, "n,j", 
(short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1l);
+            new StoreEntity(null, 1L, 2, "rocketmq", "run1", 1L, "n,j", 
(short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
         storeMapper.addStore(storeEntity);
         storeMapper.deleteStoreByUnique(storeEntity);
         List<StoreEntity> storeEntities = 
storeMapper.selectStoreByCluster(storeEntity);
@@ -51,7 +68,7 @@ public class TestStoreMapper {
     @Test
     public void testUpdateStoreByUnique() {
         StoreEntity storeEntity =
-            new StoreEntity(null, 1l, 2, "rocketmq", "run1", 1l, "n,j", 
(short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1l);
+            new StoreEntity(null, 1L, 2, "rocketmq", "run1", 1L, "n,j", 
(short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L);
         storeMapper.addStore(storeEntity);
         storeEntity.setStatus((short) 5);
         storeMapper.updateStoreByUnique(storeEntity);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to