LadyForest commented on code in PR #73: URL: https://github.com/apache/flink-table-store/pull/73#discussion_r843852275
########## flink-table-store-connector/src/test/java/org/apache/flink/table/store/connector/ReadWriteTableTestUtil.java: ########## @@ -0,0 +1,739 @@ +/* + * 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.flink.table.store.connector; + +import org.apache.flink.api.common.RuntimeExecutionMode; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; +import org.apache.flink.table.catalog.ObjectIdentifier; +import org.apache.flink.table.catalog.ResolvedCatalogTable; +import org.apache.flink.table.planner.factories.TestValuesTableFactory; +import org.apache.flink.table.store.file.utils.BlockingIterator; +import org.apache.flink.table.types.logical.BigIntType; +import org.apache.flink.table.types.logical.DoubleType; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.RowType; +import org.apache.flink.table.types.logical.VarCharType; +import org.apache.flink.types.Row; + +import javax.annotation.Nullable; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static org.apache.flink.table.planner.factories.TestValuesTableFactory.changelogRow; +import static org.apache.flink.table.planner.factories.TestValuesTableFactory.registerData; +import static org.apache.flink.table.store.connector.TableStoreTestBase.createResolvedTable; +import static org.assertj.core.api.Assertions.assertThat; + +/** Util for {@link ReadWriteTableITCase}. */ +public class ReadWriteTableTestUtil { + + static void assertNoMoreRecords(BlockingIterator<Row, Row> iterator) { + List<Row> expectedRecords = Collections.emptyList(); + try { + // set expectation size to 1 to let time pass by until timeout + // just wait 5s to avoid too long time + expectedRecords = iterator.collect(1, 5L, TimeUnit.SECONDS); + iterator.close(); + } catch (Exception ignored) { Review Comment: > So? Do we want to ignore the Exception from close? Alright, I got your point. Do you feel it's better to throw out every Exception except for `TimeoutException` because it should not happen? I thought you just forgot `iteraotor#close` also throws an Exception. -- 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]
