AISBuilder { public void moveTreeToEmptyGroup(String schemaName, String tableName, String groupName) { moveTreeToEmptyGroup(schemaName, tableName, findFullGroupName(groupName)); } AISBuilder();  AISBuilder(AkibanInformationSchema ais);  AISBuilder(AkibanInformationSchema ais, NameGenerator nameGenerator,
                      StorageFormatRegistry storageFormatRegistry); NameGenerator getNameGenerator(); Sequence sequence(String schemaName, String sequenceName,
                             long start, long increment, long minValue, long maxValue, boolean cycle); Table table(String schemaName, String tableName); void view(String schemaName, String tableName,
                     String definition, Properties definitionProperties,
                     Map<TableName,Collection<String>> tableColumnReferences); Column column(String schemaName, String tableName, String columnName,
                Integer position, TInstance type, Boolean autoIncrement,
                String defaultValue, String defaultFunction); void columnAsIdentity(String schemaName, String tableName, String columnName,
                                 long start, long increment, boolean defaultIdentity); void columnAsIdentity(String schemaName, String tableName, String columnName,
            String sequenceName, Boolean defaultIdentity); void pk(String schemaName, String tableName); void pkConstraint(String schemaName, String tableName, TableName constraintName); void unique(String schemaName, String tableName, String indexName); void uniqueConstraint(String schemaName, String tableName, String indexName, TableName constraintName); void index(String schemaName, String tableName, String indexName); void index(String schemaName, String tableName, String indexName, Boolean unique, Boolean isPrimaryKey, TableName constraintName); void index(String schemaName, String tableName, String indexName, Boolean unique, Boolean isPrimaryKey, TableName constraintName, StorageDescription copyStorage); void groupIndex(String groupName, String indexName, Boolean unique, Index.JoinType joinType); void groupIndex(TableName groupName, String indexName, Boolean unique, Index.JoinType joinType); void indexColumn(String schemaName, String tableName,
            String indexName, String columnName, Integer position,
            Boolean ascending, Integer indexedLength); void groupIndexColumn(String groupName, String indexName, String schemaName, String tableName,
                                 String columnName, Integer position); void groupIndexColumn(TableName groupName, String indexName, String schemaName, String tableName,
                                 String columnName, Integer position); void fullTextIndex(TableName tableName, String indexName); void fullTextIndexColumn(TableName indexedTableName, String indexName, 
                                    String schemaName, String tableName, String columnName, Integer position); void joinTables(String joinName, String parentSchemaName,
            String parentTableName, String childSchemaName,
            String childTableName); void joinColumns(String joinName, String parentSchemaName,
            String parentTableName, String parentColumnName,
            String childSchemaName, String childTableName,
            String childColumnName); void routine(String schemaName, String routineName,
                        String language, Routine.CallingConvention callingConvention); void parameter(String schemaName, String routineName, 
                          String parameterName, Parameter.Direction direction, 
                          TInstance type); void routineExternalName(String schemaName, String routineName,
                                    String jarSchema, String jarName, 
                                    String className, String methodName); void routineDefinition(String schemaName, String routineName,
                                  String definition); void routineSQLAllowed(String schemaName, String routineName,
                                  Routine.SQLAllowed sqlAllowed); void routineDynamicResultSets(String schemaName, String routineName,
                                         int dynamicResultSets); void routineDeterministic(String schemaName, String routineName,
                                     boolean deterministic); void routineCalledOnNullInput(String schemaName, String routineName,
                                         boolean calledOnNullInput); void sqljJar(String schemaName, String jarName, URL url); void basicSchemaIsComplete(); void createGroup(String groupName, String groupSchemaName); void createGroup(String groupName, String groupSchemaName,
                            StorageDescription copyStorage); void deleteGroup(String groupName); void deleteGroup(TableName groupName); void addTableToGroup(String groupName, String schemaName,
            String tableName); void addTableToGroup(TableName groupName, String schemaName, String tableName); void addJoinToGroup(String groupName, String joinName, Integer weight); void addJoinToGroup(TableName groupName, String joinName, Integer weight); void removeTableFromGroup(String groupName, String schemaName,
            String tableName); void removeTableFromGroup(TableName groupName, String schemaName, String tableName); void removeJoinFromGroup(String groupName, String joinName); void removeJoinFromGroup(TableName groupName, String joinName); void moveTreeToGroup(String schemaName, String tableName,
            String groupName, String joinName); void moveTreeToGroup(String schemaName, String tableName, TableName groupName, String joinName); void moveTreeToEmptyGroup(String schemaName, String tableName,
            String groupName); void moveTreeToEmptyGroup(String schemaName, String tableName, TableName groupName); void groupingIsComplete(); void finishStorageDescription(HasStorage object); void finishStorageDescription(HasStorage object, StorageDescription copyStorage); void clearGroupings(); void foreignKey(String referencingSchemaName, String referencingTableName, List<String> referencingColumnNames,
                           String referencedSchemaName, String referencedTableName, List<String> referencedColumnNames,
                           ForeignKey.Action deleteAction, ForeignKey.Action updateAction,
                           boolean deferrable, boolean initiallyDeferred,
                           String name); AkibanInformationSchema akibanInformationSchema(); final static int MAX_COLUMN_NAME_LENGTH; }
