diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java index f1f492f3..6a4eee11 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/ConnectionController.java @@ -17,9 +17,11 @@ package org.apache.eventmesh.dashboard.console.controller; + +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.AddConnectionDTO; +import org.apache.eventmesh.dashboard.console.mapstruct.connection.ConnectionControllerMapper; import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; @@ -60,15 +62,15 @@ public List getConnectorConfigsByClassAndVersion(String version, S @GetMapping("/showCreateConnectionMessage") - public AddConnectionDTO showCreateConnectionMessage() { - return new AddConnectionDTO(); + public AddConnectionEntity showCreateConnectionMessage() { + return new AddConnectionEntity(); } @PostMapping("/createConnection") public String createConnection(@Validated @RequestBody CreateConnectionDTO createConnectionDTO) { try { - connectionDataService.createConnection(createConnectionDTO); + connectionDataService.createConnection(ConnectionControllerMapper.INSTANCE.queryCreateEntityByConnection(createConnectionDTO)); } catch (Exception e) { return e.getMessage(); } @@ -78,7 +80,7 @@ public String createConnection(@Validated @RequestBody CreateConnectionDTO creat @PostMapping("/getConnectionList") public List getConnectionList(@Validated @RequestBody GetConnectionListDTO getConnectionListDTO) { - return connectionDataService.getConnectionToFrontByCluster(getConnectionListDTO.getClusterId(), getConnectionListDTO); + return connectionDataService.getConnectionToFrontByCluster(ConnectionControllerMapper.INSTANCE.queryEntityByConnection(getConnectionListDTO)); } @GetMapping("/getConnectorDetail") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java new file mode 100644 index 00000000..1f453fea --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/CreateConnectionEntity.java @@ -0,0 +1,33 @@ +/* + * 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.entity; + +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectorConfigEntity; + +import lombok.Data; + +@Data +public class CreateConnectionEntity { + + private Long clusterId; + + private AddConnectionEntity addConnectionEntity; + + private AddConnectorConfigEntity addConnectorConfigEntity; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java similarity index 92% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java index 63438145..917462a7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectionDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectionEntity.java @@ -15,12 +15,12 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.modle.dto.connection; +package org.apache.eventmesh.dashboard.console.entity.connection; import lombok.Data; @Data -public class AddConnectionDTO { +public class AddConnectionEntity { private String sinkName; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java similarity index 85% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java index aa6801cf..291fe8cc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/AddConnectorConfigDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/connection/AddConnectorConfigEntity.java @@ -15,18 +15,16 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.modle.dto.connection; +package org.apache.eventmesh.dashboard.console.entity.connection; import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; import java.util.List; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; @Data -public class AddConnectorConfigDTO { +public class AddConnectorConfigEntity { private List sinkConnectorConfigs; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java index d0f92828..2afd16c0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/config/ConfigControllerMapper.java @@ -19,9 +19,7 @@ import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; -import org.apache.eventmesh.dashboard.console.entity.function.LogEntity; import org.apache.eventmesh.dashboard.console.modle.dto.config.GetConfigsListDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.log.GetLogListDTO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java new file mode 100644 index 00000000..a1c22646 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapstruct/connection/ConnectionControllerMapper.java @@ -0,0 +1,37 @@ +/* + * 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.mapstruct.connection; + +import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; +import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; + +import org.mapstruct.factory.Mappers; + +/** + * + */ +public interface ConnectionControllerMapper { + + ConnectionControllerMapper INSTANCE = Mappers.getMapper(ConnectionControllerMapper.class); + + ConnectionEntity queryEntityByConnection(GetConnectionListDTO getConnectionListDTO); + + CreateConnectionEntity queryCreateEntityByConnection(CreateConnectionDTO createConnectionDTO); +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java index 6352038f..f204296f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/modle/dto/connection/CreateConnectionDTO.java @@ -17,6 +17,9 @@ package org.apache.eventmesh.dashboard.console.modle.dto.connection; +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectorConfigEntity; + import lombok.Data; @Data @@ -24,7 +27,7 @@ public class CreateConnectionDTO { private Long clusterId; - private AddConnectionDTO addConnectionDTO; + private AddConnectionEntity addConnectionEntity; - private AddConnectorConfigDTO addConnectorConfigDTO; + private AddConnectorConfigEntity addConnectorConfigEntity; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java index 5db26c96..c1a6345f 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ConnectionDataService.java @@ -17,16 +17,16 @@ package org.apache.eventmesh.dashboard.console.service.cluster; +import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.CreateConnectionDTO; -import org.apache.eventmesh.dashboard.console.modle.dto.connection.GetConnectionListDTO; import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; import java.util.List; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * Service providing ConnectionEntity data. @@ -40,13 +40,16 @@ public interface ConnectionDataService { List getAllConnectionsByClusterId(Long clusterId); - boolean createConnection(CreateConnectionDTO createConnectionDTO); + boolean createConnection(CreateConnectionEntity connectionEntity); List getAllConnections(); - List getConnectionToFrontByCluster(Long clusterId, GetConnectionListDTO getConnectionListDTO); + List getConnectionToFrontByCluster(ConnectionEntity connectionEntity); + + @Transactional + void replaceAllConnections(List connectionEntityList); List getConnectorConfigsByClassAndVersion(String classType, String version); - Long insert(ConnectionEntity connectionEntity); + void insert(ConnectionEntity connectionEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java new file mode 100644 index 00000000..2ba287a8 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ConnectionDataServiceDatabaseImpl.java @@ -0,0 +1,231 @@ +/* + * 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.service.cluster.impl; + + + +import org.apache.eventmesh.dashboard.console.annotation.EmLog; +import org.apache.eventmesh.dashboard.console.entity.CreateConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.connection.AddConnectionEntity; +import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; +import org.apache.eventmesh.dashboard.console.entity.function.ConfigEntity; +import org.apache.eventmesh.dashboard.console.mapper.cluster.ConnectionMapper; +import org.apache.eventmesh.dashboard.console.mapper.connector.ConnectorMapper; +import org.apache.eventmesh.dashboard.console.mapper.function.ConfigMapper; +import org.apache.eventmesh.dashboard.console.modle.vo.connection.ConnectionListVO; +import org.apache.eventmesh.dashboard.console.service.cluster.ConnectionDataService; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +@Service +public class ConnectionDataServiceDatabaseImpl implements ConnectionDataService { + + @Autowired + private ConnectionMapper connectionMapper; + + @Autowired + private ConnectorMapper connectorMapper; + + @Autowired + private ConfigMapper configMapper; + + + @Override + public ConnectorEntity getConnectorById(Long connectorId) { + ConnectorEntity connectorEntity = new ConnectorEntity(); + connectorEntity.setId(connectorId); + return connectorMapper.selectById(connectorEntity); + } + + @Override + public List getConnectorBusinessType(String type) { + ConfigEntity config = new ConfigEntity(); + config.setBusinessType(type); + return configMapper.selectConnectorBusinessType(config); + } + + @Override + public List getAllConnectionsByClusterId(Long clusterId) { + ConnectionEntity connectionEntity = new ConnectionEntity(); + connectionEntity.setClusterId(clusterId); + return connectionMapper.selectByClusterId(connectionEntity); + } + + @Override + public void insert(ConnectionEntity connectionEntity) { + connectionMapper.insert(connectionEntity); + } + + + @EmLog(OprType = "add", OprTarget = "Connection") + @Override + public boolean createConnection(CreateConnectionEntity createConnectionEntity) { + ConnectorEntity sinkConnector = this.createSinkConnector(createConnectionEntity.getClusterId(), + createConnectionEntity.getAddConnectionEntity()); + ConnectorEntity sourceConnector = this.createSourceConnector(createConnectionEntity.getClusterId(), + createConnectionEntity.getAddConnectionEntity()); + ConnectionEntity connectionEntity = this.setConnection(createConnectionEntity); + connectionEntity.setSinkId(sinkConnector.getId()); + connectionEntity.setSourceId(sourceConnector.getId()); + connectionMapper.insert(connectionEntity); + this.addConnectorConfigs(createConnectionEntity.getAddConnectorConfigEntity().getSinkConnectorConfigs(), sinkConnector); + this.addConnectorConfigs(createConnectionEntity.getAddConnectorConfigEntity().getSourceConnectorConfigs(), sourceConnector); + return false; + } + + private ConnectionEntity setConnection(CreateConnectionEntity createConnectionEntity) { + ConnectionEntity connectionEntity = new ConnectionEntity(); + connectionEntity.setClusterId(createConnectionEntity.getClusterId()); + connectionEntity.setSourceType("connector"); + connectionEntity.setSinkType("connector"); + connectionEntity.setRuntimeId(-1L); + connectionEntity.setGroupId(createConnectionEntity.getAddConnectionEntity().getGroupId()); + connectionEntity.setStatus(1); + connectionEntity.setDescription(createConnectionEntity.getAddConnectionEntity().getConnectionDescription()); + connectionEntity.setTopic(createConnectionEntity.getAddConnectionEntity().getTopicName()); + return connectionEntity; + } + + public void addConnectorConfigs(List configEntityList, ConnectorEntity connectorEntity) { + configEntityList.forEach(n -> { + n.setInstanceId(connectorEntity.getId()); + n.setIsDefault(0); + n.setClusterId(connectorEntity.getClusterId()); + }); + configMapper.batchInsert(configEntityList); + } + + public ConnectorEntity createSinkConnector(Long clusterId, AddConnectionEntity addConnectionEntity) { + ConnectorEntity connectorEntity = new ConnectorEntity(); + connectorEntity.setName(addConnectionEntity.getSinkName()); + connectorEntity.setHost(addConnectionEntity.getSinkHost()); + connectorEntity.setClusterId(clusterId); + connectorEntity.setClassName(addConnectionEntity.getSinkClass()); + connectorEntity.setType("Connector"); + connectorEntity.setStatus(1); + connectorEntity.setPodState(0); + connectorEntity.setPort(addConnectionEntity.getSinkPort()); + connectorMapper.insert(connectorEntity); + return connectorEntity; + } + + public ConnectorEntity createSourceConnector(Long clusterId, AddConnectionEntity addConnectionEntity) { + ConnectorEntity connectorEntity = new ConnectorEntity(); + connectorEntity.setName(addConnectionEntity.getSourceName()); + connectorEntity.setHost(addConnectionEntity.getSourceHost()); + connectorEntity.setClusterId(clusterId); + connectorEntity.setClassName(addConnectionEntity.getSourceClass()); + connectorEntity.setType("Connector"); + connectorEntity.setStatus(1); + connectorEntity.setPodState(0); + connectorEntity.setPort(addConnectionEntity.getSourcePort()); + connectorMapper.insert(connectorEntity); + return connectorEntity; + } + + + @Override + public List getAllConnections() { + return connectionMapper.selectAll(); + } + + @Override + public List getConnectionToFrontByCluster(ConnectionEntity connectionEntity) { + List allConnectionsByClusterId = connectionMapper.selectToFrontByClusterId(connectionEntity); + List connectionListVOs = new ArrayList<>(); + allConnectionsByClusterId.forEach(n -> { + connectionListVOs.add(this.setConnectionListVO(n)); + }); + return connectionListVOs; + } + + private ConnectionListVO setConnectionListVO(ConnectionEntity connectionEntity) { + ConnectionListVO connectionListVO = new ConnectionListVO(); + ConnectorEntity connectorEntity = new ConnectorEntity(); + connectorEntity.setId(connectionEntity.getSinkId()); + ConnectorEntity sinkConnector = connectorMapper.selectById(connectorEntity); + connectorEntity.setId(connectionEntity.getSourceId()); + ConnectorEntity sourceConnector = connectorMapper.selectById(connectorEntity); + connectionListVO.setSinkClass(sinkConnector.getClassName()); + connectionListVO.setSourceClass(sourceConnector.getClassName()); + connectionListVO.setSinkConnectorId(sinkConnector.getId()); + connectionListVO.setSourceConnectorId(sourceConnector.getId()); + connectionListVO.setSinkConnectorName(sinkConnector.getName()); + connectionListVO.setSourceConnectorName(sourceConnector.getName()); + connectionListVO.setTopicName(connectionEntity.getTopic()); + connectionListVO.setStatus(connectionEntity.getStatus()); + return connectionListVO; + } + + @Override + @Transactional + public void replaceAllConnections(List connectionEntityList) { + Map> connectionsGroupedByClusterId = connectionEntityList.stream() + .collect(Collectors.groupingBy(ConnectionEntity::getClusterId)); + + connectionsGroupedByClusterId.forEach((clusterId, newConnections) -> { + ConnectionEntity connectionEntity = new ConnectionEntity(); + connectionEntity.setClusterId(clusterId); + List existingConnections = connectionMapper.selectByClusterId(connectionEntity); + + // Collect connections that are not in the new list + List connectionsToInactive = existingConnections.stream() + .filter(existingConnection -> !newConnections.contains(existingConnection)) + .collect(Collectors.toList()); + + // Collect new connections that are not in the existing list + List connectionsToInsert = newConnections.stream() + .filter(connection -> !existingConnections.contains(connection)) + .collect(Collectors.toList()); + + // Delete connections in batch + if (!connectionsToInactive.isEmpty()) { + connectionMapper.batchEndConnectionById(connectionsToInactive); + } + + // Insert new connections in batch + if (!connectionsToInsert.isEmpty()) { + connectionMapper.batchInsert(connectionsToInsert); + } + }); + } + + + @Override + public List getConnectorConfigsByClassAndVersion(String classType, String version) { + ConfigEntity config = new ConfigEntity(); + config.setBusinessType(classType); + List configEntityList = configMapper.selectConnectorConfigsByBusinessType(config); + configEntityList.forEach(n -> { + if (!n.matchVersion(version)) { + configEntityList.remove(n); + } + }); + return configEntityList; + } +} + diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java index 7c53e34c..c619bd17 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/ConfigService.java @@ -32,7 +32,8 @@ public interface ConfigService { List selectToFront(ConfigEntity configEntity); - void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, List changeConfigEntityList); + void updateConfigsByInstanceId(String name, Long clusterId, Integer instanceType, Long instanceId, + List changeConfigEntityList); List selectAll(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java index 89d20f3d..2b315ae6 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/function/Impl/HealthDataServiceDatabaseImpl.java @@ -74,7 +74,10 @@ public InstanceLiveProportionVo selectTopicLiveProportion(Long clusterId) { abnormalNum++; } } - return new InstanceLiveProportionVo(abnormalNum, topicNum); + InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo(); + instanceLiveProportionVo.setAbnormalNum(abnormalNum); + instanceLiveProportionVo.setAllNum(topicNum); + return instanceLiveProportionVo; } @@ -89,7 +92,10 @@ public InstanceLiveProportionVo selectRuntimeLiveProportion(Long clusterId) { abnormalNum++; } } - return new InstanceLiveProportionVo(abnormalNum, topicNum); + InstanceLiveProportionVo instanceLiveProportionVo = new InstanceLiveProportionVo(); + instanceLiveProportionVo.setAbnormalNum(abnormalNum); + instanceLiveProportionVo.setAllNum(topicNum); + return instanceLiveProportionVo; } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java index b01940a1..0884b5cf 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java @@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.eventmesh.dashboard.console.entity.cluster.ConnectionEntity; +import org.apache.eventmesh.dashboard.console.service.cluster.impl.ConnectionDataServiceDatabaseImpl; import java.util.List; @@ -52,4 +53,4 @@ public void testGetAllConnections() { List connectionEntityList = connectionServiceDatabaseImpl.getAllConnections(); assertEquals(6, connectionEntityList.size()); } -} \ No newline at end of file +}