sandynz commented on code in PR #19456:
URL: https://github.com/apache/shardingsphere/pull/19456#discussion_r927251086
##########
shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/prepare/datasource/AbstractDataSourcePreparerTest.java:
##########
@@ -39,36 +38,18 @@ public void prepareTargetTables(final
PrepareTargetTablesParameter parameter) {
}
};
- @Test
- public void assertGetTableDefinitionSQLType() {
- assertThat(preparer.getTableDefinitionSQLType("SET search_path =
public"), is(TableDefinitionSQLType.UNKNOWN));
- assertThat(preparer.getTableDefinitionSQLType("CREATE TABLE t1_0 (id
int NOT NULL)"), is(TableDefinitionSQLType.CREATE_TABLE));
- assertThat(preparer.getTableDefinitionSQLType("ALTER TABLE t1_0 ADD
CONSTRAINT t1_0_pkey PRIMARY KEY (id)"),
is(TableDefinitionSQLType.ALTER_TABLE));
- }
-
@Test
public void assertAddIfNotExistsForCreateTableSQL() {
Collection<String> createTableSQLs = Arrays.asList("CREATE TABLE IF
NOT EXISTS t (id int)", "CREATE TABLE t (id int)",
- "CREATE TABLE IF \nNOT \tEXISTS t (id int)", "CREATE \tTABLE
t (id int)");
+ "CREATE TABLE IF \nNOT \tEXISTS t (id int)", "CREATE \tTABLE
t (id int)", "CREATE TABLE \tt_order (id bigint) WITH (orientation=row,
compression=no);");
for (String each : createTableSQLs) {
- String sql = preparer.addIfNotExistsForCreateTableSQL(each);
- assertTrue(PATTERN_CREATE_TABLE_IF_NOT_EXISTS.matcher(sql).find());
+ String actual = preparer.addIfNotExistsForCreateTableSQL(each);
+
assertTrue(PATTERN_CREATE_TABLE_IF_NOT_EXISTS.matcher(actual).find());
+ }
+ Collection<String> mismatchedSQLs = Arrays.asList("SET search_path =
public", "UPDATE t_order SET id = 1");
+ for (String each : mismatchedSQLs) {
+ String actual = preparer.addIfNotExistsForCreateTableSQL(each);
+ assertThat(actual, is(actual));
}
Review Comment:
`assertThat(actual, is(actual))`, it's strange, the second `acual` might be
`each`.
--
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]