protected Table createTable( final String vdbName, final String vdbPath, final String modelName, final String tableName) throws Exception { final WorkspaceManager mgr = WorkspaceManager.getInstance(_repo); final Vdb vdb = mgr.createVdb(this.uow, null, vdbName, vdbPath); final Model model = vdb.addModel(this.uow, modelName); return model.addTable(this.uow, tableName); }
protected Model createModel(final String vdbName, final String vdbPath, final String modelName) throws Exception { final WorkspaceManager mgr = WorkspaceManager.getInstance(_repo); final Vdb vdb = mgr.createVdb(this.uow, null, vdbName, vdbPath); final Model model = vdb.addModel(this.uow, modelName); assertThat(model.getPrimaryType(this.uow).getName(), is(VdbLexicon.Vdb.DECLARATIVE_MODEL)); assertThat(model.getName(this.uow), is(modelName)); return model; }
@Before public void init() throws Exception { final Vdb vdb = createVdb(); final Model model = createModel(); this.parentTable = model.addTable(getTransaction(), "parentTable"); final Model refModel = vdb.addModel(getTransaction(), "refModel"); this.refTable = refModel.addTable(getTransaction(), "refTable"); this.foreignKey = this.parentTable.addForeignKey(getTransaction(), NAME, this.refTable); commit(); }