Merge lp:~nwilliams/akiban-server/remove-get-table-definition into lp:~akiban-technologies/akiban-server/trunk
- remove-get-table-definition
- Merge into trunk
Proposed by
Nathan Williams
Status: | Merged |
---|---|
Approved by: | Mike McMahon |
Approved revision: | 2720 |
Merged at revision: | 2725 |
Proposed branch: | lp:~nwilliams/akiban-server/remove-get-table-definition |
Merge into: | lp:~akiban-technologies/akiban-server/trunk |
Diff against target: |
494 lines (+26/-302) 6 files modified
src/main/java/com/akiban/server/store/AbstractSchemaManager.java (+0/-46) src/main/java/com/akiban/server/store/SchemaManager.java (+0/-28) src/main/java/com/akiban/server/store/TableDefinition.java (+0/-60) src/test/java/com/akiban/server/service/is/BasicInfoSchemaTablesServiceImplTest.java (+0/-17) src/test/java/com/akiban/server/test/it/dxl/AtomicSchemaChangesIT.java (+14/-8) src/test/java/com/akiban/server/test/it/store/SchemaManagerIT.java (+12/-143) |
To merge this branch: | bzr merge lp:~nwilliams/akiban-server/remove-get-table-definition |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mike McMahon | Approve | ||
Review via email: mp+177399@code.launchpad.net |
Commit message
Description of the change
Remove TableDefinition and creation from SchemaManager.
Hasn't been used since the adapter started generating its own.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/main/java/com/akiban/server/store/AbstractSchemaManager.java' |
2 | --- src/main/java/com/akiban/server/store/AbstractSchemaManager.java 2013-07-25 16:10:58 +0000 |
3 | +++ src/main/java/com/akiban/server/store/AbstractSchemaManager.java 2013-07-29 14:51:38 +0000 |
4 | @@ -385,52 +385,6 @@ |
5 | } |
6 | |
7 | @Override |
8 | - public TableDefinition getTableDefinition(Session session, TableName tableName) { |
9 | - final Table table = getAis(session).getTable(tableName); |
10 | - if(table == null) { |
11 | - throw new NoSuchTableException(tableName); |
12 | - } |
13 | - final String ddl = new DDLGenerator().createTable(table); |
14 | - return new TableDefinition(table.getTableId(), tableName, ddl); |
15 | - } |
16 | - |
17 | - @Override |
18 | - public SortedMap<String, TableDefinition> getTableDefinitions(Session session, String schemaName) { |
19 | - final SortedMap<String, TableDefinition> result = new TreeMap<>(); |
20 | - final DDLGenerator gen = new DDLGenerator(); |
21 | - for(UserTable table : getAis(session).getUserTables().values()) { |
22 | - final TableName name = table.getName(); |
23 | - if(name.getSchemaName().equals(schemaName)) { |
24 | - final String ddl = gen.createTable(table); |
25 | - final TableDefinition def = new TableDefinition(table.getTableId(), name, ddl); |
26 | - result.put(name.getTableName(), def); |
27 | - } |
28 | - } |
29 | - return result; |
30 | - } |
31 | - |
32 | - @Override |
33 | - public List<String> schemaStrings(Session session, boolean withISTables) { |
34 | - final AkibanInformationSchema ais = getAis(session); |
35 | - final DDLGenerator generator = new DDLGenerator(); |
36 | - final List<String> ddlList = new ArrayList<>(); |
37 | - for(Schema schema : ais.getSchemas().values()) { |
38 | - if(!withISTables && |
39 | - (TableName.INFORMATION_SCHEMA.equals(schema.getName()) || |
40 | - TableName.SECURITY_SCHEMA.equals(schema.getName()) || |
41 | - TableName.SYS_SCHEMA.equals(schema.getName()) || |
42 | - TableName.SQLJ_SCHEMA.equals(schema.getName()))) { |
43 | - continue; |
44 | - } |
45 | - ddlList.add(String.format(CREATE_SCHEMA_FORMATTER, schema.getName())); |
46 | - for(UserTable table : schema.getUserTables().values()) { |
47 | - ddlList.add(generator.createTable(table)); |
48 | - } |
49 | - } |
50 | - return ddlList; |
51 | - } |
52 | - |
53 | - @Override |
54 | public void createView(Session session, View view) { |
55 | final AkibanInformationSchema oldAIS = getAis(session); |
56 | checkSystemSchema(view.getName(), false); |
57 | |
58 | === modified file 'src/main/java/com/akiban/server/store/SchemaManager.java' |
59 | --- src/main/java/com/akiban/server/store/SchemaManager.java 2013-07-25 16:10:58 +0000 |
60 | +++ src/main/java/com/akiban/server/store/SchemaManager.java 2013-07-29 14:51:38 +0000 |
61 | @@ -142,23 +142,6 @@ |
62 | void alterSequence(Session session, TableName sequenceName, Sequence newDefinition); |
63 | |
64 | /** |
65 | - * Generate a TableDefinition, which includes a canonical 'create table' statement, |
66 | - * schema name, table name, and table ID, for the given table. |
67 | - * @param session Session to operate under. |
68 | - * @param tableName The name of the requested table. |
69 | - * @return Filled in TableDefinition. |
70 | - */ |
71 | - TableDefinition getTableDefinition(Session session, TableName tableName); |
72 | - |
73 | - /** |
74 | - * Generate a 'create table' DDL statement for each table in the given schema. |
75 | - * @param session Session to operate under. |
76 | - * @param schemaName Schema to to query. |
77 | - * @return Map, keyed by table name, of all TableDefinitions. |
78 | - */ |
79 | - SortedMap<String, TableDefinition> getTableDefinitions(Session session, String schemaName); |
80 | - |
81 | - /** |
82 | * Returns the current and authoritative AIS, containing all metadata about |
83 | * all known for the running system. |
84 | * @param session Session to operate under. |
85 | @@ -166,17 +149,6 @@ |
86 | */ |
87 | AkibanInformationSchema getAis(Session session); |
88 | |
89 | - /** |
90 | - * Generate DDL statements for every schema and table. |
91 | - * The format of the 'create schema' contains if not exists and will occur before |
92 | - * any table in that schema. No other guarantees are given about ordering. |
93 | - * |
94 | - * @param session The Session to operate under. |
95 | - * @param withISTables true, include 'create table' statements for tables in the I_S. |
96 | - * @return List of every create statement request. |
97 | - */ |
98 | - List<String> schemaStrings(Session session, boolean withISTables); |
99 | - |
100 | /** Add the given view to the current AIS. */ |
101 | void createView(Session session, View view); |
102 | |
103 | |
104 | === removed file 'src/main/java/com/akiban/server/store/TableDefinition.java' |
105 | --- src/main/java/com/akiban/server/store/TableDefinition.java 2013-03-22 20:05:57 +0000 |
106 | +++ src/main/java/com/akiban/server/store/TableDefinition.java 1970-01-01 00:00:00 +0000 |
107 | @@ -1,60 +0,0 @@ |
108 | -/** |
109 | - * Copyright (C) 2009-2013 Akiban Technologies, Inc. |
110 | - * |
111 | - * This program is free software: you can redistribute it and/or modify |
112 | - * it under the terms of the GNU Affero General Public License as published by |
113 | - * the Free Software Foundation, either version 3 of the License, or |
114 | - * (at your option) any later version. |
115 | - * |
116 | - * This program is distributed in the hope that it will be useful, |
117 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
118 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
119 | - * GNU Affero General Public License for more details. |
120 | - * |
121 | - * You should have received a copy of the GNU Affero General Public License |
122 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
123 | - */ |
124 | - |
125 | -package com.akiban.server.store; |
126 | - |
127 | -import com.akiban.ais.model.TableName; |
128 | - |
129 | -public class TableDefinition { |
130 | - private final int tableId; |
131 | - private final String schemaName; |
132 | - private final String tableName; |
133 | - private final String ddl; |
134 | - |
135 | - public TableDefinition(int tableId, String schemaName, String tableName, String ddl) { |
136 | - this.tableId = tableId; |
137 | - this.schemaName = schemaName; |
138 | - this.tableName = tableName; |
139 | - this.ddl = ddl; |
140 | - } |
141 | - |
142 | - public TableDefinition(int tableId, TableName name, String ddl) { |
143 | - this(tableId, name.getSchemaName(), name.getTableName(), ddl); |
144 | - } |
145 | - |
146 | - public String getDDL() { |
147 | - return ddl; |
148 | - } |
149 | - |
150 | - public String getSchemaName() { |
151 | - return schemaName; |
152 | - } |
153 | - |
154 | - public String getTableName() { |
155 | - return tableName; |
156 | - } |
157 | - |
158 | - public int getTableId() { |
159 | - return tableId; |
160 | - } |
161 | - |
162 | - @Override |
163 | - public String toString() { |
164 | - return "TableDefinition[" + tableId + ": " |
165 | - + TableName.create(schemaName, tableName) + ']'; |
166 | - } |
167 | -} |
168 | \ No newline at end of file |
169 | |
170 | === modified file 'src/test/java/com/akiban/server/service/is/BasicInfoSchemaTablesServiceImplTest.java' |
171 | --- src/test/java/com/akiban/server/service/is/BasicInfoSchemaTablesServiceImplTest.java 2013-07-25 16:10:58 +0000 |
172 | +++ src/test/java/com/akiban/server/service/is/BasicInfoSchemaTablesServiceImplTest.java 2013-07-29 14:51:38 +0000 |
173 | @@ -39,7 +39,6 @@ |
174 | import com.akiban.server.service.security.SecurityService; |
175 | import com.akiban.server.service.session.Session; |
176 | import com.akiban.server.store.SchemaManager; |
177 | -import com.akiban.server.store.TableDefinition; |
178 | import com.akiban.server.types.AkType; |
179 | import com.akiban.server.types.ValueSource; |
180 | import org.junit.Before; |
181 | @@ -54,7 +53,6 @@ |
182 | import java.util.Map; |
183 | import java.util.Properties; |
184 | import java.util.Set; |
185 | -import java.util.SortedMap; |
186 | |
187 | import static com.akiban.qp.memoryadapter.MemoryGroupCursor.GroupScan; |
188 | import static com.akiban.server.types.AkType.*; |
189 | @@ -725,21 +723,6 @@ |
190 | } |
191 | |
192 | @Override |
193 | - public TableDefinition getTableDefinition(Session session, TableName tableName) { |
194 | - throw new UnsupportedOperationException(); |
195 | - } |
196 | - |
197 | - @Override |
198 | - public SortedMap<String, TableDefinition> getTableDefinitions(Session session, String schemaName) { |
199 | - throw new UnsupportedOperationException(); |
200 | - } |
201 | - |
202 | - @Override |
203 | - public List<String> schemaStrings(Session session, boolean withISTables) { |
204 | - throw new UnsupportedOperationException(); |
205 | - } |
206 | - |
207 | - @Override |
208 | public void createView(Session session, View view) { |
209 | throw new UnsupportedOperationException(); |
210 | } |
211 | |
212 | === modified file 'src/test/java/com/akiban/server/test/it/dxl/AtomicSchemaChangesIT.java' |
213 | --- src/test/java/com/akiban/server/test/it/dxl/AtomicSchemaChangesIT.java 2013-03-22 20:05:57 +0000 |
214 | +++ src/test/java/com/akiban/server/test/it/dxl/AtomicSchemaChangesIT.java 2013-07-29 14:51:38 +0000 |
215 | @@ -18,16 +18,17 @@ |
216 | package com.akiban.server.test.it.dxl; |
217 | |
218 | import com.akiban.ais.model.AkibanInformationSchema; |
219 | +import com.akiban.ais.model.UserTable; |
220 | import com.akiban.ais.protobuf.ProtobufWriter; |
221 | +import com.akiban.ais.util.DDLGenerator; |
222 | import com.akiban.server.error.UnsupportedIndexSizeException; |
223 | -import com.akiban.server.store.SchemaManager; |
224 | -import com.akiban.server.store.TableDefinition; |
225 | import com.akiban.server.test.it.ITBase; |
226 | import com.akiban.util.GrowableByteBuffer; |
227 | import org.junit.Assert; |
228 | import org.junit.Test; |
229 | |
230 | import java.util.Map; |
231 | +import java.util.TreeMap; |
232 | import java.util.concurrent.Callable; |
233 | |
234 | import static junit.framework.Assert.*; |
235 | @@ -181,9 +182,9 @@ |
236 | |
237 | private void checkInitialDDL() throws Exception |
238 | { |
239 | - for (Map.Entry<String, TableDefinition> entry : createTableStatements("s").entrySet()) { |
240 | + for (Map.Entry<String, String> entry : createTableStatements("s").entrySet()) { |
241 | String table = entry.getKey(); |
242 | - String ddl = entry.getValue().getDDL(); |
243 | + String ddl = entry.getValue(); |
244 | if (table.equals("parent")) { |
245 | assertEquals(PARENT_DDL, ddl); |
246 | } else if (table.equals("child")) { |
247 | @@ -202,12 +203,17 @@ |
248 | return buffer; |
249 | } |
250 | |
251 | - private Map<String, TableDefinition> createTableStatements(final String schema) throws Exception |
252 | + private Map<String, String> createTableStatements(final String schema) throws Exception |
253 | { |
254 | - return transactionallyUnchecked(new Callable<Map<String, TableDefinition>>() { |
255 | + return transactionallyUnchecked(new Callable<Map<String, String>>() { |
256 | @Override |
257 | - public Map<String, TableDefinition> call() throws Exception { |
258 | - return serviceManager().getServiceByClass(SchemaManager.class).getTableDefinitions(session(), schema); |
259 | + public Map<String, String> call() throws Exception { |
260 | + DDLGenerator generator = new DDLGenerator(); |
261 | + Map<String, String> map = new TreeMap<>(); |
262 | + for(UserTable table : ais().getSchema(schema).getUserTables().values()) { |
263 | + map.put(table.getName().getTableName(), generator.createTable(table)); |
264 | + } |
265 | + return map; |
266 | } |
267 | }); |
268 | } |
269 | |
270 | === modified file 'src/test/java/com/akiban/server/test/it/store/SchemaManagerIT.java' |
271 | --- src/test/java/com/akiban/server/test/it/store/SchemaManagerIT.java 2013-07-25 18:32:49 +0000 |
272 | +++ src/test/java/com/akiban/server/test/it/store/SchemaManagerIT.java 2013-07-29 14:51:38 +0000 |
273 | @@ -33,18 +33,19 @@ |
274 | import java.util.List; |
275 | import java.util.Map; |
276 | import java.util.Set; |
277 | -import java.util.SortedMap; |
278 | import java.util.SortedSet; |
279 | import java.util.TreeSet; |
280 | import java.util.concurrent.Callable; |
281 | |
282 | import com.akiban.ais.model.Index; |
283 | import com.akiban.ais.model.Routine; |
284 | +import com.akiban.ais.model.Schema; |
285 | import com.akiban.ais.model.Sequence; |
286 | import com.akiban.ais.model.Table; |
287 | import com.akiban.ais.model.TableName; |
288 | import com.akiban.ais.model.aisb2.AISBBasedBuilder; |
289 | import com.akiban.ais.model.aisb2.NewAISBuilder; |
290 | +import com.akiban.ais.util.DDLGenerator; |
291 | import com.akiban.qp.expression.IndexKeyRange; |
292 | import com.akiban.qp.memoryadapter.MemoryAdapter; |
293 | import com.akiban.qp.memoryadapter.MemoryGroupCursor; |
294 | @@ -60,7 +61,6 @@ |
295 | import com.akiban.server.error.NoSuchTableException; |
296 | import com.akiban.server.service.session.Session; |
297 | import com.akiban.server.store.SchemaManager; |
298 | -import com.akiban.server.store.TableDefinition; |
299 | import com.akiban.server.store.statistics.IndexStatistics; |
300 | import com.akiban.server.test.it.ITBase; |
301 | import org.junit.Assert; |
302 | @@ -115,22 +115,6 @@ |
303 | }); |
304 | } |
305 | |
306 | - private TableDefinition getTableDef(final String schema, final String table) throws Exception { |
307 | - return transactionally(new Callable<TableDefinition>() { |
308 | - public TableDefinition call() throws Exception { |
309 | - return schemaManager.getTableDefinition(session(), new TableName(schema, table)); |
310 | - } |
311 | - }); |
312 | - } |
313 | - |
314 | - private List<String> getSchemaStringsWithoutAIS() throws Exception { |
315 | - return transactionally(new Callable<List<String>>() { |
316 | - public List<String> call() throws Exception { |
317 | - return schemaManager.schemaStrings(session(), false); |
318 | - } |
319 | - }); |
320 | - } |
321 | - |
322 | private void safeRestart() throws Exception { |
323 | safeRestartTestServices(); |
324 | schemaManager = serviceManager().getSchemaManager(); |
325 | @@ -155,36 +139,6 @@ |
326 | assertTablesInSchema(SCHEMA); |
327 | } |
328 | |
329 | - @Test(expected=NoSuchTableException.class) |
330 | - public void getUnknownTableDefinition() throws Exception { |
331 | - getTableDef("fooschema", "bartable1"); |
332 | - } |
333 | - |
334 | - // Also tests createDef(), but assertTablesInSchema() uses getDef() so try and test first |
335 | - @Test |
336 | - public void getTableDefinition() throws Exception { |
337 | - createTableDef(SCHEMA, T1_NAME, T1_DDL); |
338 | - final TableDefinition def = getTableDef(SCHEMA, T1_NAME); |
339 | - assertNotNull("Definition exists", def); |
340 | - } |
341 | - |
342 | - @Test |
343 | - public void getTableDefinitionsUnknownSchema() throws Exception { |
344 | - final SortedMap<String, TableDefinition> defs = getTableDefinitions("fooschema"); |
345 | - assertEquals("no defs", 0, defs.size()); |
346 | - } |
347 | - |
348 | - @Test |
349 | - public void getTableDefinitionsOneSchema() throws Exception { |
350 | - createTableDef(SCHEMA, T1_NAME, T1_DDL); |
351 | - createTableDef(SCHEMA, T2_NAME, T2_DDL); |
352 | - createTableDef(SCHEMA + "_bob", T1_NAME, T1_DDL); |
353 | - final SortedMap<String, TableDefinition> defs = getTableDefinitions(SCHEMA); |
354 | - assertTrue("contains t1", defs.containsKey(T1_NAME)); |
355 | - assertTrue("contains t2", defs.containsKey(T2_NAME)); |
356 | - assertEquals("no defs", 2, defs.size()); |
357 | - } |
358 | - |
359 | @Test |
360 | public void createOneDefinition() throws Exception { |
361 | createTableDef(SCHEMA, T1_NAME, T1_DDL); |
362 | @@ -335,45 +289,6 @@ |
363 | final long second = ais().getGeneration(); |
364 | assertTrue("timestamp changed", first != second); |
365 | } |
366 | - |
367 | - @Test |
368 | - public void schemaStringsSingleTable() throws Exception { |
369 | - // Check 1) basic ordering 2) that the statements are 'canonicalized' |
370 | - final String TABLE_DDL = "id int not null primary key"; |
371 | - final String SCHEMA_DDL = "create schema if not exists `foo`;"; |
372 | - final String TABLE_CANONICAL = "create table `foo`.`bar`(`id` int NOT NULL, PRIMARY KEY(`id`)) engine=akibandb DEFAULT CHARSET=utf8 COLLATE=utf8_bin"; |
373 | - createTableDef("foo", "bar", TABLE_DDL); |
374 | - final List<String> ddls = getSchemaStringsWithoutAIS(); |
375 | - assertEquals("ddl count", 2, ddls.size()); // schema and table |
376 | - assertTrue("create schema", ddls.get(0).startsWith("create schema")); |
377 | - assertEquals("create schema is canonical", SCHEMA_DDL, ddls.get(0)); |
378 | - assertTrue("create table second", ddls.get(1).startsWith("create table")); |
379 | - assertEquals("create table is canonical", TABLE_CANONICAL, ddls.get(1)); |
380 | - } |
381 | - |
382 | - @Test |
383 | - public void schemaStringsSingleGroup() throws Exception { |
384 | - final String SCHEMA = "s1"; |
385 | - createTableDef(SCHEMA, T1_NAME, T1_DDL); |
386 | - createTableDef(SCHEMA, T3_CHILD_T1_NAME, T3_CHILD_T1_DDL); |
387 | - Map<String, List<String>> schemaAndTables = new HashMap<>(); |
388 | - schemaAndTables.put(SCHEMA, Arrays.asList(T1_NAME, T3_CHILD_T1_NAME)); |
389 | - assertSchemaStrings(schemaAndTables); |
390 | - } |
391 | - |
392 | - @Test |
393 | - public void schemaStringsMultipleSchemas() throws Exception { |
394 | - final Map<String, List<String>> schemaAndTables = new HashMap<>(); |
395 | - schemaAndTables.put("s1", Arrays.asList("t1", "t2")); |
396 | - schemaAndTables.put("s2", Arrays.asList("t3")); |
397 | - schemaAndTables.put("s3", Arrays.asList("t4")); |
398 | - for(Map.Entry<String, List<String>> entry : schemaAndTables.entrySet()) { |
399 | - for(String table : entry.getValue()) { |
400 | - createTableDef(entry.getKey(), table, "id int not null primary key"); |
401 | - } |
402 | - } |
403 | - assertSchemaStrings(schemaAndTables); |
404 | - } |
405 | |
406 | @Test |
407 | public void manyTablesAndRestart() throws Exception { |
408 | @@ -505,13 +420,14 @@ |
409 | "REFERENCES `index_statistics`(`table_id`, `index_id`)"+ |
410 | ") engine=akibandb DEFAULT CHARSET=utf8 COLLATE=utf8_bin"; |
411 | |
412 | - TableDefinition statsDef = getTableDef(SCHEMA, STATS_TABLE); |
413 | - assertNotNull("Stats table present", statsDef); |
414 | - assertEquals("Stats DDL", STATS_DDL, statsDef.getDDL()); |
415 | + DDLGenerator generator = new DDLGenerator(); |
416 | + UserTable statsTable = ais().getUserTable(SCHEMA, STATS_TABLE); |
417 | + assertNotNull("Stats table present", statsTable); |
418 | + assertEquals("Stats DDL", STATS_DDL, generator.createTable(statsTable)); |
419 | |
420 | - TableDefinition entryDef = getTableDef(SCHEMA, ENTRY_TABLE); |
421 | - assertNotNull("Entry table present", entryDef); |
422 | - assertEquals("Entry DDL", ENTRY_DDL, entryDef.getDDL()); |
423 | + UserTable entryTable = ais().getUserTable(SCHEMA, ENTRY_TABLE); |
424 | + assertNotNull("Entry table present", entryTable); |
425 | + assertEquals("Entry DDL", ENTRY_DDL, generator.createTable(entryTable)); |
426 | } |
427 | |
428 | @Test |
429 | @@ -789,62 +705,15 @@ |
430 | for (String name : tableNames) { |
431 | final Table table = ais.getTable(schema, name); |
432 | assertNotNull(schema + "." + name + " in AIS", table); |
433 | - final TableDefinition def = getTableDefinitions(schema).get(table.getName().getTableName()); |
434 | - assertNotNull(schema + "." + name + " has definition", def); |
435 | expected.add(name); |
436 | } |
437 | final SortedSet<String> actual = new TreeSet<>(); |
438 | - for (TableDefinition def : getTableDefinitions(schema).values()) { |
439 | - final Table table = ais.getTable(schema, def.getTableName()); |
440 | - assertNotNull(def + " in AIS", table); |
441 | - actual.add(def.getTableName()); |
442 | + Schema schemaObj = ais.getSchema(schema); |
443 | + if(schemaObj != null) { |
444 | + actual.addAll(schemaObj.getUserTables().keySet()); |
445 | } |
446 | assertEquals("tables in: " + schema, expected, actual); |
447 | } |
448 | - |
449 | - /** |
450 | - * Check that the result of {@link SchemaManager#schemaStrings(Session, boolean)} is correct for |
451 | - * the given tables. The only guarantees are that schemas are created with 'if not exists', |
452 | - * a schema statement comes before any table in it, and a create table statement is fully qualified. |
453 | - * @param schemaAndTables Map of schema names to table names that should exist |
454 | - * @throws Exception For any internal error. |
455 | - */ |
456 | - private void assertSchemaStrings(Map<String, List<String>> schemaAndTables) throws Exception { |
457 | - final String CREATE_SCHEMA = "create schema if not exists `"; |
458 | - final String CREATE_TABLE = "create table `"; |
459 | - final List<String> ddls = getSchemaStringsWithoutAIS(); |
460 | - final Set<String> sawSchemas = new HashSet<>(); |
461 | - for(String statement : ddls) { |
462 | - if(statement.startsWith(CREATE_SCHEMA)) { |
463 | - final int offset = CREATE_SCHEMA.length(); |
464 | - final String schemaName = statement.substring(offset, offset + 2); |
465 | - assertFalse("haven't seen schema "+schemaName, |
466 | - sawSchemas.contains(schemaName)); |
467 | - sawSchemas.add(schemaName); |
468 | - } |
469 | - else if(statement.startsWith(CREATE_TABLE)){ |
470 | - final int offset = CREATE_TABLE.length(); |
471 | - final String schemaName = statement.substring(offset, offset + 2); |
472 | - assertTrue("schema "+schemaName+" has been seen", |
473 | - sawSchemas.contains(schemaName)); |
474 | - final String tableName = statement.substring(offset+5, offset+7); |
475 | - assertTrue("table "+tableName+" is in schema "+tableName, |
476 | - schemaAndTables.get(schemaName).contains(tableName)); |
477 | - } |
478 | - else { |
479 | - Assert.fail("Unknown statement type: " + statement); |
480 | - } |
481 | - } |
482 | - } |
483 | - |
484 | - private SortedMap<String, TableDefinition> getTableDefinitions(final String schema) { |
485 | - return transactionallyUnchecked(new Callable<SortedMap<String, TableDefinition>>() { |
486 | - @Override |
487 | - public SortedMap<String, TableDefinition> call() throws Exception { |
488 | - return schemaManager.getTableDefinitions(session(), schema); |
489 | - } |
490 | - }); |
491 | - } |
492 | |
493 | private static UserTable makeSimpleISTable(TableName name) { |
494 | NewAISBuilder builder = AISBBasedBuilder.create(name.getSchemaName()); |
As described.