This is an automated email from the ASF dual-hosted git repository.

zhangliang 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 b17a77b1871 Add test cases for ClusterPersistServiceBuilder and 
StandalonePersistServiceBuilder (#32838)
b17a77b1871 is described below

commit b17a77b1871cfecf26bda6759803aad2cebea2ab
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Sep 12 23:43:17 2024 +0800

    Add test cases for ClusterPersistServiceBuilder and 
StandalonePersistServiceBuilder (#32838)
    
    * Add test cases for StandalonePersistServiceBuilder
    
    * Add test cases for ClusterPersistServiceBuilder
---
 .../persist/ClusterPersistServiceBuilderTest.java  | 44 ++++++++++++++++++++++
 .../StandalonePersistServiceBuilderTest.java       | 44 ++++++++++++++++++++++
 2 files changed, 88 insertions(+)

diff --git 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/ClusterPersistServiceBuilderTest.java
 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/ClusterPersistServiceBuilderTest.java
new file mode 100644
index 00000000000..eb8a7320b63
--- /dev/null
+++ 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/persist/ClusterPersistServiceBuilderTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.shardingsphere.mode.manager.cluster.persist;
+
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.mode.metadata.MetaDataContextManager;
+import org.apache.shardingsphere.mode.persist.service.PersistServiceBuilder;
+import org.apache.shardingsphere.mode.spi.PersistRepository;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.mock;
+
+class ClusterPersistServiceBuilderTest {
+    
+    private final PersistServiceBuilder persistServiceBuilder = 
TypedSPILoader.getService(PersistServiceBuilder.class, "Cluster");
+    
+    @Test
+    void assertBuildMetaDataManagerPersistService() {
+        
assertThat(persistServiceBuilder.buildMetaDataManagerPersistService(mock(PersistRepository.class),
 mock(MetaDataContextManager.class)),
+                instanceOf(ClusterMetaDataManagerPersistService.class));
+    }
+    
+    @Test
+    void assertBuildProcessPersistService() {
+        
assertThat(persistServiceBuilder.buildProcessPersistService(mock(PersistRepository.class)),
 instanceOf(ClusterProcessPersistService.class));
+    }
+}
diff --git 
a/mode/type/standalone/core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/persist/StandalonePersistServiceBuilderTest.java
 
b/mode/type/standalone/core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/persist/StandalonePersistServiceBuilderTest.java
new file mode 100644
index 00000000000..d17a28878a6
--- /dev/null
+++ 
b/mode/type/standalone/core/src/test/java/org/apache/shardingsphere/mode/manager/standalone/persist/StandalonePersistServiceBuilderTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.shardingsphere.mode.manager.standalone.persist;
+
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.mode.metadata.MetaDataContextManager;
+import org.apache.shardingsphere.mode.persist.service.PersistServiceBuilder;
+import org.apache.shardingsphere.mode.spi.PersistRepository;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.mockito.Mockito.mock;
+
+class StandalonePersistServiceBuilderTest {
+    
+    private final PersistServiceBuilder persistServiceBuilder = 
TypedSPILoader.getService(PersistServiceBuilder.class, "Standalone");
+    
+    @Test
+    void assertBuildMetaDataManagerPersistService() {
+        
assertThat(persistServiceBuilder.buildMetaDataManagerPersistService(mock(PersistRepository.class),
 mock(MetaDataContextManager.class)),
+                instanceOf(StandaloneMetaDataManagerPersistService.class));
+    }
+    
+    @Test
+    void assertBuildProcessPersistService() {
+        
assertThat(persistServiceBuilder.buildProcessPersistService(mock(PersistRepository.class)),
 instanceOf(StandaloneProcessPersistService.class));
+    }
+}

Reply via email to