// We want to make sure that it clones MultiProcParameters too!
Procedure target_proc = this.getProcedure(neworder.class);
List<MultiProcParameter> expected = new ArrayList<MultiProcParameter>();
int cnt = 3;
for (int i = 0; i < cnt; i++) {
ProcParameter col0 = target_proc.getParameters().get(i);
for (int ii = i + 1; ii < cnt; ii++) {
ProcParameter col1 = target_proc.getParameters().get(ii);
MultiProcParameter mpp = MultiProcParameter.get(col0, col1);
assertNotNull(mpp);
expected.add(mpp);
} // FOR
} // FOR
assertFalse(expected.isEmpty());
Database clone_db = CatalogCloner.cloneDatabase(catalog_db);
assertNotNull(clone_db);
Cluster catalog_cluster = CatalogUtil.getCluster(catalog_db);
assertNotNull(catalog_cluster);
Cluster clone_cluster = CatalogUtil.getCluster(clone_db);
assertNotNull(clone_cluster);
for (Host catalog_host : catalog_cluster.getHosts()) {
Host clone_host = clone_cluster.getHosts().get(catalog_host.getName());
assertNotNull(clone_host);
checkFields(Host.class, catalog_host, clone_host);
} // FOR
for (Site catalog_site : catalog_cluster.getSites()) {
Site clone_site = clone_cluster.getSites().get(catalog_site.getName());
assertNotNull(clone_site);
checkFields(Site.class, catalog_site, clone_site);
}
assertEquals(NUM_PARTITIONS, CatalogUtil.getNumberOfPartitions(clone_db));
Collection<Integer> clone_partitions = CatalogUtil.getAllPartitionIds(clone_db);
assertNotNull(clone_partitions);
assertEquals(all_partitions.size(), clone_partitions.size());
assert (all_partitions.containsAll(clone_partitions));
for (Table catalog_tbl : catalog_db.getTables()) {
Table clone_tbl = clone_db.getTables().get(catalog_tbl.getName());
assertNotNull(catalog_tbl.toString(), clone_tbl);
checkFields(Table.class, catalog_tbl, clone_tbl);
for (Column catalog_col : catalog_tbl.getColumns()) {
Column clone_col = clone_tbl.getColumns().get(catalog_col.getName());
assertNotNull(CatalogUtil.getDisplayName(catalog_col), clone_col);
assertEquals(CatalogUtil.getDisplayName(clone_col), clone_tbl, (Table) clone_col.getParent());
assertEquals(CatalogUtil.getDisplayName(clone_col), clone_tbl.hashCode(), clone_col.getParent().hashCode());
} // FOR
for (MaterializedViewInfo catalog_view : catalog_tbl.getViews()) {
assert (catalog_view.getGroupbycols().size() > 0);
MaterializedViewInfo clone_view = clone_tbl.getViews().get(catalog_view.getName());
checkFields(MaterializedViewInfo.class, catalog_view, clone_view);
} // FOR
} // FOR
for (Procedure catalog_proc : catalog_db.getProcedures()) {
Procedure clone_proc = clone_db.getProcedures().get(catalog_proc.getName());
assertNotNull(catalog_proc.toString(), clone_proc);
assertEquals(clone_proc.getParameters().toString(), catalog_proc.getParameters().size(), clone_proc.getParameters().size());
// Procedure Conflicts
this.checkProcedureConflicts(catalog_proc, catalog_proc.getConflicts(), clone_proc.getConflicts());
this.checkProcedureConflicts(catalog_proc, catalog_proc.getConflicts(), clone_proc.getConflicts());
for (ProcParameter catalog_param : catalog_proc.getParameters()) {
ProcParameter clone_param = clone_proc.getParameters().get(catalog_param.getIndex());
assertNotNull(CatalogUtil.getDisplayName(catalog_param), clone_param);
assertEquals(CatalogUtil.getDisplayName(clone_param), clone_proc, (Procedure) clone_param.getParent());
assertEquals(CatalogUtil.getDisplayName(clone_param), clone_proc.hashCode(), clone_param.getParent().hashCode());
} // FOR
}
}