diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java index 14c3e050..df5f0715 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/ApiPrefix.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.common.constant; public class ApiPrefix { + public static final String API_PREFIX = "/eventmesh-dashboard/"; public static final String API_V1_PREFIX = API_PREFIX + "v1/"; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java index dfa3711c..665024af 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/StoreTypeConstant.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.common.constant; public class StoreTypeConstant { + public static final String STORE_TYPE_TYPE_UNKNOWN = "unknown"; public static final String STORE_TYPE_STANDALONE = "standalone"; public static final String STORE_TYPE_REDIS = "redis"; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java index bc3818b7..dd724889 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/constant/health/HealthConstant.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.common.constant.health; public class HealthConstant { + public static final String NEW_LINE_ENDING = "\n"; public static final String RUNTIME_CHECK_TOPIC = "eventmesh-dashboard-healthcheck-topic"; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/difference/topic/StorageTopicDifference.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/difference/topic/StorageTopicDifference.java deleted file mode 100644 index af91b35b..00000000 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/difference/topic/StorageTopicDifference.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.apache.eventmesh.dashboard.common.difference.topic; - -public class StorageTopicDifference { - - - - -} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java index 1ea4c520..e34fd920 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/dto/Result.java @@ -70,8 +70,7 @@ public static Result success(T data) { } /** - * The request is valid and the result is returned in {@link ResponseEntity}. - * Logic issues should use 422 Unprocessable Entity instead of 200 OK. + * The request is valid and the result is returned in {@link ResponseEntity}. Logic issues should use 422 Unprocessable Entity instead of 200 OK. */ public static ResponseEntity> ok() { return ResponseEntity.ok(new Result<>(new StatusMessage(Status.SUCCESS))); @@ -126,8 +125,7 @@ public StatusMessage(BaseException e) { } /** - * Only recommended for returning successful results, - * the stack trace cannot be displayed when returning unsuccessful results. + * Only recommended for returning successful results, the stack trace cannot be displayed when returning unsuccessful results. */ public StatusMessage(Status status) { this.status = status.name(); diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java index 193a2741..44b852d1 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterTrusteeshipType.java @@ -1,15 +1,30 @@ +/* + * 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.common.enums; public enum ClusterTrusteeshipType { - // FIRE_AND_FORGET_TRUSTEESHIP, - // 发现 or 长时间没有上线 cluster sync db TRUSTEESHIP, REVERSE, NO_TRUSTEESHIP; - + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java index c2390378..41d918fb 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/ClusterType.java @@ -1,11 +1,28 @@ -package org.apache.eventmesh.dashboard.common.enums; +/* + * 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. + */ -import lombok.Getter; +package org.apache.eventmesh.dashboard.common.enums; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import lombok.Getter; + public enum ClusterType { DEFAULT(1), @@ -52,44 +69,26 @@ public enum ClusterType { public static final List STORAGE_TYPES = getStorage(); - - - private static List getStorage(){ - List list = new ArrayList<>(); - for(ClusterType clusterType : ClusterType.values()){ - if(Objects.equals(clusterType.eventmeshNodeType , ClusterType.STORAGE) && Objects.equals(clusterType.assemblyNodeType , ClusterType.CLUSTER)) { - list.add(clusterType); - } - } - return list; - } - - @Getter private ClusterType eventmeshNodeType; - @Getter private ClusterType assemblyName; - @Getter private ClusterType assemblyNodeType; - @Getter private ClusterType assemblyBusiness; - @Getter private RemotingType remotingType; - @Getter private int code; - - ClusterType(int code) { this.code = code; } - ClusterType(ClusterType eventmeshNodeType, ClusterType assemblyName, ClusterType assemblyNodeType, ClusterType assemblyBusiness, RemotingType remotingType) { + + ClusterType(ClusterType eventmeshNodeType, ClusterType assemblyName, ClusterType assemblyNodeType, ClusterType assemblyBusiness, + RemotingType remotingType) { this.eventmeshNodeType = eventmeshNodeType; this.assemblyName = assemblyName; this.assemblyNodeType = assemblyNodeType; @@ -97,21 +96,29 @@ private static List getStorage(){ this.remotingType = remotingType; } + private static List getStorage() { + List list = new ArrayList<>(); + for (ClusterType clusterType : ClusterType.values()) { + if (Objects.equals(clusterType.eventmeshNodeType, ClusterType.STORAGE) && Objects.equals(clusterType.assemblyNodeType, + ClusterType.CLUSTER)) { + list.add(clusterType); + } + } + return list; + } - public boolean isMainCluster(){ - return Objects.equals(this, ClusterType.EVENTMESH_CLUSTER ) || Objects.equals(this.assemblyNodeType, ClusterType.CLUSTER ); + public boolean isMainCluster() { + return Objects.equals(this, ClusterType.EVENTMESH_CLUSTER) || Objects.equals(this.assemblyNodeType, ClusterType.CLUSTER); } public boolean isFirstLayer() { - return Objects.equals(this, ClusterType.EVENTMESH_META_NACOS) - || Objects.equals(this, ClusterType.EVENTMESH_META_ETCD) - || Objects.equals(this, ClusterType.EVENTMESH_RUNTIME) - || Objects.equals(this.getAssemblyNodeType(), ClusterType.CLUSTER); + return Objects.equals(this, ClusterType.EVENTMESH_META_NACOS) || Objects.equals(this, ClusterType.EVENTMESH_META_ETCD) || Objects.equals(this, + ClusterType.EVENTMESH_RUNTIME) || Objects.equals(this.getAssemblyNodeType(), ClusterType.CLUSTER); } public boolean isSecondFloor() { - return Objects.equals(eventmeshNodeType, ClusterType.STORAGE) ? (Objects.equals(assemblyNodeType, ClusterType.RUNTIME) - || Objects.equals(assemblyNodeType, ClusterType.META)) : false; + return Objects.equals(eventmeshNodeType, ClusterType.STORAGE) ? (Objects.equals(assemblyNodeType, ClusterType.RUNTIME) || Objects.equals( + assemblyNodeType, ClusterType.META)) : false; } } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java index c7770afc..aa0ad0e8 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/enums/RemotingType.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.common.enums; public enum RemotingType { @@ -15,6 +32,5 @@ public enum RemotingType { EVENT_MESH_ETCD, ROCKETMQ, - ROCKETMQ_NAMESERVER - ; + ROCKETMQ_NAMESERVER; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java index c1829045..57f37b26 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterMetadata.java @@ -17,12 +17,13 @@ package org.apache.eventmesh.dashboard.common.model.metadata; -import lombok.Data; -import lombok.EqualsAndHashCode; import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; import org.apache.eventmesh.dashboard.common.enums.ClusterType; import org.apache.eventmesh.dashboard.common.enums.StoreType; +import lombok.Data; +import lombok.EqualsAndHashCode; + @Data @EqualsAndHashCode(callSuper = true) public class ClusterMetadata extends MetadataConfig { diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java index dcb725b1..1b5d5644 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/ClusterRelationshipMetadata.java @@ -1,8 +1,27 @@ +/* + * 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.common.model.metadata; -import lombok.Data; import org.apache.eventmesh.dashboard.common.enums.ClusterType; +import lombok.Data; + + @Data public class ClusterRelationshipMetadata extends MetadataConfig { diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java index 31c8485e..890ce757 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/metadata/RegistryMetadata.java @@ -17,10 +17,10 @@ package org.apache.eventmesh.dashboard.common.model.metadata; -import lombok.EqualsAndHashCode; import org.apache.eventmesh.dashboard.common.enums.RecordStatus; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java index 2459c79e..28d413aa 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/BaseGlobalResult.java @@ -18,4 +18,5 @@ package org.apache.eventmesh.dashboard.common.model.remoting; public class BaseGlobalResult extends GlobalResult { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java index a6933760..82e6c7fa 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/GlobalRequest.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.common.model.remoting; import lombok.Data; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java index 527a742c..ce625648 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingAction.java @@ -1,12 +1,29 @@ +/* + * 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.common.model.remoting; import org.apache.eventmesh.dashboard.common.enums.RemotingType; public @interface RemotingAction { - boolean support(); + boolean support(); - RemotingType substitution(); + RemotingType substitution(); - RemotingType retrySubstitution() default RemotingType.STORAGE; + RemotingType retrySubstitution() default RemotingType.STORAGE; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java index cdfa5a8c..39bda207 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingOperate.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.common.model.remoting; public enum RemotingOperate { diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingServiceType.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingServiceType.java deleted file mode 100644 index 2c9413ad..00000000 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/RemotingServiceType.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.apache.eventmesh.dashboard.common.model.remoting; - -public enum RemotingServiceType { - - -} diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java index 08b80990..e1844ce0 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/acl/CreateAclRequest.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.common.model.remoting.acl; public class CreateAclRequest { + //acl is included in runtime config private String runtimeAddress; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java index 3098ae8c..0f8d3de7 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigRequest.java @@ -18,12 +18,11 @@ package org.apache.eventmesh.dashboard.common.model.remoting.config; import org.apache.eventmesh.dashboard.common.model.remoting.RemotingOperate; -import lombok.Data; - - import java.util.List; +import lombok.Data; + @Data public class AddConfigRequest { diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java index 2d358b63..d951a91a 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResponse.java @@ -18,4 +18,5 @@ package org.apache.eventmesh.dashboard.common.model.remoting.config; public class AddConfigResponse { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java index 0929d2c8..2af482a7 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/AddConfigResult.java @@ -18,4 +18,5 @@ package org.apache.eventmesh.dashboard.common.model.remoting.config; public class AddConfigResult { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java index afa9a4d6..b580d437 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResponse.java @@ -18,4 +18,5 @@ package org.apache.eventmesh.dashboard.common.model.remoting.config; public class DeleteConfigResponse { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java index 8fa13603..935fb4d1 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/DeleteConfigResult.java @@ -17,5 +17,6 @@ package org.apache.eventmesh.dashboard.common.model.remoting.config; -public class DeleteConfigResult extends AddConfigResult{ +public class DeleteConfigResult extends AddConfigResult { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java index 3954e7f5..3fb1053f 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/GetConfigResult.java @@ -28,5 +28,6 @@ @AllArgsConstructor public class GetConfigResult { + CompletableFuture getConfigResponseFuture; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java index 2a3409fc..2686df1c 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResponse.java @@ -18,4 +18,5 @@ package org.apache.eventmesh.dashboard.common.model.remoting.config; public class UpdateConfigResponse { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java index d55e9da1..a3128dab 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/config/UpdateConfigResult.java @@ -18,4 +18,5 @@ package org.apache.eventmesh.dashboard.common.model.remoting.config; public class UpdateConfigResult extends AddConfigResult { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java index 80b50d6a..b41acc3e 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/group/GetGroupResult.java @@ -17,11 +17,12 @@ package org.apache.eventmesh.dashboard.common.model.remoting.group; -import lombok.Data; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; import java.util.concurrent.CompletableFuture; +import lombok.Data; + @Data public class GetGroupResult extends GlobalResult { diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java index f33d8a75..ea62eb57 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetRequest.java @@ -26,15 +26,10 @@ public class ResetOffsetRequest { Long timestamp; Long offset; - + ResetOffsetMode resetOffsetMode; private String topic; - private String bootstrapServers; - private Integer partitionId; - - ResetOffsetMode resetOffsetMode; - private String groupName; public enum ResetOffsetMode { diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java index 3c1fb225..3f0773e7 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/offset/ResetOffsetResult.java @@ -23,6 +23,7 @@ @Data public class ResetOffsetResult { + private Boolean success; private CompletableFuture future; diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java index 2d635d79..de8ac0ab 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeRequest.java @@ -17,11 +17,12 @@ package org.apache.eventmesh.dashboard.common.model.remoting.runtime; -import lombok.Data; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; +import lombok.Data; + @Data -public class GetRuntimeRequest extends GlobalRequest { +public class GetRuntimeRequest extends GlobalRequest { private String registryAddress; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java index 736f73a6..d0ec3e17 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/runtime/GetRuntimeResult.java @@ -17,11 +17,12 @@ package org.apache.eventmesh.dashboard.common.model.remoting.runtime; -import lombok.Data; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; import java.util.concurrent.CompletableFuture; +import lombok.Data; + @Data public class GetRuntimeResult extends GlobalResult { diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java index a21e4b60..a9eb328e 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicRequest.java @@ -18,13 +18,15 @@ package org.apache.eventmesh.dashboard.common.model.remoting.topic; +import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; + import com.alibaba.fastjson2.JSONObject; + import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; @Data @NoArgsConstructor diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java index a66e4b9d..d4e4a786 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/CreateTopicResponse.java @@ -25,5 +25,6 @@ @NoArgsConstructor @AllArgsConstructor public class CreateTopicResponse { + private String result; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java index 5b429dfe..b2bd2161 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicRequest.java @@ -28,5 +28,6 @@ @NoArgsConstructor @AllArgsConstructor public class DeleteTopicRequest { + TopicMetadata topicMetadata; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java index 95d82561..df818750 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/DeleteTopicResponse.java @@ -25,5 +25,6 @@ @NoArgsConstructor @AllArgsConstructor public class DeleteTopicResponse { + private String result; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java index 0858a9ce..d9920d82 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsRequest.java @@ -17,10 +17,11 @@ package org.apache.eventmesh.dashboard.common.model.remoting.topic; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; + import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; @Data @NoArgsConstructor diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java index 5ed2126b..dfe3408d 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResponse.java @@ -18,7 +18,6 @@ package org.apache.eventmesh.dashboard.common.model.remoting.topic; - import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; import java.util.List; @@ -31,5 +30,6 @@ @NoArgsConstructor @AllArgsConstructor public class GetTopicsResponse { + List topicMetadataList; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java index a039d7e7..debdbdba 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/topic/GetTopicsResult.java @@ -20,7 +20,8 @@ import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; /** - * @author hahaha + * */ public class GetTopicsResult extends GlobalResult { + } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java index f047e2ff..a8c10278 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/DeleteUserResponse.java @@ -18,5 +18,6 @@ package org.apache.eventmesh.dashboard.common.model.remoting.user; public class DeleteUserResponse { + Boolean success; } diff --git a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java index 420c746d..faccba53 100644 --- a/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java +++ b/eventmesh-dashboard-common/src/main/java/org/apache/eventmesh/dashboard/common/model/remoting/user/GetUserRequest.java @@ -20,6 +20,7 @@ import org.apache.eventmesh.dashboard.common.enums.StoreType; public class GetUserRequest { + private StoreType serviceType; private String serviceAddress; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/adapter/DynamicsAdapter.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/adapter/DynamicsAdapter.java index 5d95049a..d9bfe995 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/adapter/DynamicsAdapter.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/adapter/DynamicsAdapter.java @@ -1,29 +1,43 @@ -package org.apache.eventmesh.dashboard.console.adapter; +/* + * 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. + */ -import com.alibaba.fastjson2.JSON; -import org.checkerframework.checker.units.qual.C; +package org.apache.eventmesh.dashboard.console.adapter; import java.util.HashMap; import java.util.Map; +import com.alibaba.fastjson2.JSON; + public class DynamicsAdapter { private static final DynamicsAdapter INSTANCE = new DynamicsAdapter(); + private Map, Class> objectMapper = new HashMap<>(); - public static final DynamicsAdapter getInstance(){ - return INSTANCE; - } - - private Map,Class> objectMapper = new HashMap<>(); - + public DynamicsAdapter() { - public DynamicsAdapter(){ + } + public static final DynamicsAdapter getInstance() { + return INSTANCE; } - public T to(Object source,Class target){ + public T to(Object source, Class target) { String sourceString = JSON.toJSONString(source); - return (T)JSON.to(target,sourceString); + return (T) JSON.to(target, sourceString); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java index d2602c42..afb3151c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterCache.java @@ -30,14 +30,11 @@ public class ClusterCache { @Getter private static final ClusterCache INSTANCE = new ClusterCache(); - + private static final Object lock = new Object(); //cluster name private HashMap clusterNameMap = new HashMap<>(); - private HashMap clusterIdMap = new HashMap<>(); - private static final Object lock = new Object(); - public ClusterEntity getClusterById(Long id) { return clusterIdMap.get(id); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDO.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDO.java index 49c3fcd2..59cb6975 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDO.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDO.java @@ -1,11 +1,29 @@ +/* + * 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.cache; -import lombok.Data; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; import java.util.List; +import lombok.Data; + @Data public class ClusterDO { @@ -17,8 +35,8 @@ public class ClusterDO { private List useClusterList; - private ClusterEntity k8sCLuster; + private ClusterEntity k8sCLuster; - private Object RegistrationCenter; + private Object registrationCenter; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDoCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDoCache.java index 3fc3a13a..819faf69 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDoCache.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/ClusterDoCache.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.cache; @@ -13,63 +30,60 @@ public class ClusterDoCache { private static final ClusterDoCache INSTANCE = new ClusterDoCache(); + private Map> clusterDoMap = new HashMap<>(); - - public static final ClusterDoCache getInstance() { - return INSTANCE; + { + this.clusterDoMap = this.getClusterDoMap(); } - private ClusterDoCache(){} - - - private Map> clusterDoMap = new HashMap<>(); - - { - this.clusterDoMap = this.getClusterDoMap(); + private ClusterDoCache() { } + public static final ClusterDoCache getInstance() { + return INSTANCE; + } - public Map> getClusterDoMap(){ - Map> clusterDoMap = new HashMap<>(); - for(ClusterType clusterType : ClusterType.values()){ + public Map> getClusterDoMap() { + Map> clusterDoMap = new HashMap<>(); + for (ClusterType clusterType : ClusterType.values()) { clusterDoMap.put(clusterType, new HashMap<>()); } return clusterDoMap; } - public void setClusterDoMap(Map> clusterDoMap){ + public void setClusterDoMap(Map> clusterDoMap) { this.clusterDoMap = clusterDoMap; } - public List getEventMeshClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType){ + public List getEventMeshClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterate(ClusterType.EVENTMESH, clusterTrusteeshipType); } - public List getMetaNacosClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType){ + public List getMetaNacosClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterate(ClusterType.EVENTMESH_META_ETCD, clusterTrusteeshipType); } - public List getMetaEtcdClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType){ + public List getMetaEtcdClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterate(ClusterType.EVENTMESH_META_NACOS, clusterTrusteeshipType); } - public List getRocketMQClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType){ + public List getRocketMQClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterate(ClusterType.STORAGE_ROCKETMQ, clusterTrusteeshipType); } - private List filterate(ClusterType clusterType , ClusterTrusteeshipType... clusterTrusteeshipTypes){ - Map> clusterDoMap = new HashMap<>(); + private List filterate(ClusterType clusterType, ClusterTrusteeshipType... clusterTrusteeshipTypes) { + Map> clusterDoMap = new HashMap<>(); Map clusterDOList = clusterDoMap.get(clusterType); - if(Objects.isNull(clusterTrusteeshipTypes) || clusterTrusteeshipTypes.length == 0){ + if (Objects.isNull(clusterTrusteeshipTypes) || clusterTrusteeshipTypes.length == 0) { return new ArrayList<>(clusterDOList.values()); } List newClusterDOList = new ArrayList<>(); - for(ClusterDO clusterDO : clusterDOList.values()){ + for (ClusterDO clusterDO : clusterDOList.values()) { newClusterDOList.add(clusterDO); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java index d179847f..79e4ba4c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/cache/RuntimeCache.java @@ -27,17 +27,16 @@ public class RuntimeCache { private static final RuntimeCache INSTANCE = new RuntimeCache(); - - public static final RuntimeCache getInstance() { - return INSTANCE; - } - // ip:port -> runtime private Map runtimeMap = new ConcurrentHashMap<>(); private RuntimeCache() { } + public static final RuntimeCache getInstance() { + return INSTANCE; + } + public void addRuntime(RuntimeEntity runtimeEntity) { runtimeMap.put(runtimeEntity.getHost() + ":" + runtimeEntity.getPort(), runtimeEntity); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java index c07c4c90..3f54f166 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/HealthController.java @@ -21,7 +21,7 @@ import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo; import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; -import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; @@ -36,8 +36,7 @@ public class HealthController { @GetMapping("/cluster/health/getHistoryLiveStatus") public List getHistoryLiveStatusById(Integer type, Long instanceId, String startTime) { - Timestamp timestamp = Timestamp.valueOf(startTime); - return healthDataService.getInstanceLiveStatusHistory(type, instanceId, timestamp); + return healthDataService.getInstanceLiveStatusHistory(type, instanceId, LocalDateTime.parse(startTime)); } @GetMapping("/cluster/health/getInstanceLiveProportion") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java index 6d53a963..871e0c53 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/controller/SubscriptionController.java @@ -32,14 +32,13 @@ @RequestMapping("/api/v1") public class SubscriptionController { + // the subscription dataId naming pattern of EventMesh clients: ip-protocol + private static final String CLIENT_DATA_ID_PATTERN = "*.*.*.*-*"; /** * TODO expose implement by FunctionManager */ SubscriptionCore subscriptionCore; - // the subscription dataId naming pattern of EventMesh clients: ip-protocol - private static final String CLIENT_DATA_ID_PATTERN = "*.*.*.*-*"; - /** * Retrieve the config content of a specified config. * @@ -55,10 +54,10 @@ public Result retrieveSubscription(@RequestParam("dataId") String dataId /** * Retrieve a list of configs. * - * @param page page number - * @param size page size + * @param page page number + * @param size page size * @param dataId nacos config data id (Fuzzy Matching) - * @param group config group (Fuzzy Matching) + * @param group config group (Fuzzy Matching) * @return config properties and base64 encoded config content */ @GetMapping("/subscriptions") 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 27b2dbce..1c3df39e 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 @@ -17,16 +17,17 @@ package org.apache.eventmesh.dashboard.console.entity.base; +import java.io.Serializable; +import java.time.LocalDateTime; + import io.swagger.v3.oas.annotations.media.Schema; + import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import java.io.Serializable; -import java.time.LocalDateTime; - /** * Base Entity provide some basic fields that every Eventmesh Dashboard Entity would have */ 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 61bc823f..8e80b356 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 @@ -93,10 +93,6 @@ public class ClientEntity extends BaseEntity { */ private Timestamp endTime; - public void setStatusEntity(RecordStatus status) { - this.status = status.getNumber(); - } - public ClientEntity(ClientMetadata source) { setName(source.getName()); setPlatform(source.getPlatform()); @@ -110,5 +106,9 @@ public ClientEntity(ClientMetadata source) { setConfigIds(""); setStatus(1); } + + public void setStatusEntity(RecordStatus 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/cluster/ClusterEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java index 58b0a514..b9b250ff 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterEntity.java @@ -17,20 +17,14 @@ package org.apache.eventmesh.dashboard.console.entity.cluster; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + @Data -@NoArgsConstructor -@AllArgsConstructor -@SuperBuilder @EqualsAndHashCode(callSuper = true, exclude = "status") public class ClusterEntity extends BaseEntity { @@ -60,22 +54,4 @@ public class ClusterEntity extends BaseEntity { private Integer status; - - public ClusterEntity(ClusterMetadata source) { - if (source.getClusterName() != null && !source.getClusterName().isEmpty()) { - setAuthType(source.getAuthType()); - setBootstrapServers(source.getBootstrapServers()); - setClientProperties(source.getClientProperties()); - setRegistryAddress(source.getRegistryAddress()); - setVersion(source.getEventmeshVersion()); - setJmxProperties(source.getJmxProperties()); - setRegProperties(source.getRegProperties()); - setDescription(source.getDescription()); - setAuthType(source.getAuthType()); - setRunState(source.getRunState()); - setName(source.getClusterName()); - } else { - throw new RuntimeException("cluster name is empty"); - } - } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java index a2f6613f..a25e0105 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/cluster/ClusterRelationshipEntity.java @@ -1,10 +1,28 @@ +/* + * 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.cluster; -import lombok.Data; import org.apache.eventmesh.dashboard.common.enums.ClusterType; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; +import lombok.Data; + @Data public class ClusterRelationshipEntity extends BaseEntity { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java index ed612fab..375280c7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/config/ConfigEntity.java @@ -17,22 +17,13 @@ package org.apache.eventmesh.dashboard.console.entity.config; -import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; -import java.sql.Timestamp; - -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data @EqualsAndHashCode(callSuper = true) -@NoArgsConstructor -@AllArgsConstructor -@SuperBuilder public class ConfigEntity extends BaseEntity { private Long id; @@ -66,70 +57,14 @@ public class ConfigEntity extends BaseEntity { private Integer edit; - private Timestamp createTime; - - private Timestamp updateTime; - private Integer isDefault; private Integer isModify; private Integer alreadyUpdate; - public boolean matchVersion(String eventmeshVersion) { - return (xiaoyu(eventmeshVersion) && dayu(eventmeshVersion)); - } - - public boolean xiaoyu(String eventmeshVersion) { - String[] em = eventmeshVersion.split("."); - String[] startVersion = this.getStartVersion().split("."); - boolean flag = true; - for (int i = 0; i < em.length; i++) { - if (Integer.valueOf(em[i]) < Integer.valueOf(startVersion[i])) { - flag = false; - break; - } else if (Integer.valueOf(em[i]) == Integer.valueOf(startVersion[i])) { - continue; - } else { - break; - } - } - return flag; - } - - public boolean dayu(String eventmeshVersion) { - String[] em = eventmeshVersion.split("."); - String[] endVersion = this.getEndVersion().split("."); - boolean flag = true; - for (int i = 0; i < em.length; i++) { - if (Integer.valueOf(em[i]) < Integer.valueOf(endVersion[i])) { - break; - } else if (Integer.valueOf(em[i]) == Integer.valueOf(endVersion[i])) { - continue; - } else { - flag = false; - break; - } - } - return flag; - } - - public ConfigEntity(ConfigMetadata source) { - setConfigName(source.getConfigKey()); - setConfigValue(source.getConfigValue()); - setClusterId(source.getClusterId()); - setEdit(1); - setBusinessType(""); - setInstanceId(source.getInstanceId()); - setDescription(""); - setInstanceType(source.getInstanceType()); - setIsDefault(0); - setStartVersion(""); - setEndVersion(""); - setEventmeshVersion(""); - setDiffType(0); - setIsModify(0); - setStatus(1); + public boolean matchVersion(String eventmeshVersion) { + return true; } } 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 613f33c6..97ac8205 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 @@ -87,10 +87,6 @@ public class ConnectionEntity extends BaseEntity { private String description; - public void setStatusEnum(RecordStatus statusEnum) { - this.status = statusEnum.getNumber(); - } - public ConnectionEntity(ConnectionMetadata source) { setClusterId(source.getClusterId()); setSourceId(source.getSourceId()); @@ -103,4 +99,8 @@ public ConnectionEntity(ConnectionMetadata source) { setGroupId(source.getGroupId()); setDescription(source.getDescription()); } + + public void setStatusEnum(RecordStatus statusEnum) { + this.status = statusEnum.getNumber(); + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java index 8e255651..47861162 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/group/GroupEntity.java @@ -17,22 +17,12 @@ package org.apache.eventmesh.dashboard.console.entity.group; -import org.apache.eventmesh.dashboard.common.enums.RecordStatus; -import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; -import java.sql.Timestamp; - -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -@NoArgsConstructor -@AllArgsConstructor @Data -@SuperBuilder @EqualsAndHashCode(callSuper = true, exclude = "status") public class GroupEntity extends BaseEntity { @@ -50,19 +40,6 @@ public class GroupEntity extends BaseEntity { private String state; - private Timestamp createTime; - - private Timestamp updateTime; - private Integer status; - public GroupEntity(GroupMetadata source) { - setClusterId(source.getClusterId()); - setName(source.getName()); - setMembers(source.getMembers()); - setType(source.getType()); - setState(source.getState()); - setStatus(RecordStatus.ACTIVE.getNumber()); - setMemberCount(source.getMemberCount()); - } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java index 9e2f6011..faeae39e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/groupmember/GroupMemberEntity.java @@ -19,8 +19,6 @@ import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; -import java.sql.Timestamp; - import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; @@ -46,9 +44,5 @@ public class GroupMemberEntity extends BaseEntity { private String state; - private Timestamp createTime; - - private Timestamp updateTime; - private Integer status; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java index 48c0efbe..a490d00b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/log/LogEntity.java @@ -44,7 +44,6 @@ public class LogEntity extends BaseEntity { private String content; - private Timestamp createTime; private Timestamp endTime; 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 60ef0eb1..87549f26 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 @@ -64,10 +64,6 @@ public class MetaEntity extends BaseEntity { @Schema(name = "status", defaultValue = "0", allowableValues = {"0", "1"}, description = "0:inactive, 1:active") private Integer status; - public void setStatusEnum(RecordStatus statusEnum) { - this.status = statusEnum.getNumber(); - } - public MetaEntity(RegistryMetadata source) { setHost(source.getHost()); setPort(source.getPort()); @@ -80,4 +76,8 @@ public MetaEntity(RegistryMetadata source) { setType(source.getType()); setUsername(source.getUsername()); } + + public void setStatusEnum(RecordStatus statusEnum) { + this.status = statusEnum.getNumber(); + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java index 4d3901b2..f0cf8a0d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/runtime/RuntimeEntity.java @@ -17,22 +17,17 @@ package org.apache.eventmesh.dashboard.console.entity.runtime; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; import org.apache.eventmesh.dashboard.common.enums.ClusterType; -import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; -import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +/** + * + */ @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class RuntimeEntity extends BaseEntity { private Long clusterId; @@ -53,21 +48,6 @@ public class RuntimeEntity extends BaseEntity { private Integer status; - private Timestamp createTime; - - private Timestamp updateTime; - private String endpointMap; - public RuntimeEntity(RuntimeMetadata source) { - setHost(source.getHost()); - setPort(source.getPort()); - setClusterId(source.getClusterId()); - setStatus(1); - setEndpointMap(source.getEndpointMap()); - setJmxPort(source.getJmxPort()); - setRack(source.getRack()); - setStorageClusterId(source.getStorageClusterId()); - setStartTimestamp(source.getStartTimestamp()); - } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java index ba0781e0..a49ba307 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/storage/StoreEntity.java @@ -20,19 +20,11 @@ import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; -import java.sql.Timestamp; - -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class StoreEntity extends BaseEntity { private Long clusterId; @@ -56,10 +48,6 @@ public class StoreEntity extends BaseEntity { private Short status; - private Timestamp createTime; - - private Timestamp updateTime; - private String endpointMap; private Long startTimestamp; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java index 531e63ac..199a1865 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/topic/TopicEntity.java @@ -17,24 +17,15 @@ package org.apache.eventmesh.dashboard.console.entity.topic; -import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; -import java.sql.Timestamp; - import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; @Data -@NoArgsConstructor -@AllArgsConstructor @EqualsAndHashCode(callSuper = true, exclude = "status") -@SuperBuilder public class TopicEntity extends BaseEntity { private Long id; @@ -56,22 +47,8 @@ public class TopicEntity extends BaseEntity { private String description; - private Timestamp createTime; - - private Timestamp updateTime; - private Integer status; private Integer createProgress; - - public TopicEntity(TopicMetadata source) { - setClusterId(source.getClusterId()); - setTopicName(source.getTopicName()); - setStorageId(source.getStorageId()); - setRetentionMs(source.getRetentionMs()); - setType(source.getType()); - setDescription(source.getDescription()); - setStatus(1); - setCreateProgress(1); - } + } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java index 891255d6..f61431fc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/exception/GlobalExceptionHandler.java @@ -31,8 +31,7 @@ import lombok.extern.slf4j.Slf4j; /** - * This class, in conjunction with {@linkplain Status Status} and {@link BaseException}, - * collectively implements customized error reporting. + * This class, in conjunction with {@linkplain Status Status} and {@link BaseException}, collectively implements customized error reporting. */ @Slf4j diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/ClusterInfoManager.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/ClusterInfoManager.java deleted file mode 100644 index 5bc5169d..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/ClusterInfoManager.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.apache.eventmesh.dashboard.console.function; - -import com.alibaba.fastjson.JSON; -import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; -import org.apache.eventmesh.dashboard.common.model.metadata.ClusterRelationshipMetadata; -import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService; -import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; -import org.apache.eventmesh.dashboard.core.cluster.ColonyDO; -import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Component -public class ClusterInfoManager { - - @Autowired - private ClusterService clusterService; - - @Autowired - private RuntimeService runtimeService; - - - @Autowired - private ClusterRelationshipService clusterRelationshipService; - - @Autowired - private RemotingManager remotingManager; - - private Map clusterEntityMap = new HashMap<>(); - - private Map> relationshipMap = new HashMap<>(); - - - private Map runtimeCollectMap = new HashMap<>(); - - - @PostConstruct - public void initSync() throws Exception { - this.sync(this.clusterService.selectAll(),this.runtimeService.selectAll(),this.clusterRelationshipService.selectAll()); - remotingManager.loadingCompleted(); - - } - - private void sync(List clusterEntityList, List runtimeEntityList, List clusterRelationshipEntityList){ - if(!clusterEntityList.isEmpty()) { - String jsonString = JSON.toJSONString(clusterEntityList); - List clusterMetadataList = JSON.parseArray(jsonString, ClusterMetadata.class); - remotingManager.cacheCluster(clusterMetadataList); - } - if(!runtimeEntityList.isEmpty()) { - String jsonString = JSON.toJSONString(runtimeEntityList); - List runtimeMetadataList = JSON.parseArray(jsonString, RuntimeMetadata.class); - remotingManager.cacheRuntime(runtimeMetadataList); - } - if(!clusterRelationshipEntityList.isEmpty()) { - String jsonString = JSON.toJSONString(runtimeEntityList); - List runtimeMetadataList = JSON.parseArray(jsonString, ClusterRelationshipMetadata.class); - remotingManager.cacheClusterRelationship(runtimeMetadataList); - } - } - - - @Scheduled(initialDelay = 50, fixedDelay = 30 * 1000) - public void sync() { - LocalDateTime updatedDateTime = LocalDateTime.now().minusSeconds(30); - ClusterEntity clusterEntity = new ClusterEntity(); - clusterEntity.setUpdateTime(updatedDateTime); - RuntimeEntity runtimeEntity = new RuntimeEntity(); - clusterEntity.setUpdateTime(updatedDateTime); - ClusterRelationshipEntity clusterRelationshipEntity = new ClusterRelationshipEntity(); - clusterEntity.setUpdateTime(updatedDateTime); - this.sync(clusterService.selectNewlyIncreased(clusterEntity),this.runtimeService.selectNewlyIncreased(runtimeEntity),this.clusterRelationshipService.selectNewlyIncreased(clusterRelationshipEntity)); - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java index 69358641..512ea12b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/CheckResultCache.java @@ -38,16 +38,16 @@ public class CheckResultCache { private final HashMap> cacheMap = new HashMap<>(); - public Integer getLastHealthyCheckResult(String type, Long typeId) { + private CheckResultCache() { + } + + public Integer getLastHealthyCheckResult(String type, Long typeId) { if (!Objects.isNull(cacheMap.get(type)) && !Objects.isNull(cacheMap.get(type).get(typeId))) { return cacheMap.get(type).get(typeId).getStatus().getNumber(); } return HealthCheckStatus.CHECKING.getNumber(); } - private CheckResultCache() { - } - public void update(String type, Long typeId, HealthCheckStatus status, String resultDesc, Long latency) { HashMap subMap = cacheMap.get(type); if (Objects.isNull(subMap)) { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java index 08d46daa..25ac13cd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutor.java @@ -36,9 +36,9 @@ @Slf4j public class HealthExecutor { + private final ExecutorService executorService = Executors.newCachedThreadPool(); @Setter private HealthDataService dataService; - /** * memory cache is used to store real-time health check result. */ @@ -46,8 +46,6 @@ public class HealthExecutor { @Setter private CheckResultCache memoryCache; - private final ExecutorService executorService = Executors.newCachedThreadPool(); - /** * execute function is where health check services work. * @@ -93,8 +91,8 @@ public void onFail(Exception e) { } /** - * this function should be called before any actual execute behaviour.

It will check the execution result of the last check cycle in the - * memory cache, set tasks that haven't finished status to time out and update the database. + * this function should be called before any actual execute behaviour.

It will check the execution result of the last check cycle in the memory + * cache, set tasks that haven't finished status to time out and update the database. */ public void startExecute() { ArrayList resultList = new ArrayList<>(); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java index 17e17b86..45e728d0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/HealthService.java @@ -54,8 +54,6 @@ @Slf4j public class HealthService { - private HealthExecutor healthExecutor; - /** * class cache used to build healthCheckService instance.

key: HealthCheckObjectConfig.SimpleClassName value: HealthCheckService * @@ -69,10 +67,6 @@ public class HealthService { setClassCache(Rocketmq4NameServerCheck.class); } - private static void setClassCache(Class clazz) { - HEALTH_CHECK_CLASS_CACHE.put(clazz.getSimpleName(), clazz); - } - /** * This map is used to store HealthExecutor.

Outside key is Type(runtime, storage etc.), inside key is the id of type instance(runtimeId, * storageId etc.). @@ -80,9 +74,13 @@ private static void setClassCache(Class clazz) { * @see AbstractHealthCheckService */ private final Map> checkServiceMap = new ConcurrentHashMap<>(); - + private HealthExecutor healthExecutor; private ScheduledThreadPoolExecutor scheduledExecutor; + private static void setClassCache(Class clazz) { + HEALTH_CHECK_CLASS_CACHE.put(clazz.getSimpleName(), clazz); + } + public Map> getCheckResultCacheMap() { return healthExecutor.getMemoryCache().getCacheMap(); } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java index 0d3750ca..43de45cc 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/annotation/HealthCheckType.java @@ -24,11 +24,13 @@ /** * This annotation is used to mark the type of health check service implement. + * * @see org.apache.eventmesh.dashboard.common.enums.health.HealthCheckType */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface HealthCheckType { + /** * type of resource. runtime, topic etc. */ diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java index 86e92c23..1229b234 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/callback/HealthCheckCallback.java @@ -21,9 +21,11 @@ /** * Callback used by HealthService.doCheck to notify the caller of the result of the health check.

+ * * @see HealthExecutor */ public interface HealthCheckCallback { + public void onSuccess(); public void onFail(Exception e); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java index 5aa15e11..98f666f5 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/HealthCheckService.java @@ -21,15 +21,15 @@ import org.apache.eventmesh.dashboard.console.function.health.callback.HealthCheckCallback; /** - * Health check service interface.

- * To add a new check service, extend the {@link AbstractHealthCheckService}. + * Health check service interface.

To add a new check service, extend the {@link AbstractHealthCheckService}. + * * @see AbstractHealthCheckService */ public interface HealthCheckService { /** - * Do the health check.

- * To implement a new check service, add the necessary logic to call the success and fail functions of the callback. + * Do the health check.

To implement a new check service, add the necessary logic to call the success and fail functions of the callback. + * * @param callback The behaviour of the callback is defined as a lambda function when used. Please refer to {@link HealthExecutor} for usage. */ public void doCheck(HealthCheckCallback callback); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java index 73d466b9..58c144cd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4BrokerCheck.java @@ -24,11 +24,11 @@ import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; -import org.apache.rocketmq.common.protocol.RequestCode; import org.apache.rocketmq.remoting.InvokeCallback; import org.apache.rocketmq.remoting.RemotingClient; import org.apache.rocketmq.remoting.netty.ResponseFuture; import org.apache.rocketmq.remoting.protocol.RemotingCommand; +import org.apache.rocketmq.remoting.protocol.RequestCode; import java.util.Objects; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java index 00e7739a..3c26a06d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4NameServerCheck.java @@ -26,11 +26,11 @@ import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; -import org.apache.rocketmq.common.protocol.RequestCode; import org.apache.rocketmq.remoting.InvokeCallback; import org.apache.rocketmq.remoting.RemotingClient; import org.apache.rocketmq.remoting.netty.ResponseFuture; import org.apache.rocketmq.remoting.protocol.RemotingCommand; +import org.apache.rocketmq.remoting.protocol.RequestCode; import java.util.Objects; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java index 1acbe934..3e7c4337 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/storage/rocketmq4/Rocketmq4TopicCheck.java @@ -35,14 +35,14 @@ import org.apache.rocketmq.common.constant.PermName; import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.common.message.MessageExt; -import org.apache.rocketmq.common.protocol.RequestCode; -import org.apache.rocketmq.common.protocol.header.CreateTopicRequestHeader; -import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; import org.apache.rocketmq.remoting.RemotingClient; import org.apache.rocketmq.remoting.common.RemotingHelper; import org.apache.rocketmq.remoting.netty.NettyClientConfig; import org.apache.rocketmq.remoting.netty.NettyRemotingClient; import org.apache.rocketmq.remoting.protocol.RemotingCommand; +import org.apache.rocketmq.remoting.protocol.RequestCode; +import org.apache.rocketmq.remoting.protocol.header.CreateTopicRequestHeader; +import org.apache.rocketmq.remoting.protocol.heartbeat.MessageModel; import java.util.Arrays; import java.util.List; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManager.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManager.java deleted file mode 100644 index 55c5b327..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManager.java +++ /dev/null @@ -1,236 +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.function.metadata; - -import org.apache.eventmesh.dashboard.common.model.metadata.MetadataConfig; -import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.MetadataServiceWrapper.SingleMetadataServiceWrapper; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.MetadataHandlerWrapper; -import org.apache.eventmesh.dashboard.console.function.metadata.syncservice.SyncDataServiceWrapper; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; - -import javax.validation.constraints.NotNull; - -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; - -/** - * MetadataManager is a manager for metadata service, it will sync the data between cluster service and database. database should be empty when this - * manager booted - * 启动应该进行差异化对比。进行差异化增量,差异化删除 - * 表 -> increment-> remote -> function -> data -> convert - * 流程,前端页面 - * 梳理并整理现在的代码,业务,模块 - * functionManager - * - * @author hahaha - */ -@Slf4j -public class MetadataManager { - - @Setter - private Boolean toDbSync = true; - - private final ScheduledThreadPoolExecutor scheduledExecutorService = new ScheduledThreadPoolExecutor(2); - - private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(32, 32, 10, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), - new ThreadFactory() { - final AtomicInteger counter = new AtomicInteger(0); - - @Override - public Thread newThread(@NotNull Runnable r) { - return new Thread(r, "metadata-manager-" + counter.incrementAndGet()); - } - }); - /** - * singleton id for service wrapper map, even if the cache is not on, the id should be increased. - */ - private static final AtomicLong staticServiceId = new AtomicLong(0); - - private static final ConcurrentHashMap firstRunToDb = new ConcurrentHashMap<>(); - - private final Map metaDataServiceWrapperMap = new ConcurrentHashMap<>(); - - private final Map> cacheData = new ConcurrentHashMap<>(); - - - public void init(Integer initialDelay, Integer period) { - - scheduledExecutorService.scheduleAtFixedRate(() -> MetadataManager.this.run(toDbSync, true), initialDelay, period, TimeUnit.SECONDS); - } - - - /** - * entrance of a sync scheduled task - * - * @param metaDataServiceWrapper - */ - public void addMetadataService(MetadataServiceWrapper metaDataServiceWrapper) { - Long cacheId = staticServiceId.incrementAndGet(); - metaDataServiceWrapper.setCacheId(cacheId); - metaDataServiceWrapperMap.put(cacheId, metaDataServiceWrapper); - } - - public void run() { - metaDataServiceWrapperMap.forEach(this::handlers); - } - - public void run(Boolean toDbOn, Boolean toServiceOn) { - try { - CountDownLatch countDownLatch = new CountDownLatch(metaDataServiceWrapperMap.size()); - // sync - metaDataServiceWrapperMap.forEach((cacheId, metaDataServiceWrapper) -> handlers(countDownLatch,cacheId, metaDataServiceWrapper, toDbOn, toServiceOn)); - // Exclude unhealthy raw data from services - } catch (Exception e) { - log.error("metadata manager run error", e); - } - } - - public void handlers(CountDownLatch countDownLatch,Long cacheId, MetadataServiceWrapper metaDataServiceWrapper, Boolean toDbOn, Boolean toServiceOn) { - this.threadPoolExecutor.execute(() -> { - try { - if (toDbOn) { - this.handler(cacheId, metaDataServiceWrapper.getDbToService(), true); - } - if (toServiceOn) { - this.handler(cacheId, metaDataServiceWrapper.getServiceToDb(), false); - } - } catch (Throwable e) { - log.error("metadata manager handler error", e); - }finally { - countDownLatch.countDown(); - } - - }); - } - - public void handlers(Long cacheId, MetadataServiceWrapper metaDataServiceWrapper) { - handlers(cacheId, metaDataServiceWrapper, true, true); - } - - public void handler(Long cacheID, SingleMetadataServiceWrapper singleMetadataServiceWrapper, boolean isDbToService) { - if (singleMetadataServiceWrapper == null) { - return; - } - - try { - List newObjectList = (List) singleMetadataServiceWrapper.getSyncService().getData(); - if (newObjectList.isEmpty()) { - return; - } - - //if cache is false, we don't need to compare the data - // full volume updates - if (!singleMetadataServiceWrapper.getCache()) { - singleMetadataServiceWrapper.getHandler() - .replaceMetadata(newObjectList); - return; - } - - List cacheDataList = cacheData.get(cacheID); - //update old cache - cacheData.put(cacheID, newObjectList); - - Map newObjectMap = getUniqueKeyMap(newObjectList); - Map oldObjectMap = getUniqueKeyMap(cacheDataList); - - //these three List are in target type - List toUpdate = new ArrayList<>(); - List toDelete = new ArrayList<>(); - List toInsert; - - for (Entry entry : oldObjectMap.entrySet()) { - - Object serviceObject = newObjectMap.remove(entry.getKey()); - //if new Data don't have a key in oldMap, - if (serviceObject == null) { - toDelete.add(entry.getValue()); - } else { - //primary id, creat time and update time should not be compared - //if not equal, we need to update fields except unique key(they are equal) - //cause entry is from the oldMap, it should contain the primary key. - if (!serviceObject.equals(entry.getValue())) { - toUpdate.add(entry.getValue()); - } - } - } - - toInsert = new ArrayList<>(newObjectMap.values()); - - //if target is db, we use handler to provide transaction - if (!isDbToService) { - firstRunToDb.putIfAbsent(cacheID, false); - singleMetadataServiceWrapper.getHandler().handleAllObject(toInsert, toUpdate, toDelete); - //if target is eventmesh, we just use that 3 basic method - } else { - toInsert.forEach(singleMetadataServiceWrapper.getHandler()::addMetadataObject); - toUpdate.forEach(singleMetadataServiceWrapper.getHandler()::updateMetadataObject); - toDelete.forEach(singleMetadataServiceWrapper.getHandler()::deleteMetadataObject); - } - } catch (Throwable e) { - log.error("metadata manager handler error", e); - } - } - - public void setUpSyncMetadataManager(SyncDataServiceWrapper syncDataServiceWrapper, MetadataHandlerWrapper metadataHandlerWrapper) { - MetadataServiceWrapper metadataServiceWrapper = new MetadataServiceWrapper(); - SingleMetadataServiceWrapper singleMetadataServiceWrapper = SingleMetadataServiceWrapper.builder() - .syncService(syncDataServiceWrapper.getRuntimeSyncFromClusterService()) - .handler(metadataHandlerWrapper.getRuntimeMetadataHandlerToDb()).build(); - metadataServiceWrapper.setServiceToDb(singleMetadataServiceWrapper); - this.addMetadataService(metadataServiceWrapper); - } - - private Map getUniqueKeyMap(List list) { - Map map = new HashMap<>(); - if (Objects.nonNull(list) && !list.isEmpty()) { - Object firstItem = list.get(0); - if (firstItem instanceof MetadataConfig) { - for (Object item : list) { - MetadataConfig metadataItem = (MetadataConfig) item; - map.put(metadataItem.getUnique(), metadataItem); - } - } else if (firstItem instanceof BaseEntity) { - for (Object item : list) { - BaseEntity baseEntityItem = (BaseEntity) item; - //TODO we don't have db2service method and getUniqueKeyMap from entity is not used - - // map.put(baseEntityItem.getUniqueKey(), baseEntityItem); - } - } - } - return map; - } - - //TODO if database is modified by other service, we need to update the cache -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java index 9c95acd4..0c8656ef 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataServiceWrapper.java @@ -18,7 +18,6 @@ package org.apache.eventmesh.dashboard.console.function.metadata; import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; -import org.apache.eventmesh.dashboard.core.metadata.SyncDataService; import lombok.AllArgsConstructor; import lombok.Builder; @@ -43,15 +42,12 @@ public static class SingleMetadataServiceWrapper { /** * true -> incremental updates false -> full volume updates + * * @See MetadataManager */ @Default private Boolean cache = true; - /** - * syncService is the source of metadata - */ - private SyncDataService syncService; /** * handler is the target of metadata, it will process the metadata from syncService diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java index 610facc9..018584ab 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/SyncRelationshipConfig.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.function.metadata; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java index 4faed193..f9a27432 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImpl.java @@ -18,12 +18,11 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; -import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,18 +35,28 @@ public class ClusterMetadataHandlerToDbImpl implements MetadataHandler metadataList) { - List entityList = metadataList.stream() + /* List entityList = metadataList.stream() .map(ClusterEntity::new) .collect(Collectors.toList()); - clusterService.batchInsert(entityList); + clusterService.batchInsert(entityList);*/ } @Override public void deleteMetadata(ClusterMetadata meta) { } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java index 65de1027..63ee690b 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConfigMetadataHandlerToDbImpl.java @@ -18,12 +18,11 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; -import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.service.config.ConfigService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; -import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -40,20 +39,30 @@ public class ConfigMetadataHandlerToDbImpl implements MetadataHandler meta) { - List entityList = meta.stream() + /* List entityList = meta.stream() .map(ConfigEntity::new) - .collect(Collectors.toList()); - configService.batchInsert(entityList); + .collect(Collectors.toList());*/ + //configService.batchInsert(entityList); } @Override public void deleteMetadata(ConfigMetadata meta) { - configService.deleteConfig(new ConfigEntity(meta)); + //configService.deleteConfig(new ConfigEntity(meta)); + } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java index 4cb60511..2445f5a4 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImpl.java @@ -19,13 +19,14 @@ import org.apache.eventmesh.dashboard.common.enums.RecordStatus; import org.apache.eventmesh.dashboard.common.model.metadata.ConnectionMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.client.ClientDataService; import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService; import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; import java.util.Objects; @@ -151,4 +152,14 @@ public void addMetadata(ConnectionMetadata meta) { public void deleteMetadata(ConnectionMetadata meta) { } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java index b7abf578..a9d38f88 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImpl.java @@ -18,12 +18,11 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; -import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.service.group.GroupService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; -import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,19 +35,29 @@ public class GroupMetadataHandlerToDbImpl implements MetadataHandler metadata) { - List entityList = metadata.stream().map(GroupEntity::new).collect(Collectors.toList()); - groupService.batchInsert(entityList); + /*List entityList = metadata.stream().map(GroupEntity::new).collect(Collectors.toList()); + groupService.batchInsert(entityList);*/ } @Override public void deleteMetadata(GroupMetadata meta) { } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.java index b44aa7bb..d004d3c8 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImpl.java @@ -18,9 +18,10 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.RegistryMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; import java.util.stream.Collectors; @@ -54,4 +55,14 @@ public void addMetadata(List meta) { public void deleteMetadata(RegistryMetadata meta) { registryDataService.deactivate(new MetaEntity(meta)); } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java index 130e112c..5cf790e1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImpl.java @@ -17,21 +17,23 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; -import lombok.extern.slf4j.Slf4j; import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; import org.apache.eventmesh.dashboard.common.enums.ClusterType; import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.cache.ClusterCache; -import org.apache.eventmesh.dashboard.console.cache.RuntimeCache; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; + +import java.util.List; +import java.util.Objects; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Objects; +import lombok.extern.slf4j.Slf4j; @Slf4j @Service @@ -70,8 +72,8 @@ public void addMetadata(RuntimeMetadata meta) { if (Objects.isNull(meta.getClusterId())) { meta.setClusterId(ClusterCache.getINSTANCE().getClusterByName(meta.getClusterName()).getId()); } - runtimeService.addRuntime(new RuntimeEntity(meta)); - RuntimeCache.getInstance().addRuntime(new RuntimeEntity(meta)); + //runtimeService.addRuntime(new RuntimeEntity(meta)); + //RuntimeCache.getInstance().addRuntime(new RuntimeEntity(meta)); // 集群存在且不过时。 直接同步就可以。 @@ -90,7 +92,17 @@ public void addMetadata(RuntimeMetadata meta) { @Override public void deleteMetadata(RuntimeMetadata meta) { - runtimeService.deactivate(new RuntimeEntity(meta)); - RuntimeCache.getInstance().deleteRuntime(new RuntimeEntity(meta)); + //runtimeService.deactivate(new RuntimeEntity(meta)); + + } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java index a25eb45d..3ef6c790 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImpl.java @@ -18,13 +18,14 @@ package org.apache.eventmesh.dashboard.console.function.metadata.handler.db; import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; +import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.store.StoreService; import org.apache.eventmesh.dashboard.console.service.topic.TopicService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.net.URI; +import java.util.List; import java.util.Objects; import org.springframework.beans.factory.annotation.Autowired; @@ -54,11 +55,21 @@ public void addMetadata(TopicMetadata meta) { } } - topicService.addTopic(new TopicEntity(meta)); + //topicService.addTopic(new TopicEntity(meta)); } @Override public void deleteMetadata(TopicMetadata meta) { topicService.deleteTopic(null); } + + @Override + public List getData() { + return null; + } + + @Override + public List getData(GlobalRequest globalRequest) { + return null; + } } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java index 061436be..7b52922c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/SyncDataServiceWrapper.java @@ -17,13 +17,13 @@ package org.apache.eventmesh.dashboard.console.function.metadata.syncservice; +import org.apache.eventmesh.dashboard.console.spring.support.FunctionManagerLoader; import org.apache.eventmesh.dashboard.core.metadata.cluster.AclSyncFromClusterService; import org.apache.eventmesh.dashboard.core.metadata.cluster.ConfigSyncFromClusterService; import org.apache.eventmesh.dashboard.core.metadata.cluster.GroupSyncFromClusterService; import org.apache.eventmesh.dashboard.core.metadata.cluster.InstanceUserFromClusterService; import org.apache.eventmesh.dashboard.core.metadata.cluster.RuntimeSyncFromClusterService; import org.apache.eventmesh.dashboard.core.metadata.cluster.TopicSyncFromClusterService; -import org.apache.eventmesh.dashboard.console.spring.support.FunctionManagerLoader; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/db/TopicSyncFromDbService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/db/TopicSyncFromDbService.java deleted file mode 100644 index f50231b6..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/db/TopicSyncFromDbService.java +++ /dev/null @@ -1,43 +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.function.metadata.syncservice.db; - - -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.core.metadata.SyncDataService; -import org.apache.eventmesh.dashboard.console.service.topic.TopicService; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -public class TopicSyncFromDbService implements SyncDataService { - - @Autowired - private TopicService topicDataService; - - @Override - public List getData() { - return topicDataService.selectAll(); - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/optration/TopicMetadataHandlerToClusterImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/optration/TopicMetadataHandlerToClusterImpl.java deleted file mode 100644 index 3e30fdd5..00000000 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/function/optration/TopicMetadataHandlerToClusterImpl.java +++ /dev/null @@ -1,57 +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.function.optration; - -import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; -import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; - -import org.springframework.stereotype.Service; - -import lombok.Setter; - -@Service -public class TopicMetadataHandlerToClusterImpl implements MetadataHandler { - - @Setter - private TopicRemotingService topicRemotingService; - - @Override - public void addMetadata(TopicEntity meta) { - TopicMetadata topicMetadata = new TopicMetadata(); - topicMetadata.setStoreAddress(""); - topicMetadata.setConnectionUrl(""); - topicMetadata.setTopicName(meta.getTopicName()); - topicMetadata.setRuntimeId(0L); - topicMetadata.setStorageId(meta.getStorageId()); - topicMetadata.setRetentionMs(0L); - topicMetadata.setType(meta.getType()); - topicMetadata.setDescription(meta.getDescription()); - topicMetadata.setRegistryAddress(""); - topicMetadata.setClusterId(0L); - - topicRemotingService.createTopic(new CreateTopicRequest(topicMetadata)); - } - - @Override - public void deleteMetadata(TopicEntity meta) { - - } -} diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java index bed58ebb..76de2cdf 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/log/OprLog.java @@ -24,6 +24,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.Objects; import org.aspectj.lang.ProceedingJoinPoint; @@ -99,7 +100,7 @@ public LogEntity productLoEntity(EmLog declaredAnnotation, ProceedingJoinPoint j logEntity.setOperationType(declaredAnnotation.OprType()); logEntity.setTargetType(declaredAnnotation.OprTarget()); logEntity.setState(1); - logEntity.setCreateTime(new Timestamp(System.currentTimeMillis())); + logEntity.setCreateTime(LocalDateTime.now()); return logEntity; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java index afda5062..e22c368e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterMapper.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.console.mapper.cluster; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; + import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Options; @@ -37,7 +38,7 @@ public interface ClusterMapper { List selectAllCluster(); @Select("SELECT * FROM cluster where update_time > #{updateTime}") - List selectClusterByUpdate(@Param("updateTime")long updateTime); + List selectClusterByUpdate(@Param("updateTime") long updateTime); @Select("SELECT * FROM cluster WHERE status=1 LIMIT #{rowIndex},#{pageNum}") List selectAllClusterToFront(Integer rowIndex, Integer pageNum); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java index 0995a512..c6e3ccf9 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/cluster/ClusterRelationshipMapper.java @@ -1,6 +1,24 @@ +/* + * 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.mapper.cluster; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity; + import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; @@ -8,11 +26,15 @@ import java.util.List; +/** + * + */ @Mapper public interface ClusterRelationshipMapper { - @Insert(" insert into cluster_relationship (cluster_type,cluster_id,relationship_type,relationship_id)values( #{clusterType},#{clusterId},#{relationshipType},#{relationshipId})") + @Insert({" insert into cluster_relationship (cluster_type,cluster_id,relationship_type,relationship_id)values( #{clusterType},#{clusterId},", + "#{relationshipType},#{relationshipId})"}) Integer addClusterRelationshipEntry(ClusterRelationshipEntity clusterRelationshipEntity); @Update("update cluster_relationship set status = 3 where id = #{id} ") diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java index fcb78518..23e4b4b1 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/ClusterRelationshipService.java @@ -1,9 +1,29 @@ +/* + * 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; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterRelationshipEntity; import java.util.List; +/** + * + */ public interface ClusterRelationshipService { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java index 30bf208d..8c64a7e0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterRelationshipServiceImpl.java @@ -1,13 +1,31 @@ +/* + * 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.entity.cluster.ClusterRelationshipEntity; import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterRelationshipMapper; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterRelationshipService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + @Service public class ClusterRelationshipServiceImpl implements ClusterRelationshipService { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java index 0ab4d381..5789db8c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/cluster/impl/ClusterServiceImpl.java @@ -31,11 +31,12 @@ import org.apache.eventmesh.dashboard.console.modle.vo.cluster.GetClusterBaseMessageVO; import org.apache.eventmesh.dashboard.console.modle.vo.cluster.ResourceNumVO; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + @Service public class ClusterServiceImpl implements ClusterService { @@ -99,7 +100,7 @@ public List selectAll() { } @Override - public List selectNewlyIncreased(ClusterEntity clusterEntity){ + public List selectNewlyIncreased(ClusterEntity clusterEntity) { return clusterMapper.selectAllCluster(); } @@ -120,7 +121,7 @@ public ClusterEntity selectClusterById(ClusterEntity cluster) { } - public List selectIncrementCluster(){ + public List selectIncrementCluster() { return null; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java index 3be1c537..4bb7894d 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/ConfigService.java @@ -54,5 +54,4 @@ public interface ConfigService { Map selectDefaultConfig(String version, Long instanceId, Integer instanceType); - } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigService.java index e54b3cc4..47929a2e 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigService.java @@ -23,6 +23,7 @@ import java.util.List; import org.springframework.stereotype.Service; + /** * TODO Pending interfaces */ diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java index 3e8645dd..dc28bf2c 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/RuntimeConfigService.java @@ -22,6 +22,7 @@ import java.util.List; import org.springframework.stereotype.Service; + /** * TODO Pending interfaces */ diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/StoreConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/StoreConfigService.java index 7ad7c16e..32ad30a0 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/StoreConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/StoreConfigService.java @@ -22,6 +22,7 @@ import java.util.List; import org.springframework.stereotype.Service; + /** * TODO Pending interfaces */ diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java index c5564ffc..b9041cbd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java @@ -22,6 +22,7 @@ import java.util.List; import org.springframework.stereotype.Service; + /** * TODO Pending interfaces */ diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java index fc429061..9d2c0f01 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connection/impl/ConnectionDataServiceDatabaseImpl.java @@ -77,7 +77,6 @@ public Long insert(ConnectionEntity connectionEntity) { } - @EmLog(OprType = "add", OprTarget = "Connection") @Override public boolean createConnection(CreateConnectionDTO createConnectionDTO) { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java index c50ca055..65873e49 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/group/Impl/GroupServiceImpl.java @@ -24,7 +24,7 @@ import org.apache.eventmesh.dashboard.console.service.group.GroupService; import org.apache.eventmesh.dashboard.console.service.groupmember.GroupMemberService; -import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; @@ -34,10 +34,10 @@ public class GroupServiceImpl implements GroupService { @Autowired - OprGroupMapper oprGroupMapper; + private OprGroupMapper oprGroupMapper; @Autowired - GroupMemberService groupMemberService; + private GroupMemberService groupMemberService; @Override public List selectAll() { @@ -88,7 +88,7 @@ public Integer insertMemberToGroup(GroupMemberEntity groupMemberEntity) { groupEntity1.setMembers(groupMemberEntity.getId() + "" + "," + groupEntity1.getMembers()); //Concatenate the members of the group groupEntity1.setMemberCount(groupEntity1.getMemberCount() + 1); - groupEntity1.setUpdateTime(new Timestamp(System.currentTimeMillis())); + groupEntity1.setUpdateTime(LocalDateTime.now()); oprGroupMapper.updateGroup(groupEntity1); return 1; //Modify the group member information @@ -104,7 +104,7 @@ public Integer deleteMemberFromGroup(GroupMemberEntity groupMemberEntity) { //^Obtain the group to which the member belongs groupEntity1.setMembers(groupEntity1.getMembers().replaceAll(groupMemberEntity.getId() + "" + ",", "")); groupEntity1.setMemberCount(groupEntity1.getMemberCount() - 1); - groupEntity1.setUpdateTime(new Timestamp(System.currentTimeMillis())); + groupEntity1.setUpdateTime(LocalDateTime.now()); oprGroupMapper.updateGroup(groupEntity1); return 1; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java index b90c9d26..5c6be2cd 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataService.java @@ -21,6 +21,7 @@ import org.apache.eventmesh.dashboard.console.modle.vo.health.InstanceLiveProportionVo; import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.List; /** @@ -30,7 +31,7 @@ public interface HealthDataService { InstanceLiveProportionVo getInstanceLiveProportion(Long clusterId, Integer instanceType); - List getInstanceLiveStatusHistory(Integer type, Long clusterId, Timestamp startTime); + List getInstanceLiveStatusHistory(Integer type, Long clusterId, LocalDateTime startTime); HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity healthCheckResultEntity); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataServiceMemoryStorage.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataServiceMemoryStorage.java index 85a2667f..4282a368 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataServiceMemoryStorage.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/HealthDataServiceMemoryStorage.java @@ -20,6 +20,7 @@ import org.apache.eventmesh.dashboard.console.entity.health.HealthCheckResultEntity; import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -36,7 +37,7 @@ public class HealthDataServiceMemoryStorage { public HealthCheckResultEntity insertHealthCheckResult(HealthCheckResultEntity healthCheckResultEntity) { lock.writeLock().lock(); try { - healthCheckResultEntity.setCreateTime(new Timestamp(System.currentTimeMillis())); + healthCheckResultEntity.setCreateTime(LocalDateTime.now()); cache.add(healthCheckResultEntity); return healthCheckResultEntity; } finally { @@ -49,7 +50,7 @@ public void batchInsertHealthCheckResult(List healthChe lock.writeLock().lock(); try { for (HealthCheckResultEntity entity : healthCheckResultEntityList) { - entity.setCreateTime(new Timestamp(System.currentTimeMillis())); + entity.setCreateTime(LocalDateTime.now()); cache.add(entity); } } finally { @@ -63,9 +64,10 @@ public List queryHealthCheckResultByClusterIdAndTimeRan try { List result = new ArrayList<>(); for (HealthCheckResultEntity entity : cache) { - if (entity.getClusterId().equals(clusterId) && entity.getCreateTime().after(startTime) && entity.getCreateTime().before(endTime)) { - result.add(entity); - } + result.add(entity); + //if (entity.getClusterId().equals(clusterId) && entity.getCreateTime().after(startTime) && entity.getCreateTime().before(endTime)) { + + //} } return result; } finally { diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java index 41e0dfc6..513e95ea 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/health/impl/HealthDataServiceDatabaseImpl.java @@ -28,6 +28,7 @@ import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; import java.sql.Timestamp; +import java.time.LocalDateTime; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; @@ -93,7 +94,7 @@ public InstanceLiveProportionVo getRuntimeLiveProportion(Long clusterId) { @Override - public List getInstanceLiveStatusHistory(Integer type, Long instanceId, Timestamp startTime) { + public List getInstanceLiveStatusHistory(Integer type, Long instanceId, LocalDateTime startTime) { HealthCheckResultEntity healthCheckResultEntity = new HealthCheckResultEntity(); healthCheckResultEntity.setType(type); healthCheckResultEntity.setTypeId(instanceId); diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java index ebe42069..aba2b229 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/runtime/Impl/RuntimeServiceImpl.java @@ -68,7 +68,7 @@ public List selectAll() { } @Override - public List selectNewlyIncreased(RuntimeEntity runtimeEntity){ + public List selectNewlyIncreased(RuntimeEntity runtimeEntity) { return null; } diff --git a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java index fada3ea8..9a785fb7 100644 --- a/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java +++ b/eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManager.java @@ -20,7 +20,6 @@ import org.apache.eventmesh.dashboard.console.config.FunctionManagerConfigs; import org.apache.eventmesh.dashboard.console.function.health.CheckResultCache; import org.apache.eventmesh.dashboard.console.function.health.HealthService; -import org.apache.eventmesh.dashboard.console.function.metadata.MetadataManager; import lombok.Getter; import lombok.Setter; @@ -42,10 +41,6 @@ public class FunctionManager { @Getter private HealthService healthService; - @Setter - @Getter - private MetadataManager metadataManager; - public void initFunctionManager() { //Health Check healthService = new HealthService(); @@ -54,10 +49,6 @@ public void initFunctionManager() { configs.getHealthCheck().getUpdateConfig().getPeriod(), properties.getDataServiceContainer()); healthService.startScheduledExecution(configs.getHealthCheck().getDoCheck().getInitialDelay(), configs.getHealthCheck().getDoCheck().getPeriod()); - - metadataManager = new MetadataManager(); - metadataManager.setUpSyncMetadataManager(properties.getSyncDataServiceWrapper(), properties.getMetadataHandlerWrapper()); - metadataManager.init(configs.getSync().getInitialDelay(), configs.getSync().getPeriod()); } } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java index 973176ab..6c7ccba7 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/EventMeshDashboardApplicationTest.java @@ -17,8 +17,6 @@ package org.apache.eventmesh.dashboard.console; -import static org.mockito.ArgumentMatchers.any; - import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; import java.util.Objects; @@ -60,7 +58,7 @@ public void IntegrationTest() throws InterruptedException { //To make a test, add cluster with registry address ip:port in web endpoint if (Objects.equals(System.getenv("APPLICATION_TEST"), "on")) { - EventMeshDashboardApplication.main(new String[]{}); + EventMeshDashboardApplication.main(new String[] {}); Thread.sleep(1000 * 60 * 10); } } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheBase.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheBase.java index 66f0379a..85184d99 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheBase.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheBase.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.BeforeAll; public class ClusterCacheBase { + @BeforeAll public static void addTestCluster() { ClusterEntity clusterEntity = new ClusterEntity(); @@ -36,7 +37,6 @@ public static void addTestCluster() { clusterEntity.setAuthType(0); clusterEntity.setRunState(0); clusterEntity.setStatus(0); - clusterEntity.setStoreType(0); clusterEntity.setId(0L); clusterEntity.setClusterId(0L); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java index 1700f0d7..47fae456 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/cache/ClusterCacheTest.java @@ -38,7 +38,6 @@ public void testInsertAndDelete() { clusterEntity.setAuthType(0); clusterEntity.setRunState(0); clusterEntity.setStatus(0); - clusterEntity.setStoreType(0); clusterEntity.setId(0L); clusterEntity.setClusterId(0L); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java index 000abbcb..86e0d592 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/HealthExecutorTest.java @@ -30,8 +30,6 @@ import org.apache.eventmesh.dashboard.console.function.health.check.AbstractHealthCheckService; import org.apache.eventmesh.dashboard.console.function.health.check.config.HealthCheckObjectConfig; import org.apache.eventmesh.dashboard.console.service.health.HealthDataService; -import org.apache.eventmesh.dashboard.console.spring.support.FunctionManager; -import org.apache.eventmesh.dashboard.console.spring.support.FunctionManagerLoader; import java.util.concurrent.CompletableFuture; @@ -45,7 +43,6 @@ import org.mockito.stubbing.Answer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -58,20 +55,16 @@ @Timeout(value = 5) class HealthExecutorTest { - private HealthExecutor healthExecutor = new HealthExecutor(); - private CheckResultCache memoryCache = CheckResultCache.getINSTANCE(); - @Autowired HealthDataService healthDataService; - @Mock AbstractHealthCheckService successHealthCheckService; - @Mock AbstractHealthCheckService failHealthCheckService; - @Mock AbstractHealthCheckService timeoutHealthCheckService; + private HealthExecutor healthExecutor = new HealthExecutor(); + private CheckResultCache memoryCache = CheckResultCache.getINSTANCE(); @BeforeEach public void initMock() { diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManagerTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManagerTest.java deleted file mode 100644 index 38881465..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/MetadataManagerTest.java +++ /dev/null @@ -1,159 +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.function.metadata; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.console.entity.topic.TopicEntity; -import org.apache.eventmesh.dashboard.console.function.metadata.MetadataServiceWrapper.SingleMetadataServiceWrapper; -import org.apache.eventmesh.dashboard.console.function.metadata.handler.db.RuntimeMetadataHandlerToDbImpl; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; -import org.apache.eventmesh.dashboard.core.metadata.SyncDataService; -import org.apache.eventmesh.dashboard.core.metadata.cluster.RuntimeSyncFromClusterService; -import org.apache.eventmesh.dashboard.console.function.optration.TopicMetadataHandlerToClusterImpl; -import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; - -import java.util.Collections; -import java.util.List; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mockito; -import org.mockito.junit.jupiter.MockitoExtension; -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; - -import lombok.extern.slf4j.Slf4j; - -@ExtendWith(MockitoExtension.class) -@ExtendWith(SpringExtension.class) -@ActiveProfiles("test") -@SpringBootTest(classes = EventMeshDashboardApplication.class) -@Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = {"classpath:use-test-schema.sql", "classpath:eventmesh-dashboard.sql"}) -@Slf4j -class MetadataManagerTest extends ClusterCacheBase { - - private final MetadataManager metadataManager = new MetadataManager(); - private static RuntimeMetadata runtimeMetadata = new RuntimeMetadata(); - private static TopicEntity topicEntity = new TopicEntity(); - - private SyncDataService sourceService1 = Mockito.mock(RuntimeSyncFromClusterService.class); - @Autowired - private RuntimeMetadataHandlerToDbImpl targetService1; - - @Autowired - private SyncDataService sourceService2; - - MetadataHandler targetService2 = Mockito.mock(TopicMetadataHandlerToClusterImpl.class); - @Autowired - private RuntimeService runtimeService; - - @BeforeAll - public static void init() { - topicEntity.setClusterId(0L); - topicEntity.setTopicName(""); - topicEntity.setStorageId(0L); - topicEntity.setRetentionMs(0L); - topicEntity.setType(0); - topicEntity.setDescription(""); - topicEntity.setId(0L); - topicEntity.setClusterId(0L); - - runtimeMetadata.setHost("0.0.0.0"); - runtimeMetadata.setPort(1000); - runtimeMetadata.setJmxPort(0); - runtimeMetadata.setRack(""); - runtimeMetadata.setEndpointMap(""); - runtimeMetadata.setStorageClusterId(0L); - runtimeMetadata.setStartTimestamp(0L); - runtimeMetadata.setClusterName(""); - runtimeMetadata.setRegistryAddress(""); - runtimeMetadata.setClusterId(0L); - - } - - @BeforeEach - public void initManager() { - - Mockito.when(sourceService1.getData()).thenReturn(Collections.singletonList(runtimeMetadata)); - - Mockito.doNothing().when(targetService2).addMetadataObject(Mockito.any()); - Mockito.doNothing().when(targetService2).addMetadata(Mockito.any(List.class)); - - MetadataServiceWrapper metadataServiceWrapper = new MetadataServiceWrapper(); - metadataServiceWrapper.setDbToService( - new MetadataServiceWrapper.SingleMetadataServiceWrapper(true, sourceService1, targetService1)); - - metadataServiceWrapper.setServiceToDb(new SingleMetadataServiceWrapper(true, sourceService1, targetService1)); - metadataServiceWrapper.setServiceToDb(new SingleMetadataServiceWrapper(false, sourceService2, targetService2)); - - metadataManager.addMetadataService(metadataServiceWrapper); - } - - @Test - public void testMetadataToDb() throws InterruptedException { - metadataManager.run(true, false); - Thread.sleep(2000); - List runtimeEntities = runtimeService.selectAll(); - assertEquals(1000, runtimeEntities.get(runtimeEntities.size() - 1).getPort()); - } - - @Test - public void testMetadataToService() throws InterruptedException { - metadataManager.run(false, true); - Thread.sleep(2000); - } - - @Test - public void testUpdateMetadata() throws InterruptedException { - metadataManager.run(true, false); - Thread.sleep(2000); - - runtimeMetadata.setHost("1.1.1.1"); - Mockito.when(sourceService1.getData()).thenReturn(Collections.emptyList()); - metadataManager.run(true, false); - Thread.sleep(2000); - - metadataManager.run(true, false); - Thread.sleep(2000); - List runtimeEntities = runtimeService.selectAll(); - assertEquals(1, runtimeEntities.size()); - } - - @Test - public void testDeleteMetadata() throws InterruptedException { - metadataManager.run(true, false); - Thread.sleep(2000); - runtimeMetadata.setHost("1.1.1.1"); - Mockito.when(sourceService1.getData()).thenReturn(Collections.singletonList(runtimeMetadata)); - metadataManager.run(true, false); - Thread.sleep(2000); - List runtimeEntities = runtimeService.selectAll(); - assertEquals(1, runtimeEntities.size()); - } - -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImplTest.java index cdc3404f..9dc15ef0 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ClusterMetadataHandlerToDbImplTest.java @@ -23,8 +23,8 @@ import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java index c3c4eac3..2a237152 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/ConnectionMetadataHandlerToDbImplTest.java @@ -24,10 +24,10 @@ import org.apache.eventmesh.dashboard.console.entity.client.ClientEntity; import org.apache.eventmesh.dashboard.console.entity.connection.ConnectionEntity; import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.client.ClientDataService; import org.apache.eventmesh.dashboard.console.service.connection.ConnectionDataService; import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java index 54c9f92c..fbb09379 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/GroupMetadataHandlerToDbImplTest.java @@ -22,8 +22,8 @@ import org.apache.eventmesh.dashboard.common.model.metadata.GroupMetadata; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.entity.group.GroupEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.group.GroupService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImplTest.java index 683a40e2..6264ecfc 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RegistryMetadataHandlerToDbImplTest.java @@ -23,8 +23,8 @@ import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase; import org.apache.eventmesh.dashboard.console.entity.meta.MetaEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.registry.RegistryDataService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java index 5d668322..160bdc60 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/RuntimeMetadataHandlerToDbImplTest.java @@ -22,9 +22,9 @@ import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase; import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.cluster.ClusterService; import org.apache.eventmesh.dashboard.console.service.runtime.RuntimeService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import java.util.List; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java index 67cd3b9d..6bb2583e 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/handler/db/TopicMetadataHandlerToDbImplTest.java @@ -23,8 +23,8 @@ import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.cache.ClusterCacheBase; -import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.console.service.topic.TopicService; +import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterServiceTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterServiceTest.java deleted file mode 100644 index e32fc108..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/metadata/syncservice/cluster/TopicSyncFromClusterServiceTest.java +++ /dev/null @@ -1,83 +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.function.metadata.syncservice.cluster; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResponse; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult; -import org.apache.eventmesh.dashboard.console.cache.RuntimeCache; -import org.apache.eventmesh.dashboard.console.entity.runtime.RuntimeEntity; -import org.apache.eventmesh.dashboard.core.metadata.cluster.TopicSyncFromClusterService; -import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; - -import java.util.Arrays; -import java.util.concurrent.CompletableFuture; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mockito; -import org.mockito.junit.jupiter.MockitoExtension; - -@ExtendWith(MockitoExtension.class) -class TopicSyncFromClusterServiceTest { - - private static TopicSyncFromClusterService topicSyncFromManagerService = new TopicSyncFromClusterService(); - - private static TopicRemotingService topicRemotingService = Mockito.mock(TopicRemotingService.class); - - @BeforeAll - public static void initMock() { - Mockito.when(topicRemotingService.getAllTopics(Mockito.any())).thenAnswer(invocation -> { - GetTopicsResponse getTopicsResponse = new GetTopicsResponse(); - getTopicsResponse.setTopicMetadataList(Arrays.asList(new TopicMetadata())); - GetTopicsResult getTopicsResult = new GetTopicsResult(); - getTopicsResult.setGetTopicsResponseFuture(CompletableFuture.completedFuture(getTopicsResponse) - .thenApply(response -> { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return response; - })); - return getTopicsResult; - }); - topicSyncFromManagerService.setTopicRemotingService(topicRemotingService); - RuntimeEntity runtimeEntity = new RuntimeEntity(1L, "runtime1", 2L, 1019, 1099, 1L, "null", 1, null, null, "null"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - runtimeEntity.setHost("runtime2"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - runtimeEntity.setHost("runtime3"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - runtimeEntity.setHost("runtime4"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - runtimeEntity.setHost("runtime5"); - RuntimeCache.getInstance().addRuntime(runtimeEntity); - } - - @Test - public void testGetData() { - long start = System.nanoTime(); - topicSyncFromManagerService.getData(); - long end = System.nanoTime(); - assertTrue((end - start) < 2000_000_000L); - } -} \ No newline at end of file diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java index 98b5b268..78222516 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/integration/health/HealthServiceIntegrateTest.java @@ -41,13 +41,11 @@ @Timeout(value = 10) public class HealthServiceIntegrateTest { + private final CheckResultCache checkResultCache = CheckResultCache.getINSTANCE(); HealthService healthService = new HealthService(); - @Autowired private HealthDataService healthDataService; - private final CheckResultCache checkResultCache = CheckResultCache.getINSTANCE(); - @BeforeEach void init() { healthService.createExecutor(healthDataService, checkResultCache); @@ -56,12 +54,12 @@ void init() { @Test void testStorageRedis() throws InterruptedException { HealthCheckObjectConfig config = HealthCheckObjectConfig.builder() - .clusterId(1L) - .instanceId(1L) - .healthCheckResourceType("storage") - .healthCheckResourceSubType("redis") - .connectUrl("redis://localhost:6379") - .build(); + .clusterId(1L) + .instanceId(1L) + .healthCheckResourceType("storage") + .healthCheckResourceSubType("redis") + .connectUrl("redis://localhost:6379") + .build(); healthService.insertCheckService(config); healthService.executeAll(); Thread.sleep(1000); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java index 82ae51e9..cde56152 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/linkage/log/TestOprLog.java @@ -45,9 +45,18 @@ public class TestOprLog { @Test public void testGroupServiceOprLog() { - GroupEntity groupEntity = new GroupEntity(null, 1L, "logTest", 0, null, 1, "OK", null, null, 0); + GroupEntity groupEntity = new GroupEntity(); + groupEntity.setClusterId(1L); + groupEntity.setName("logTest"); + groupEntity.setStatus(1); + groupEntity.setType(0); + groupEntity.setState("OS"); groupService.addGroup(groupEntity); - LogEntity logEntity = new LogEntity(null, 1L, "add", "Group", 2, groupEntity.toString(), null, null, null, null); + LogEntity logEntity = new LogEntity(); + logEntity.setClusterId(1L); + logEntity.setOperationType("add"); + logEntity.setOperationUser("Group"); + logEntity.setContent(groupEntity.toString()); logEntity.setResult(groupEntity.toString()); logEntity.setId(groupEntity.getId()); List logListByCluster = logService.getLogListByCluster(new GetLogListDTO()); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java index b9edc8ef..893b99b1 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapperTest.java @@ -1,20 +1,18 @@ /* - * 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 + * 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 + * 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. + * 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.mapper.acl; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java index d2539abd..2a0a6ad3 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/mapper/instanceuser/InstanceUserMapperTest.java @@ -1,20 +1,18 @@ /* - * 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 + * 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 + * 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. + * 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.mapper.instanceuser; 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 641b5d38..69a5da87 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 @@ -32,7 +32,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; - @ExtendWith(SpringExtension.class) @ActiveProfiles("test") @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:connection-test.sql") diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java index 89e6d9c8..5a1b63c2 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/spring/support/FunctionManagerTest.java @@ -30,7 +30,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.junit.jupiter.SpringExtension; diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java deleted file mode 100644 index 28a50184..00000000 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/cluster/TestClusterMapper.java +++ /dev/null @@ -1,105 +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.unit.cluster; - -import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; -import org.apache.eventmesh.dashboard.console.entity.cluster.ClusterEntity; -import org.apache.eventmesh.dashboard.console.mapper.cluster.ClusterMapper; - -import java.util.List; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = EventMeshDashboardApplication.class) -public class TestClusterMapper { - - @Autowired - private ClusterMapper clusterMapper; - - @Test - public void testAddCluster() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); - clusterEntity1.setUpdateTime(null); - clusterEntity1.setCreateTime(null); - Assert.assertEquals(clusterEntity1, clusterEntity); - } - - @Test - public void testSelectAllCluster() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0, 0); - ClusterEntity clusterEntity1 = - new ClusterEntity("c1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - clusterMapper.addCluster(clusterEntity1); - List clusterEntities = clusterMapper.selectAllCluster(); - Assert.assertEquals(clusterEntities.size(), 2); - } - - @Test - public void testSelectClusterById() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); - clusterEntity1.setCreateTime(null); - clusterEntity1.setUpdateTime(null); - Assert.assertEquals(clusterEntity1, clusterEntity); - } - - @Test - public void testUpdateCluster() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - clusterEntity.setDescription("nothing"); - clusterEntity.setName("cl2"); - clusterEntity.setAuthType(1); - clusterEntity.setBootstrapServers("1999"); - clusterEntity.setClientProperties("nothing"); - clusterEntity.setVersion("1.10.0"); - clusterEntity.setJmxProperties("nothing"); - clusterEntity.setRegistryAddress("1.23.18"); - clusterEntity.setRunState(1); - clusterEntity.setRegProperties("nothing"); - clusterMapper.updateClusterById(clusterEntity); - ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); - clusterEntity1.setCreateTime(null); - clusterEntity1.setUpdateTime(null); - Assert.assertEquals(clusterEntity1, clusterEntity); - } - - @Test - public void testDeleteCluster() { - ClusterEntity clusterEntity = - new ClusterEntity("cl1", "registryList", "server", "1.7.0", "null", "null", "null", "no", 0, 0, 0,0); - clusterMapper.addCluster(clusterEntity); - clusterMapper.deactivate(clusterEntity); - ClusterEntity clusterEntity1 = clusterMapper.selectClusterById(clusterEntity); - Assert.assertEquals(clusterEntity1, null); - } -} diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java index 06250ef9..e6df7691 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/config/TestConfigMapper.java @@ -32,6 +32,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import lombok.Builder; + @RunWith(SpringRunner.class) @SpringBootTest(classes = EventMeshDashboardApplication.class) @@ -40,11 +42,41 @@ public class TestConfigMapper { @Autowired private ConfigMapper configMapper; + private ConfigEntity config; + + private ConfigEntity config1; + + @Builder + public void init(){ + this.config = new ConfigEntity(); + this.config.setClusterId(1L); + this.config.setBusinessType("rocketmq"); + this.config.setInstanceType(2); + this.config.setInstanceId(2L); + this.config.setConfigName("port"); + this.config.setConfigValue("127.0.0.1"); + this.config.setStartVersion("1.0.0"); + this.config.setEndVersion("1.1.1"); + this.config.setDiffType(1); + this.config.setDescription("1.1.1.1.1"); + this.config.setEdit(-1); + + this.config1 = new ConfigEntity(); + this.config1.setClusterId(1L); + this.config1.setBusinessType("rocketmq"); + this.config1.setInstanceType(2); + this.config1.setInstanceId(2L); + this.config1.setConfigName("port"); + this.config1.setConfigValue("127.0.0.1"); + this.config1.setStartVersion("1.0.0"); + this.config1.setEndVersion("1.1.1"); + this.config1.setDiffType(1); + this.config1.setDescription("1.1.1.1.1"); + this.config1.setEdit(-1); + } + @Test public void testAddConfig() throws IllegalAccessException { - ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, - null, null, 0, 0, 0); configMapper.addConfig(config); ConfigEntity configEntity = configMapper.selectByUnique(config); configEntity.setUpdateTime(null); @@ -55,9 +87,6 @@ public void testAddConfig() throws IllegalAccessException { @Test public void testDeleteConfig() { - ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, - null, null, 0, 0, 0); configMapper.addConfig(config); configMapper.deleteConfig(config); ConfigEntity config1 = configMapper.selectByUnique(config); @@ -66,12 +95,6 @@ public void testDeleteConfig() { @Test public void testSelectByInstanceId() { - ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, - null, null, 0, 0, 0); - ConfigEntity config1 = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "name", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", 0, - null, null, 0, 0, 0); configMapper.addConfig(config1); configMapper.addConfig(config); List configEntityList = new ArrayList<>(); @@ -96,9 +119,6 @@ public void testSelectDefaultConfig() { @Test public void testUpdateConfig() { - ConfigEntity config = new ConfigEntity(null, 1L, "rocketmq", 2, 2L, "port", - "127.0.0.1", "1.7.0", "1.8.0", 1, "1.10.0", -1, "666", - 2, null, null, 0, 0, 0); configMapper.addConfig(config); config.setConfigValue("127.1.1.1"); configMapper.updateConfig(config); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java index 6f26339a..f0ec5a98 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/group/GroupMapperTest.java @@ -41,7 +41,7 @@ public class GroupMapperTest { public List insertGroupData(String name) { List groupEntities = new ArrayList<>(); for (int i = 0; i < 10; i++) { - GroupEntity groupEntity = new GroupEntity(null, (long) i, name, 0, null, 1, "OK", null, null, 0); + GroupEntity groupEntity = new GroupEntity(); groupMapper.addGroup(groupEntity); groupEntities.add(groupEntity); } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java index 31d4ce45..954e31e4 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/groupmember/GroupMemberMapperTest.java @@ -41,7 +41,13 @@ public class GroupMemberMapperTest { public List insertGroupData(String topicName, String groupName) { List groupMemberEntities = new ArrayList<>(); for (int i = 0; i < 10; i++) { - GroupMemberEntity groupMemberEntity = new GroupMemberEntity(null, (long) i, topicName, groupName, "admin", "active", null, null, 0); + GroupMemberEntity groupMemberEntity = new GroupMemberEntity(); + groupMemberEntity.setClusterId((long)i); + groupMemberEntity.setTopicName(topicName); + groupMemberEntity.setGroupName(groupName); + groupMemberEntity.setEventMeshUser("admin"); + groupMemberEntity.setState("active"); + groupMemberEntity.setStatus(0); groupMemberMapper.addGroupMember(groupMemberEntity); groupMemberEntities.add(groupMemberEntity); } diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java index 47aa0266..c7021c1b 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/runtime/TestRuntimeMapper.java @@ -37,9 +37,15 @@ public class TestRuntimeMapper { @Autowired private RuntimeMapper runtimeMapper; + private RuntimeEntity runtimeEntity; + + public void init(){ + this.runtimeEntity = new RuntimeEntity(); + } + + @Test public void testAddRuntimeMapper() { - RuntimeEntity runtimeEntity = new RuntimeEntity(1L, "runtime1", 2L, 1019, 1099, 1L, "null", 1, null, null, "null"); runtimeMapper.addRuntime(runtimeEntity); List runtimeEntities = runtimeMapper.selectRuntimeByCluster(runtimeEntity); RuntimeEntity runtimeEntity1 = runtimeEntities.get(0); @@ -50,7 +56,6 @@ public void testAddRuntimeMapper() { @Test public void testUpdateRuntimeByCluster() { - RuntimeEntity runtimeEntity = new RuntimeEntity(1L, "runtime1", 2L, 1019, 1099, 1L, "null", 1, null, null, "null"); runtimeMapper.addRuntime(runtimeEntity); runtimeEntity.setPort(1000); runtimeEntity.setJmxPort(1099); @@ -65,7 +70,6 @@ public void testUpdateRuntimeByCluster() { @Test public void testDeleteRuntime() { - RuntimeEntity runtimeEntity = new RuntimeEntity(1L, "runtime1", 2L, 1019, 1099, 1L, "null", 1, null, null, "null"); runtimeMapper.addRuntime(runtimeEntity); runtimeMapper.deleteRuntimeByCluster(runtimeEntity); List runtimeEntities = runtimeMapper.selectRuntimeByCluster(runtimeEntity); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java index 16d79f06..e76535ab 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/store/TestStoreMapper.java @@ -17,12 +17,12 @@ package org.apache.eventmesh.dashboard.console.unit.store; -import org.apache.eventmesh.dashboard.common.enums.StoreType; import org.apache.eventmesh.dashboard.console.EventMeshDashboardApplication; import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity; import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -37,15 +37,18 @@ public class TestStoreMapper { @Autowired private StoreMapper storeMapper; + private StoreEntity storeEntity; + + private StoreEntity storeEntity1; + + @Before + public void init() { + storeEntity = new StoreEntity(); + storeEntity1 = new StoreEntity(); + } + @Test public void testAddStore() { - StoreEntity storeEntity = - new StoreEntity(1L, StoreType.ROCKETMQ.getNumber(), "run1", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", - 1L); - StoreEntity storeEntity1 = - new StoreEntity(2L, StoreType.ROCKETMQ.getNumber(), "run1", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", - 1L); - storeMapper.addStore(storeEntity); storeMapper.addStore(storeEntity1); StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity); @@ -58,18 +61,14 @@ public void testAddStore() { @Test public void testDeleteStoreByUnique() { - StoreEntity storeEntity = - new StoreEntity(2L, StoreType.ROCKETMQ.getNumber(), "run1", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L); storeMapper.addStore(storeEntity); storeMapper.deleteStoreByUnique(storeEntity); StoreEntity storeEntities = storeMapper.selectStoreByCluster(storeEntity); - Assert.assertEquals(storeEntities, null); + Assert.assertNull(storeEntities); } @Test public void testUpdateStoreByUnique() { - StoreEntity storeEntity = - new StoreEntity(1L, StoreType.ROCKETMQ.getNumber(), "run1", "n,j", (short) -1, 1098, 1099, "nothing", (short) 1, null, null, "nothing", 1L); storeMapper.addStore(storeEntity); storeEntity.setStatus((short) 5); storeMapper.updateStoreByUnique(storeEntity); diff --git a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java index f0debdbe..9c59dfd2 100644 --- a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java +++ b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/unit/topic/TopicMapperTest.java @@ -41,7 +41,8 @@ public class TopicMapperTest { public List insertGroupData(String topicName) { List topicEntities = new ArrayList<>(); for (int i = 0; i < 10; i++) { - TopicEntity topicEntity = new TopicEntity(null, (long) i, topicName, 10L, 100L, 1, "testTopic", null, null, 0, 0); + TopicEntity topicEntity = new TopicEntity(); + topicEntity.setTopicName(topicName); topicMapper.addTopic(topicEntity); topicEntities.add(topicEntity); } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java index 222f650b..20621ae7 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDO.java @@ -1,17 +1,35 @@ +/* + * 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.core.cluster; -import lombok.Data; import org.apache.eventmesh.dashboard.common.model.metadata.ClusterMetadata; import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import lombok.Data; + @Data public class ClusterDO { private ClusterMetadata clusterInfo; - private Map runtimeMap = new ConcurrentHashMap<>(); + private Map runtimeMap = new ConcurrentHashMap<>(); } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java index 535f38d0..61ac242f 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ClusterDoCache.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.core.cluster; @@ -13,63 +30,60 @@ public class ClusterDoCache { private static final ClusterDoCache INSTANCE = new ClusterDoCache(); + private Map> clusterDoMap = new HashMap<>(); - - public static final ClusterDoCache getInstance() { - return INSTANCE; + { + this.clusterDoMap = this.getClusterDoMap(); } - private ClusterDoCache(){} - - - private Map> clusterDoMap = new HashMap<>(); - - { - this.clusterDoMap = this.getClusterDoMap(); + private ClusterDoCache() { } + public static final ClusterDoCache getInstance() { + return INSTANCE; + } - public Map> getClusterDoMap(){ - Map> clusterDoMap = new HashMap<>(); - for(ClusterType clusterType : ClusterType.values()){ + public Map> getClusterDoMap() { + Map> clusterDoMap = new HashMap<>(); + for (ClusterType clusterType : ClusterType.values()) { clusterDoMap.put(clusterType, new HashMap<>()); } return clusterDoMap; } - public void setClusterDoMap(Map> clusterDoMap){ + public void setClusterDoMap(Map> clusterDoMap) { this.clusterDoMap = clusterDoMap; } - public List getEventMeshClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType){ + public List getEventMeshClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterate(ClusterType.EVENTMESH, clusterTrusteeshipType); } - public List getMetaNacosClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType){ + public List getMetaNacosClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterate(ClusterType.EVENTMESH_META_NACOS, clusterTrusteeshipType); } - public List getMetaEtcdClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType){ + public List getMetaEtcdClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterate(ClusterType.EVENTMESH_META_ETCD, clusterTrusteeshipType); } - public List getRocketMQClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType){ + public List getRocketMQClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterate(ClusterType.STORAGE_ROCKETMQ, clusterTrusteeshipType); } - private List filterate(ClusterType clusterType , ClusterTrusteeshipType... clusterTrusteeshipTypes){ - Map> clusterDoMap = new HashMap<>(); + private List filterate(ClusterType clusterType, ClusterTrusteeshipType... clusterTrusteeshipTypes) { + Map> clusterDoMap = new HashMap<>(); Map clusterDOList = clusterDoMap.get(clusterType); - if(Objects.isNull(clusterTrusteeshipTypes) || clusterTrusteeshipTypes.length == 0){ + if (Objects.isNull(clusterTrusteeshipTypes) || clusterTrusteeshipTypes.length == 0) { return new ArrayList<>(clusterDOList.values()); } List newClusterDOList = new ArrayList<>(); - for(ColonyDO clusterDO : clusterDOList.values()){ + for (ColonyDO clusterDO : clusterDOList.values()) { newClusterDOList.add(clusterDO); } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java index 9195e911..b2218695 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/cluster/ColonyDO.java @@ -1,19 +1,30 @@ -package org.apache.eventmesh.dashboard.core.cluster; +/* + * 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. + */ -import lombok.Data; +package org.apache.eventmesh.dashboard.core.cluster; import java.util.Map; import java.util.Objects; import java.util.concurrent.ConcurrentHashMap; +import lombok.Data; + /** - * eventmesh ClusterDO - * meta ClusterDO - * runtime ClusterDO - * storage ClusterDO - * meta(注册中心,zk,) ClusterDO - * runtime(broker) ClusterDO - * + * eventmesh ClusterDO meta ClusterDO runtime ClusterDO storage ClusterDO meta(注册中心,zk,) ClusterDO runtime(broker) ClusterDO */ @Data public class ColonyDO { @@ -24,22 +35,22 @@ public class ColonyDO { // 双活集群 所以是可以是一个list的 // 可以默认一个集群 - private Map runtimeColonyDOList = new ConcurrentHashMap<>(); + private Map runtimeColonyDOList = new ConcurrentHashMap<>(); // 只有 eventmesh 集群有这个点,其他没有。 - private Map storageColonyDOList = new ConcurrentHashMap<>(); + private Map storageColonyDOList = new ConcurrentHashMap<>(); /** - * A(nameserver cluster) a1 a2 a3 - * B(nameserver cluster) b1 b2 b3 - * + * A(nameserver cluster) a1 a2 a3 B(nameserver cluster) b1 b2 b3 + *

* rocketmq a1,a2,a3,b1,b2,b3 */ - private Map metaColonyDOList = new ConcurrentHashMap<>(); + private Map metaColonyDOList = new ConcurrentHashMap<>(); - public Long getClusterId(){ - return Objects.nonNull(this.clusterDO.getClusterInfo().getClusterId())?this.clusterDO.getClusterInfo().getClusterId():this.clusterDO.getClusterInfo().getId() ; + public Long getClusterId() { + return Objects.nonNull(this.clusterDO.getClusterInfo().getClusterId()) ? this.clusterDO.getClusterInfo().getClusterId() + : this.clusterDO.getClusterInfo().getId(); } } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java index 127d2e3c..66f1420c 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/config/AdminProperties.java @@ -47,6 +47,7 @@ public static class MetaProperties { @Data public static class NacosProperties { + private String addr = "127.0.0.1:8848"; private String namespace = ""; private boolean authEnabled = false; @@ -59,6 +60,7 @@ public static class NacosProperties { @Data public static class EtcdProperties { + private String addr; } } @@ -72,6 +74,7 @@ public static class StoreProperties { @Data public static class RocketMQProperties { + private String namesrvAddr; private String clusterName = ""; private String accessKey = ""; @@ -80,6 +83,7 @@ public static class RocketMQProperties { @Data public static class KafkaProperties { + private String namesrvAddr; private int partitions = 1; private int replicationFactors = 1; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java index b4d1920f..823af69e 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/SDKManager.java @@ -47,37 +47,24 @@ */ public class SDKManager { - private static volatile SDKManager INSTANCE = null; - - public static synchronized SDKManager getInstance() { - if (INSTANCE == null) { - synchronized (SDKManager.class) { - if (INSTANCE == null) { - INSTANCE = new SDKManager(); - } - } - } - return INSTANCE; - } - /** * inner key is the unique key of a client, such as (ip + port) they are defined in CreateClientConfig *

- * key: SDKTypeEnum - * value: A map collection is used with key being (ip+port) and value being client. + * key: SDKTypeEnum value: A map collection is used with key being (ip+port) and value being client. + * * @see CreateSDKConfig#getUniqueKey() */ private static final Map> clientMap = new ConcurrentHashMap<>(); - /** * Initialise the SDKOperation object instance according to SDKTypeEnum. *

- * key: SDKTypeEnum - * value: SDKOperation + * key: SDKTypeEnum value: SDKOperation + * * @see SDKTypeEnum * @see SDKOperation */ private static final Map> clientCreateOperationMap = new ConcurrentHashMap<>(); + private static volatile SDKManager INSTANCE = null; // register all client create operation static { @@ -91,7 +78,7 @@ public static synchronized SDKManager getInstance() { clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, new RocketMQRemotingSDKOperation()); clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_PRODUCER, new RocketMQProduceSDKOperation()); clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_CONSUMER, new RocketMQPushConsumerSDKOperation()); - clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_ADMIN , new RocketMQAdminOperation()); + clientCreateOperationMap.put(SDKTypeEnum.STORAGE_ROCKETMQ_ADMIN, new RocketMQAdminOperation()); // nacos clientCreateOperationMap.put(SDKTypeEnum.META_NACOS, new NacosSDKOperation()); @@ -121,6 +108,17 @@ public static synchronized SDKManager getInstance() { private SDKManager() { } + public static synchronized SDKManager getInstance() { + if (INSTANCE == null) { + synchronized (SDKManager.class) { + if (INSTANCE == null) { + INSTANCE = new SDKManager(); + } + } + } + return INSTANCE; + } + /** * Create SDK client through (SDKTypeEnum) clientTypeEnum, (CreateSDKConfig) config. */ diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java index d8982cb5..f9d7833a 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateRocketmqAdminSDKConfig.java @@ -1,16 +1,32 @@ +/* + * 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.core.function.SDK.config; import lombok.Data; @Data -public class CreateRocketmqAdminSDKConfig implements CreateSDKConfig{ +public class CreateRocketmqAdminSDKConfig implements CreateSDKConfig { private String nameServerUrl; private String clusterName; - @Override public String getUniqueKey() { return nameServerUrl; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java index 98f88bdd..29e3fb35 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKOperation.java @@ -33,6 +33,10 @@ @Slf4j public class EtcdSDKOperation extends AbstractSDKOperation { + private static String[] getSplitEndpoints(CreateEtcdConfig etcdConfig) { + return etcdConfig.getEtcdServerAddress().split(";"); + } + @Override public SimpleEntry createClient(CreateSDKConfig clientConfig) { final CreateEtcdConfig etcdConfig = (CreateEtcdConfig) clientConfig; @@ -49,10 +53,6 @@ public SimpleEntry createClient(CreateSDKConfig clientConfig) { return new SimpleEntry<>(clientConfig.getUniqueKey(), kvClient); } - private static String[] getSplitEndpoints(CreateEtcdConfig etcdConfig) { - return etcdConfig.getEtcdServerAddress().split(";"); - } - @Override public void close(Object client) { castClient(client).close(); diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java index c5486883..f655fe13 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQAdminOperation.java @@ -17,17 +17,18 @@ package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq; -import lombok.extern.slf4j.Slf4j; import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; + import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.client.producer.DefaultMQProducer; import org.apache.rocketmq.tools.admin.DefaultMQAdminExt; -import org.checkerframework.checker.units.qual.A; import java.util.AbstractMap.SimpleEntry; +import lombok.extern.slf4j.Slf4j; + @Slf4j public class RocketMQAdminOperation extends AbstractSDKOperation { diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java index b60fee8b..37d71c25 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/rocketmq/RocketMQPushConsumerSDKOperation.java @@ -17,15 +17,17 @@ package org.apache.eventmesh.dashboard.core.function.SDK.operation.rocketmq; -import lombok.extern.slf4j.Slf4j; import org.apache.eventmesh.dashboard.core.function.SDK.AbstractSDKOperation; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; + import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.exception.MQClientException; import java.util.AbstractMap.SimpleEntry; +import lombok.extern.slf4j.Slf4j; + @Slf4j public class RocketMQPushConsumerSDKOperation extends AbstractSDKOperation { diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java index 537bb312..a51bb8ad 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/runtime/RuntimeSDKOperation.java @@ -54,7 +54,7 @@ public SimpleEntry createClient(CreateSDKConfig clien final String protocolName = ((CreateRuntimeConfig) clientConfig).getProtocolName(); final String clientType = ((CreateRuntimeConfig) clientConfig).getClientType(); - SimpleEntry cloudSimpleEntry = null; + SimpleEntry cloudSimpleEntry = null; SimpleEntry eventMeshMessageSimpleEntry = null; SimpleEntry openMessageSimpleEntry = null; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java index 60f9022d..617331db 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/wrapper/NacosSDKWrapper.java @@ -28,11 +28,11 @@ @AllArgsConstructor public class NacosSDKWrapper { + private ConfigService configService; + private NamingService namingService; + public void shutdown() throws NacosException { configService.shutDown(); namingService.shutDown(); } - - private ConfigService configService; - private NamingService namingService; } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java index 0d665c69..db6d5053 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/meta/subscription/NacosSubscriptionCore.java @@ -58,14 +58,11 @@ @Slf4j public class NacosSubscriptionCore implements SubscriptionCore { + private static String HTTP_PREFIX = ConfigConst.HTTP_PREFIX; AdminProperties adminProperties; - Properties nacosProps = new Properties(); - RestTemplate restTemplate = new RestTemplate(); - private static String HTTP_PREFIX = ConfigConst.HTTP_PREFIX; - public NacosSubscriptionCore(AdminProperties adminProperties) { this.adminProperties = adminProperties; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java index 1a4ad56a..481e88bd 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManager.java @@ -1,7 +1,22 @@ +/* + * 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.core.metadata; -import lombok.Data; -import lombok.Setter; import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; import org.apache.eventmesh.dashboard.common.model.metadata.MetadataConfig; import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; @@ -19,48 +34,46 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import lombok.Data; +import lombok.Setter; + /** - * 启动应该进行差异化对比。进行差异化增量,差异化删除 - * 表 -> increment-> remote -> function -> data -> conver -> request + * 启动应该进行差异化对比。进行差异化增量,差异化删除 表 -> increment-> remote -> function -> data -> conver -> request */ public class MetadataSyncManager { - @Setter - private Map,MetadataSyncWrapper> metadataSyncWrapperMap = new HashMap<>(); - private final ScheduledThreadPoolExecutor scheduledExecutorService = new ScheduledThreadPoolExecutor(2); - private final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(32, 32, 10, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), - new ThreadFactory() { - final AtomicInteger counter = new AtomicInteger(0); - - @Override - public Thread newThread(Runnable r) { - return new Thread(r, "metadata-manager-" + counter.incrementAndGet()); - } - }); - + new ThreadFactory() { + final AtomicInteger counter = new AtomicInteger(0); + @Override + public Thread newThread(Runnable r) { + return new Thread(r, "metadata-manager-" + counter.incrementAndGet()); + } + }); + @Setter + private Map, MetadataSyncWrapper> metadataSyncWrapperMap = new HashMap<>(); @Setter private RemotingManager remotingManager; - public void register(MetadataSyncConfig metadataSyncConfig){ + public void register(MetadataSyncConfig metadataSyncConfig) { MetadataSyncWrapper metadataSyncWrapper = new MetadataSyncWrapper(); metadataSyncWrapper.setMetadataClass(metadataSyncConfig.getMetadataClass()); metadataSyncWrapper.setEntityClass(metadataSyncConfig.getEntityClass()); metadataSyncWrapper.setDataBasesHandler(metadataSyncConfig.getDataBasesHandler()); metadataSyncWrapper.setClusterService(metadataSyncConfig.getClusterService()); - metadataSyncWrapperMap.put(metadataSyncWrapper.getMetadataClass(),metadataSyncWrapper); + metadataSyncWrapperMap.put(metadataSyncWrapper.getMetadataClass(), metadataSyncWrapper); } - public void init(Integer initialDelay, Integer period){ - scheduledExecutorService.scheduleAtFixedRate(this::run , initialDelay, period,TimeUnit.SECONDS); + public void init(Integer initialDelay, Integer period) { + scheduledExecutorService.scheduleAtFixedRate(this::run, initialDelay, period, TimeUnit.SECONDS); } - public void run(){ - for(MetadataSyncWrapper metadataSyncWrapper : metadataSyncWrapperMap.values()){ + public void run() { + for (MetadataSyncWrapper metadataSyncWrapper : metadataSyncWrapperMap.values()) { // 一个MetadataSyncWrapper 一个线程 threadPoolExecutor.execute(metadataSyncWrapper); } @@ -68,7 +81,7 @@ public void run(){ @Data - public static class MetadataSyncConfig{ + public static class MetadataSyncConfig { private Class metadataClass; @@ -83,7 +96,7 @@ public static class MetadataSyncConfig{ } @Data - public class MetadataSyncWrapper implements Runnable{ + public class MetadataSyncWrapper implements Runnable { private Class metadataClass; @@ -99,14 +112,14 @@ public class MetadataSyncWrapper implements Runnable{ private CountDownLatch countDownLatch = new CountDownLatch(2); - private Map clusterData = new HashMap<>(); + private Map clusterData = new HashMap<>(); - private Map dataBasesData = new HashMap<>(); + private Map dataBasesData = new HashMap<>(); private List toClusterUpdate = new ArrayList<>(); - private List toDataUpdate = new ArrayList<>(); + private List toDataUpdate = new ArrayList<>(); private List toDelete = new ArrayList<>(); @@ -115,7 +128,7 @@ public class MetadataSyncWrapper implements Runnable{ private long lastTime = System.currentTimeMillis(); @Override - public void run(){ + public void run() { try { // 全程托管,托管都需要,异步 读取 cluster 信息 @@ -127,7 +140,7 @@ public void run(){ // 对读取的数据进行分类, this.difference(); // 托管的进行差异化之后。进行写库。 - if(this.toInsert.isEmpty() && this.toClusterUpdate.isEmpty() && this.toDelete.isEmpty() && this.toDataUpdate.isEmpty()){ + if (this.toInsert.isEmpty() && this.toClusterUpdate.isEmpty() && this.toDelete.isEmpty() && this.toDataUpdate.isEmpty()) { return; } this.toTrusteeship(); @@ -136,7 +149,7 @@ public void run(){ } catch (InterruptedException e) { throw new RuntimeException(e); - }finally { + } finally { countDownLatch = new CountDownLatch(2); clusterData.clear(); dataBasesData.clear(); @@ -145,42 +158,43 @@ public void run(){ } - public void syncClusterData(){ + public void syncClusterData() { try { List metadataConfigList = this.clusterService.getData(); - this.arrange(this.clusterData , metadataConfigList); - }finally { + this.arrange(this.clusterData, metadataConfigList); + } finally { countDownLatch.countDown(); } } - public void syncDatabasesData(){ + public void syncDatabasesData() { try { List metadataConfigList = this.dataBasesHandler.getData(); this.arrange(this.dataBasesData, metadataConfigList); - }finally { + } finally { countDownLatch.countDown(); } } - public void arrange(Map data , List metadataConfigList){ - for(MetadataConfig metadataConfig : metadataConfigList){ - data.put(metadataConfig.getUnique(), metadataConfig); - } + public void arrange(Map data, List metadataConfigList) { + for (MetadataConfig metadataConfig : metadataConfigList) { + data.put(metadataConfig.getUnique(), metadataConfig); + } } /** * TODO 一定要注意。这个就得是 cluster 的差集。如果要对 database 操作 就要反翻过啦 */ - public void difference(){ - Map newClusterData = new HashMap<>(this.clusterData); - Map newDataBasesData = new HashMap<>(this.dataBasesData); + public void difference() { + this.toDataUpdate = new ArrayList<>(); this.toClusterUpdate = new ArrayList<>(); this.toDelete = new ArrayList<>(); this.toInsert = new ArrayList<>(); - for(Map.Entry entry : newClusterData.entrySet()){ + Map newClusterData = new HashMap<>(this.clusterData); + Map newDataBasesData = new HashMap<>(this.dataBasesData); + for (Map.Entry entry : newClusterData.entrySet()) { MetadataConfig serviceObject = newDataBasesData.remove(entry.getKey()); if (Objects.isNull(serviceObject)) { toDelete.add(entry.getValue()); @@ -195,32 +209,32 @@ public void difference(){ } - public void toTrusteeship(){ + public void toTrusteeship() { // 如果 update 中 cluster 与 databases 数据不一致。 以谁为主 // this.dataBasesHandler.updateMetadata(this.filterTrusteeship(this.toClusterUpdate)); this.dataBasesHandler.addMetadata(this.filterTrusteeship(this.toDelete)); } - public void toFullTrusteeship(){ + public void toFullTrusteeship() { // this.clusterService.addMetadata(this.filterFullTrusteeship(this.toInsert)); this.clusterService.addMetadata(this.filterFullTrusteeship(this.toDataUpdate)); this.clusterService.deleteMetadata(this.filterTrusteeship(this.toDelete)); } - private List filterFullTrusteeship(List metadataConfigList){ - return this.filter(metadataConfigList,ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP); + private List filterFullTrusteeship(List metadataConfigList) { + return this.filter(metadataConfigList, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP); } - private List filterTrusteeship(List metadataConfigList){ - return this.filter(metadataConfigList,ClusterTrusteeshipType.TRUSTEESHIP); + private List filterTrusteeship(List metadataConfigList) { + return this.filter(metadataConfigList, ClusterTrusteeshipType.TRUSTEESHIP); } - private List filter(List metadataConfigList,ClusterTrusteeshipType clusterTrusteeshipType){ + private List filter(List metadataConfigList, ClusterTrusteeshipType clusterTrusteeshipType) { List newMetadataConfigList = new ArrayList<>(); - for(MetadataConfig metadataConfig: metadataConfigList){ - if(remotingManager.isClusterTrusteeshipType(metadataConfig.getClusterId(), clusterTrusteeshipType)){ + for (MetadataConfig metadataConfig : metadataConfigList) { + if (remotingManager.isClusterTrusteeshipType(metadataConfig.getClusterId(), clusterTrusteeshipType)) { newMetadataConfigList.add(metadataConfig); } } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java index ee236d26..939dd8ad 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AbstractMetadataHandler.java @@ -1,6 +1,22 @@ +/* + * 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.core.metadata.cluster; -import lombok.Setter; import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; import org.apache.eventmesh.dashboard.core.metadata.MetadataHandler; import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; @@ -8,29 +24,34 @@ import java.util.ArrayList; import java.util.List; -public abstract class AbstractMetadataHandler implements MetadataHandler ,RemotingManager.RemotingRequestWrapper{ +import lombok.Setter; +public abstract class AbstractMetadataHandler implements MetadataHandler, RemotingManager.RemotingRequestWrapper { - @Setter - private RemotingManager remotingManager; protected S request; + @Setter + private RemotingManager remotingManager; - public void init(){ - this.request = (S)remotingManager.getProxyObject(); + public void init() { + this.request = (S) remotingManager.getProxyObject(); } /** * 同步的时候,只同步runtime 的数据,还是会同步 storage 的数据。这个可以进行配置。 + * * @return */ @Override - public List getData(){ + public List getData() { List remotingWrapperList = new ArrayList<>(); - remotingWrapperList.addAll(remotingManager.getEventMeshClusterDO(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); - remotingWrapperList.addAll(remotingManager.getStorageCluster(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); - return remotingManager.request(this, remotingManager.getEventMeshClusterDO(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); + remotingWrapperList.addAll( + remotingManager.getEventMeshClusterDO(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); + remotingWrapperList.addAll( + remotingManager.getStorageCluster(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); + return remotingManager.request(this, + remotingManager.getEventMeshClusterDO(ClusterTrusteeshipType.TRUSTEESHIP, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)); } } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java index 0dbd1965..98ec6aad 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/AclSyncFromClusterService.java @@ -17,18 +17,20 @@ package org.apache.eventmesh.dashboard.core.metadata.cluster; -import lombok.Setter; import org.apache.eventmesh.dashboard.common.model.metadata.AclMetadata; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; import org.apache.eventmesh.dashboard.common.model.remoting.acl.GetAclsRequest; import org.apache.eventmesh.dashboard.service.remoting.AclRemotingService; -import org.springframework.stereotype.Service; import java.util.List; +import org.springframework.stereotype.Service; + +import lombok.Setter; + @Service -public class AclSyncFromClusterService extends AbstractMetadataHandler { +public class AclSyncFromClusterService extends AbstractMetadataHandler { @Setter private AclRemotingService aclRemotingService; @@ -44,12 +46,11 @@ public void deleteMetadata(AclMetadata meta) { } - @Override public List getData(GlobalRequest globalRequest) { GetAclsRequest getAclsRequest = new GetAclsRequest(); getAclsRequest.setClusterId(globalRequest.getClusterId()); - return (List)this.request(this.request,getAclsRequest).getData(); + return (List) this.request(this.request, getAclsRequest).getData(); } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java index 079e2cd0..b8ffab6f 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/ConfigSyncFromClusterService.java @@ -17,20 +17,19 @@ package org.apache.eventmesh.dashboard.core.metadata.cluster; -import lombok.Setter; -import lombok.extern.slf4j.Slf4j; import org.apache.eventmesh.dashboard.common.model.metadata.ConfigMetadata; -import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService; -import org.apache.eventmesh.dashboard.service.remoting.RuntimeRemotingService; -import org.springframework.stereotype.Service; import java.util.List; +import org.springframework.stereotype.Service; + +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + @Slf4j @Service public class ConfigSyncFromClusterService extends AbstractMetadataHandler { diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java index 27edeba3..bae1ad1b 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/GroupSyncFromClusterService.java @@ -23,13 +23,14 @@ import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupsRequest; import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + @Service -public class GroupSyncFromClusterService extends AbstractMetadataHandler{ +public class GroupSyncFromClusterService extends AbstractMetadataHandler { @Autowired private RemotingManager remotingManager; @@ -46,7 +47,7 @@ public void deleteMetadata(GroupMetadata meta) { @Override public List getData() { - List eventMeshGroupList = this.remotingManager.request(this,remotingManager.getEventMeshClusterDO()); + List eventMeshGroupList = this.remotingManager.request(this, remotingManager.getEventMeshClusterDO()); //List rocketMQMeshGroupList = this.remotingManager.request(this,remotingManager.getRocketMQClusterDO() ); //eventMeshGroupList.addAll(rocketMQMeshGroupList); return eventMeshGroupList; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java index d89a8508..f9d32491 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/RuntimeSyncFromClusterService.java @@ -17,20 +17,21 @@ package org.apache.eventmesh.dashboard.core.metadata.cluster; -import lombok.extern.slf4j.Slf4j; import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; import org.apache.eventmesh.dashboard.service.remoting.RuntimeRemotingService; -import org.springframework.stereotype.Service; import java.util.List; +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; + @Slf4j @Service -public class RuntimeSyncFromClusterService extends AbstractMetadataHandler{ - +public class RuntimeSyncFromClusterService extends AbstractMetadataHandler { @Override @@ -45,13 +46,13 @@ public void deleteMetadata(RuntimeMetadata meta) { @Override public List getData(GlobalRequest globalRequest) { - GetRuntimeRequest getRuntimeRequest = new GetRuntimeRequest(); + GetRuntimeRequest getRuntimeRequest = new GetRuntimeRequest(); getRuntimeRequest.setClusterId(globalRequest.getClusterId()); - return (List)this.request(this.request,getRuntimeRequest).getData(); + return (List) this.request(this.request, getRuntimeRequest).getData(); } @Override - public GlobalResult request( RuntimeRemotingService runtimeRemotingService,GetRuntimeRequest key) { + public GlobalResult request(RuntimeRemotingService runtimeRemotingService, GetRuntimeRequest key) { return runtimeRemotingService.getRuntimeMetadata(key); } } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java index 0be9cf93..a12dee50 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/metadata/cluster/TopicSyncFromClusterService.java @@ -17,16 +17,18 @@ package org.apache.eventmesh.dashboard.core.metadata.cluster; -import lombok.extern.slf4j.Slf4j; import org.apache.eventmesh.dashboard.common.model.metadata.TopicMetadata; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalRequest; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest; import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; -import org.springframework.stereotype.Service; import java.util.List; +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; + @Slf4j @Service public class TopicSyncFromClusterService extends AbstractMetadataHandler { diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java index c9f8bc49..f15ee089 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/AbstractRemotingService.java @@ -1,7 +1,22 @@ +/* + * 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.core.remoting; -import com.alibaba.fastjson.JSONObject; -import lombok.Setter; import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; import org.apache.eventmesh.dashboard.core.cluster.ClusterDO; import org.apache.eventmesh.dashboard.core.cluster.ColonyDO; @@ -10,6 +25,10 @@ import java.util.List; import java.util.Map; +import com.alibaba.fastjson.JSONObject; + +import lombok.Setter; + /** * 默认是一个集群,操作是基于集群操作还是单个操作 */ @@ -21,7 +40,7 @@ public abstract class AbstractRemotingService { protected ClusterDO clusterDO; - public void init(){ + public void init() { this.clusterDO = colonyDO.getClusterDO(); this.createConfig(); this.doInit(); @@ -29,52 +48,52 @@ public void init(){ public abstract void createConfig(); - public List getMeta(){ + public List getMeta() { List list = new ArrayList<>(); - for(ColonyDO c : colonyDO.getMetaColonyDOList().values()){ - for(RuntimeMetadata runtimeMetadata : c.getClusterDO().getRuntimeMap().values()){ - list.add(runtimeMetadata.getHost()+":"+runtimeMetadata.getPort()); + for (ColonyDO c : colonyDO.getMetaColonyDOList().values()) { + for (RuntimeMetadata runtimeMetadata : c.getClusterDO().getRuntimeMap().values()) { + list.add(runtimeMetadata.getHost() + ":" + runtimeMetadata.getPort()); } } return list; } - public String getMetaString(){ + public String getMetaString() { StringBuilder sb = new StringBuilder(); List list = new ArrayList<>(); - for(ColonyDO c : colonyDO.getMetaColonyDOList().values()){ - for(RuntimeMetadata runtimeMetadata : c.getClusterDO().getRuntimeMap().values()){ - sb.append(runtimeMetadata.getHost()+":"+runtimeMetadata.getPort()); + for (ColonyDO c : colonyDO.getMetaColonyDOList().values()) { + for (RuntimeMetadata runtimeMetadata : c.getClusterDO().getRuntimeMap().values()) { + sb.append(runtimeMetadata.getHost() + ":" + runtimeMetadata.getPort()); sb.append(";"); } } - return sb.toString().substring(0, sb.length() - 1); + return sb.substring(0, sb.length() - 1); } - public void update(){ + public void update() { } - public Long getClusterId(){ + public Long getClusterId() { return clusterDO.getClusterInfo().getClusterId(); } - public Long getId(){ + public Long getId() { return clusterDO.getClusterInfo().getId(); } - public T toDataOjbect(Object object,Class clazz){ + public T toDataOjbect(Object object, Class clazz) { if (object instanceof JSONObject) { JSONObject jsonObject = (JSONObject) object; return (T) jsonObject.toJavaObject(clazz); - }else if(object instanceof String){ - return (T)JSONObject.parseObject((String)object,clazz); - }else if(object instanceof Map){ - + } else if (object instanceof String) { + return (T) JSONObject.parseObject((String) object, clazz); + } else if (object instanceof Map) { + return null; } return null; } - protected abstract void doInit(); + protected abstract void doInit(); } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java index 3a8ff7c9..592a3a77 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManager.java @@ -1,7 +1,22 @@ +/* + * 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.core.remoting; -import lombok.Data; -import lombok.Getter; import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; import org.apache.eventmesh.dashboard.common.enums.ClusterType; import org.apache.eventmesh.dashboard.common.enums.RemotingType; @@ -40,9 +55,12 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; +import lombok.Data; +import lombok.Getter; + /** - * @author hahaha + * */ public class RemotingManager { @@ -63,23 +81,23 @@ public class RemotingManager { */ private final Map colonyDOMap = new HashMap<>(); - private AtomicBoolean loading = new AtomicBoolean(true); + private final AtomicBoolean loading = new AtomicBoolean(true); { for (RemotingType remotingType : RemotingType.values()) { remotingServiceClasses.put(remotingType, new ArrayList<>()); } - this.registerService(RemotingType.ROCKETMQ, RocketMQAclRemotingService.class, RocketMQConfigRemotingService.class, RocketMQClientRemotingService.class - , RocketMQGroupRemotingService.class, RocketMQOffsetRemotingService.class, RocketMQSubscriptionRemotingService.class - , RocketMQTopicRemotingService.class, RocketMQUserRemotingService.class); + this.registerService(RemotingType.ROCKETMQ, RocketMQAclRemotingService.class, RocketMQConfigRemotingService.class, + RocketMQClientRemotingService.class, RocketMQGroupRemotingService.class, RocketMQOffsetRemotingService.class, + RocketMQSubscriptionRemotingService.class, RocketMQTopicRemotingService.class, RocketMQUserRemotingService.class); - this.registerService(RemotingType.EVENT_MESH_RUNTIME, RocketMQAclRemotingService.class, RocketMQConfigRemotingService.class, RocketMQClientRemotingService.class - , RocketMQGroupRemotingService.class, RocketMQOffsetRemotingService.class, RocketMQSubscriptionRemotingService.class - , RocketMQTopicRemotingService.class, RocketMQUserRemotingService.class); + this.registerService(RemotingType.EVENT_MESH_RUNTIME, RocketMQAclRemotingService.class, RocketMQConfigRemotingService.class, + RocketMQClientRemotingService.class, RocketMQGroupRemotingService.class, RocketMQOffsetRemotingService.class, + RocketMQSubscriptionRemotingService.class, RocketMQTopicRemotingService.class, RocketMQUserRemotingService.class); RemotingServiceHandler remotingServiceHandler = new RemotingServiceHandler(); - Class[] clazzList = new Class[]{RemotingIntegrationService.class}; + Class[] clazzList = new Class[] {RemotingIntegrationService.class}; proxyObject = Proxy.newProxyInstance(this.getClass().getClassLoader(), clazzList, remotingServiceHandler); } @@ -90,7 +108,7 @@ public void registerService(RemotingType remotingType, Class... clazzs) { public void registerColony(ColonyDO colonyDO) throws Exception { - if (loading.get() == true) { + if (loading.get()) { return; } @@ -132,7 +150,8 @@ public void updateColony(ColonyDO colonyDO) { } public RemotingWrapper getMainRemotingWrapper(ColonyDO colonyDO) { - Long clusterId = colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster() ? colonyDO.getClusterId() : colonyDO.getSuperiorId(); + Long clusterId = + colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster() ? colonyDO.getClusterId() : colonyDO.getSuperiorId(); if (Objects.isNull(clusterId)) { return null; } @@ -140,7 +159,8 @@ public RemotingWrapper getMainRemotingWrapper(ColonyDO colonyDO) { } public ColonyDO getMainColonyDO(ColonyDO colonyDO) { - Long clusterId = colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster() ? colonyDO.getClusterId() : colonyDO.getSuperiorId(); + Long clusterId = + colonyDO.getClusterDO().getClusterInfo().getClusterType().isMainCluster() ? colonyDO.getClusterId() : colonyDO.getSuperiorId(); return colonyDOMap.get(clusterId); } @@ -249,21 +269,22 @@ public List getMetaEtcdClusterDO(ClusterTrusteeshipType... clus public List getRocketMQClusterDO(ClusterTrusteeshipType... clusterTrusteeshipType) { return this.filterer(ClusterType.STORAGE_ROCKETMQ, clusterTrusteeshipType); } + public List getStorageCluster(ClusterTrusteeshipType... clusterTrusteeshipType) { List list = new ArrayList<>(); - for(ClusterType clusterType : ClusterType.STORAGE_TYPES){ + for (ClusterType clusterType : ClusterType.STORAGE_TYPES) { list.addAll(this.filterer(clusterType, clusterTrusteeshipType)); } return list; } - public boolean isClusterTrusteeshipType(Long clusterId, ClusterTrusteeshipType clusterTrusteeshipType){ - ColonyDO colonyDO = this.colonyDOMap.get(clusterId ); - if(Objects.isNull(colonyDO)){ + public boolean isClusterTrusteeshipType(Long clusterId, ClusterTrusteeshipType clusterTrusteeshipType) { + ColonyDO colonyDO = this.colonyDOMap.get(clusterId); + if (Objects.isNull(colonyDO)) { return false; } - return Objects.equals(colonyDO.getClusterDO().getClusterInfo().getTrusteeshipType() , clusterTrusteeshipType); + return Objects.equals(colonyDO.getClusterDO().getClusterInfo().getTrusteeshipType(), clusterTrusteeshipType); } @@ -293,18 +314,18 @@ public T request(RemotingRequestWrapper remotingRequestWrapper, List)actualTypeArguments[0]; - globalRequestClass = (Class)actualTypeArguments[1]; + executeClass = (Class) actualTypeArguments[0]; + globalRequestClass = (Class) actualTypeArguments[1]; } - RemotingRequestWrapper remotingRequestWrapper1 = (RemotingRequestWrapper)remotingRequestWrapper; + RemotingRequestWrapper remotingRequestWrapper1 = (RemotingRequestWrapper) remotingRequestWrapper; for (RemotingWrapper remotingWrapper : remotingWrapperList) { try { GlobalRequest globalRequest = globalRequestClass.newInstance(); globalRequest.setClusterId(remotingWrapper.getColonyDO().getClusterId()); - GlobalResult globalResult = remotingRequestWrapper1.request(globalRequest,executeClass); - if(globalResult.getData() instanceof List){ - resultData.addAll((List)globalResult.getData()); - }else{ + GlobalResult globalResult = remotingRequestWrapper1.request(globalRequest, executeClass); + if (globalResult.getData() instanceof List) { + resultData.addAll((List) globalResult.getData()); + } else { resultData.add(globalResult.getData()); } } catch (Exception e) { @@ -316,13 +337,18 @@ public T request(RemotingRequestWrapper remotingRequestWrapper, List { + /** + * @param + * @param + */ + public interface RemotingRequestWrapper { - GlobalResult request(T t,RE key); + GlobalResult request(T t, RE key); } @Data public static class RemotingWrapper { + private ColonyDO colonyDO; private Map, Object> object = new HashMap<>(); @@ -342,7 +368,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl Class declaringClass = method.getDeclaringClass(); Object object = remotingWrapper.getObject().get(declaringClass); if (Objects.isNull(object)) { - + return null; } Method currentMethod = object.getClass().getMethod(method.getName(), method.getParameterTypes()); diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java index 938e1bf4..2b76a70d 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/RemotingServiceRuntimeConfig.java @@ -1,20 +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.core.remoting; -import lombok.Data; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import org.apache.eventmesh.dashboard.service.remoting.RemotingServiceType; import java.util.HashMap; import java.util.Map; +import lombok.Data; + @Data public class RemotingServiceRuntimeConfig { - private CreateSDKConfig runtimeConfig; private CreateSDKConfig storageConfig; - private Map remotingServiceTypeStringMap = new HashMap<>(); + private Map remotingServiceTypeStringMap = new HashMap<>(); } diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java index 405518a1..124ea575 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/AbstractRocketMQRemotingService.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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; @@ -5,6 +22,7 @@ import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRocketmqConfig; import org.apache.eventmesh.dashboard.core.remoting.AbstractRemotingService; + import org.apache.rocketmq.tools.admin.DefaultMQAdminExt; import org.apache.rocketmq.tools.command.CommandUtil; @@ -24,14 +42,15 @@ public abstract class AbstractRocketMQRemotingService extends AbstractRemotingSe @Override - public void createConfig(){ + public void createConfig() { createRocketmqConfig = new CreateRocketmqConfig(); createRocketmqConfig.setNameServerUrl(this.getMetaString()); } @Override protected void doInit() { - AbstractMap.SimpleEntry clientSimple = SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_ROCKETMQ_ADMIN, createRocketmqConfig); + AbstractMap.SimpleEntry clientSimple = + SDKManager.getInstance().createClient(SDKTypeEnum.STORAGE_ROCKETMQ_ADMIN, createRocketmqConfig); this.defaultMQAdminExt = clientSimple.getValue(); } @@ -45,7 +64,7 @@ protected T cluster(GlobalResult t, Function function) { }*/ Set masterSet = - CommandUtil.fetchMasterAddrByClusterName(defaultMQAdminExt, createRocketmqConfig.getClusterName()); + CommandUtil.fetchMasterAddrByClusterName(defaultMQAdminExt, createRocketmqConfig.getClusterName()); for (String masterName : masterSet) { Object newResult = function.apply(masterName, t); if (Objects.nonNull(newResult)) { @@ -67,8 +86,6 @@ protected T cluster(GlobalResult t, Function function) { protected T clusterName(GlobalResult t, Function function) { try { - - Object newResult = function.apply(createRocketmqConfig.getClusterName(), t); if (Objects.nonNull(newResult)) { return (T) newResult; @@ -83,6 +100,9 @@ protected T clusterName(GlobalResult t, Function function) { } } + /** + * @param + */ protected interface Function { T apply(String masterName, T t) throws Exception; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java index aa799281..00b52719 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQAclRemotingService.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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.model.remoting.acl.CreateAclRequest; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java index d17372fa..f64f4fb7 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQClientRemotingService.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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.model.metadata.ClientMetadata; @@ -6,6 +23,7 @@ import java.util.List; public class RocketMQClientRemotingService extends AbstractRocketMQRemotingService implements ClientRemotingService { + @Override public List getClientList() { return null; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java index d08f2cae..60d72cef 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQConfigRemotingService.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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult; @@ -8,6 +25,7 @@ import org.apache.eventmesh.dashboard.service.remoting.ConfigRemotingService; public class RocketMQConfigRemotingService extends AbstractRocketMQRemotingService implements ConfigRemotingService { + @Override public BaseGlobalResult addConfig(AddConfigRequest addConfigRequest) { return null; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java index 6b05f44d..50094447 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQGroupRemotingService.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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.model.remoting.group.GetGroupResult; @@ -5,6 +22,7 @@ import org.apache.eventmesh.dashboard.service.remoting.GroupRemotingService; public class RocketMQGroupRemotingService extends AbstractRocketMQRemotingService implements GroupRemotingService { + @Override public GetGroupResult getAllGroups(GetGroupsRequest getGroupsRequest) { return null; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java index 36881f5d..f3ae2927 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQOffsetRemotingService.java @@ -1,3 +1,21 @@ +/* + * 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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.model.remoting.offset.GetOffsetRequest; @@ -7,6 +25,7 @@ import org.apache.eventmesh.dashboard.service.remoting.OffsetRemotingService; public class RocketMQOffsetRemotingService extends AbstractRocketMQRemotingService implements OffsetRemotingService { + @Override public GetOffsetResult getOffset(GetOffsetRequest getOffsetRequest) { return null; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java index 342126e3..66729a0e 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQSubscriptionRemotingService.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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.model.remoting.subscription.GetSubscriptionRequest; @@ -5,6 +22,7 @@ import org.apache.eventmesh.dashboard.service.remoting.SubscriptionRemotingService; public class RocketMQSubscriptionRemotingService extends AbstractRocketMQRemotingService implements SubscriptionRemotingService { + @Override public GetSubscriptionResult getSubscription(GetSubscriptionRequest request) { return null; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java index 31905e41..8eaf7032 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQTopicRemotingService.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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.enums.RemotingType; @@ -11,23 +28,26 @@ import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResponse; import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult; import org.apache.eventmesh.dashboard.service.remoting.TopicRemotingService; + import org.apache.rocketmq.common.TopicConfig; import org.apache.rocketmq.remoting.protocol.body.TopicConfigSerializeWrapper; -import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import javax.annotation.Resource; + public class RocketMQTopicRemotingService extends AbstractRocketMQRemotingService implements TopicRemotingService { + @Resource @Override - @RemotingAction(support = false,substitution = RemotingType.STORAGE) + @RemotingAction(support = false, substitution = RemotingType.STORAGE) public CreateTopicResult createTopic(CreateTopicRequest createTopicRequest) { CreateTopicResult createTopicResult = new CreateTopicResult(); TopicConfig topicConfig = this.toDataOjbect(createTopicRequest.getTopicMetadata().getTopicConfig(), TopicConfig.class); - return this.cluster(createTopicResult,( master, result) -> { - this.defaultMQAdminExt.createAndUpdateTopicConfig(master,topicConfig); + return this.cluster(createTopicResult, (master, result) -> { + this.defaultMQAdminExt.createAndUpdateTopicConfig(master, topicConfig); return null; }); } @@ -35,7 +55,7 @@ public CreateTopicResult createTopic(CreateTopicRequest createTopicRequest) { @Override public DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest) { DeleteTopicResult deleteTopicResult = new DeleteTopicResult(); - return this.clusterName(deleteTopicResult,(master,result ) -> { + return this.clusterName(deleteTopicResult, (master, result) -> { this.defaultMQAdminExt.deleteTopic(deleteTopicRequest.getTopicMetadata().getTopicName(), master); return null; }); @@ -43,14 +63,14 @@ public DeleteTopicResult deleteTopic(DeleteTopicRequest deleteTopicRequest) { @Override public GetTopicsResult getAllTopics(GetTopicsRequest getTopicsRequest) { - GetTopicsResult getTopicsResult = new GetTopicsResult(); + GetTopicsResult getTopicsResult = new GetTopicsResult(); GetTopicsResponse getTopicsResponse = new GetTopicsResponse(); List list = new ArrayList<>(); getTopicsResult.setData(getTopicsResponse); - return this.cluster(getTopicsResult,( master, result ) -> { + return this.cluster(getTopicsResult, (master, result) -> { TopicConfigSerializeWrapper topicConfigSerializeWrapper = this.defaultMQAdminExt.getAllTopicConfig(master, 3000); - if( !topicConfigSerializeWrapper.getTopicConfigTable().isEmpty()){ - topicConfigSerializeWrapper.getTopicConfigTable().forEach( (k , v) ->{ + if (!topicConfigSerializeWrapper.getTopicConfigTable().isEmpty()) { + topicConfigSerializeWrapper.getTopicConfigTable().forEach((k, v) -> { TopicMetadata topicMetadata = new TopicMetadata(); //topicMetadata.setClusterId(); }); diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java index 3e0eda94..4568eca9 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/remoting/rocketmq/RocketMQUserRemotingService.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.core.remoting.rocketmq; import org.apache.eventmesh.dashboard.common.model.remoting.user.CreateUserRequest; @@ -7,6 +24,7 @@ import org.apache.eventmesh.dashboard.service.remoting.UserRemotingService; public class RocketMQUserRemotingService extends AbstractRocketMQRemotingService implements UserRemotingService { + @Override public CreateUserRequest createInstanceUser(CreateUserRequest request) { return null; diff --git a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java index d7f816f6..e1f9bac8 100644 --- a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java +++ b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/store/RocketmqTopicCore.java @@ -17,14 +17,14 @@ package org.apache.eventmesh.dashboard.core.store; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.apache.eventmesh.dashboard.core.function.SDK.SDKManager; import org.apache.eventmesh.dashboard.core.function.SDK.SDKTypeEnum; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateSDKConfig; import org.apache.eventmesh.dashboard.service.dto.RocketmqProperties; import org.apache.eventmesh.dashboard.service.dto.TopicProperties; import org.apache.eventmesh.dashboard.service.store.TopicCore; + +import org.apache.commons.lang3.StringUtils; import org.apache.rocketmq.common.TopicConfig; import org.apache.rocketmq.common.TopicFilterType; import org.apache.rocketmq.common.constant.PermName; @@ -35,19 +35,26 @@ import org.apache.rocketmq.remoting.protocol.body.TopicConfigSerializeWrapper; import org.apache.rocketmq.remoting.protocol.header.CreateTopicRequestHeader; import org.apache.rocketmq.remoting.protocol.header.DeleteTopicRequestHeader; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentMap; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import lombok.extern.slf4j.Slf4j; + @Slf4j @Service public class RocketmqTopicCore implements TopicCore { private final RocketmqProperties rocketmqProperties; + public RocketmqTopicCore(RocketmqProperties rocketmqProperties) { + this.rocketmqProperties = rocketmqProperties; + } + private RemotingClient createRemotingClient(String brokerUrl) { CreateSDKConfig createSDKConfig = () -> brokerUrl; @@ -55,11 +62,6 @@ private RemotingClient createRemotingClient(String brokerUrl) { return (RemotingClient) SDKManager.getInstance().getClient(SDKTypeEnum.STORAGE_ROCKETMQ_REMOTING, brokerUrl); } - - public RocketmqTopicCore(RocketmqProperties rocketmqProperties) { - this.rocketmqProperties = rocketmqProperties; - } - @Override public Boolean createTopic(String topicName) { String namesrvAddr = rocketmqProperties.getNamesrvAddr(); diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java index 8f0670a0..badbd6b8 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/EtcdSDKCreateOperationTest.java @@ -33,9 +33,8 @@ @Timeout(value = 5) public class EtcdSDKCreateOperationTest { - private final EtcdSDKOperation etcdSDKOperation = new EtcdSDKOperation(); - private static final String url = "http://localhost:2379"; + private final EtcdSDKOperation etcdSDKOperation = new EtcdSDKOperation(); @Test void testCreateClient() { diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java index 1e46942f..c348c532 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcConsumerSDKOperationTest.java @@ -19,10 +19,10 @@ import org.apache.eventmesh.client.grpc.consumer.EventMeshGrpcConsumer; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcConsumerSDKOperation; import java.util.AbstractMap.SimpleEntry; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcConsumerSDKOperation; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java index 796ac256..86e18a2c 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeGrpcProducerSDKOperationTest.java @@ -19,10 +19,10 @@ import org.apache.eventmesh.client.grpc.producer.EventMeshGrpcProducer; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcProducerSDKOperation; import java.util.AbstractMap.SimpleEntry; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeGrpcProducerSDKOperation; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java index bb930ecf..ec62b11d 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpConsumerSDKOperationTest.java @@ -21,10 +21,10 @@ import org.apache.eventmesh.common.utils.IPUtils; import org.apache.eventmesh.common.utils.ThreadUtils; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpConsumerSDKOperation; import java.util.AbstractMap.SimpleEntry; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpConsumerSDKOperation; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java index 9b8674ba..8bdf4718 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeHttpProducerSDKOperationTest.java @@ -21,10 +21,10 @@ import org.apache.eventmesh.common.utils.IPUtils; import org.apache.eventmesh.common.utils.ThreadUtils; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpProducerSDKOperation; import java.util.AbstractMap.SimpleEntry; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeHttpProducerSDKOperation; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java index 2a757c59..f3fa14d6 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpCloudEventSDKOperationTest.java @@ -21,10 +21,10 @@ import org.apache.eventmesh.client.tcp.impl.cloudevent.CloudEventTCPClient; import org.apache.eventmesh.common.protocol.tcp.UserAgent; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpCloudEventSDKOperation; import java.util.AbstractMap.SimpleEntry; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpCloudEventSDKOperation; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java index bc09e6c9..1dc74957 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpEventMeshSDKOperationTest.java @@ -21,10 +21,10 @@ import org.apache.eventmesh.client.tcp.impl.eventmeshmessage.EventMeshMessageTCPClient; import org.apache.eventmesh.common.protocol.tcp.UserAgent; import org.apache.eventmesh.dashboard.core.function.SDK.config.CreateRuntimeConfig; +import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpEventMeshSDKOperation; import java.util.AbstractMap.SimpleEntry; -import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpEventMeshSDKOperation; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java index 22ab936f..66083179 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/RuntimeTcpOpenMessageSDKOperationTest.java @@ -19,6 +19,7 @@ import org.apache.eventmesh.dashboard.core.function.SDK.operation.runtime.RuntimeTcpOpenMessageSDKOperation; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java index d5603c78..9b7bf0ef 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/meta/runtime/NacosRuntimeCoreTest.java @@ -17,8 +17,6 @@ package org.apache.eventmesh.dashboard.core.meta.runtime; -import static org.junit.jupiter.api.Assertions.assertEquals; - import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; import org.junit.jupiter.api.Test; @@ -39,7 +37,8 @@ public void testGetRuntime() throws InterruptedException { getRuntimeRequest.setRegistryAddress("127.0.0.1:8848"); nacosRuntimeCore.getRuntime(getRuntimeRequest).getFuture().thenAccept( getRuntimeResponse -> { - log.info("testGetRuntime success, the first cluster name is {}",getRuntimeResponse.getRuntimeMetadataList().get(0).getClusterName()); + log.info("testGetRuntime success, the first cluster name is {}", + getRuntimeResponse.getRuntimeMetadataList().get(0).getClusterName()); } ); } catch (Exception e) { diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java index 5c4114b8..3b7f0092 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/metadata/MetadataSyncManagerTest.java @@ -1,15 +1,27 @@ +/* + * 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.core.metadata; -import org.apache.commons.lang3.reflect.FieldUtils; import org.apache.eventmesh.dashboard.common.enums.ClusterTrusteeshipType; import org.apache.eventmesh.dashboard.common.model.metadata.RuntimeMetadata; import org.apache.eventmesh.dashboard.core.remoting.RemotingManager; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; + +import org.apache.commons.lang3.reflect.FieldUtils; import java.lang.reflect.Field; import java.util.ArrayList; @@ -17,6 +29,13 @@ import java.util.Map; import java.util.Objects; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + @RunWith(MockitoJUnitRunner.class) public class MetadataSyncManagerTest { @@ -42,18 +61,18 @@ public void init() throws IllegalAccessException { MetadataSyncManager.MetadataSyncConfig metadataSyncConfig = new MetadataSyncManager.MetadataSyncConfig(); metadataSyncConfig.setDataBasesHandler(dataBasesHandler); metadataSyncConfig.setClusterService(clusterHandler); - metadataSyncConfig.setMetadataClass(RuntimeMetadata.class ); + metadataSyncConfig.setMetadataClass(RuntimeMetadata.class); metadataSyncManager.setRemotingManager(this.remotingManager); metadataSyncManager.register(metadataSyncConfig); Field metadataSyncWrapperMapField = FieldUtils.getField(MetadataSyncManager.class, "metadataSyncWrapperMap", true); - metadataSyncWrapperMap = (Map, MetadataSyncManager.MetadataSyncWrapper>)metadataSyncWrapperMapField.get(metadataSyncManager); + metadataSyncWrapperMap = (Map, MetadataSyncManager.MetadataSyncWrapper>) metadataSyncWrapperMapField.get(metadataSyncManager); } @Test - public void test_sync_mock(){ + public void test_sync_mock() { // // ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP 3 // databases cluster @@ -66,22 +85,22 @@ public void test_sync_mock(){ // F 3 5 -2 // G 5 3 2 - this.mock_data(1 , 5,3); - this.mock_data(2 , 3,5); - this.mock_data(3 , 5,5); - this.mock_data(5 , 5,3); - this.mock_data(6 , 3,5); - this.mock_data(7 , 5,5); + this.mock_data(1, 5, 3); + this.mock_data(2, 3, 5); + this.mock_data(3, 5, 5); + this.mock_data(5, 5, 3); + this.mock_data(6, 3, 5); + this.mock_data(7, 5, 5); MetadataSyncManager.MetadataSyncWrapper metadataSyncWrapper = this.metadataSyncWrapperMap.get(RuntimeMetadata.class); Mockito.when(this.dataBasesHandler.getData()).thenReturn(this.databasesList); Mockito.when(this.clusterHandler.getData()).thenReturn(this.clusterList); - Mockito.when(this.remotingManager.isClusterTrusteeshipType(Mockito.anyLong(),Mockito.any())).thenAnswer((invocation)->{ - Long clusterId = (Long)invocation.getArgument(0); + Mockito.when(this.remotingManager.isClusterTrusteeshipType(Mockito.anyLong(), Mockito.any())).thenAnswer((invocation) -> { + Long clusterId = (Long) invocation.getArgument(0); ClusterTrusteeshipType clusterTrusteeshipType = (ClusterTrusteeshipType) invocation.getArgument(1); - if(Objects.equals(clusterTrusteeshipType,ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP)&& clusterId < 4){ + if (Objects.equals(clusterTrusteeshipType, ClusterTrusteeshipType.FIRE_AND_FORGET_TRUSTEESHIP) && clusterId < 4) { return true; } - if(Objects.equals(clusterTrusteeshipType,ClusterTrusteeshipType.TRUSTEESHIP)&& clusterId > 4){ + if (Objects.equals(clusterTrusteeshipType, ClusterTrusteeshipType.TRUSTEESHIP) && clusterId > 4) { return true; } return false; @@ -90,23 +109,23 @@ public void test_sync_mock(){ metadataSyncWrapper.run(); } - private void mock_data(long clusterId , int databasesCount,int clusterCount){ - int index = databasesCount > clusterCount? databasesCount : clusterCount; - for(int i = 0; i < index ; i++){ + private void mock_data(long clusterId, int databasesCount, int clusterCount) { + int index = databasesCount > clusterCount ? databasesCount : clusterCount; + for (int i = 0; i < index; i++) { RuntimeMetadata runtimeMetadata = new RuntimeMetadata(); runtimeMetadata.setClusterId(clusterId); runtimeMetadata.setPort(i); - runtimeMetadata.setHost(clusterId+"."+i+""); - if(i < databasesCount){ - this.databasesList.add( runtimeMetadata ); + runtimeMetadata.setHost(clusterId + "." + i + ""); + if (i < databasesCount) { + this.databasesList.add(runtimeMetadata); } - if(i < clusterCount){ - if( databasesCount == clusterCount){ - if( i == 0 ||i == 1){ + if (i < clusterCount) { + if (databasesCount == clusterCount) { + if (i == 0 || i == 1) { runtimeMetadata = new RuntimeMetadata(); runtimeMetadata.setClusterId(clusterId); runtimeMetadata.setPort(i); - runtimeMetadata.setHost(clusterId+".."+i+" " +i); + runtimeMetadata.setHost(clusterId + ".." + i + " " + i); } } this.clusterList.add(runtimeMetadata); diff --git a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java index b826ea4d..cc168244 100644 --- a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.java +++ b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/remoting/RemotingManagerTest.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.core.remoting; import org.apache.eventmesh.dashboard.common.enums.ClusterType; @@ -5,20 +22,21 @@ import org.apache.eventmesh.dashboard.common.model.metadata.ClusterRelationshipMetadata; import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest; import org.apache.eventmesh.dashboard.service.remoting.RemotingIntegrationService; -import org.junit.Test; import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicLong; +import org.junit.Test; + public class RemotingManagerTest { private RemotingManager remotingManager = new RemotingManager(); @Test - public void init_test(){ - RemotingIntegrationService proxyObject = (RemotingIntegrationService)remotingManager.getProxyObject(); + public void init_test() { + RemotingIntegrationService proxyObject = (RemotingIntegrationService) remotingManager.getProxyObject(); CreateTopicRequest createTopicRequest = new CreateTopicRequest(); createTopicRequest.setClusterId(1L); @@ -28,10 +46,10 @@ public void init_test(){ } @Test - public void mock_overall_logic(){ + public void mock_overall_logic() { List clusterRelationshipMetadataList = new ArrayList<>(); AtomicLong clusterId = new AtomicLong(1); - List clusterMetadataList = new ArrayList<>(); + List clusterMetadataList = new ArrayList<>(); // 两个 eventmesh 集群 ClusterMetadata eventMeshCluster1 = new ClusterMetadata(); @@ -44,91 +62,81 @@ public void mock_overall_logic(){ eventMeshCluster2.setId(clusterId.incrementAndGet()); clusterMetadataList.add(eventMeshCluster2); - // 两个注册中心 ClusterMetadata eventMeshMetaNacos1 = new ClusterMetadata(); eventMeshMetaNacos1.setClusterType(ClusterType.EVENTMESH_META_NACOS); eventMeshMetaNacos1.setId(clusterId.incrementAndGet()); clusterMetadataList.add(eventMeshMetaNacos1); - this.relationship(clusterRelationshipMetadataList, eventMeshCluster1,eventMeshMetaNacos1); - this.relationship(clusterRelationshipMetadataList, eventMeshCluster2,eventMeshMetaNacos1); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshMetaNacos1); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshMetaNacos1); ClusterMetadata eventMeshMetaNacos2 = new ClusterMetadata(); eventMeshMetaNacos2.setClusterType(ClusterType.EVENTMESH_META_NACOS); eventMeshMetaNacos2.setId(clusterId.incrementAndGet()); clusterMetadataList.add(eventMeshMetaNacos2); - this.relationship(clusterRelationshipMetadataList, eventMeshCluster1,eventMeshMetaNacos2); - this.relationship(clusterRelationshipMetadataList, eventMeshCluster2,eventMeshMetaNacos2); - - + this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshMetaNacos2); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshMetaNacos2); // 2个 eventmesh runtime ClusterMetadata eventMeshRuntime1 = new ClusterMetadata(); eventMeshRuntime1.setClusterType(ClusterType.EVENTMESH_RUNTIME); eventMeshRuntime1.setId(clusterId.incrementAndGet()); clusterMetadataList.add(eventMeshRuntime1); - this.relationship(clusterRelationshipMetadataList, eventMeshCluster1,eventMeshRuntime1); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, eventMeshRuntime1); ClusterMetadata eventMeshRuntime2 = new ClusterMetadata(); eventMeshRuntime2.setClusterType(ClusterType.EVENTMESH_RUNTIME); eventMeshRuntime2.setId(clusterId.incrementAndGet()); clusterMetadataList.add(eventMeshRuntime2); - this.relationship(clusterRelationshipMetadataList, eventMeshCluster2,eventMeshRuntime2); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, eventMeshRuntime2); // 两个个 rocketmq 集群 ClusterMetadata rocketMCluster = new ClusterMetadata(); rocketMCluster.setClusterType(ClusterType.STORAGE_ROCKETMQ_CLUSTER); rocketMCluster.setId(clusterId.incrementAndGet()); clusterMetadataList.add(rocketMCluster); - this.relationship(clusterRelationshipMetadataList, eventMeshCluster1,rocketMCluster); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster1, rocketMCluster); ClusterMetadata rocketMCluster1 = new ClusterMetadata(); rocketMCluster1.setClusterType(ClusterType.STORAGE_ROCKETMQ_CLUSTER); rocketMCluster1.setId(clusterId.incrementAndGet()); clusterMetadataList.add(rocketMCluster1); - this.relationship(clusterRelationshipMetadataList, eventMeshCluster2,rocketMCluster1); + this.relationship(clusterRelationshipMetadataList, eventMeshCluster2, rocketMCluster1); // 2个 rocketmq broker 集群 ClusterMetadata rocketBroker = new ClusterMetadata(); rocketBroker.setClusterType(ClusterType.STORAGE_ROCKETMQ_BROKER); rocketBroker.setId(clusterId.incrementAndGet()); clusterMetadataList.add(rocketBroker); - this.relationship(clusterRelationshipMetadataList, rocketMCluster,rocketBroker); + this.relationship(clusterRelationshipMetadataList, rocketMCluster, rocketBroker); ClusterMetadata rocketBroker1 = new ClusterMetadata(); rocketBroker1.setClusterType(ClusterType.STORAGE_ROCKETMQ_BROKER); rocketBroker1.setId(clusterId.incrementAndGet()); clusterMetadataList.add(rocketBroker1); - this.relationship(clusterRelationshipMetadataList, rocketMCluster1,rocketBroker1); + this.relationship(clusterRelationshipMetadataList, rocketMCluster1, rocketBroker1); // 两个 nameservier ClusterMetadata rocketMQNameserver = new ClusterMetadata(); rocketMQNameserver.setClusterType(ClusterType.STORAGE_ROCKETMQ_NAMESERVER); rocketMQNameserver.setId(clusterId.incrementAndGet()); clusterMetadataList.add(rocketMQNameserver); - this.relationship(clusterRelationshipMetadataList, rocketBroker,rocketMQNameserver); - this.relationship(clusterRelationshipMetadataList, rocketBroker1,rocketMQNameserver); - + this.relationship(clusterRelationshipMetadataList, rocketBroker, rocketMQNameserver); + this.relationship(clusterRelationshipMetadataList, rocketBroker1, rocketMQNameserver); ClusterMetadata rocketMQNameserver1 = new ClusterMetadata(); rocketMQNameserver1.setClusterType(ClusterType.STORAGE_ROCKETMQ_NAMESERVER); rocketMQNameserver1.setId(clusterId.incrementAndGet()); clusterMetadataList.add(rocketMQNameserver1); - this.relationship(clusterRelationshipMetadataList, rocketBroker,rocketMQNameserver1); - this.relationship(clusterRelationshipMetadataList, rocketBroker1,rocketMQNameserver1); - - - - - - + this.relationship(clusterRelationshipMetadataList, rocketBroker, rocketMQNameserver1); + this.relationship(clusterRelationshipMetadataList, rocketBroker1, rocketMQNameserver1); try { remotingManager.cacheCluster(clusterMetadataList); remotingManager.cacheClusterRelationship(clusterRelationshipMetadataList); remotingManager.loadingCompleted(); - RemotingIntegrationService proxyObject = (RemotingIntegrationService)remotingManager.getProxyObject(); + RemotingIntegrationService proxyObject = (RemotingIntegrationService) remotingManager.getProxyObject(); CreateTopicRequest createTopicRequest = new CreateTopicRequest(); createTopicRequest.setClusterId(9L); proxyObject.createTopic(createTopicRequest); @@ -141,7 +149,8 @@ public void mock_overall_logic(){ } - private void relationship(List clusterRelationshipMetadataList , ClusterMetadata clusterMetadata , ClusterMetadata relationship){ + private void relationship(List clusterRelationshipMetadataList, ClusterMetadata clusterMetadata, + ClusterMetadata relationship) { clusterMetadata.setStatus(0); relationship.setStatus(0); @@ -154,5 +163,4 @@ private void relationship(List clusterRelationshipM } - } diff --git a/eventmesh-dashboard-observe/src/main/java/org/apache/eventmesh/dashboard/observe/Main.java b/eventmesh-dashboard-observe/src/main/java/org/apache/eventmesh/dashboard/observe/Main.java index dc40fa22..7033aa5e 100644 --- a/eventmesh-dashboard-observe/src/main/java/org/apache/eventmesh/dashboard/observe/Main.java +++ b/eventmesh-dashboard-observe/src/main/java/org/apache/eventmesh/dashboard/observe/Main.java @@ -18,6 +18,7 @@ package org.apache.eventmesh.dashboard.observe; public class Main { + public static void main(String[] args) { } } \ No newline at end of file diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java index 7fbed105..818c6b35 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/ConnectionCore.java @@ -18,9 +18,8 @@ package org.apache.eventmesh.dashboard.service.meta; /** - * "Connection" refers to the subscription relationship between connectors. - * It focuses on the configuration deployed on the source and sink connectors themselves, - * reported by the connector. + * "Connection" refers to the subscription relationship between connectors. It focuses on the configuration deployed on the source and sink connectors + * themselves, reported by the connector. */ public interface ConnectionCore { diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java index 2512a95a..e27974f7 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/meta/SubscriptionCore.java @@ -23,9 +23,8 @@ import java.util.List; /** - * "Subscription" refers to the traditional MQ producer-consumer topic subscription relationship, - * emphasizing the subscription relationship between EventMesh clients (including SDK and connectors) and topics, - * reported by the EventMesh runtime. + * "Subscription" refers to the traditional MQ producer-consumer topic subscription relationship, emphasizing the subscription relationship between + * EventMesh clients (including SDK and connectors) and topics, reported by the EventMesh runtime. */ public interface SubscriptionCore { diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java index 3b89e608..44d7a3d5 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ClientRemotingService.java @@ -23,10 +23,10 @@ import java.util.List; /** - * A remoting service for client operations. - Not implemented in eventmesh by now + * A remoting service for client operations. Not implemented in eventmesh by now */ public interface ClientRemotingService { + // get consumer only for now List getClientList(); } diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java index 2b6abd41..e38954fc 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/ConfigRemotingService.java @@ -18,40 +18,26 @@ package org.apache.eventmesh.dashboard.service.remoting; import org.apache.eventmesh.dashboard.common.model.remoting.BaseGlobalResult; -import org.apache.eventmesh.dashboard.common.model.remoting.GlobalResult; import org.apache.eventmesh.dashboard.common.model.remoting.config.AddConfigRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.config.AddConfigResponse; -import org.apache.eventmesh.dashboard.common.model.remoting.config.AddConfigResult; import org.apache.eventmesh.dashboard.common.model.remoting.config.DeleteConfigRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.config.DeleteConfigResult; import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.config.GetConfigResult; import org.apache.eventmesh.dashboard.common.model.remoting.config.UpdateConfigRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.config.UpdateConfigResult; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.CreateTopicResult; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicRequest; -import org.apache.eventmesh.dashboard.common.model.remoting.topic.DeleteTopicResult; import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsRequest; import org.apache.eventmesh.dashboard.common.model.remoting.topic.GetTopicsResult; /** - * A remoting service for config operations. Getting configs from different sources - * 1. runtime - * 2. RocketMQ - * 3. connector to db + * A remoting service for config operations. Getting configs from different sources 1. runtime 2. RocketMQ 3. connector to db */ public interface ConfigRemotingService { - BaseGlobalResult addConfig(AddConfigRequest addConfigRequest); - default BaseGlobalResult updateConfig(UpdateConfigRequest updateConfigRequest){ + default BaseGlobalResult updateConfig(UpdateConfigRequest updateConfigRequest) { return addConfig(updateConfigRequest); } - default BaseGlobalResult deleteConfig(DeleteConfigRequest deleteConfigRequest){ + default BaseGlobalResult deleteConfig(DeleteConfigRequest deleteConfigRequest) { return addConfig(deleteConfigRequest); } diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java index 2745d24c..de9876d1 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/MetaRemotingService.java @@ -24,5 +24,6 @@ * service to get data from remote meta */ public interface MetaRemotingService { + GetRuntimeResult getRuntime(GetRuntimeRequest getRuntimeRequest); } diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java index a07f2f97..0f117427 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RemotingIntegrationService.java @@ -17,5 +17,10 @@ package org.apache.eventmesh.dashboard.service.remoting; -public interface RemotingIntegrationService extends AclRemotingService, ClientRemotingService, ConfigRemotingService, ConnectorRemotingService, GroupRemotingService, MetaRemotingService, OffsetRemotingService, SubscriptionRemotingService, TopicRemotingService, UserRemotingService { +/** + * + */ +public interface RemotingIntegrationService extends AclRemotingService, ClientRemotingService, ConfigRemotingService, ConnectorRemotingService, + GroupRemotingService, MetaRemotingService, OffsetRemotingService, SubscriptionRemotingService, TopicRemotingService, UserRemotingService { + } diff --git a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java index 40a6b2f8..b673c27a 100644 --- a/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java +++ b/eventmesh-dashboard-service/src/main/java/org/apache/eventmesh/dashboard/service/remoting/RuntimeRemotingService.java @@ -1,8 +1,28 @@ +/* + * 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.service.remoting; import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeRequest; import org.apache.eventmesh.dashboard.common.model.remoting.runtime.GetRuntimeResult; +/** + * + */ public interface RuntimeRemotingService { GetRuntimeResult getRuntimeMetadata(GetRuntimeRequest request); diff --git a/style/checkStyle.xml b/style/checkStyle.xml index b59a83ee..55411805 100644 --- a/style/checkStyle.xml +++ b/style/checkStyle.xml @@ -59,11 +59,11 @@ - +