appContext.cleanAndDeploy();
appContext.cleanAndDeploy();
@Test public void testUnitTestDeploy() throws Exception { DbDeployerAppContext builder = new UnitTestDbBuilder() .setReferenceEnvName("test") .setSourcePath("./src/test/resources/platforms/h2/step1") .setDbPlatform(new H2DbPlatform()) .setDbServer("MYCUSTOMDB") .buildContext(); builder.setupEnvInfra(); builder.cleanAndDeploy(); DbDeployerAppContext context = builder.cleanAndDeploy();// run it twice to ensure clean ability DbEnvironment env = builder.getEnvironment(); this.setupVerification(builder); int result; this.conn = context.getDataSource().getConnection(); result = this.jdbc.queryForInt(conn, "select count(*) from bogusSchema.TABLE_A"); assertEquals(4, result); result = this.jdbc.queryForInt(conn, "select count(*) from bogusSchema.VIEW1"); assertEquals(4, result); }
@Test public void testUnitTestDeploy() throws Exception { DbDeployerAppContext builder = new UnitTestDbBuilder() .setReferenceEnvName("test") .setSourcePath("./src/test/resources/platforms/h2/step1") .setDbPlatform(new H2DbPlatform()) .setDbServer("MYCUSTOMDB") .buildContext(); builder.setupEnvInfra(); builder.cleanAndDeploy(); DbDeployerAppContext context = builder.cleanAndDeploy();// run it twice to ensure clean ability DbEnvironment env = builder.getEnvironment(); this.setupVerification(builder); int result; this.conn = context.getDataSource().getConnection(); result = this.jdbc.queryForInt(conn, "select count(*) from bogusSchema.TABLE_A"); assertEquals(4, result); result = this.jdbc.queryForInt(conn, "select count(*) from bogusSchema.VIEW1"); assertEquals(4, result); }
@Test public void testInMemoryH2() { DbDeployerAppContext context = UnitTestDbBuilder.newBuilder() .setSourcePath("platforms/db2/step1/system-config-inmem.xml") .setReferenceEnvName("unittestrefh2") .setDbPlatform(new H2DbPlatform()) .setDbServer("mydb2testH2") .buildContext(); context.setupEnvInfra(); context.cleanAndDeploy(); // TODO add assertions }
@Test public void testInMemoryH2() { DbDeployerAppContext context = UnitTestDbBuilder.newBuilder() .setSourcePath("platforms/db2/step1/system-config-inmem.xml") .setReferenceEnvName("unittestrefh2") .setDbPlatform(new H2DbPlatform()) .setDbServer("mydb2testH2") .buildContext(); context.setupEnvInfra(); context.cleanAndDeploy(); // TODO add assertions }
@Test public void testUnitTestDeploy() throws SQLException { DbDeployerAppContext context = UnitTestDbBuilder.newBuilder() .setEnvName("test2") .setDbPlatform(new HsqlDbPlatform()) .setSourcePath("platforms/hsql") .setDbServer("HsqlCustomName") .buildContext(); context.setupEnvInfra(); // run it twice to ensure that we can drop the schema context.cleanAndDeploy(); context.cleanAndDeploy(); DbEnvironment env = context.getEnvironment(); System.out.println("Created env at " + env.getJdbcUrl()); int result; this.setup(); Connection conn = context.getDataSource().getConnection(); try { result = this.jdbc.queryForInt(conn, "select count(*) from SCHEMA1.TABLE_A"); assertEquals(3, result); result = this.jdbc.queryForInt(conn, "select count(*) from SCHEMA1.VIEW1"); assertEquals(3, result); } finally { DbUtils.closeQuietly(conn); } } }
@Test public void testUnitTestDeploy() throws SQLException { DbDeployerAppContext context = UnitTestDbBuilder.newBuilder() .setEnvName("test2") .setDbPlatform(new HsqlDbPlatform()) .setSourcePath("platforms/hsql") .setDbServer("HsqlCustomName") .buildContext(); context.setupEnvInfra(); // run it twice to ensure that we can drop the schema context.cleanAndDeploy(); context.cleanAndDeploy(); DbEnvironment env = context.getEnvironment(); System.out.println("Created env at " + env.getJdbcUrl()); int result; this.setup(); Connection conn = context.getDataSource().getConnection(); try { result = this.jdbc.queryForInt(conn, "select count(*) from SCHEMA1.TABLE_A"); assertEquals(3, result); result = this.jdbc.queryForInt(conn, "select count(*) from SCHEMA1.VIEW1"); assertEquals(3, result); } finally { DbUtils.closeQuietly(conn); } } }
@Test public void testInMemoryHsql() { DbDeployerAppContext context = UnitTestDbBuilder.newBuilder() .setSourcePath("platforms/db2/step1/system-config-inmem.xml") .setReferenceEnvName("unittestrefhsql") .setDbPlatform(new HsqlDbPlatform()) .setDbServer("mydb2testHsql") .buildContext(); context.setupEnvInfra(); context.cleanAndDeploy(); // TODO add assertions } }
@Test public void testInMemoryHsql() { DbDeployerAppContext context = UnitTestDbBuilder.newBuilder() .setSourcePath("platforms/db2/step1/system-config-inmem.xml") .setReferenceEnvName("unittestrefhsql") .setDbPlatform(new HsqlDbPlatform()) .setDbServer("mydb2testHsql") .buildContext(); context.setupEnvInfra(); context.cleanAndDeploy(); // TODO add assertions } }
@Test public void testUnitTestWithFile() throws Exception { DataSource ds = JdbcDataSourceFactory.createFromJdbcUrl(org.h2.Driver.class, H2JdbcDataSourceFactory.getUrl("fileTest", true), new Credential("sa", "")); this.jdbc = new JdbcHelper(); // run it twice to ensure that we can drop the schema DbDeployerAppContext builder = new UnitTestDbBuilder() .setEnvName("unittest-file") .setDbServer("fileTest") .setSourcePath("platforms/h2/step1") .setDbPlatform(new H2DbPlatform()) .setPersistToFile(true) .buildContext(); builder.setupEnvInfra(); builder.setupEnvInfra(); builder.setupEnvInfra(); builder.cleanAndDeploy(); DbDeployerAppContext dbDeployerAppContext = builder.cleanAndDeploy(); int result; this.conn = dbDeployerAppContext.getDataSource().getConnection(); result = this.jdbc.queryForInt(conn, "select count(*) from bogusSchema.TABLE_A"); assertEquals(4, result); result = this.jdbc.queryForInt(conn, "select count(*) from bogusSchema.VIEW1"); assertEquals(4, result); } }
@Test public void testUnitTestWithFile() throws Exception { DataSource ds = JdbcDataSourceFactory.createFromJdbcUrl(org.h2.Driver.class, H2JdbcDataSourceFactory.getUrl("fileTest", true), new Credential("sa", "")); this.jdbc = new JdbcHelper(); // run it twice to ensure that we can drop the schema DbDeployerAppContext builder = new UnitTestDbBuilder() .setEnvName("unittest-file") .setDbServer("fileTest") .setSourcePath("platforms/h2/step1") .setDbPlatform(new H2DbPlatform()) .setPersistToFile(true) .buildContext(); builder.setupEnvInfra(); builder.setupEnvInfra(); builder.setupEnvInfra(); builder.cleanAndDeploy(); DbDeployerAppContext dbDeployerAppContext = builder.cleanAndDeploy(); int result; this.conn = dbDeployerAppContext.getDataSource().getConnection(); result = this.jdbc.queryForInt(conn, "select count(*) from bogusSchema.TABLE_A"); assertEquals(4, result); result = this.jdbc.queryForInt(conn, "select count(*) from bogusSchema.VIEW1"); assertEquals(4, result); } }
.buildContext() .setupEnvInfra() .cleanAndDeploy() .setupAndCleanAndDeploy() .getEnvironment();
.buildContext() .setupEnvInfra() .cleanAndDeploy() .setupAndCleanAndDeploy() .getEnvironment();