View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.pipeline;
19  
20  import lombok.AccessLevel;
21  import lombok.NoArgsConstructor;
22  import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.queryable.ShowStreamingListStatement;
23  import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.queryable.ShowStreamingRuleStatement;
24  import org.apache.shardingsphere.data.pipeline.cdc.distsql.statement.queryable.ShowStreamingStatusStatement;
25  import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.queryable.ShowMigrationCheckStatusStatement;
26  import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.queryable.ShowMigrationListStatement;
27  import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.queryable.ShowMigrationSourceStorageUnitsStatement;
28  import org.apache.shardingsphere.data.pipeline.migration.distsql.statement.queryable.ShowMigrationStatusStatement;
29  import org.apache.shardingsphere.data.pipeline.distsql.statement.queryable.QueryablePipelineRALStatement;
30  import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.SQLCaseAssertContext;
31  import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ExistingAssert;
32  import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.pipeline.cdc.ShowStreamingStatusStatementAssert;
33  import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.pipeline.migration.query.ShowMigrationCheckStatusStatementAssert;
34  import org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.ral.impl.pipeline.migration.query.ShowMigrationStatusStatementAssert;
35  import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.SQLParserTestCase;
36  import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.cdc.ShowStreamingStatusStatementTestCase;
37  import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.migration.ShowMigrationCheckStatusStatementTestCase;
38  import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.ral.migration.ShowMigrationStatusStatementTestCase;
39  
40  /**
41   * Queryable pipeline RAL statement assert.
42   */
43  @NoArgsConstructor(access = AccessLevel.PRIVATE)
44  public final class QueryablePipelineRALStatementAssert {
45      
46      /**
47       * Assert query pipeline RAL statement is correct with expected parser result.
48       * 
49       * @param assertContext assert context
50       * @param actual actual queryable pipeline RAL statement
51       * @param expected expected queryable pipeline RAL statement test case
52       */
53      public static void assertIs(final SQLCaseAssertContext assertContext, final QueryablePipelineRALStatement actual, final SQLParserTestCase expected) {
54          // TODO add more test case
55          if (actual instanceof ShowMigrationListStatement) {
56              ExistingAssert.assertIs(assertContext, actual, expected);
57          } else if (actual instanceof ShowMigrationCheckStatusStatement) {
58              ShowMigrationCheckStatusStatementAssert.assertIs(assertContext, (ShowMigrationCheckStatusStatement) actual, (ShowMigrationCheckStatusStatementTestCase) expected);
59          } else if (actual instanceof ShowMigrationStatusStatement) {
60              ShowMigrationStatusStatementAssert.assertIs(assertContext, (ShowMigrationStatusStatement) actual, (ShowMigrationStatusStatementTestCase) expected);
61          } else if (actual instanceof ShowMigrationSourceStorageUnitsStatement) {
62              ExistingAssert.assertIs(assertContext, actual, expected);
63          } else if (actual instanceof ShowStreamingListStatement) {
64              ExistingAssert.assertIs(assertContext, actual, expected);
65          } else if (actual instanceof ShowStreamingStatusStatement) {
66              ShowStreamingStatusStatementAssert.assertIs(assertContext, (ShowStreamingStatusStatement) actual, (ShowStreamingStatusStatementTestCase) expected);
67          } else if (actual instanceof ShowStreamingRuleStatement) {
68              ExistingAssert.assertIs(assertContext, actual, expected);
69          }
70      }
71  }