@Test public void testExceptionDetectionAndSkips() { try { DbEnvironmentFactory.getInstance().readOneFromSourcePath("./src/test/resources/DbDeployer/error-run-test") .buildAppContext() .setupAndCleanAndDeploy(); } catch (DeployerRuntimeException exc) { assertThat(exc.getMessage(), containsString("Object [TABLE_A]; ChangeName [invalidChange]")); assertThat(exc.getMessage(), containsString("Object [TABLE_B]; ChangeName [n/a]")); assertThat(exc.getMessage(), not(containsString("Object [TABLE_A]; ChangeName [failed_fk_not_to_be_attempted]"))); } } }
.setViews(views) .buildContext(); dbDeployerAppContext.setupAndCleanAndDeploy().getEnvironment();
.setViews(views) .buildContext(); dbDeployerAppContext.setupAndCleanAndDeploy().getEnvironment();
@Test public void testCrossDbJoin() throws Exception { Set<String> tables = new HashSet<String>(); Set<String> views = new HashSet<String>(); tables.add("TABLE_C"); tables.add("PRODUCT"); // run it twice to ensure that we can drop the schema DbDeployerAppContext dbDeployerAppContext = new UnitTestDbBuilder() .setReferenceEnvName("test") .setDbServer("crossDbJoin") .setSourcePath("platforms/h2/step1") .setDbPlatform(new H2DbPlatform()) .setTables(tables) .setViews(views) .buildContext(); dbDeployerAppContext.setupAndCleanAndDeploy().getEnvironment(); this.setupVerification(dbDeployerAppContext); int result; this.conn = dbDeployerAppContext.getDataSource().getConnection(); result = this.jdbc .queryForInt(conn, "select count(p.*) from bogusSchema.TABLE_C a, SCHEMA2.PRODUCT p where a.PRODUCT_ID = p.PRODUCT_ID "); assertEquals(3, result); }
@Test public void testCrossDbJoin() throws Exception { Set<String> tables = new HashSet<String>(); Set<String> views = new HashSet<String>(); tables.add("TABLE_C"); tables.add("PRODUCT"); // run it twice to ensure that we can drop the schema DbDeployerAppContext dbDeployerAppContext = new UnitTestDbBuilder() .setReferenceEnvName("test") .setDbServer("crossDbJoin") .setSourcePath("platforms/h2/step1") .setDbPlatform(new H2DbPlatform()) .setTables(tables) .setViews(views) .buildContext(); dbDeployerAppContext.setupAndCleanAndDeploy().getEnvironment(); this.setupVerification(dbDeployerAppContext); int result; this.conn = dbDeployerAppContext.getDataSource().getConnection(); result = this.jdbc .queryForInt(conn, "select count(p.*) from bogusSchema.TABLE_C a, SCHEMA2.PRODUCT p where a.PRODUCT_ID = p.PRODUCT_ID "); assertEquals(3, result); }
.setupEnvInfra() .cleanAndDeploy() .setupAndCleanAndDeploy() .getEnvironment(); .setDbPlatform(new HsqlDbPlatform()) .setDbServer("mytest") .buildContext().setupAndCleanAndDeploy();
.setupEnvInfra() .deploy() .setupAndCleanAndDeploy() .getEnvironment(); .setDbPlatform(new H2DbPlatform()) .setDbServer("mytest") .buildContext().setupAndCleanAndDeploy();
.setupEnvInfra() .cleanAndDeploy() .setupAndCleanAndDeploy() .getEnvironment(); .setDbPlatform(new HsqlDbPlatform()) .setDbServer("mytest") .buildContext().setupAndCleanAndDeploy();
.setupEnvInfra() .deploy() .setupAndCleanAndDeploy() .getEnvironment(); .setDbPlatform(new H2DbPlatform()) .setDbServer("mytest") .buildContext().setupAndCleanAndDeploy();