From 6837150777f8a89bd29b00525e002028961720ec Mon Sep 17 00:00:00 2001 From: "lambert@arch" Date: Mon, 29 Jan 2024 17:11:48 +0800 Subject: [PATCH] fix: add StatusEnum add enum support for entity class. --- .../console/dto/ConnectionResponse.java | 8 +-- .../console/entity/client/ClientEntity.java | 37 +++++++++++ .../entity/connection/ConnectionEntity.java | 17 +++++ .../entity/connector/ConnectorEntity.java | 35 ++++++++-- .../health/HealthCheckResultEntity.java | 47 -------------- .../console/entity/meta/MetaEntity.java | 14 ++++ .../enums/KubernetesPodStatusEnum.java | 36 ++++++++++ ...bernetesPodStatus.java => StatusEnum.java} | 18 ++--- .../health/HealthCheckScheduler.java} | 17 ++--- .../main/resources/eventmesh-dashboard.sql | 8 +-- ...ConnectionDataServiceDatabaseImplTest.java | 65 ------------------- 11 files changed, 159 insertions(+), 143 deletions(-) delete mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java create mode 100644 eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/KubernetesPodStatusEnum.java rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/{KubernetesPodStatus.java => StatusEnum.java} (78%) rename eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/{enums/health/HealthCheckDimensionEnum.java => scheduler/health/HealthCheckScheduler.java} (72%) delete mode 100644 eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/ConnectionResponse.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/ConnectionResponse.java index a7d7a53f..d4062a68 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/ConnectionResponse.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/dto/ConnectionResponse.java @@ -38,8 +38,8 @@ public class ConnectionResponse implements Serializable { @Schema(name = "sourceStatus", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active") private Integer sourceStatus; - @Schema(name = "sourceConfigList", description = "source config list") - private List sourceConfigList; + // @Schema(name = "sourceConfigList", description = "source config list") + // private List sourceConfigList; @Schema(name = "sinkType", defaultValue = "connector", allowableValues = {"connector", "client"}) private String sinkType; @@ -50,8 +50,8 @@ public class ConnectionResponse implements Serializable { @Schema(name = "sinkStatus", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active") private Integer sinkStatus; - @Schema(name = "sinkConfigList", description = "sink config list") - private List sinkConfigList; + // @Schema(name = "sinkConfigList", description = "sink config list") + // private List sinkConfigList; private Long runtimeId; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/client/ClientEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/client/ClientEntity.java index 6eba6f66..4da4dada 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/client/ClientEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/client/ClientEntity.java @@ -18,14 +18,26 @@ package org.apache.eventmesh.dashboard.console.entity.client; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.enums.StatusEnum; import java.sql.Timestamp; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor public class ClientEntity extends BaseEntity { private static final long serialVersionUID = 8204133370609215856L; + + /** + * Primary key + */ @Schema(name = "id", description = "primary key") private Long id; @@ -33,26 +45,51 @@ public class ClientEntity extends BaseEntity { private String platform; + /** + * programing language of client + */ + @Schema(name = "language", example = "java") private String language; + /** + * process id + */ + @Schema(name = "pid", description = "process id") private Long pid; private String host; private Integer port; + /** + * protocol used to connect to runtime. + */ + @Schema(name = "protocol", example = "http", allowableValues = {"http", "grpc", "tcp"}) private String protocol; /** * 0: not active, 1: active + * @see StatusEnum */ @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:not active, 1:active") private Integer status; + /** + * csv format config id list.
+ * Example value: 1,2,7
+ * This field is updated when the configuration is modified via the web API, but is not used during the configuration retrieval process. + */ private String configIds; private String description; + /** + * The time when the client is terminated. + */ private Timestamp endTime; + + public void setStatusEntity(StatusEnum status) { + this.status = status.getNumber(); + } } \ No newline at end of file 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 55a4f576..d4d21c51 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 @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.console.entity.connection; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.enums.StatusEnum; import java.sql.Timestamp; import java.util.Objects; @@ -34,6 +35,10 @@ public class ConnectionEntity extends BaseEntity { private static final long serialVersionUID = 6565578252656944905L; + + /** + * Primary key + */ @Schema(name = "id", description = "primary key") private Long id; @@ -43,6 +48,10 @@ public class ConnectionEntity extends BaseEntity { @Schema(name = "sourceType", defaultValue = "connector", allowableValues = {"connector", "client"}) private String sourceType; + /** + * The id of the source.
+ * It can be connectorId or clientId according to the sourceType. + */ @Schema(name = "sourceId", description = "connectorId or clientId") private Long sourceId; @@ -52,6 +61,10 @@ public class ConnectionEntity extends BaseEntity { @Schema(name = "sinkType", defaultValue = "connector", allowableValues = {"connector", "client"}) private String sinkType; + /** + * The id of the sink.
+ * It can be connectorId or clientId according to the sinkType. + */ @Schema(name = "sinkId", description = "connectorId or clientId") private Long sinkId; @@ -68,6 +81,10 @@ public class ConnectionEntity extends BaseEntity { private String description; + public void setStatusEnum(StatusEnum statusEnum) { + this.status = statusEnum.getNumber(); + } + @Override public boolean equals(Object o) { if (this == o) { 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 26750194..79754d92 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 @@ -18,9 +18,18 @@ package org.apache.eventmesh.dashboard.console.entity.connector; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.enums.KubernetesPodStatusEnum; +import org.apache.eventmesh.dashboard.console.enums.StatusEnum; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor public class ConnectorEntity extends BaseEntity { private static final long serialVersionUID = -8226303660232951326L; @@ -34,14 +43,32 @@ public class ConnectorEntity extends BaseEntity { private String type; - private String status; + /** + * 0: not active, 1: active + * + * @see StatusEnum + */ + @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active") + private Integer status; + /** + * @see KubernetesPodStatusEnum + */ + @Schema(name = "podState", defaultValue = "0", allowableValues = {"0", "1", "2", "3", "4", "5", + "6"}, description = "0:Pending, 1:Running, 2:Succeeded, 3:Failed, 4:Unknown, 5:Terminating, 6:Terminated") private Integer podState; /** - * csv format config id list.
- * Example value: 1,2,7
- * This field is updated when the configuration is modified via the web API, but is not used during the configuration retrieval process. + * csv format config id list.
Example value: 1,2,7
This field is updated when the configuration is modified via the web API, but is not + * used during the configuration retrieval process. */ private String configIds; + + public void setStatusEnum(StatusEnum statusEnum) { + this.status = statusEnum.getNumber(); + } + + public void setKubernetesPodStatusEnum(KubernetesPodStatusEnum kubernetesPodStatusEnum) { + this.podState = kubernetesPodStatusEnum.getNumber(); + } } 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 deleted file mode 100644 index 1b1aa9e6..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/health/HealthCheckResultEntity.java +++ /dev/null @@ -1,47 +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.entity.health; - -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; - -import io.swagger.v3.oas.annotations.media.Schema; - -import lombok.Data; - -@Data -@Schema(name = "HealthCheckResultEntity", description = "Health check result entity") -public class HealthCheckResultEntity extends BaseEntity { - - private static final long serialVersionUID = -7350585209577598040L; - @Schema(name = "id", description = "primary key") - private Long id; - - @Schema(description = "Dimension of Health Check;0:Unknown, 1:Cluster, 2:Runtime, 3:Topic, 4:Group", defaultValue = "0", allowableValues = {"0", - "1", "2", "3", "4"}) - private Integer dimension; - - private String configName; - - private String resName; - - private Integer passed; - - public HealthCheckResultEntity() { - } - -} 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 016acc1a..2c32e284 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 @@ -18,12 +18,17 @@ package org.apache.eventmesh.dashboard.console.entity.meta; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import org.apache.eventmesh.dashboard.console.enums.StatusEnum; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; @Data +@NoArgsConstructor +@AllArgsConstructor public class MetaEntity extends BaseEntity { private static final long serialVersionUID = 7176263169716424469L; @@ -52,5 +57,14 @@ public class MetaEntity extends BaseEntity { private String params; + /** + * 0: not active, 1: active + * @see StatusEnum + */ + @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active") private Integer status; + + public void setStatusEnum(StatusEnum statusEnum) { + this.status = statusEnum.getNumber(); + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/KubernetesPodStatusEnum.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/KubernetesPodStatusEnum.java new file mode 100644 index 00000000..497fd3c1 --- /dev/null +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/KubernetesPodStatusEnum.java @@ -0,0 +1,36 @@ +/* + * 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.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum KubernetesPodStatusEnum { + PENDING(0, "Pending"), + RUNNING(1, "Running"), + SUCCEEDED(2, "Succeeded"), + FAILED(3, "Failed"), + UNKNOWN(4, "Unknown"), + TERMINATING(5, "Terminating"), + TERMINATED(6, "Terminated"); + + private final Integer number; + private final String name; +} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/KubernetesPodStatus.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/StatusEnum.java similarity index 78% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/KubernetesPodStatus.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/StatusEnum.java index 449e970e..271e3f2a 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/KubernetesPodStatus.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/StatusEnum.java @@ -17,13 +17,15 @@ package org.apache.eventmesh.dashboard.console.enums; -public enum KubernetesPodStatus { - PENDING(0, "pending"), - RUNNING(1, "running"), - SUCCEEDED(2, "succeeded"), - FAILED(3, "failed"), - UNKNOWN(4, "unknown"); +import lombok.AllArgsConstructor; +import lombok.Getter; - KubernetesPodStatus(Integer number, String status) { - } +@Getter +@AllArgsConstructor +public enum StatusEnum { + INACTIVE(0, "Inactive"), + ACTIVE(1, "Active"); + + private final Integer number; + private final String name; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/health/HealthCheckDimensionEnum.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/scheduler/health/HealthCheckScheduler.java similarity index 72% rename from eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/health/HealthCheckDimensionEnum.java rename to eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/scheduler/health/HealthCheckScheduler.java index d59a13f0..7263f7cd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/enums/health/HealthCheckDimensionEnum.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/scheduler/health/HealthCheckScheduler.java @@ -15,19 +15,14 @@ * limitations under the License. */ -package org.apache.eventmesh.dashboard.console.enums.health; +package org.apache.eventmesh.dashboard.console.scheduler.health; -public enum HealthCheckDimensionEnum { - UNKNOWN(0, "unknown"), +import org.springframework.stereotype.Component; - CLUSTER(1, "cluster"), +import lombok.extern.slf4j.Slf4j; - RUNTIME(2, "runtime"), +@Slf4j +@Component +public class HealthCheckScheduler { - TOPIC(3, "topic"), - - GROUP(4, "group"); - - HealthCheckDimensionEnum(Integer dimensionId, String dimensionName) { - } } diff --git a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql index 7704ec0a..8de09e77 100644 --- a/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql +++ b/eventmesh-dashboard-console/src/main/resources/eventmesh-dashboard.sql @@ -19,7 +19,7 @@ DROP TABLE IF EXISTS `client`; CREATE TABLE `client` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '物理集群ID', + `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', `name` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端名称', `platform` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端平台', `language` varchar(192) NOT NULL DEFAULT '' COMMENT '客户端语言', @@ -45,7 +45,7 @@ DROP TABLE IF EXISTS `connector`; CREATE TABLE `connector` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '物理集群ID', + `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', `name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector名称', `class_name` varchar(512) NOT NULL DEFAULT '' COMMENT 'Connector类', `type` varchar(32) NOT NULL DEFAULT '' COMMENT 'Connector类型', @@ -63,7 +63,7 @@ DROP TABLE IF EXISTS `connection`; CREATE TABLE `connection` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '物理集群ID', + `cluster_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '集群ID', `source_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'source类型,可以为client或source connector', `source_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'client或source connector ID', `sink_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'sink类型,可以为client或sink connector', @@ -92,7 +92,7 @@ CREATE TABLE `health_check_result` `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', `dimension` int(11) NOT NULL DEFAULT '0' COMMENT '检查维度(0:未知,1:Cluster,2:Runtime,3:Topic,4:Group)', `config_name` varchar(192) NOT NULL DEFAULT '' COMMENT '配置名', - `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '物理集群ID', + `cluster_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '集群ID', `res_name` varchar(192) NOT NULL DEFAULT '' COMMENT '资源名称', `passed` tinyint(4) NOT NULL DEFAULT '0' COMMENT '检查通过(0:未通过,1:通过)', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', 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 deleted file mode 100644 index 4debf74f..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImplTest.java +++ /dev/null @@ -1,65 +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.service.connection.impl; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; - -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit.jupiter.SpringExtension; - - - -@ExtendWith(SpringExtension.class) -@ActiveProfiles("test") -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:connectiontest.sql") -@SpringBootTest -public class ConnectionDataServiceDatabaseImplTest { - - @Autowired - private ConnectionDataServiceDatabaseImpl connectionServiceDatabaseImpl; - - @Test - public void testGetAllConnectionsByClusterId() { - List connectionEntityList = connectionServiceDatabaseImpl.getAllConnectionsByClusterId(1L); - assertEquals(3, connectionEntityList.size()); - } - - @Test - public void testGetAllConnections() { - List connectionEntityList = connectionServiceDatabaseImpl.getAllConnections(); - assertEquals(6, connectionEntityList.size()); - } - - @Test - public void testReplaceAllConnections() { - List connectionEntityList = connectionServiceDatabaseImpl.getAllConnectionsByClusterId(1L); - //change ClusterId into 2 - connectionEntityList.forEach(connectionEntity -> connectionEntity.setClusterId(2L)); - connectionServiceDatabaseImpl.replaceAllConnections(connectionEntityList); - assertEquals(7, connectionServiceDatabaseImpl.getAllConnections().size()); - } -} \ No newline at end of file