azexcy commented on code in PR #24376: URL: https://github.com/apache/shardingsphere/pull/24376#discussion_r1124083067
########## test/e2e/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/AbstractCDCE2EIT.java: ########## @@ -0,0 +1,147 @@ +/* + * 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.test.e2e.data.pipeline.cases.cdc; + +import lombok.extern.slf4j.Slf4j; +import org.apache.shardingsphere.data.pipeline.cdc.client.CDCClient; +import org.apache.shardingsphere.data.pipeline.cdc.client.parameter.ImportDataSourceParameter; +import org.apache.shardingsphere.data.pipeline.cdc.client.parameter.StartCDCClientParameter; +import org.apache.shardingsphere.data.pipeline.cdc.protocol.request.StreamDataRequestBody.SchemaTable; +import org.apache.shardingsphere.test.e2e.data.pipeline.cases.base.PipelineBaseE2EIT; +import org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTypeEnum; +import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter; +import org.apache.shardingsphere.test.e2e.env.container.atomic.constants.ProxyContainerConstants; +import org.apache.shardingsphere.test.e2e.env.container.atomic.util.DatabaseTypeUtil; +import org.junit.After; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +@Slf4j +public abstract class AbstractCDCE2EIT extends PipelineBaseE2EIT { + + private static final String REGISTER_STORAGE_UNIT_SQL = "REGISTER STORAGE UNIT ds_0 ( URL='${ds0}', USER='${user}', PASSWORD='${password}')," + + "ds_1 ( URL='${ds1}', USER='${user}', PASSWORD='${password}')"; + + private static final String CREATE_SHARDING_RULE_SQL = "CREATE SHARDING TABLE RULE t_order(" + + "STORAGE_UNITS(ds_0,ds_1)," + + "SHARDING_COLUMN=user_id," + + "TYPE(NAME='hash_mod',PROPERTIES('sharding-count'='4'))," + + "KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME='snowflake'))" + + ")"; + + private final ExecutorService executor = Executors.newSingleThreadExecutor(); + + public AbstractCDCE2EIT(final PipelineTestParameter testParam) { + super(testParam); + // if the time zone of the unit test and the time zone of the mirror do not match, CDC will get the wrong timestamp + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Review Comment: Added more detailed comments -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
