xtern commented on code in PR #5493:
URL: https://github.com/apache/ignite-3/pull/5493#discussion_r2016451379


##########
modules/table/src/integrationTest/java/org/apache/ignite/internal/table/ItTableViewApiUnifiedBaseTest.java:
##########
@@ -82,17 +83,69 @@ protected int initialNodes() {
         return 1;
     }
 
-    void createTable(String name, List<Column> columns) {
-        createTable(name, true, DEF_PK, columns);
+    void createTables(Collection<TestTableDefinition> tables) {
+        IgniteStringBuilder buf = new IgniteStringBuilder();
+
+        for (TestTableDefinition def : tables) {
+            buf.app(generateSqlCreate(def));
+
+            if (def.clearAfterTest) {
+                tablesToClear.add(def.name);
+            }
+        }
+
+        CLUSTER.aliveNode().sql().executeScript(buf.toString());
+    }
+
+    static void assertEqualsValues(SchemaDescriptor schema, Tuple expected, 
@Nullable Tuple actual) {
+        assertNotNull(actual);
+
+        for (int i = 0; i < schema.valueColumns().size(); i++) {
+            Column col = schema.valueColumns().get(i);
+
+            String quotedName = IgniteNameUtils.quoteIfNeeded(col.name());
+
+            Object val1 = expected.value(quotedName);
+            Object val2 = actual.value(quotedName);
+
+            if (val1 instanceof byte[] && val2 instanceof byte[]) {
+                Assertions.assertArrayEquals((byte[]) val1, (byte[]) val2, 
"Equality check failed: colIdx=" + col.positionInRow());
+            } else {
+                assertEquals(val1, val2, "Equality check failed: colIdx=" + 
col.positionInRow());
+            }
+        }
     }
 
-    void createTable(String name, boolean cleanup, List<Column> pkColumns, 
List<Column> columns) {
-        String createTableTemplate = "CREATE TABLE {} ({} PRIMARY KEY ({}))";
+    static List<String> quoteOrLowercaseNames(List<Column> columns) {
+        return columns.stream()
+                .map(col -> {
+                    String quotedName = 
IgniteNameUtils.quoteIfNeeded(col.name());
+
+                    if (quotedName.equals(col.name())) {
+                        return col.name().toLowerCase();
+                    }
+
+                    return quotedName;
+                })
+                .collect(Collectors.toUnmodifiableList());
+    }
+
+    private static List<String> getClientAddresses(List<Ignite> nodes) {
+        return nodes.stream()
+                .map(ignite -> unwrapIgniteImpl(ignite).clientAddress().port())
+                .map(port -> "127.0.0.1" + ":" + port)
+                .collect(toList());
+    }
+
+    private static String generateSqlCreate(TestTableDefinition 
tableDefinition) {
+        SchemaDescriptor schema = tableDefinition.schemaDescriptor;
+
+        String createTableTemplate = "CREATE TABLE {} ({} PRIMARY KEY ({}));";
 
         IgniteStringBuilder columnsBuffer = new IgniteStringBuilder();
-        Set<Column> allColumns = new LinkedHashSet<>(pkColumns);
+        Set<Column> allColumns = new LinkedHashSet<>(schema.keyColumns());
 
-        allColumns.addAll(columns);
+        allColumns.addAll(schema.valueColumns());

Review Comment:
   Thanks, fixed.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to