diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aac6fa1f..df1716f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: services: mysql: image: mysql:8.0 + command: --character-set-server=utf8mb4 --collation-server=utf8mb4_bin env: # The MySQL docker container requires these environment variables to be set, so we can create and migrate the test database. MYSQL_DATABASE: eventmesh_dashboard_test diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/HealthConstant.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/HealthConstant.java deleted file mode 100644 index 979f5783..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/HealthConstant.java +++ /dev/null @@ -1,22 +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.dashboard.console.constant; - -public class HealthConstant { - public static final String NEW_LINE_ENDING = "\n"; -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/health/HealthCheckTypeConstant.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/health/HealthCheckTypeConstant.java new file mode 100644 index 00000000..6765bab7 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/health/HealthCheckTypeConstant.java @@ -0,0 +1,39 @@ +/* + * 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.constant.health; + +public class HealthCheckTypeConstant { + + public static final String HEALTH_CHECK_TYPE_UNKNOWN = "unknown"; + + public static final String HEALTH_CHECK_TYPE_CLUSTER = "cluster"; + + public static final String HEALTH_CHECK_TYPE_RUNTIME = "runtime"; + public static final String HEALTH_CHECK_TYPE_STORAGE = "storage"; + public static final String HEALTH_CHECK_TYPE_META = "meta"; + public static final String HEALTH_CHECK_TYPE_TOPIC = "topic"; + + public static final String HEALTH_CHECK_SUBTYPE_REDIS = "redis"; + public static final String HEALTH_CHECK_SUBTYPE_MYSQL = "mysql"; + public static final String HEALTH_CHECK_SUBTYPE_ROCKETMQ_BROKER = "rocketmq4-broker"; + public static final String HEALTH_CHECK_SUBTYPE_ROCKETMQ_NAMESERVER = "rocketmq4-nameserver"; + public static final String HEALTH_CHECK_SUBTYPE_ROCKETMQ_TOPIC = "rocketmq4-topic"; + + public static final String HEALTH_CHECK_SUBTYPE_NACOS_CONFIG = "nacos-config"; + public static final String HEALTH_CHECK_SUBTYPE_NACOS_REGISTER = "nacos-register"; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/health/HealthConstant.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/health/HealthConstant.java new file mode 100644 index 00000000..e243b30f --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/constant/health/HealthConstant.java @@ -0,0 +1,61 @@ +/* + * 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.constant.health; + +public class HealthConstant { + public static final String NEW_LINE_ENDING = "\n"; + + public static final String RUNTIME_CHECK_TOPIC = "eventmesh-dashboard-healthcheck-topic"; + + public static final String RUNTIME_CHECK_CONTENT_KEY = "eventmesh-dashboard-healthcheck-content"; + + public static final String RUNTIME_CHECK_CONTENT_BODY = "eventmesh-dashboard-healthcheck-content-body"; + + public static final String CLOUDEVENT_CONTENT_TYPE = "application/cloudevents+json"; + + + public static final String ENV = "test"; + public static final String HOST = "localhost"; + public static final String PASSWORD = "PASSWORD"; + public static final String USER_NAME = "PU4283"; + public static final String GROUP = "EventmeshTestGroup"; + public static final String PATH = "/data/app/umg_proxy"; + public static final Integer PORT = 8362; + public static final String VERSION = "2.0.11"; + public static final String IDC = "FT"; + public static final String SUBSYSTEM = "5023"; + + public static final String ROCKETMQ_CHECK_PRODUCER_GROUP = "eventmesh-dashboard-healthcheck-rocketmq-producer-group"; + + public static final String ROCKETMQ_CHECK_CONSUMER_GROUP = "eventmesh-dashboard-healthcheck-rocketmq-consumer-group"; + + public static final String ROCKETMQ_CHECK_TOPIC = "DO-NOT-USE-THIS-TOPIC-" + + "eventmesh-dashboard-healthcheck-rocketmq-topic-90a78a5d-b803-447e-8c48-1c87ab0c74d9"; + public static final String ROCKETMQ_CHECK_TOPIC_MSG = "eventmesh-dashboard-healthcheck-rocketmq-message"; + + public static final String NACOS_CHECK_DATA_ID = "DO-NOT-USE-THIS-" + + "eventmesh-dashboard-healthcheck-nacos-data-id-28e2933f-a47b-439d-b14b-7d9970c37042"; + + public static final String NACOS_CHECK_GROUP = "EVENTMESH_DASHBOARD_HEALTH_CHECK_GROUP"; + + public static final String NACOS_CHECK_CONTENT = "eventmesh-dashboard"; + + public static final String NACOS_CHECK_SERVICE_NAME = "eventmesh-dashboard-healthcheck-nacos-service-name"; + + public static final String NACOS_CHECK_SERVICE_CLUSTER_NAME = "eventmesh-dashboard-healthcheck-nacos-service-cluster-name"; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseEntity.java index 14192fad..6f0b7970 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/base/BaseEntity.java @@ -29,8 +29,14 @@ public class BaseEntity implements Serializable { private static final long serialVersionUID = -2697805837923579585L; + /** + * Primary key + */ + @Schema(name = "id", description = "primary key") + protected Long id; - private Long clusterId; + + protected Long clusterId; protected Timestamp createTime; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/ConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/ConnectionEntity.java index 0a451cf1..626e793c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/ConnectionEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/ConnectionEntity.java @@ -40,12 +40,6 @@ public class ConnectionEntity extends BaseEntity { private static final long serialVersionUID = 6565578252656944905L; - /** - * Primary key - */ - @Schema(name = "id", description = "primary key") - private Long id; - /** * Runtime cluster id */ diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java index 1681ac29..66db0f9b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connector/ConnectorEntity.java @@ -34,9 +34,6 @@ public class ConnectorEntity extends BaseEntity { private static final long serialVersionUID = -8226303660232951326L; - @Schema(name = "id", description = "primary key") - private Long id; - private Long clusterId; private String name; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java index e8578eb0..f427b66b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java @@ -32,8 +32,6 @@ public class HealthCheckResultEntity extends BaseEntity { private static final long serialVersionUID = -7350585209577598040L; - @Schema(name = "id", description = "primary key") - private Long id; private Long clusterId; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/MetaEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/MetaEntity.java index 2c32e284..a6871eb0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/MetaEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/meta/MetaEntity.java @@ -33,12 +33,6 @@ public class MetaEntity extends BaseEntity { private static final long serialVersionUID = 7176263169716424469L; - /** - * Primary key - */ - @Schema(name = "id", description = "Primary key") - private Long id; - private String name; private String type; @@ -59,6 +53,7 @@ public class MetaEntity extends BaseEntity { /** * 0: not active, 1: active + * * @see StatusEnum */ @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/health/HealthCheckType.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/health/HealthCheckType.java index 3ee990bb..abd918f3 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/health/HealthCheckType.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/health/HealthCheckType.java @@ -17,20 +17,26 @@ package org.apache.eventmesh.dashboard.console.enums.health; +import static org.apache.eventmesh.dashboard.console.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_TYPE_CLUSTER; +import static org.apache.eventmesh.dashboard.console.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_TYPE_RUNTIME; +import static org.apache.eventmesh.dashboard.console.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_TYPE_STORAGE; +import static org.apache.eventmesh.dashboard.console.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_TYPE_TOPIC; +import static org.apache.eventmesh.dashboard.console.constant.health.HealthCheckTypeConstant.HEALTH_CHECK_TYPE_UNKNOWN; + import lombok.AllArgsConstructor; import lombok.Getter; @AllArgsConstructor public enum HealthCheckType { - UNKNOWN(0, "unknown"), + UNKNOWN(0, HEALTH_CHECK_TYPE_UNKNOWN), - CLUSTER(1, "cluster"), + CLUSTER(1, HEALTH_CHECK_TYPE_CLUSTER), - RUNTIME(2, "runtime"), + RUNTIME(2, HEALTH_CHECK_TYPE_RUNTIME), - TOPIC(3, "topic"), + TOPIC(3, HEALTH_CHECK_TYPE_TOPIC), - STORAGE(4, "storage"); + STORAGE(4, HEALTH_CHECK_TYPE_STORAGE); @Getter private final Integer number; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java index ab57fc11..d51a9eff 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapper.java @@ -26,6 +26,8 @@ import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; +import java.util.List; + /** * Mybatis Mapper for the table of meta. */ @@ -35,7 +37,7 @@ public interface MetaMapper { MetaEntity selectById(MetaEntity metaEntity); @Select("SELECT * FROM meta WHERE cluster_id = #{clusterId} LIMIT 1") - MetaEntity selectByClusterId(MetaEntity metaEntity); + List selectByClusterId(MetaEntity metaEntity); @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") @Insert("INSERT INTO meta (name, type, version, cluster_id, host, port, role, username, params, status)" diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java index 4f282297..6106e175 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapperTest.java @@ -83,15 +83,15 @@ public void testSelectByClusterIdSinkTypeAndSinkId() { @Test public void testInsert() { - ConnectionEntity connectionEntity = new ConnectionEntity(1L, 1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description"); + ConnectionEntity connectionEntity = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description"); connectionMapper.insert(connectionEntity); assertEquals(7, connectionMapper.selectAll().size()); } @Test public void testBatchInsert() { - ConnectionEntity connectionEntity1 = new ConnectionEntity(1L, 1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description"); - ConnectionEntity connectionEntity2 = new ConnectionEntity(1L, 1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description"); + ConnectionEntity connectionEntity1 = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description"); + ConnectionEntity connectionEntity2 = new ConnectionEntity(1L, "connector", 1L, "connector", 2L, 1L, 0, "topic", 3L, null, "description"); connectionMapper.batchInsert(Arrays.asList(connectionEntity1, connectionEntity2)); assertEquals(8, connectionMapper.selectAll().size()); } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java index 0bb360b1..786597dc 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/connector/ConnectorMapperTest.java @@ -69,7 +69,7 @@ public void testSelectByClusterId() { @Test public void testInsert() { - ConnectorEntity connectorEntity = new ConnectorEntity(1L, 1L, "test", "test", "test", 0, 2, "test"); + ConnectorEntity connectorEntity = new ConnectorEntity(1L, "test", "test", "test", 0, 2, "test"); connectorMapper.insert(connectorEntity); assertNotNull(connectorEntity); @@ -78,9 +78,9 @@ public void testInsert() { @Test public void testBatchInsert() { - ConnectorEntity connectorEntity1 = new ConnectorEntity(1L, 1L, "test", "test", "test", 0, 2, "test"); - ConnectorEntity connectorEntity2 = new ConnectorEntity(1L, 1L, "test", "test", "test", 0, 2, "test"); - ConnectorEntity connectorEntity3 = new ConnectorEntity(1L, 1L, "test", "test", "test", 0, 2, "test"); + ConnectorEntity connectorEntity1 = new ConnectorEntity(1L, "test", "test", "test", 0, 2, "test"); + ConnectorEntity connectorEntity2 = new ConnectorEntity(1L, "test", "test", "test", 0, 2, "test"); + ConnectorEntity connectorEntity3 = new ConnectorEntity(1L, "test", "test", "test", 0, 2, "test"); List connectorEntityList = new ArrayList<>(); connectorEntityList.add(connectorEntity1); connectorEntityList.add(connectorEntity2); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java index 1ceb8fce..30e66907 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/health/HealthCheckResultMapperTest.java @@ -17,7 +17,7 @@ package org.apache.eventmesh.dashboard.console.mapper.health; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; @@ -58,7 +58,7 @@ public void testSelectById() { @Test public void testSelectByClusterIdAndTypeAndTypeId() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1L, 1, 1L, "", 1); + HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1, 1L, "", 1); healthCheckResultEntity = healthCheckResultMapper.selectByClusterIdAndTypeAndTypeId(healthCheckResultEntity).get(0); assertEquals(1, healthCheckResultEntity.getId()); assertEquals(0, healthCheckResultEntity.getStatus()); @@ -66,7 +66,7 @@ public void testSelectByClusterIdAndTypeAndTypeId() { @Test public void testSelectByClusterIdAndType() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1L, 1, 1L, "", 1); + HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1, 1L, "", 1); List results = healthCheckResultMapper.selectByClusterIdAndType(healthCheckResultEntity); assertEquals(2, results.size()); } @@ -84,7 +84,7 @@ public void testSelectByClusterIdAndTimeRange() throws ParseException { @Test public void testInsert() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 5L, 1, 5L, "", 1); + HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(5L, 1, 5L, "", 1); healthCheckResultMapper.insert(healthCheckResultEntity); healthCheckResultEntity = healthCheckResultMapper.selectById(healthCheckResultEntity); assertEquals(7, healthCheckResultEntity.getId()); @@ -92,8 +92,8 @@ public void testInsert() { @Test public void testBatchInsert() { - HealthCheckResultEntity healthCheckResultEntity1 = new HealthCheckResultEntity(1L, 1L, 1, 5L, "", 1); - HealthCheckResultEntity healthCheckResultEntity2 = new HealthCheckResultEntity(1L, 1L, 1, 6L, "", 1); + HealthCheckResultEntity healthCheckResultEntity1 = new HealthCheckResultEntity(1L, 1, 5L, "", 1); + HealthCheckResultEntity healthCheckResultEntity2 = new HealthCheckResultEntity(1L, 1, 6L, "", 1); healthCheckResultMapper.batchInsert(Arrays.asList(healthCheckResultEntity1, healthCheckResultEntity2)); List results = healthCheckResultMapper.selectByClusterIdAndType(healthCheckResultEntity1); assertEquals(4, results.size()); @@ -101,7 +101,7 @@ public void testBatchInsert() { @Test public void testUpdate() { - HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1L, 1, 1L, "reason", 0); + HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(1L, 1, 1L, "reason", 0); healthCheckResultMapper.update(healthCheckResultEntity); healthCheckResultEntity = healthCheckResultMapper.selectByClusterIdAndTypeAndTypeId(healthCheckResultEntity).get(0); assertEquals(0, healthCheckResultEntity.getStatus()); @@ -109,8 +109,10 @@ public void testUpdate() { @Test public void testBatchUpdate() { - HealthCheckResultEntity healthCheckResultEntity1 = new HealthCheckResultEntity(1L, 1L, 1, 1L, "reason", 0); - HealthCheckResultEntity healthCheckResultEntity2 = new HealthCheckResultEntity(2L, 1L, 1, 1L, "reason", 0); + HealthCheckResultEntity healthCheckResultEntity1 = new HealthCheckResultEntity(1L, 1, 1L, "reason", 0); + healthCheckResultEntity1.setId(1L); + HealthCheckResultEntity healthCheckResultEntity2 = new HealthCheckResultEntity(1L, 1, 1L, "reason", 0); + healthCheckResultEntity2.setId(2L); healthCheckResultMapper.batchUpdate(Arrays.asList(healthCheckResultEntity1, healthCheckResultEntity2)); healthCheckResultEntity1 = healthCheckResultMapper.selectById(healthCheckResultEntity1); healthCheckResultEntity2 = healthCheckResultMapper.selectById(healthCheckResultEntity2); @@ -121,8 +123,8 @@ public void testBatchUpdate() { @Test public void testUpdateByClusterIdAndTypeAndTypeId() { - HealthCheckResultEntity entity1 = new HealthCheckResultEntity(null, 1L, 1, 1L, "reason", 2); - HealthCheckResultEntity entity2 = new HealthCheckResultEntity(null, 1L, 1, 1L, "reason", 2); + HealthCheckResultEntity entity1 = new HealthCheckResultEntity(1L, 1, 1L, "reason", 2); + HealthCheckResultEntity entity2 = new HealthCheckResultEntity(1L, 1, 1L, "reason", 2); healthCheckResultMapper.batchInsert(Arrays.asList(entity1, entity2)); List toBeUpdate = healthCheckResultMapper.getIdsNeedToBeUpdateByClusterIdAndTypeAndTypeId( diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapperTest.java index 9d05b401..5888edae 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/meta/MetaMapperTest.java @@ -20,6 +20,7 @@ import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; @@ -42,6 +43,7 @@ class MetaMapperTest { public void testSelectByClusterId() { MetaEntity metaEntity = new MetaEntity(); metaEntity.setClusterId(1L); - metaEntity = metaMapper.selectByClusterId(metaEntity); + metaEntity = metaMapper.selectByClusterId(metaEntity).get(0); + Assertions.assertEquals("nacos", metaEntity.getType()); } } \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/TestGroupMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java similarity index 82% rename from eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/TestGroupMapper.java rename to eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java index f02fcafc..41eca99f 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/TestGroupMapper.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.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.group; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; @@ -16,7 +33,7 @@ @RunWith(SpringRunner.class) @SpringBootTest(classes = EventMeshDashboardApplication.class) -public class TestGroupMapper { +public class GroupMapperTest { @Autowired private OprGroupMapper groupMapper; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/testGroupMemberMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java similarity index 88% rename from eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/testGroupMemberMapper.java rename to eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java index d3a20a0f..76fa8498 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/testGroupMemberMapper.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.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.groupmember; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; @@ -16,7 +33,7 @@ @RunWith(SpringRunner.class) @SpringBootTest(classes = EventMeshDashboardApplication.class) -public class testGroupMemberMapper { +public class GroupMemberMapperTest { @Autowired OprGroupMemberMapper groupMemberMapper; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/testTopicMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java similarity index 84% rename from eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/testTopicMapper.java rename to eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java index 7472792e..929953a5 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/testTopicMapper.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.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.topic; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; @@ -16,7 +33,7 @@ @RunWith(SpringRunner.class) @SpringBootTest(classes = EventMeshDashboardApplication.class) -public class testTopicMapper { +public class TopicMapperTest { @Autowired private TopicMapper topicMapper; diff --git a/eventmesh-dashboard-console/src/test/resources/logback-test.xml b/eventmesh-dashboard-console/src/test/resources/logback-test.xml new file mode 100644 index 00000000..e86bb3ef --- /dev/null +++ b/eventmesh-dashboard-console/src/test/resources/logback-test.xml @@ -0,0 +1,50 @@ + + + + + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n + + + + + ${user.home}/logs/eventmesh-dashboard.log + true + + ${user.home}/logs/eventmesh-dashboard-%d{yyyy-MM-dd}.%i.log + + + 104857600 + + 10 + + + [%d{yyyy-MM-dd HH:mm:ss.SSS}] %p %t - %m%n + UTF-8 + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 68372bf7..7672656d 100644 --- a/pom.xml +++ b/pom.xml @@ -74,13 +74,14 @@ https://github.com/apache/eventmesh-dashboard/issues - - 8 - 8 - UTF-8 - 2.7.6 - 2.3.2 - + + 8 + 8 + UTF-8 + 2.7.6 + 2.3.2 + 2.1.2 + eventmesh-dashboard-console @@ -135,6 +136,16 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.2 + + + **/org/apache/eventmesh/dashboard/console/integration/**/*.java + + + org.apache.maven.plugins