You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by so...@apache.org on 2022/06/08 06:48:09 UTC
[shardingsphere] branch master updated: Refactor storage node and adjustment QualifiedSchema to QualifiedDatabase (#18193)
This is an automated email from the ASF dual-hosted git repository.
soulasuna pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 413b97c2b05 Refactor storage node and adjustment QualifiedSchema to QualifiedDatabase (#18193)
413b97c2b05 is described below
commit 413b97c2b0557b6d003db985c3f964afae5d4a12
Author: zhaojinchao <zh...@apache.org>
AuthorDate: Wed Jun 8 14:48:00 2022 +0800
Refactor storage node and adjustment QualifiedSchema to QualifiedDatabase (#18193)
---
.../{StorageStatusNode.java => StorageNode.java} | 25 +++++++++++-----------
.../storage/service/StorageNodeStatusService.java | 6 +++---
.../subscriber/StorageNodeStatusSubscriber.java | 6 +++---
.../watcher/StorageNodeStateChangedWatcher.java | 14 ++++++------
...ageStatusNodeTest.java => StorageNodeTest.java} | 13 +++++++----
.../StorageNodeStatusSubscriberTest.java | 8 +++----
.../StorageNodeStateChangedWatcherTest.java | 8 +++----
7 files changed, 42 insertions(+), 38 deletions(-)
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageStatusNode.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageNode.java
similarity index 72%
rename from shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageStatusNode.java
rename to shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageNode.java
index f4441547dc0..ef9c5003a59 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageStatusNode.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageNode.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.stat
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.StatusNode;
import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedDatabase;
import java.util.Optional;
@@ -27,14 +26,14 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
- * Storage status node.
+ * Storage node.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class StorageStatusNode {
+public final class StorageNode {
- private static final String STORAGE_NODES = "storage_nodes";
+ public static final String ROOT_NODE = "nodes";
- private static final String ATTRIBUTES_NODE = "attributes";
+ private static final String STORAGE_NODES = "storage_nodes";
/**
* Get storage node root path.
@@ -42,7 +41,7 @@ public final class StorageStatusNode {
* @return root path of storage node
*/
public static String getRootPath() {
- return String.join("/", "", StatusNode.ROOT_NODE, STORAGE_NODES, ATTRIBUTES_NODE);
+ return String.join("/", "", ROOT_NODE, STORAGE_NODES);
}
/**
@@ -52,26 +51,26 @@ public final class StorageStatusNode {
* @return data source path of storage node
*/
public static String getStorageNodesDataSourcePath(final String dataSourcePath) {
- return String.join("/", "", StatusNode.ROOT_NODE, STORAGE_NODES, ATTRIBUTES_NODE, dataSourcePath);
+ return String.join("/", getRootPath(), dataSourcePath);
}
/**
* Get storage node status path.
*
- * @param schema cluster schema
+ * @param database cluster database
* @return status path of storage node
*/
- public static String getStatusPath(final QualifiedDatabase schema) {
- return String.join("/", "", StatusNode.ROOT_NODE, STORAGE_NODES, ATTRIBUTES_NODE, schema.toString());
+ public static String getStatusPath(final QualifiedDatabase database) {
+ return String.join("/", getRootPath(), database.toString());
}
/**
- * Extract qualified schema.
+ * Extract qualified database.
*
* @param storageNodePath storage node path
- * @return extracted qualified schema
+ * @return extracted qualified database
*/
- public static Optional<QualifiedDatabase> extractQualifiedSchema(final String storageNodePath) {
+ public static Optional<QualifiedDatabase> extractQualifiedDatabase(final String storageNodePath) {
Pattern pattern = Pattern.compile(getRootPath() + "/(\\S+)$", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(storageNodePath);
return matcher.find() ? Optional.of(new QualifiedDatabase(matcher.group(1))) : Optional.empty();
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/service/StorageNodeStatusService.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/service/StorageNodeStatusService.java
index d7828f1dfbe..0b19b6b6ce4 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/service/StorageNodeStatusService.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/service/StorageNodeStatusService.java
@@ -21,7 +21,7 @@ import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.mode.metadata.storage.StorageNodeDataSource;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.node.StorageStatusNode;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.node.StorageNode;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import java.util.Collection;
@@ -42,10 +42,10 @@ public final class StorageNodeStatusService {
* @return loaded storage node names
*/
public Map<String, StorageNodeDataSource> loadStorageNodes() {
- Collection<String> storageNodes = repository.getChildrenKeys(StorageStatusNode.getRootPath());
+ Collection<String> storageNodes = repository.getChildrenKeys(StorageNode.getRootPath());
Map<String, StorageNodeDataSource> result = new HashMap<>(storageNodes.size(), 1);
storageNodes.forEach(each -> {
- String yamlContext = repository.get(StorageStatusNode.getStorageNodesDataSourcePath(each));
+ String yamlContext = repository.get(StorageNode.getStorageNodesDataSourcePath(each));
if (!Strings.isNullOrEmpty(yamlContext)) {
result.put(each, YamlEngine.unmarshal(yamlContext, StorageNodeDataSource.class));
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/subscriber/StorageNodeStatusSubscriber.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/subscriber/StorageNodeStatus [...]
index 17d6fd70a8a..c5aa6bbbd6a 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/subscriber/StorageNodeStatusSubscriber.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/subscriber/StorageNodeStatusSubscriber.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.mode.metadata.storage.StorageNodeDataSource;
import org.apache.shardingsphere.mode.metadata.storage.StorageNodeRole;
import org.apache.shardingsphere.mode.metadata.storage.StorageNodeStatus;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.node.StorageStatusNode;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.node.StorageNode;
import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedDatabase;
import org.apache.shardingsphere.mode.metadata.storage.event.DataSourceDisabledEvent;
import org.apache.shardingsphere.mode.metadata.storage.event.PrimaryDataSourceChangedEvent;
@@ -48,7 +48,7 @@ public final class StorageNodeStatusSubscriber {
*/
@Subscribe
public void update(final DataSourceDisabledEvent event) {
- repository.persist(StorageStatusNode.getStatusPath(new QualifiedDatabase(event.getDatabaseName(), event.getGroupName(), event.getDataSourceName())),
+ repository.persist(StorageNode.getStatusPath(new QualifiedDatabase(event.getDatabaseName(), event.getGroupName(), event.getDataSourceName())),
YamlEngine.marshal(event.getStorageNodeDataSource()));
}
@@ -59,6 +59,6 @@ public final class StorageNodeStatusSubscriber {
*/
@Subscribe
public void update(final PrimaryDataSourceChangedEvent event) {
- repository.persist(StorageStatusNode.getStatusPath(event.getQualifiedDatabase()), YamlEngine.marshal(new StorageNodeDataSource(StorageNodeRole.PRIMARY, StorageNodeStatus.ENABLED)));
+ repository.persist(StorageNode.getStatusPath(event.getQualifiedDatabase()), YamlEngine.marshal(new StorageNodeDataSource(StorageNodeRole.PRIMARY, StorageNodeStatus.ENABLED)));
}
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/watcher/StorageNodeStateChangedWatcher.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/watcher/StorageNodeStateChan [...]
index 83cf452a02f..61df4f8b1ab 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/watcher/StorageNodeStateChangedWatcher.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/watcher/StorageNodeStateChangedWatcher.java
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.Gover
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceWatcher;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.event.DisabledStateChangedEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.event.PrimaryStateChangedEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.node.StorageStatusNode;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.node.StorageNode;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent.Type;
@@ -43,7 +43,7 @@ public final class StorageNodeStateChangedWatcher implements GovernanceWatcher<G
@Override
public Collection<String> getWatchingKeys() {
- return Collections.singletonList(StorageStatusNode.getRootPath());
+ return Collections.singletonList(StorageNode.getRootPath());
}
@Override
@@ -56,14 +56,14 @@ public final class StorageNodeStateChangedWatcher implements GovernanceWatcher<G
if (Strings.isNullOrEmpty(event.getValue())) {
return Optional.empty();
}
- Optional<QualifiedDatabase> qualifiedSchema = StorageStatusNode.extractQualifiedSchema(event.getKey());
- if (qualifiedSchema.isPresent()) {
- QualifiedDatabase schema = qualifiedSchema.get();
+ Optional<QualifiedDatabase> qualifiedDatabase = StorageNode.extractQualifiedDatabase(event.getKey());
+ if (qualifiedDatabase.isPresent()) {
+ QualifiedDatabase database = qualifiedDatabase.get();
StorageNodeDataSource storageNodeDataSource = YamlEngine.unmarshal(event.getValue(), StorageNodeDataSource.class);
if (StorageNodeRole.PRIMARY.name().toLowerCase().equals(storageNodeDataSource.getRole())) {
- return Optional.of(new PrimaryStateChangedEvent(schema));
+ return Optional.of(new PrimaryStateChangedEvent(database));
}
- return Optional.of(new DisabledStateChangedEvent(schema, Type.DELETED == event.getType()
+ return Optional.of(new DisabledStateChangedEvent(database, Type.DELETED == event.getType()
|| StorageNodeStatus.DISABLED.name().toLowerCase().equals(storageNodeDataSource.getStatus())));
}
return Optional.empty();
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageStatusNodeTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageNodeTest.java
similarity index 72%
rename from shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageStatusNodeTest.java
rename to shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageNodeTest.java
index 1669942e4e4..b6af88ab564 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageStatusNodeTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/node/StorageNodeTest.java
@@ -26,16 +26,21 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-public final class StorageStatusNodeTest {
+public final class StorageNodeTest {
@Test
public void assertGetRootPath() {
- assertThat(StorageStatusNode.getRootPath(), is("/nodes/storage_nodes/attributes"));
+ assertThat(StorageNode.getRootPath(), is("/nodes/storage_nodes"));
}
@Test
- public void assertExtractQualifiedSchema() {
- Optional<QualifiedDatabase> actual = StorageStatusNode.extractQualifiedSchema("/nodes/storage_nodes/attributes/replica_query_db.readwrite_ds.replica_ds_0");
+ public void assertGetStorageNodesDataSourcePath() {
+ assertThat(StorageNode.getStorageNodesDataSourcePath("replica_query_db.readwrite_ds.replica_ds_0"), is("/nodes/storage_nodes/replica_query_db.readwrite_ds.replica_ds_0"));
+ }
+
+ @Test
+ public void assertExtractQualifiedDatabase() {
+ Optional<QualifiedDatabase> actual = StorageNode.extractQualifiedDatabase("/nodes/storage_nodes/replica_query_db.readwrite_ds.replica_ds_0");
assertTrue(actual.isPresent());
assertThat(actual.get().getDatabaseName(), is("replica_query_db"));
assertThat(actual.get().getGroupName(), is("readwrite_ds"));
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/subscriber/StorageNodeStatusSubscriberTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/subscriber/StorageNodeSt [...]
index f43bcc81b75..dea474d7898 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/subscriber/StorageNodeStatusSubscriberTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/subscriber/StorageNodeStatusSubscriberTest.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.mode.metadata.storage.StorageNodeDataSource;
import org.apache.shardingsphere.mode.metadata.storage.StorageNodeRole;
import org.apache.shardingsphere.mode.metadata.storage.StorageNodeStatus;
import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.node.StorageStatusNode;
+import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.node.StorageNode;
import org.apache.shardingsphere.mode.metadata.storage.event.DataSourceDisabledEvent;
import org.apache.shardingsphere.mode.metadata.storage.event.PrimaryDataSourceChangedEvent;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
@@ -47,7 +47,7 @@ public final class StorageNodeStatusSubscriberTest {
StorageNodeDataSource storageNodeDataSource = new StorageNodeDataSource(StorageNodeRole.MEMBER, StorageNodeStatus.DISABLED);
DataSourceDisabledEvent dataSourceDisabledEvent = new DataSourceDisabledEvent(databaseName, groupName, dataSourceName, storageNodeDataSource);
new StorageNodeStatusSubscriber(repository).update(dataSourceDisabledEvent);
- verify(repository).persist(StorageStatusNode.getStatusPath(new QualifiedDatabase(databaseName, groupName, dataSourceName)), YamlEngine.marshal(storageNodeDataSource));
+ verify(repository).persist(StorageNode.getStatusPath(new QualifiedDatabase(databaseName, groupName, dataSourceName)), YamlEngine.marshal(storageNodeDataSource));
}
@Test
@@ -58,7 +58,7 @@ public final class StorageNodeStatusSubscriberTest {
StorageNodeDataSource storageNodeDataSource = new StorageNodeDataSource(StorageNodeRole.MEMBER, StorageNodeStatus.ENABLED);
DataSourceDisabledEvent dataSourceDisabledEvent = new DataSourceDisabledEvent(databaseName, groupName, dataSourceName, storageNodeDataSource);
new StorageNodeStatusSubscriber(repository).update(dataSourceDisabledEvent);
- verify(repository).persist(StorageStatusNode.getStatusPath(new QualifiedDatabase(databaseName, groupName, dataSourceName)), YamlEngine.marshal(storageNodeDataSource));
+ verify(repository).persist(StorageNode.getStatusPath(new QualifiedDatabase(databaseName, groupName, dataSourceName)), YamlEngine.marshal(storageNodeDataSource));
}
@Test
@@ -68,7 +68,7 @@ public final class StorageNodeStatusSubscriberTest {
String dataSourceName = "replica_ds_0";
PrimaryDataSourceChangedEvent event = new PrimaryDataSourceChangedEvent(new QualifiedDatabase(databaseName, groupName, dataSourceName));
new StorageNodeStatusSubscriber(repository).update(event);
- verify(repository).persist(StorageStatusNode.getStatusPath(new QualifiedDatabase(databaseName, groupName, dataSourceName)),
+ verify(repository).persist(StorageNode.getStatusPath(new QualifiedDatabase(databaseName, groupName, dataSourceName)),
YamlEngine.marshal(new StorageNodeDataSource(StorageNodeRole.PRIMARY, StorageNodeStatus.ENABLED)));
}
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/watcher/StorageNodeStateChangedWatcherTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/watcher/StorageNodeState [...]
index 19736c73a09..a1f056d7a74 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/watcher/StorageNodeStateChangedWatcherTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/storage/watcher/StorageNodeStateChangedWatcherTest.java
@@ -36,7 +36,7 @@ public final class StorageNodeStateChangedWatcherTest {
@Test
public void assertCreatePrimaryStateChangedEvent() {
Optional<GovernanceEvent> actual = new StorageNodeStateChangedWatcher().createGovernanceEvent(
- new DataChangedEvent("/nodes/storage_nodes/attributes/replica_query_db.readwrite_ds.replica_ds_0", "role: primary\nstatus: enable\n", Type.ADDED));
+ new DataChangedEvent("/nodes/storage_nodes/replica_query_db.readwrite_ds.replica_ds_0", "role: primary\nstatus: enable\n", Type.ADDED));
assertTrue(actual.isPresent());
PrimaryStateChangedEvent actualEvent = (PrimaryStateChangedEvent) actual.get();
assertThat(actualEvent.getQualifiedDatabase().getDatabaseName(), is("replica_query_db"));
@@ -47,7 +47,7 @@ public final class StorageNodeStateChangedWatcherTest {
@Test
public void assertCreateEnabledStateChangedEvent() {
Optional<GovernanceEvent> actual = new StorageNodeStateChangedWatcher().createGovernanceEvent(
- new DataChangedEvent("/nodes/storage_nodes/attributes/replica_query_db.readwrite_ds.replica_ds_0", "role: member\nstatus: enable\n", Type.ADDED));
+ new DataChangedEvent("/nodes/storage_nodes/replica_query_db.readwrite_ds.replica_ds_0", "role: member\nstatus: enable\n", Type.ADDED));
assertTrue(actual.isPresent());
DisabledStateChangedEvent actualEvent = (DisabledStateChangedEvent) actual.get();
assertThat(actualEvent.getQualifiedSchema().getDatabaseName(), is("replica_query_db"));
@@ -59,7 +59,7 @@ public final class StorageNodeStateChangedWatcherTest {
@Test
public void assertCreateDisabledStateChangedEvent() {
Optional<GovernanceEvent> actual = new StorageNodeStateChangedWatcher().createGovernanceEvent(
- new DataChangedEvent("/nodes/storage_nodes/attributes/replica_query_db.readwrite_ds.replica_ds_0", "role: member\nstatus: disable\n", Type.DELETED));
+ new DataChangedEvent("/nodes/storage_nodes/replica_query_db.readwrite_ds.replica_ds_0", "role: member\nstatus: disable\n", Type.DELETED));
assertTrue(actual.isPresent());
DisabledStateChangedEvent actualEvent = (DisabledStateChangedEvent) actual.get();
assertThat(actualEvent.getQualifiedSchema().getDatabaseName(), is("replica_query_db"));
@@ -71,7 +71,7 @@ public final class StorageNodeStateChangedWatcherTest {
@Test
public void assertCreateEmptyEvent() {
Optional<GovernanceEvent> actual = new StorageNodeStateChangedWatcher().createGovernanceEvent(
- new DataChangedEvent("/nodes/storage_nodes/attributes/replica_query_db.readwrite_ds.replica_ds_0", "", Type.ADDED));
+ new DataChangedEvent("/nodes/storage_nodes/replica_query_db.readwrite_ds.replica_ds_0", "", Type.ADDED));
assertFalse(actual.isPresent());
}
}