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 9f496c57361 Add test cases for RDL (3 branches) in 
TextProtocolBackendHandlerFactoryTest (#19743)
9f496c57361 is described below

commit 9f496c573611d67bf2752c8f61bf0a65a886f1f7
Author: tianhao960 <[email protected]>
AuthorDate: Mon Aug 1 21:29:14 2022 +0800

    Add test cases for RDL (3 branches) in 
TextProtocolBackendHandlerFactoryTest (#19743)
    
    * Add test cases for RDL (3 branches) in 
TextProtocolBackendHandlerFactoryTest
    
    * Add test cases for RDL (3 branches) in RDLBackendHandlerFactoryTest
    
    Co-authored-by: 何文斌 <[email protected]>
---
 .../distsql/rdl/RDLBackendHandlerFactoryTest.java  | 73 ++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/RDLBackendHandlerFactoryTest.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/RDLBackendHandlerFactoryTest.java
new file mode 100644
index 00000000000..35675dbe2e7
--- /dev/null
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rdl/RDLBackendHandlerFactoryTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.proxy.backend.handler.distsql.rdl;
+
+import lombok.SneakyThrows;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterResourceStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
+import org.apache.shardingsphere.proxy.backend.handler.ProxyBackendHandler;
+import 
org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.resource.AddResourceBackendHandler;
+import 
org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.resource.AlterResourceBackendHandler;
+import 
org.apache.shardingsphere.proxy.backend.handler.distsql.rdl.resource.DropResourceBackendHandler;
+import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertThat;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class RDLBackendHandlerFactoryTest {
+    
+    @Mock
+    private AddResourceStatement addResourceStatement;
+    
+    @Mock
+    private AlterResourceStatement alterResourceStatement;
+    
+    @Mock
+    private DropResourceStatement dropResourceStatement;
+    
+    @Mock
+    private ConnectionSession connectionSession;
+    
+    @Test
+    @SneakyThrows
+    public void assertRDLBackendHandlerReturnAddResourceBackendHandler() {
+        ProxyBackendHandler handler = 
RDLBackendHandlerFactory.newInstance(addResourceStatement, connectionSession);
+        assertThat(handler, instanceOf(AddResourceBackendHandler.class));
+    }
+    
+    @Test
+    @SneakyThrows
+    public void assertRDLBackendHandlerReturnAlterResourceStatement() {
+        ProxyBackendHandler handler = 
RDLBackendHandlerFactory.newInstance(alterResourceStatement, connectionSession);
+        assertThat(handler, instanceOf(AlterResourceBackendHandler.class));
+    }
+    
+    @Test
+    @SneakyThrows
+    public void assertRDLBackendHandlerReturnDropResourceStatement() {
+        ProxyBackendHandler handler = 
RDLBackendHandlerFactory.newInstance(dropResourceStatement, connectionSession);
+        assertThat(handler, instanceOf(DropResourceBackendHandler.class));
+    }
+    
+}

Reply via email to