This is an automated email from the ASF dual-hosted git repository.
pandaapo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 53e36b56d [ISSUE #4489] Migrate eventmesh-admin module (#4490)
53e36b56d is described below
commit 53e36b56d13c9f0add8da1d11843b78f4869d7dd
Author: Pil0tXia <[email protected]>
AuthorDate: Tue Oct 17 16:45:00 2023 +0800
[ISSUE #4489] Migrate eventmesh-admin module (#4490)
* remove old module
* remove old module dependency and reference
* optimize webhook operationMode to lowercase
* rename software package
* rename project and builder
* optimize admin config and thread pool
* remove old usages in test class
---
build.gradle | 7 +-
{eventmesh-console => eventmesh-admin}/.gitignore | 0
eventmesh-admin/README.md | 65 +++-------
eventmesh-admin/build.gradle | 60 ++++++++++
.../docker/Dockerfile | 4 +-
.../docs/UserGuide_CN.md | 0
.../docs/UserGuide_EN.md | 0
.../eventmesh-admin-rocketmq/build.gradle | 33 -----
.../eventmesh-admin-rocketmq/gradle.properties | 17 ---
.../apache/eventmesh/admin/rocketmq/Constants.java | 29 -----
.../admin/rocketmq/controller/AdminController.java | 58 ---------
.../admin/rocketmq/handler/TopicsHandler.java | 133 ---------------------
.../admin/rocketmq/request/TopicCreateRequest.java | 67 -----------
.../admin/rocketmq/response/TopicResponse.java | 72 -----------
.../admin/rocketmq/util/RequestMapping.java | 94 ---------------
.../admin/rocketmq/util/UrlMappingPattern.java | 117 ------------------
.../rocketmq/request/TopicCreateRequestTest.java | 63 ----------
.../admin/rocketmq/response/TopicResponseTest.java | 56 ---------
.../admin/rocketmq/util/RequestMappingTest.java | 78 ------------
.../admin/rocketmq/util/UrlMappingPatternTest.java | 117 ------------------
eventmesh-admin/gradle.properties | 16 ---
.../gradle/wrapper/gradle-wrapper.jar | Bin
.../gradle/wrapper/gradle-wrapper.properties | 0
{eventmesh-console => eventmesh-admin}/gradlew | 0
{eventmesh-console => eventmesh-admin}/gradlew.bat | 0
.../settings.gradle | 2 +-
.../admin}/EventMeshAdminApplication.java | 2 +-
.../eventmesh/admin}/config/AdminProperties.java | 2 +-
.../apache/eventmesh/admin}/config/Constants.java | 2 +-
.../eventmesh/admin}/config/MetaTypeConfig.java | 18 +--
.../admin}/controller/ConnectionController.java | 4 +-
.../admin}/controller/SubscriptionController.java | 8 +-
.../eventmesh/admin}/dto/SubscriptionResponse.java | 4 +-
.../admin}/exception/EventMeshAdminException.java | 2 +-
.../admin}/exception/EventMeshException.java | 2 +-
.../eventmesh/admin}/exception/MetaException.java | 2 +-
.../eventmesh/admin}/model/ConnectionInfo.java | 2 +-
.../eventmesh/admin}/model/SubscriptionInfo.java | 2 +-
.../admin}/service/ConnectionService.java | 2 +-
.../admin}/service/SubscriptionService.java | 4 +-
.../admin}/service/impl/EtcdConnectionService.java | 4 +-
.../service/impl/EtcdSubscriptionService.java | 6 +-
.../service/impl/NacosConnectionService.java | 6 +-
.../service/impl/NacosSubscriptionService.java | 24 ++--
.../src/main/resources/application.yml | 0
.../src/main/resources/logback.xml | 0
.../admin}/EventMeshAdminApplicationTests.java | 2 +-
eventmesh-console/README.md | 24 ----
eventmesh-console/build.gradle | 76 ------------
eventmesh-runtime/build.gradle | 6 -
eventmesh-runtime/conf/eventmesh.properties | 26 ++--
.../admin/controller/ClientManageController.java | 3 -
.../eventmesh/runtime/boot/AbstractHTTPServer.java | 3 +-
.../runtime/boot/EventMeshHTTPServer.java | 4 +-
.../runtime/boot/HTTPThreadPoolGroup.java | 16 +--
.../controller/ClientManageControllerTest.java | 4 -
settings.gradle | 3 -
57 files changed, 156 insertions(+), 1195 deletions(-)
diff --git a/build.gradle b/build.gradle
index db1380c74..3991792dc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -304,9 +304,7 @@ subprojects {
new File("${projectDir}/dist/lib").mkdirs()
new File("${projectDir}/dist/licenses").mkdirs()
}
- Set<String> rootProject = ["eventmesh-admin",
- "eventmesh-admin-rocketmq",
- "eventmesh-common",
+ Set<String> rootProject = ["eventmesh-common",
"eventmesh-storage-api",
"eventmesh-metrics-api",
"eventmesh-meta-api",
@@ -318,8 +316,7 @@ subprojects {
"eventmesh-spi",
"eventmesh-webhook-api",
"eventmesh-webhook-admin",
- "eventmesh-webhook-receive"
- ]
+ "eventmesh-webhook-receive"]
doLast {
copy {
into("${projectDir}/dist/apps")
diff --git a/eventmesh-console/.gitignore b/eventmesh-admin/.gitignore
similarity index 100%
rename from eventmesh-console/.gitignore
rename to eventmesh-admin/.gitignore
diff --git a/eventmesh-admin/README.md b/eventmesh-admin/README.md
index 69db9bb59..aadf9b82e 100644
--- a/eventmesh-admin/README.md
+++ b/eventmesh-admin/README.md
@@ -1,53 +1,24 @@
-# EventMesh Administration Module
+# Getting Started
-EventMesh Administration Module for EventMesh. It manages Admin Service,
Configurations such as topics/subscriptions management.It works as a control
plane and provide some interface to manage the eventmesh-runtime module and
other configurations.
+## Build on source code
-## Administration Client Manager APIs
+```
+cd eventmesh-console
+./gradlew clean bootJar
+```
-### POST /topicManage
-- Create a new topic if does not exist
-- Exposed POST endpoint to create a new topic if it does not exist.
- * Url - http://localhost:8081/topicManage
- * sample request payload
- ```json
- {
- "name": "mytopic1"
- }
- ```
+```
+java -jar build/libs/eventmesh-console-0.0.1-SNAPSHOT.jar
+```
- Sample response
+## Build and Run with Docker
- ```json
- {
- "topic": "mytopic1",
- "created_time": "2021-09-03",
- }
- ```
-### DELETE /topicManage/(string: topic)
-- Delete a specific topic.
-- Exposed DELETE endpoint to remove a specific topic
- * URL -
- ```url
- http://localhost:8081/topicManage/mytopic1
- ```
-
- * Response -
-
- ```json
- {
- "topic": "mytopic1",
- }
- ```
+```
+cd eventmesh-console
+./gradlew clean bootJar
+docker build -t yourname/eventmesh-console -f docker/Dockerfile .
+```
-### GET /topicManage
-- Retrieve a list of topics
-- Exposed GET endpoint to retrieve all topics
- * URL -
- ```url
- http://localhost:8081/topicManage
- ```
- * Response
-
- ```json
- ["mytopic1", "mytopic2"]
- ```
+```
+docker run -d --name eventmesh-console -p 8080:8080 yourname/eventmesh-console
+```
\ No newline at end of file
diff --git a/eventmesh-admin/build.gradle b/eventmesh-admin/build.gradle
index 2944f9819..5b676ab66 100644
--- a/eventmesh-admin/build.gradle
+++ b/eventmesh-admin/build.gradle
@@ -14,3 +14,63 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+plugins {
+ id 'java'
+ id 'idea'
+ id 'org.springframework.boot' version '2.7.15'
+ id 'io.spring.dependency-management' version '1.0.15.RELEASE'
+}
+
+group = 'org.apache.eventmesh'
+version = '0.0.1-SNAPSHOT'
+
+java {
+ sourceCompatibility = '1.8'
+}
+
+configurations {
+ compileOnly {
+ extendsFrom annotationProcessor
+ }
+}
+
+repositories {
+ mavenCentral()
+ maven { url 'https://maven.aliyun.com/repository/public/' }
+}
+
+ext {
+ // utility
+ commonsLang3Version = '3.13.0'
+ guavaVersion = '32.1.2-jre' // not used for now
+ fastjsonVersion = '2.0.40'
+ // swagger
+ springdocVersion = '1.7.0'
+ // unit test
+ mockitoVersion = '5.5.0'
+ // meta
+ nacosVersion = '2.2.4'
+}
+
+dependencies {
+ // versions managed by spring.dependency-management
+ implementation 'org.springframework.boot:spring-boot-starter-web'
+ compileOnly 'org.projectlombok:lombok'
+ developmentOnly 'org.springframework.boot:spring-boot-devtools'
+ annotationProcessor
'org.springframework.boot:spring-boot-configuration-processor'
+ annotationProcessor 'org.projectlombok:lombok'
+ testImplementation 'org.springframework.boot:spring-boot-starter-test'
+
+ // utility
+ implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
+ implementation("com.alibaba.fastjson2:fastjson2:${fastjsonVersion}")
+ // swagger
+ implementation "org.springdoc:springdoc-openapi-ui:${springdocVersion}"
+ implementation
"org.springdoc:springdoc-openapi-javadoc:${springdocVersion}"
+ annotationProcessor
'com.github.therapi:therapi-runtime-javadoc-scribe:0.15.0'
+ // unit test
+ testImplementation("org.mockito:mockito-core:${mockitoVersion}")
+ // meta
+ implementation("com.alibaba.nacos:nacos-client:${nacosVersion}")
+}
diff --git a/eventmesh-console/docker/Dockerfile
b/eventmesh-admin/docker/Dockerfile
similarity index 86%
rename from eventmesh-console/docker/Dockerfile
rename to eventmesh-admin/docker/Dockerfile
index efa0ccf5c..a59c68f60 100644
--- a/eventmesh-console/docker/Dockerfile
+++ b/eventmesh-admin/docker/Dockerfile
@@ -17,6 +17,6 @@
FROM openjdk:8-jre-alpine
VOLUME /tmp
-COPY build/libs/eventmesh-console-*.jar eventmesh-console.jar
+COPY build/libs/eventmesh-admin-*.jar eventmesh-admin.jar
ENV JAVA_OPTS=""
-ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /eventmesh-console.jar"]
+ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /eventmesh-admin.jar"]
diff --git a/eventmesh-console/docs/UserGuide_CN.md
b/eventmesh-admin/docs/UserGuide_CN.md
similarity index 100%
rename from eventmesh-console/docs/UserGuide_CN.md
rename to eventmesh-admin/docs/UserGuide_CN.md
diff --git a/eventmesh-console/docs/UserGuide_EN.md
b/eventmesh-admin/docs/UserGuide_EN.md
similarity index 100%
rename from eventmesh-console/docs/UserGuide_EN.md
rename to eventmesh-admin/docs/UserGuide_EN.md
diff --git a/eventmesh-admin/eventmesh-admin-rocketmq/build.gradle
b/eventmesh-admin/eventmesh-admin-rocketmq/build.gradle
deleted file mode 100644
index 216d681f4..000000000
--- a/eventmesh-admin/eventmesh-admin-rocketmq/build.gradle
+++ /dev/null
@@ -1,33 +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.
- */
-
-
-dependencies {
- implementation project(":eventmesh-common")
-
- implementation "org.apache.httpcomponents:httpclient"
- implementation "com.fasterxml.jackson.core:jackson-databind"
- implementation "com.fasterxml.jackson.core:jackson-core"
- implementation "com.fasterxml.jackson.core:jackson-annotations"
-
- implementation project(":eventmesh-storage-plugin:eventmesh-storage-api")
-
- compileOnly 'org.projectlombok:lombok'
- annotationProcessor 'org.projectlombok:lombok'
-
- testImplementation 'org.mockito:mockito-inline'
-}
diff --git a/eventmesh-admin/eventmesh-admin-rocketmq/gradle.properties
b/eventmesh-admin/eventmesh-admin-rocketmq/gradle.properties
deleted file mode 100644
index fd11b473b..000000000
--- a/eventmesh-admin/eventmesh-admin-rocketmq/gradle.properties
+++ /dev/null
@@ -1,17 +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.
-#
-
-rocketmq_version=4.9.5
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/Constants.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/Constants.java
deleted file mode 100644
index 9a61dee92..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/Constants.java
+++ /dev/null
@@ -1,29 +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.eventmesh.admin.rocketmq;
-
-public class Constants {
-
- public static final String TOPIC_MANAGE_PATH = "/topicManage";
-
- public static final String CONTENT_TYPE = "Content-Type";
-
- public static final String APPLICATION_JSON = "application/json";
-
- public static final String TOPIC_ERROR = "create topic failed! Server side
error";
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/controller/AdminController.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/controller/AdminController.java
deleted file mode 100644
index 81ae0f03c..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/controller/AdminController.java
+++ /dev/null
@@ -1,58 +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.eventmesh.admin.rocketmq.controller;
-
-import static org.apache.eventmesh.admin.rocketmq.Constants.TOPIC_MANAGE_PATH;
-
-import org.apache.eventmesh.admin.rocketmq.handler.TopicsHandler;
-
-import java.io.IOException;
-
-import com.sun.net.httpserver.HttpServer;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * This class is responsible for managing the admin module.
- * <p>
- * It provides a method to run the admin module with the specified {@link
HttpServer}
- * and handles requests related to topics management.
- */
-
-@Slf4j
-public class AdminController {
-
- public AdminController() {
- }
-
- /**
- * Invoke this method to run the admin module.
- *
- * @param server A HttpServer is bound to an IP address and port number
- * and listens for incoming TCP connections from clients on
this address.
- * @throws IOException
- * @see HttpServer
- */
- public void run(HttpServer server) throws IOException {
-
- // Creates a mapping from API URI path to the exchange handler on this
HttpServer.
- server.createContext(TOPIC_MANAGE_PATH, new TopicsHandler());
-
- log.info("EventMesh-Admin Controller server context created
successfully");
- }
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/handler/TopicsHandler.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/handler/TopicsHandler.java
deleted file mode 100644
index 480e19292..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/handler/TopicsHandler.java
+++ /dev/null
@@ -1,133 +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.eventmesh.admin.rocketmq.handler;
-
-import static org.apache.eventmesh.admin.rocketmq.Constants.APPLICATION_JSON;
-import static org.apache.eventmesh.admin.rocketmq.Constants.CONTENT_TYPE;
-import static org.apache.eventmesh.admin.rocketmq.Constants.TOPIC_ERROR;
-import static org.apache.eventmesh.admin.rocketmq.Constants.TOPIC_MANAGE_PATH;
-
-import org.apache.eventmesh.admin.rocketmq.request.TopicCreateRequest;
-import org.apache.eventmesh.admin.rocketmq.response.TopicResponse;
-import org.apache.eventmesh.admin.rocketmq.util.RequestMapping;
-import org.apache.eventmesh.common.Constants;
-import org.apache.eventmesh.common.utils.JsonUtils;
-import org.apache.eventmesh.common.utils.NetUtils;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import com.sun.net.httpserver.HttpExchange;
-import com.sun.net.httpserver.HttpHandler;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * This class is responsible for handling HTTP requests related to topics.
- * <p>
- * It implements the {@link HttpHandler} interface to process incoming
requests,
- * which is used by the {@linkplain com.sun.net.httpserver.HttpServer
HttpServer}.
- * <p>
- * It uses the {@link RequestMapping} class to match the request URL and the
HTTP method.
- * <p>
- * It uses the {@link TopicCreateRequest} class to parse the request body
- * and the {@link TopicResponse} class to create the response.
- *
- * @see HttpHandler
- */
-
-@Slf4j
-public class TopicsHandler implements HttpHandler {
-
- /**
- * Handles the HTTP request for creating topics.
- *
- * @param httpExchange the exchange containing the request from the client
and used to send the response
- * @throws IOException if an I/O error occurs
- * @see HttpHandler#handle(HttpExchange)
- */
- @Override
- public void handle(HttpExchange httpExchange) throws IOException {
-
- // If the request matches, then create a new topic.
- if (RequestMapping.postMapping(TOPIC_MANAGE_PATH, httpExchange)) {
- createTopicHandler(httpExchange);
- return;
- }
-
- // Otherwise, it prepares an error response and sends it back to the
client.
- OutputStream out = httpExchange.getResponseBody();
- httpExchange.sendResponseHeaders(500, 0);
- String result = String.format("Please check your request url: %s",
httpExchange.getRequestURI());
- log.error(result);
- // Write the response data.
- out.write(result.getBytes(Constants.DEFAULT_CHARSET));
- }
-
- /**
- * Handles the creation of a new topic.
- *
- * @param httpExchange the exchange containing the request from the client
and used to send the response
- * @throws IOException if an I/O error occurs
- */
- public void createTopicHandler(HttpExchange httpExchange) throws
IOException {
- String result;
- try (OutputStream out = httpExchange.getResponseBody()) {
- // Parses the request body into a TopicCreateRequest object.
- String params = NetUtils.parsePostBody(httpExchange);
- TopicCreateRequest topicCreateRequest =
- JsonUtils.parseObject(params, TopicCreateRequest.class);
- // Gets the topic name from the request body.
- String topic = topicCreateRequest.getTopic();
-
- // If the topic name is empty, then returns an error message.
- if (StringUtils.isBlank(topic)) {
- result = "Create topic failed. Parameter topic not found.";
- log.error(result);
- out.write(result.getBytes(Constants.DEFAULT_CHARSET));
- return;
- }
-
- // TBD: A new rocketmq service will be implemented for creating
topics
- TopicResponse topicResponse = null; // Temporary variable for
topic response
- if (topicResponse != null) {
- log.info("create a new topic: {}", topic);
- httpExchange.getResponseHeaders().add(CONTENT_TYPE,
APPLICATION_JSON);
- NetUtils.sendSuccessResponseHeaders(httpExchange);
- result = JsonUtils.toJSONString(topicResponse);
- log.info(result);
- out.write(result.getBytes(Constants.DEFAULT_CHARSET));
- } else {
- // If the topic creation fails, then returns an error message.
- httpExchange.sendResponseHeaders(500, 0);
- result = TOPIC_ERROR;
- log.error(result);
- out.write(result.getBytes(Constants.DEFAULT_CHARSET));
- }
- } catch (Exception e) {
- // If an exception occurs, then returns an error message.
- httpExchange.getResponseHeaders().add(CONTENT_TYPE,
APPLICATION_JSON);
- httpExchange.sendResponseHeaders(500, 0);
- result = TOPIC_ERROR;
- log.error(result, e);
- }
- }
-
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/request/TopicCreateRequest.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/request/TopicCreateRequest.java
deleted file mode 100644
index 925b43889..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/request/TopicCreateRequest.java
+++ /dev/null
@@ -1,67 +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.eventmesh.admin.rocketmq.request;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * A data transfer object (DTO) that represents a request to create a new
topic.
- * <p>
- * This class provides a convenient way to encapsulate the topic information
when creating a new topic.
- * <p>
- * Empty or null values will not be included in the serialized JSON.
- * <p>
- * Any unknown properties will be ignored when deserializing JSON into this
class.
- * <p>
- * Example usage:
- * <pre>
- * String params = NetUtils.parsePostBody(httpExchange);
- * TopicCreateRequest topicCreateRequest = JsonUtils.parseObject(params,
TopicCreateRequest.class);
- * String topic = topicCreateRequest.getTopic();
- * topicCreateRequest.setTopic("UpdatedTopic");
- * </pre>
- */
-
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class TopicCreateRequest {
-
- private String topic;
-
- /**
- * Constructs a new instance of {@link TopicCreateRequest}.
- *
- * @param topic the topic for the request
- */
- @JsonCreator
- public TopicCreateRequest(@JsonProperty("topic") String topic) {
- this.topic = topic;
- }
-
- public String getTopic() {
- return this.topic;
- }
-
- public void setTopic(String topic) {
- this.topic = topic;
- }
-
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/response/TopicResponse.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/response/TopicResponse.java
deleted file mode 100644
index c9b1590a7..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/response/TopicResponse.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.eventmesh.admin.rocketmq.response;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * A data transfer object (DTO) that represents a response containing a topic
and its creation time.
- * <p>
- * It includes the values returned upon the creation of a new topic, an update
to an existing topic,
- * or the retrieval of a topic's details.
- * <p>
- * It is used to encapsulate the topic information being sent to the client
from the server.
- */
-
-public class TopicResponse {
-
- private String topic;
- private String createdTime;
-
- @JsonCreator
- public TopicResponse(@JsonProperty("topic") String topic,
- @JsonProperty("created_time") String createdTime) {
- super();
- this.topic = topic;
- this.createdTime = createdTime;
- }
-
- @JsonProperty("topic")
- public String getTopic() {
- return this.topic;
- }
-
- @JsonProperty("topic")
- public void setTopic(String topic) {
- this.topic = topic;
- }
-
- @JsonProperty("created_time")
- public String getCreatedTime() {
- return createdTime;
- }
-
- @JsonProperty("created_time")
- public void setCreatedTime(String createdTime) {
- this.createdTime = createdTime;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("TopicResponse
{topic=").append(this.topic).append(",").append("created_time=").append(this.createdTime).append("}");
- return sb.toString();
- }
-
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/util/RequestMapping.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/util/RequestMapping.java
deleted file mode 100644
index 914e00c83..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/util/RequestMapping.java
+++ /dev/null
@@ -1,94 +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.eventmesh.admin.rocketmq.util;
-
-import org.apache.eventmesh.common.enums.HttpMethod;
-
-import com.sun.net.httpserver.HttpExchange;
-
-import lombok.experimental.UtilityClass;
-
-/**
- * This class provides utility methods for handling HTTP request mappings.
- */
-
-@UtilityClass
-public class RequestMapping {
-
- /**
- * Performs a POST mapping for a specific URL.
- *
- * @param value the URL pattern to match
- * @param httpExchange the exchange containing the request from the client
and used to send the response
- * @return {@code true} if the URL pattern matches and the HTTP method is
POST, {@code false} otherwise
- */
- public boolean postMapping(String value, HttpExchange httpExchange) {
- return isUrlMatch(value, httpExchange, HttpMethod.POST.name());
- }
-
- /**
- * Performs a GET mapping for a specific URL.
- *
- * @param value the URL pattern to match
- * @param httpExchange the exchange containing the request from the client
and used to send the response
- * @return {@code true} if the URL pattern matches and the HTTP method is
GET, {@code false} otherwise
- */
- public boolean getMapping(String value, HttpExchange httpExchange) {
- return isUrlMatch(value, httpExchange, HttpMethod.GET.name());
- }
-
- /**
- * Performs a PUT mapping for a specific URL.
- *
- * @param value the URL pattern to match
- * @param httpExchange the exchange containing the request from the client
and used to send the response
- * @return {@code true} if the URL pattern matches and the HTTP method is
PUT, {@code false} otherwise
- */
- public boolean putMapping(String value, HttpExchange httpExchange) {
- return isUrlMatch(value, httpExchange, HttpMethod.PUT.name());
- }
-
- /**
- * Performs a DELETE mapping for a specific URL.
- *
- * @param value the URL pattern to match
- * @param httpExchange the exchange containing the request from the client
and used to send the response
- * @return {@code true} if the URL pattern matches and the HTTP method is
DELETE, {@code false} otherwise
- */
- public boolean deleteMapping(String value, HttpExchange httpExchange) {
- return isUrlMatch(value, httpExchange, HttpMethod.DELETE.name());
- }
-
- /**
- * Checks if the URL pattern matches the request URI and the HTTP method
is the specified method type.
- *
- * @param value the URL pattern to match
- * @param httpExchange the exchange containing the request from the client
and used to send the response
- * @param methodType the HTTP method type to check against
- * @return {@code true} if the URL pattern matches and the HTTP method is
the specified method type, {@code false} otherwise
- */
- private boolean isUrlMatch(String value, HttpExchange httpExchange, String
methodType) {
- if (methodType.equalsIgnoreCase(httpExchange.getRequestMethod())) {
- String requestUri = httpExchange.getRequestURI().getPath();
- UrlMappingPattern matcher = new UrlMappingPattern(value);
- return matcher.matches(requestUri);
- }
- return false;
- }
-
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/util/UrlMappingPattern.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/util/UrlMappingPattern.java
deleted file mode 100644
index 254a3c8ca..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/main/java/org/apache/eventmesh/admin/rocketmq/util/UrlMappingPattern.java
+++ /dev/null
@@ -1,117 +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.eventmesh.admin.rocketmq.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Represents a URL mapping pattern for routing purposes.
- * The pattern can include variable path parameters or query strings.
- */
-
-public class UrlMappingPattern {
-
- private static final String URL_PARAMETER_REGEX = "\\{(\\w*?)\\}";
-
- private static final String URL_PARAMETER_MATCH_REGEX =
- "\\([%\\\\w-.\\\\~!\\$&'\\\\(\\\\)\\\\*\\\\+,;=:\\\\[\\\\]@]+?\\)";
-
- private static final Pattern URL_PARAMETER_PATTERN =
Pattern.compile(URL_PARAMETER_REGEX);
-
- private static final String URL_FORMAT_REGEX = "(?:\\.\\{format\\})$";
-
- private static final String URL_FORMAT_MATCH_REGEX =
"(?:\\\\.\\([\\\\w%]+?\\))?";
-
- private static final String URL_QUERY_STRING_REGEX = "(?:\\?.*?)?$";
-
- private String urlMappingPattern;
-
- private Pattern compiledUrlMappingPattern;
-
- private List<String> paramNames = new ArrayList<>();
-
- public UrlMappingPattern(String pattern) {
- this.urlMappingPattern = pattern;
- compile();
- }
-
- public String getMappingPattern() {
- return urlMappingPattern.replaceFirst(URL_FORMAT_REGEX, "");
- }
-
- /**
- * Extracts path parameters from the given URL and returns a {@link Map}
of parameter names to values.
- *
- * @param url the URL from which to extract path parameters
- * @return a {@link Map} containing path parameter names and their
corresponding values,
- * or null if the URL does not match the defined URL mapping
pattern
- */
- public Map<String, String> extractPathParameterValues(String url) {
- Matcher matcher = compiledUrlMappingPattern.matcher(url);
- if (matcher.matches()) {
- return extractParameters(matcher);
- }
- return null;
- }
-
- public boolean matches(String url) {
- return (extractPathParameterValues(url) != null);
- }
-
- public void compile() {
- acquireParamNames();
- String parsedPattern =
urlMappingPattern.replaceFirst(URL_FORMAT_REGEX, URL_FORMAT_MATCH_REGEX);
- parsedPattern = parsedPattern.replaceAll(URL_PARAMETER_REGEX,
URL_PARAMETER_MATCH_REGEX);
- this.compiledUrlMappingPattern = Pattern.compile(parsedPattern +
URL_QUERY_STRING_REGEX);
- }
-
- private void acquireParamNames() {
- Matcher m = URL_PARAMETER_PATTERN.matcher(urlMappingPattern);
- while (m.find()) {
- paramNames.add(m.group(1));
- }
- }
-
- /**
- * Extracts parameters from the provided {@link Matcher} object and
returns a {@link Map} of parameter names to values.
- *
- * @param matcher the Matcher object used to match and capture parameter
values
- * @return a {@link Map} containing parameter names and their
corresponding values
- */
- private Map<String, String> extractParameters(Matcher matcher) {
- Map<String, String> values = new HashMap<>((int) (matcher.groupCount()
/ 0.75f + 1));
- for (int i = 0; i < matcher.groupCount(); i++) {
- String value = matcher.group(i + 1);
-
- if (value != null) {
- values.put(paramNames.get(i), value);
- }
- }
- return values;
- }
-
- public List<String> getParamNames() {
- return Collections.unmodifiableList(paramNames);
- }
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/request/TopicCreateRequestTest.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/request/TopicCreateRequestTest.java
deleted file mode 100644
index 7d0697e28..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/request/TopicCreateRequestTest.java
+++ /dev/null
@@ -1,63 +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.eventmesh.admin.rocketmq.request;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Test;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class TopicCreateRequestTest {
-
- @Test
- public void testTopicCreateRequest() {
- String name = "testTopic";
- TopicCreateRequest topicCreateRequest = new TopicCreateRequest(name);
-
- assertEquals(name, topicCreateRequest.getTopic());
- }
-
- @Test
- public void testTopicCreateRequestSetName() {
- TopicCreateRequest topicCreateRequest = new TopicCreateRequest(null);
- assertNull(topicCreateRequest.getTopic());
-
- String name = "testTopic";
- topicCreateRequest.setTopic(name);
- assertEquals(name, topicCreateRequest.getTopic());
- }
-
- @Test
- public void testTopicCreateRequestSerialization() throws Exception {
- String topic = "testTopic";
- TopicCreateRequest topicCreateRequest = new TopicCreateRequest(topic);
-
- ObjectMapper objectMapper = new ObjectMapper();
- String json = objectMapper.writeValueAsString(topicCreateRequest);
-
- assertTrue(json.contains("topic"));
-
- TopicCreateRequest deserializedRequest = objectMapper.readValue(json,
TopicCreateRequest.class);
-
- assertEquals(topic, deserializedRequest.getTopic());
- }
-
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/response/TopicResponseTest.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/response/TopicResponseTest.java
deleted file mode 100644
index 999dffe0b..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/response/TopicResponseTest.java
+++ /dev/null
@@ -1,56 +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.eventmesh.admin.rocketmq.response;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.junit.jupiter.api.Test;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class TopicResponseTest {
-
- @Test
- public void testTopicResponse() {
- String topic = "testtopic";
- String createdTime = "2023-05-17 10:30:00";
- TopicResponse topicResponse = new TopicResponse(topic, createdTime);
-
- assertEquals(topic, topicResponse.getTopic());
- assertEquals(createdTime, topicResponse.getCreatedTime());
- }
-
- @Test
- public void testTopicResponseSerialization() throws Exception {
- String topic = "testtopic";
- String createdTime = "2023-05-17 10:30:00";
- TopicResponse topicResponse = new TopicResponse(topic, createdTime);
-
- ObjectMapper objectMapper = new ObjectMapper();
- String json = objectMapper.writeValueAsString(topicResponse);
-
- assertTrue(json.contains("topic"));
- assertTrue(json.contains("created_time"));
-
- TopicResponse deserializedResponse = objectMapper.readValue(json,
TopicResponse.class);
-
- assertEquals(topic, deserializedResponse.getTopic());
- assertEquals(createdTime, deserializedResponse.getCreatedTime());
- }
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/util/RequestMappingTest.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/util/RequestMappingTest.java
deleted file mode 100644
index a173d410d..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/util/RequestMappingTest.java
+++ /dev/null
@@ -1,78 +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.eventmesh.admin.rocketmq.util;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.apache.eventmesh.common.enums.HttpMethod;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.junit.jupiter.api.Test;
-
-import com.sun.net.httpserver.HttpExchange;
-
-public class RequestMappingTest {
-
- @Test
- public void testPostMapping() throws URISyntaxException {
- HttpExchange httpExchange = mock(HttpExchange.class);
-
when(httpExchange.getRequestMethod()).thenReturn(HttpMethod.POST.name());
- URI requestUri = new URI("/test/123");
- when(httpExchange.getRequestURI()).thenReturn(requestUri);
-
- boolean result = RequestMapping.postMapping("/test/{value}",
httpExchange);
- assertEquals(true, result);
- }
-
- @Test
- public void testGetMapping() throws URISyntaxException {
- HttpExchange httpExchange = mock(HttpExchange.class);
-
when(httpExchange.getRequestMethod()).thenReturn(HttpMethod.GET.name());
- URI requestUri = new URI("/test/123");
- when(httpExchange.getRequestURI()).thenReturn(requestUri);
-
- boolean result = RequestMapping.getMapping("/test/{value}",
httpExchange);
- assertEquals(true, result);
- }
-
- @Test
- public void testPutMapping() throws URISyntaxException {
- HttpExchange httpExchange = mock(HttpExchange.class);
-
when(httpExchange.getRequestMethod()).thenReturn(HttpMethod.PUT.name());
- URI requestUri = new URI("/test/123");
- when(httpExchange.getRequestURI()).thenReturn(requestUri);
-
- boolean result = RequestMapping.putMapping("/test/{value}",
httpExchange);
- assertEquals(true, result);
- }
-
- @Test
- public void testDeleteMapping() throws URISyntaxException {
- HttpExchange httpExchange = mock(HttpExchange.class);
-
when(httpExchange.getRequestMethod()).thenReturn(HttpMethod.DELETE.name());
- URI requestUri = new URI("/test/123");
- when(httpExchange.getRequestURI()).thenReturn(requestUri);
-
- boolean result = RequestMapping.deleteMapping("/test/{value}",
httpExchange);
- assertEquals(true, result);
- }
-}
diff --git
a/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/util/UrlMappingPatternTest.java
b/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/util/UrlMappingPatternTest.java
deleted file mode 100644
index f89447d10..000000000
---
a/eventmesh-admin/eventmesh-admin-rocketmq/src/test/java/org/apache/eventmesh/admin/rocketmq/util/UrlMappingPatternTest.java
+++ /dev/null
@@ -1,117 +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.eventmesh.admin.rocketmq.util;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.lang.reflect.Field;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-public class UrlMappingPatternTest {
-
- private static final String TEST_URL_MAPPING_PATTERN =
"/test/{param1}/path/{param2}";
-
- private TestUrlMappingPattern urlMappingPattern;
-
- @BeforeEach
- public void setUp() {
- urlMappingPattern = new
TestUrlMappingPattern(TEST_URL_MAPPING_PATTERN);
- }
-
- @Test
- public void testGetMappingPattern() {
- assertEquals("/test/{param1}/path/{param2}",
urlMappingPattern.getMappingPattern());
- }
-
- @Test
- public void testExtractPathParameterValues() {
- String testUrl = "/test/123/path/456";
- Matcher mockMatcher = mock(Matcher.class);
- when(mockMatcher.matches()).thenReturn(true);
- when(mockMatcher.groupCount()).thenReturn(2);
- when(mockMatcher.group(1)).thenReturn("123");
- when(mockMatcher.group(2)).thenReturn("456");
-
when(urlMappingPattern.compiledUrlMappingPattern.matcher(testUrl)).thenReturn(mockMatcher);
- Map<String, String> parameterValues =
urlMappingPattern.extractPathParameterValues(testUrl);
- assertEquals("123", parameterValues.get("param1"));
- assertEquals("456", parameterValues.get("param2"));
- }
-
- @Test
- public void testExtractPathParameterValuesWithNoMatch() {
- String testUrl = "/test/123/456";
- Matcher mockMatcher = mock(Matcher.class);
- when(mockMatcher.matches()).thenReturn(false);
-
when(urlMappingPattern.compiledUrlMappingPattern.matcher(testUrl)).thenReturn(mockMatcher);
- assertNull(urlMappingPattern.extractPathParameterValues(testUrl));
- }
-
- @Test
- public void testMatches() {
- String testUrl = "/test/123/path/456";
- Matcher mockMatcher = mock(Matcher.class);
- when(mockMatcher.matches()).thenReturn(true);
-
when(urlMappingPattern.compiledUrlMappingPattern.matcher(testUrl)).thenReturn(mockMatcher);
- assertTrue(urlMappingPattern.matches(testUrl));
- }
-
- @Test
- public void testGetParamNames() {
- assertEquals(2, urlMappingPattern.getParamNames().size());
- assertEquals("param1", urlMappingPattern.getParamNames().get(0));
- assertEquals("param2", urlMappingPattern.getParamNames().get(1));
- }
-
- @Test
- public void testCompile() throws NoSuchFieldException,
IllegalAccessException {
- // Obtain compiledUrlMappingPattern field with reflection
- Field compiledUrlMappingPatternField =
UrlMappingPattern.class.getDeclaredField("compiledUrlMappingPattern");
- compiledUrlMappingPatternField.setAccessible(true);
-
- urlMappingPattern.compile();
-
- // Verify that the compiledUrlMappingPattern field is updated
- Pattern compiledPattern = (Pattern)
compiledUrlMappingPatternField.get(urlMappingPattern);
- assertNotNull(compiledPattern);
-
- // Verify that the mocked pattern is compiled with the expected regex
- String expectedRegex =
"/test/([%\\w-.\\~!$&'\\(\\)\\*\\+,;=:\\[\\]@]+?)/path/([%\\w-.\\~!$&'\\(\\)\\*\\+,;=:\\[\\]@]+?)(?:\\?.*?)?$";
- Pattern expectedPattern = Pattern.compile(expectedRegex);
- assertEquals(expectedPattern.pattern(), compiledPattern.pattern());
- }
-
- class TestUrlMappingPattern extends UrlMappingPattern {
-
- private Pattern compiledUrlMappingPattern;
-
- public TestUrlMappingPattern(String pattern) {
- super(pattern);
- compiledUrlMappingPattern = mock(Pattern.class);
- }
- }
-}
diff --git a/eventmesh-admin/gradle.properties
b/eventmesh-admin/gradle.properties
deleted file mode 100644
index a9fd83fea..000000000
--- a/eventmesh-admin/gradle.properties
+++ /dev/null
@@ -1,16 +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.
-#
\ No newline at end of file
diff --git a/eventmesh-console/gradle/wrapper/gradle-wrapper.jar
b/eventmesh-admin/gradle/wrapper/gradle-wrapper.jar
similarity index 100%
rename from eventmesh-console/gradle/wrapper/gradle-wrapper.jar
rename to eventmesh-admin/gradle/wrapper/gradle-wrapper.jar
diff --git a/eventmesh-console/gradle/wrapper/gradle-wrapper.properties
b/eventmesh-admin/gradle/wrapper/gradle-wrapper.properties
similarity index 100%
rename from eventmesh-console/gradle/wrapper/gradle-wrapper.properties
rename to eventmesh-admin/gradle/wrapper/gradle-wrapper.properties
diff --git a/eventmesh-console/gradlew b/eventmesh-admin/gradlew
similarity index 100%
rename from eventmesh-console/gradlew
rename to eventmesh-admin/gradlew
diff --git a/eventmesh-console/gradlew.bat b/eventmesh-admin/gradlew.bat
similarity index 100%
rename from eventmesh-console/gradlew.bat
rename to eventmesh-admin/gradlew.bat
diff --git a/eventmesh-console/settings.gradle b/eventmesh-admin/settings.gradle
similarity index 95%
rename from eventmesh-console/settings.gradle
rename to eventmesh-admin/settings.gradle
index b2966edef..5c6d89a33 100644
--- a/eventmesh-console/settings.gradle
+++ b/eventmesh-admin/settings.gradle
@@ -15,4 +15,4 @@
* limitations under the License.
*/
-rootProject.name = 'eventmesh-console'
+rootProject.name = 'eventmesh-admin'
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/EventMeshAdminApplication.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/EventMeshAdminApplication.java
similarity index 96%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/EventMeshAdminApplication.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/EventMeshAdminApplication.java
index 2486e783b..af6707617 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/EventMeshAdminApplication.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/EventMeshAdminApplication.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console;
+package org.apache.eventmesh.admin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/config/AdminProperties.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/AdminProperties.java
similarity index 97%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/config/AdminProperties.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/AdminProperties.java
index 9140ae3b1..def5a687f 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/config/AdminProperties.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/AdminProperties.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.config;
+package org.apache.eventmesh.admin.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/config/Constants.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/Constants.java
similarity index 96%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/config/Constants.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/Constants.java
index 6a9fc86cb..d907c803d 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/config/Constants.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/Constants.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.config;
+package org.apache.eventmesh.admin.config;
public class Constants {
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/config/MetaTypeConfig.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/MetaTypeConfig.java
similarity index 78%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/config/MetaTypeConfig.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/MetaTypeConfig.java
index 6ec51d0b9..3b4f19228 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/config/MetaTypeConfig.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/config/MetaTypeConfig.java
@@ -15,17 +15,17 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.config;
+package org.apache.eventmesh.admin.config;
-import static org.apache.eventmesh.console.config.Constants.META_TYPE_ETCD;
-import static org.apache.eventmesh.console.config.Constants.META_TYPE_NACOS;
+import static org.apache.eventmesh.admin.config.Constants.META_TYPE_ETCD;
+import static org.apache.eventmesh.admin.config.Constants.META_TYPE_NACOS;
-import org.apache.eventmesh.console.service.ConnectionService;
-import org.apache.eventmesh.console.service.SubscriptionService;
-import org.apache.eventmesh.console.service.impl.EtcdConnectionService;
-import org.apache.eventmesh.console.service.impl.EtcdSubscriptionService;
-import org.apache.eventmesh.console.service.impl.NacosConnectionService;
-import org.apache.eventmesh.console.service.impl.NacosSubscriptionService;
+import org.apache.eventmesh.admin.service.ConnectionService;
+import org.apache.eventmesh.admin.service.SubscriptionService;
+import org.apache.eventmesh.admin.service.impl.EtcdConnectionService;
+import org.apache.eventmesh.admin.service.impl.EtcdSubscriptionService;
+import org.apache.eventmesh.admin.service.impl.NacosConnectionService;
+import org.apache.eventmesh.admin.service.impl.NacosSubscriptionService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/controller/ConnectionController.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/ConnectionController.java
similarity index 94%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/controller/ConnectionController.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/ConnectionController.java
index 217418e46..14df3da58 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/controller/ConnectionController.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/ConnectionController.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.controller;
+package org.apache.eventmesh.admin.controller;
-import org.apache.eventmesh.console.service.ConnectionService;
+import org.apache.eventmesh.admin.service.ConnectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/controller/SubscriptionController.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/SubscriptionController.java
similarity index 92%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/controller/SubscriptionController.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/SubscriptionController.java
index 96459872f..f59523790 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/controller/SubscriptionController.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/controller/SubscriptionController.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.controller;
+package org.apache.eventmesh.admin.controller;
-import org.apache.eventmesh.console.dto.SubscriptionResponse;
-import org.apache.eventmesh.console.exception.EventMeshAdminException;
-import org.apache.eventmesh.console.service.SubscriptionService;
+import org.apache.eventmesh.admin.dto.SubscriptionResponse;
+import org.apache.eventmesh.admin.exception.EventMeshAdminException;
+import org.apache.eventmesh.admin.service.SubscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/dto/SubscriptionResponse.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/dto/SubscriptionResponse.java
similarity index 92%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/dto/SubscriptionResponse.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/dto/SubscriptionResponse.java
index 49d0e6505..965e71d82 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/dto/SubscriptionResponse.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/dto/SubscriptionResponse.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.dto;
+package org.apache.eventmesh.admin.dto;
-import org.apache.eventmesh.console.model.SubscriptionInfo;
+import org.apache.eventmesh.admin.model.SubscriptionInfo;
import java.util.List;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/EventMeshAdminException.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshAdminException.java
similarity index 96%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/EventMeshAdminException.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshAdminException.java
index 6261b76bb..1118a981d 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/EventMeshAdminException.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshAdminException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.exception;
+package org.apache.eventmesh.admin.exception;
public class EventMeshAdminException extends RuntimeException {
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/EventMeshException.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshException.java
similarity index 97%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/EventMeshException.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshException.java
index 5423ac254..8405fd76c 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/EventMeshException.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/EventMeshException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.exception;
+package org.apache.eventmesh.admin.exception;
public class EventMeshException extends EventMeshAdminException {
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/MetaException.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/MetaException.java
similarity index 95%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/MetaException.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/MetaException.java
index e272b18cf..290bf49f3 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/exception/MetaException.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/exception/MetaException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.exception;
+package org.apache.eventmesh.admin.exception;
public class MetaException extends EventMeshAdminException {
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/model/ConnectionInfo.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/ConnectionInfo.java
similarity index 95%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/model/ConnectionInfo.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/ConnectionInfo.java
index ff265c9dd..1e2428067 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/model/ConnectionInfo.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/ConnectionInfo.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.model;
+package org.apache.eventmesh.admin.model;
public class ConnectionInfo {
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/model/SubscriptionInfo.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/SubscriptionInfo.java
similarity index 95%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/model/SubscriptionInfo.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/SubscriptionInfo.java
index 86e449734..1ad722cd0 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/model/SubscriptionInfo.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/model/SubscriptionInfo.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.model;
+package org.apache.eventmesh.admin.model;
import lombok.Builder;
import lombok.Data;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/ConnectionService.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/ConnectionService.java
similarity index 95%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/service/ConnectionService.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/ConnectionService.java
index 1ebb07304..a61c9cd6e 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/ConnectionService.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/ConnectionService.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.service;
+package org.apache.eventmesh.admin.service;
/**
* "Connection" refers to the subscription relationship between connectors.
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/SubscriptionService.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/SubscriptionService.java
similarity index 92%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/service/SubscriptionService.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/SubscriptionService.java
index 2cab96426..9e06648c1 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/SubscriptionService.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/SubscriptionService.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.service;
+package org.apache.eventmesh.admin.service;
-import org.apache.eventmesh.console.dto.SubscriptionResponse;
+import org.apache.eventmesh.admin.dto.SubscriptionResponse;
/**
* "Subscription" refers to the traditional MQ producer-consumer topic
subscription relationship,
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/EtcdConnectionService.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdConnectionService.java
similarity index 89%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/EtcdConnectionService.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdConnectionService.java
index be589d377..00bb767f4 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/EtcdConnectionService.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdConnectionService.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.service.impl;
+package org.apache.eventmesh.admin.service.impl;
-import org.apache.eventmesh.console.service.ConnectionService;
+import org.apache.eventmesh.admin.service.ConnectionService;
import org.springframework.stereotype.Service;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/EtcdSubscriptionService.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdSubscriptionService.java
similarity index 87%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/EtcdSubscriptionService.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdSubscriptionService.java
index 1c488edfa..9ea72ed35 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/EtcdSubscriptionService.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/EtcdSubscriptionService.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.service.impl;
+package org.apache.eventmesh.admin.service.impl;
-import org.apache.eventmesh.console.dto.SubscriptionResponse;
-import org.apache.eventmesh.console.service.SubscriptionService;
+import org.apache.eventmesh.admin.dto.SubscriptionResponse;
+import org.apache.eventmesh.admin.service.SubscriptionService;
import org.springframework.stereotype.Service;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/NacosConnectionService.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosConnectionService.java
similarity index 90%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/NacosConnectionService.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosConnectionService.java
index a01cf13df..0d231b73c 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/NacosConnectionService.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosConnectionService.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.service.impl;
+package org.apache.eventmesh.admin.service.impl;
-import org.apache.eventmesh.console.config.AdminProperties;
-import org.apache.eventmesh.console.service.ConnectionService;
+import org.apache.eventmesh.admin.config.AdminProperties;
+import org.apache.eventmesh.admin.service.ConnectionService;
import java.util.Properties;
diff --git
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/NacosSubscriptionService.java
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosSubscriptionService.java
similarity index 92%
rename from
eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/NacosSubscriptionService.java
rename to
eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosSubscriptionService.java
index 195667581..a7fa509ab 100644
---
a/eventmesh-console/src/main/java/org/apache/eventmesh/console/service/impl/NacosSubscriptionService.java
+++
b/eventmesh-admin/src/main/java/org/apache/eventmesh/admin/service/impl/NacosSubscriptionService.java
@@ -15,18 +15,18 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console.service.impl;
-
-import static org.apache.eventmesh.console.config.Constants.NACOS_CONFIGS_API;
-import static org.apache.eventmesh.console.config.Constants.NACOS_LOGIN_API;
-
-import org.apache.eventmesh.console.config.AdminProperties;
-import org.apache.eventmesh.console.config.Constants;
-import org.apache.eventmesh.console.dto.SubscriptionResponse;
-import org.apache.eventmesh.console.exception.EventMeshAdminException;
-import org.apache.eventmesh.console.exception.MetaException;
-import org.apache.eventmesh.console.model.SubscriptionInfo;
-import org.apache.eventmesh.console.service.SubscriptionService;
+package org.apache.eventmesh.admin.service.impl;
+
+import static org.apache.eventmesh.admin.config.Constants.NACOS_CONFIGS_API;
+import static org.apache.eventmesh.admin.config.Constants.NACOS_LOGIN_API;
+
+import org.apache.eventmesh.admin.config.AdminProperties;
+import org.apache.eventmesh.admin.config.Constants;
+import org.apache.eventmesh.admin.dto.SubscriptionResponse;
+import org.apache.eventmesh.admin.exception.EventMeshAdminException;
+import org.apache.eventmesh.admin.exception.MetaException;
+import org.apache.eventmesh.admin.model.SubscriptionInfo;
+import org.apache.eventmesh.admin.service.SubscriptionService;
import java.util.ArrayList;
import java.util.Base64;
diff --git a/eventmesh-console/src/main/resources/application.yml
b/eventmesh-admin/src/main/resources/application.yml
similarity index 100%
rename from eventmesh-console/src/main/resources/application.yml
rename to eventmesh-admin/src/main/resources/application.yml
diff --git a/eventmesh-console/src/main/resources/logback.xml
b/eventmesh-admin/src/main/resources/logback.xml
similarity index 100%
rename from eventmesh-console/src/main/resources/logback.xml
rename to eventmesh-admin/src/main/resources/logback.xml
diff --git
a/eventmesh-console/src/test/java/org/apache/eventmesh/console/EventMeshAdminApplicationTests.java
b/eventmesh-admin/src/test/java/org/apache/eventmesh/admin/EventMeshAdminApplicationTests.java
similarity index 96%
rename from
eventmesh-console/src/test/java/org/apache/eventmesh/console/EventMeshAdminApplicationTests.java
rename to
eventmesh-admin/src/test/java/org/apache/eventmesh/admin/EventMeshAdminApplicationTests.java
index 81eaea058..3e2d7fc2a 100644
---
a/eventmesh-console/src/test/java/org/apache/eventmesh/console/EventMeshAdminApplicationTests.java
+++
b/eventmesh-admin/src/test/java/org/apache/eventmesh/admin/EventMeshAdminApplicationTests.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.eventmesh.console;
+package org.apache.eventmesh.admin;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
diff --git a/eventmesh-console/README.md b/eventmesh-console/README.md
deleted file mode 100644
index aadf9b82e..000000000
--- a/eventmesh-console/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# Getting Started
-
-## Build on source code
-
-```
-cd eventmesh-console
-./gradlew clean bootJar
-```
-
-```
-java -jar build/libs/eventmesh-console-0.0.1-SNAPSHOT.jar
-```
-
-## Build and Run with Docker
-
-```
-cd eventmesh-console
-./gradlew clean bootJar
-docker build -t yourname/eventmesh-console -f docker/Dockerfile .
-```
-
-```
-docker run -d --name eventmesh-console -p 8080:8080 yourname/eventmesh-console
-```
\ No newline at end of file
diff --git a/eventmesh-console/build.gradle b/eventmesh-console/build.gradle
deleted file mode 100644
index 5b676ab66..000000000
--- a/eventmesh-console/build.gradle
+++ /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.
- */
-
-plugins {
- id 'java'
- id 'idea'
- id 'org.springframework.boot' version '2.7.15'
- id 'io.spring.dependency-management' version '1.0.15.RELEASE'
-}
-
-group = 'org.apache.eventmesh'
-version = '0.0.1-SNAPSHOT'
-
-java {
- sourceCompatibility = '1.8'
-}
-
-configurations {
- compileOnly {
- extendsFrom annotationProcessor
- }
-}
-
-repositories {
- mavenCentral()
- maven { url 'https://maven.aliyun.com/repository/public/' }
-}
-
-ext {
- // utility
- commonsLang3Version = '3.13.0'
- guavaVersion = '32.1.2-jre' // not used for now
- fastjsonVersion = '2.0.40'
- // swagger
- springdocVersion = '1.7.0'
- // unit test
- mockitoVersion = '5.5.0'
- // meta
- nacosVersion = '2.2.4'
-}
-
-dependencies {
- // versions managed by spring.dependency-management
- implementation 'org.springframework.boot:spring-boot-starter-web'
- compileOnly 'org.projectlombok:lombok'
- developmentOnly 'org.springframework.boot:spring-boot-devtools'
- annotationProcessor
'org.springframework.boot:spring-boot-configuration-processor'
- annotationProcessor 'org.projectlombok:lombok'
- testImplementation 'org.springframework.boot:spring-boot-starter-test'
-
- // utility
- implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
- implementation("com.alibaba.fastjson2:fastjson2:${fastjsonVersion}")
- // swagger
- implementation "org.springdoc:springdoc-openapi-ui:${springdocVersion}"
- implementation
"org.springdoc:springdoc-openapi-javadoc:${springdocVersion}"
- annotationProcessor
'com.github.therapi:therapi-runtime-javadoc-scribe:0.15.0'
- // unit test
- testImplementation("org.mockito:mockito-core:${mockitoVersion}")
- // meta
- implementation("com.alibaba.nacos:nacos-client:${nacosVersion}")
-}
diff --git a/eventmesh-runtime/build.gradle b/eventmesh-runtime/build.gradle
index 1f1d753c8..54f953369 100644
--- a/eventmesh-runtime/build.gradle
+++ b/eventmesh-runtime/build.gradle
@@ -42,14 +42,8 @@ dependencies {
implementation project(":eventmesh-security-plugin:eventmesh-security-acl")
implementation
project(":eventmesh-security-plugin:eventmesh-security-auth-http-basic")
implementation
project(":eventmesh-security-plugin:eventmesh-security-auth-token")
-
implementation project(":eventmesh-meta:eventmesh-meta-api")
- implementation project(":eventmesh-admin:eventmesh-admin-rocketmq")
-
-
implementation project(":eventmesh-meta:eventmesh-meta-nacos")
-
-
implementation project(":eventmesh-protocol-plugin:eventmesh-protocol-api")
implementation "io.grpc:grpc-core"
diff --git a/eventmesh-runtime/conf/eventmesh.properties
b/eventmesh-runtime/conf/eventmesh.properties
index b05968e11..de4150fba 100644
--- a/eventmesh-runtime/conf/eventmesh.properties
+++ b/eventmesh-runtime/conf/eventmesh.properties
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-###############################EVNETMESH-runtime
ENV#################################
+########################## EventMesh Runtime Environment
##########################
eventMesh.server.idc=DEFAULT
eventMesh.server.env=PRD
eventMesh.server.provide.protocols=HTTP,TCP,GRPC
@@ -23,7 +23,7 @@ eventMesh.server.name=EVENTMESH-runtime
eventMesh.sysid=0000
eventMesh.server.http.port=10105
eventMesh.server.grpc.port=10205
-########################## eventMesh tcp configuration
############################
+########################## EventMesh TCP Configuration
##########################
eventMesh.server.tcp.enabled=true
eventMesh.server.tcp.port=10000
eventMesh.server.tcp.readerIdleSeconds=120
@@ -49,41 +49,41 @@ eventMesh.server.maxEventBatchSize=10
# thread number about global scheduler
eventMesh.server.global.scheduler=5
eventMesh.server.tcp.taskHandleExecutorPoolSize=8
-#retry
+# retry
eventMesh.server.retry.async.pushRetryTimes=3
eventMesh.server.retry.sync.pushRetryTimes=3
eventMesh.server.retry.async.pushRetryDelayInMills=500
eventMesh.server.retry.sync.pushRetryDelayInMills=500
eventMesh.server.retry.pushRetryQueueSize=10000
-#admin
+# runtime admin
eventMesh.server.admin.http.port=10106
-#metaStorage
+# metaStorage
eventMesh.server.metaStorage.metaStorageIntervalInMills=10000
eventMesh.server.metaStorage.fetchMetaStorageAddrIntervalInMills=20000
-#auto-ack
+# auto-ack
#eventMesh.server.defibus.client.comsumeTimeoutInMin=5
-#sleep interval between closing client of different group in server graceful
shutdown
+# sleep interval between closing client of different group in server graceful
shutdown
eventMesh.server.gracefulShutdown.sleepIntervalInMills=1000
eventMesh.server.rebalanceRedirect.sleepIntervalInMills=200
-#ip address blacklist
+# ip address blacklist
eventMesh.server.blacklist.ipv4=0.0.0.0/8,127.0.0.0/8,169.254.0.0/16,255.255.255.255/32
eventMesh.server.blacklist.ipv6=::/128,::1/128,ff00::/8
-#connector plugin
+# connector plugin
eventMesh.connector.plugin.type=standalone
-#storage plugin
+# storage plugin
eventMesh.storage.plugin.type=standalone
-#security plugin
+# security plugin
eventMesh.server.security.enabled=false
eventMesh.security.plugin.type=security
eventMesh.security.validation.type.token=false
eventMesh.security.publickey=
-#metaStorage plugin
+# metaStorage plugin
eventMesh.metaStorage.plugin.enabled=false
eventMesh.metaStorage.plugin.type=nacos
eventMesh.metaStorage.plugin.server-addr=127.0.0.1:8848
@@ -133,7 +133,7 @@ eventMesh.trace.plugin=zipkin
# webhook
# Start webhook admin service
eventMesh.webHook.admin.start=true
-# Webhook event configuration storage mode. Currently, only file and Nacos are
supported
+# Webhook event configuration storage mode. Currently, only file and nacos are
supported
eventMesh.webHook.operationMode=file
# The file storage path of the file storage mode. If #{eventmeshhome} is
written, it is in the eventmesh root directory
eventMesh.webHook.fileMode.filePath= #{eventMeshHome}/webhook
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/ClientManageController.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/ClientManageController.java
index 43b282380..bf0c132a0 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/ClientManageController.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/controller/ClientManageController.java
@@ -17,7 +17,6 @@
package org.apache.eventmesh.runtime.admin.controller;
-import org.apache.eventmesh.admin.rocketmq.controller.AdminController;
import org.apache.eventmesh.runtime.admin.handler.ConfigurationHandler;
import org.apache.eventmesh.runtime.admin.handler.DeleteWebHookConfigHandler;
import org.apache.eventmesh.runtime.admin.handler.EventHandler;
@@ -118,8 +117,6 @@ public class ClientManageController {
// Register the handlers from the HTTP handler manager with the HTTP
server.
httpHandlerManager.registerHttpHandler(server);
- AdminController adminController = new AdminController();
- adminController.run(server);
server.start();
log.info("ClientManageController start success, port:{}", port);
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
index 6f1547588..37cb3d050 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
@@ -194,8 +194,7 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
/**
* Registers the processors required by the runtime module
*/
- public void registerProcessor(final Integer requestCode, final
HttpRequestProcessor processor,
- final ThreadPoolExecutor executor) {
+ public void registerProcessor(final Integer requestCode, final
HttpRequestProcessor processor, final ThreadPoolExecutor executor) {
AssertUtils.notNull(requestCode, "requestCode can't be null");
AssertUtils.notNull(processor, "processor can't be null");
AssertUtils.notNull(executor, "executor can't be null");
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java
index 763fa8e53..3b9149843 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java
@@ -255,9 +255,9 @@ public class EventMeshHTTPServer extends AbstractHTTPServer
{
final SendAsyncRemoteEventProcessor sendAsyncRemoteEventProcessor =
new SendAsyncRemoteEventProcessor(this);
this.getHandlerService().register(sendAsyncRemoteEventProcessor,
remoteMsgExecutor);
- ThreadPoolExecutor adminExecutor =
httpThreadPoolGroup.getAdminExecutor();
+ ThreadPoolExecutor runtimeAdminExecutor =
httpThreadPoolGroup.getRuntimeAdminExecutor();
final AdminMetricsProcessor adminMetricsProcessor = new
AdminMetricsProcessor(this);
- registerProcessor(RequestCode.ADMIN_METRICS.getRequestCode(),
adminMetricsProcessor, adminExecutor);
+ registerProcessor(RequestCode.ADMIN_METRICS.getRequestCode(),
adminMetricsProcessor, runtimeAdminExecutor);
ThreadPoolExecutor clientManageExecutor =
httpThreadPoolGroup.getClientManageExecutor();
final HeartBeatProcessor heartProcessor = new HeartBeatProcessor(this);
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/HTTPThreadPoolGroup.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/HTTPThreadPoolGroup.java
index 9a7b93d0e..4c675a0f8 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/HTTPThreadPoolGroup.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/HTTPThreadPoolGroup.java
@@ -33,7 +33,7 @@ public class HTTPThreadPoolGroup implements ThreadPoolGroup {
private ThreadPoolExecutor replyMsgExecutor;
private ThreadPoolExecutor pushMsgExecutor;
private ThreadPoolExecutor clientManageExecutor;
- private ThreadPoolExecutor adminExecutor;
+ private ThreadPoolExecutor runtimeAdminExecutor;
private ThreadPoolExecutor webhookExecutor;
public HTTPThreadPoolGroup(EventMeshHTTPConfiguration
eventMeshHttpConfiguration) {
@@ -73,11 +73,11 @@ public class HTTPThreadPoolGroup implements ThreadPoolGroup
{
new
LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerClientManageBlockQSize()),
"eventMesh-clientManage", true);
- adminExecutor = ThreadPoolFactory.createThreadPoolExecutor(
+ // The runtimeAdminExecutor here is for the runtime.admin package and
has nothing to do with the eventmesh-admin module.
+ runtimeAdminExecutor = ThreadPoolFactory.createThreadPoolExecutor(
eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(),
- new LinkedBlockingQueue<>(50), "eventMesh-admin",
- true);
+ new LinkedBlockingQueue<>(50), "eventMesh-runtime-admin", true);
replyMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor(
eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(),
@@ -96,8 +96,8 @@ public class HTTPThreadPoolGroup implements ThreadPoolGroup {
if (batchMsgExecutor != null) {
batchMsgExecutor.shutdown();
}
- if (adminExecutor != null) {
- adminExecutor.shutdown();
+ if (runtimeAdminExecutor != null) {
+ runtimeAdminExecutor.shutdown();
}
if (clientManageExecutor != null) {
clientManageExecutor.shutdown();
@@ -140,8 +140,8 @@ public class HTTPThreadPoolGroup implements ThreadPoolGroup
{
return clientManageExecutor;
}
- public ThreadPoolExecutor getAdminExecutor() {
- return adminExecutor;
+ public ThreadPoolExecutor getRuntimeAdminExecutor() {
+ return runtimeAdminExecutor;
}
public ThreadPoolExecutor getWebhookExecutor() {
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/controller/ClientManageControllerTest.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/controller/ClientManageControllerTest.java
index 1f9093e1d..83773f22f 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/controller/ClientManageControllerTest.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/admin/controller/ClientManageControllerTest.java
@@ -22,7 +22,6 @@ import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import org.apache.eventmesh.admin.rocketmq.controller.AdminController;
import org.apache.eventmesh.common.config.ConfigService;
import org.apache.eventmesh.metrics.api.model.HttpSummaryMetrics;
import org.apache.eventmesh.metrics.api.model.TcpSummaryMetrics;
@@ -47,8 +46,6 @@ public class ClientManageControllerTest {
@Test
public void testStart() throws Exception {
- AdminController adminController = mock(AdminController.class);
-
ConfigService configService = ConfigService.getInstance();
configService.setRootConfig("classPath://configuration.properties");
EventMeshTCPConfiguration tcpConfiguration =
configService.buildConfigInstance(EventMeshTCPConfiguration.class);
@@ -83,7 +80,6 @@ public class ClientManageControllerTest {
try (MockedStatic<HttpServer> dummyStatic =
Mockito.mockStatic(HttpServer.class)) {
HttpServer server = mock(HttpServer.class);
dummyStatic.when(() -> HttpServer.create(any(),
anyInt())).thenReturn(server);
- Mockito.doNothing().when(adminController).run(server);
Assertions.assertDoesNotThrow(controller::start);
}
}
diff --git a/settings.gradle b/settings.gradle
index 5f1b1ed05..42e7b6ec6 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -62,9 +62,6 @@ include 'eventmesh-meta:eventmesh-meta-etcd'
include 'eventmesh-meta:eventmesh-meta-consul'
include 'eventmesh-meta:eventmesh-meta-zookeeper'
-include 'eventmesh-admin'
-include 'eventmesh-admin:eventmesh-admin-rocketmq'
-
include 'eventmesh-protocol-plugin'
include 'eventmesh-protocol-plugin:eventmesh-protocol-api'
include 'eventmesh-protocol-plugin:eventmesh-protocol-openmessage'
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]