@Test public void testMoveTreeToEmptyGroup() { AISBuilder builder = new AISBuilder(); builder.table("s", "a"); builder.column("s", "a", "aid", 0, type("MCOMPAT", "int", false), false, null, null); builder.pk("s", "a"); builder.indexColumn("s", "a", Index.PRIMARY, "aid", 0, true, null); builder.table("s", "b"); builder.column("s", "b", "bid", 0, type("MCOMPAT", "int", false), false, null, null); builder.column("s", "b", "aid", 1, type("MCOMPAT", "int", false), false, null, null); builder.pk("s", "b"); builder.indexColumn("s", "b", Index.PRIMARY, "bid", 0, true, null); builder.table("s", "c"); builder.column("s", "c", "cid", 0, type("MCOMPAT", "int", false), false, null, null); builder.column("s", "c", "bid", 1, type("MCOMPAT", "int", false), false, null, null); builder.table("s", "d"); builder.column("s", "d", "did", 0, type("MCOMPAT", "int", false), false, null, null); builder.column("s", "d", "bid", 1, type("MCOMPAT", "int", false), false, null, null); builder.joinTables("ab", "s", "a", "s", "b"); builder.joinColumns("ab", "s", "a", "aid", "s", "b", "aid"); builder.joinTables("bc", "s", "b", "s", "c"); builder.joinColumns("bc", "s", "b", "bid", "s", "c", "bid"); builder.joinTables("bd", "s", "b", "s", "d"); builder.joinColumns("bd", "s", "b", "bid", "s", "d", "bid"); builder.basicSchemaIsComplete(); builder.createGroup("source", "g"); builder.addJoinToGroup("source", "ab", 0); builder.addJoinToGroup("source", "bc", 0); builder.addJoinToGroup("source", "bd", 0); builder.createGroup("target", "g"); AkibanInformationSchema ais = builder.akibanInformationSchema(); Assert.assertEquals(4, ais.getTables().size()); Assert.assertEquals(2, ais.getGroups().size()); Assert.assertEquals(3, ais.getJoins().size()); builder.moveTreeToEmptyGroup("s", "b", "target"); builder.groupingIsComplete(); Table a = ais.getTable("s", "a"); List<Join> aChildren = a.getChildJoins(); Assert.assertTrue(aChildren.isEmpty()); Table b = ais.getTable("s", "b"); for (Join join : b.getChildJoins()) { if (join.getChild() == ais.getTable("s", "c") || join.getChild() == ais.getTable("s", "d")) { } else { Assert.fail(); } } Assert.assertEquals(0, builder.akibanInformationSchema().validate(AISValidations.BASIC_VALIDATIONS).failures().size()); }