protected Database getDatabase() throws Exception { if (database == null) { database = DatabaseFactory.getDatabase("db.unittest"); } return database; }
@Override public void setUp() throws Exception { db = DatabaseFactory.getDatabase("db.unittest"); }
public PrecomputedTableTest(String arg1) { super(arg1); try { database = DatabaseFactory.getDatabase("db.unittest"); } catch (Exception e) { } }
public QueryOptimiserTest(String arg1) { super(arg1); try { database = DatabaseFactory.getDatabase("db.unittest"); } catch (Exception e) { } }
/** * Sets the objectstore * @param os String used to identify objectstore and therefore database */ public void setOsName(String os) { this.os = os; try { this.databaseAlias = PropertiesUtil.getProperties().getProperty(os + ".db"); this.database = DatabaseFactory.getDatabase(databaseAlias); } catch (Exception e) { e.printStackTrace(); } }
/** * Sets the objectstore * @param os String used to identify objectstore and therefore database */ public void setOsName(String os) { this.os = os; try { this.databaseAlias = PropertiesUtil.getProperties().getProperty(os + ".db"); this.database = DatabaseFactory.getDatabase(databaseAlias); } catch (Exception e) { e.printStackTrace(); } }
protected Database getDatabase() throws Exception { return DatabaseFactory.getDatabase("db.unittest"); }
public void testConfigure() throws Exception { Database db1 = DatabaseFactory.getDatabase("db.unittest"); Database db2 = DatabaseFactory.getDatabase("db.unittest"); // These should be exactly the same object assertTrue(db1 == db2); }
public void testNullName() throws Exception { try { DatabaseFactory.getDatabase(null); fail("Expected: NullPointerException"); } catch (NullPointerException e) { } }
@Override public void setUp() throws Exception { db = DatabaseFactory.getDatabase("db.unittest"); con = db.getConnection(); con.setAutoCommit(true); }
public void tearDown() throws Exception { try { dt.close(); Database db = DatabaseFactory.getDatabase("db.unittest"); Connection c = db.getConnection(); c.setAutoCommit(true); c.createStatement().execute("DROP TABLE tracker"); c.close(); } catch (Exception e) { } }
protected void setUp() throws Exception { con = DatabaseFactory.getDatabase("db.unittest").getConnection(); con.setAutoCommit(false); writer = new DatabaseWriter(con, "table1"); }
public static void oneTimeSetUp() throws Exception { SetupDataTestCase.oneTimeSetUp(); setUpResults(); db = DatabaseFactory.getDatabase("db.unittest"); }
public static void oneTimeSetUp() throws Exception { SqlGeneratorTest.oneTimeSetUp(); setUpResults(); db = DatabaseFactory.getDatabase("db.truncunittest"); }
public static void oneTimeSetUp() throws Exception { SqlGeneratorTest.oneTimeSetUp(); setUpResults(); db = DatabaseFactory.getDatabase("db.notxmlunittest"); }
public static void oneTimeSetUp() throws Exception { SqlGeneratorTest.oneTimeSetUp(); setUpResults(); db = DatabaseFactory.getDatabase("db.flatmodeunittest"); }
public void testNullWarningPreparedStatement() throws Exception { // pass in an sql statement without an EXPLAIN, should give no warnings Connection con = DatabaseFactory.getDatabase("db.unittest").getConnection(); try { String sql = "select 1"; PreparedStatement stmt = con.prepareStatement(sql); er = new PostgresExplainResult(stmt); fail("Expected: SQLException"); } catch (SQLException e) { } catch (NullPointerException e) { fail("Expected SQLException but Null PointerException thrown"); } finally { con.close(); } }
public void setUp() throws Exception { dt = new DataTracker(DatabaseFactory.getDatabase("db.unittest"), 30, 10); source1 = dt.stringToSource("Source1"); source2 = dt.stringToSource("Source2"); }
public void testWrongOrderBug() throws Exception { dt.setSource(new Integer(13), "name", source1); dt.flush(); dt.setSource(new Integer(14), "name", source1); dt.flush(); DataTracker dt2 = new DataTracker(DatabaseFactory.getDatabase("db.unittest"), 30, 10); dt2.setSource(new Integer(14), "name", dt2.stringToSource("Source2")); dt2.close(); dt2 = new DataTracker(DatabaseFactory.getDatabase("db.unittest"), 30, 10); assertEquals(source2.getName(), dt2.getSource(new Integer(14), "name").getName()); } }
public void setUp() throws Exception { database = DatabaseFactory.getDatabase("db.unittest"); Query q1 = new Query(); Table t = new Table("tabletest"); Constant c = new Constant("50"); Field f1 = new Field("col1", t); Field f2 = new Field("col2", t); SelectValue sv1 = new SelectValue(f1, null); SelectValue sv2 = new SelectValue(f2, null); q1.addFrom(t); q1.addSelect(sv1); q1.addSelect(sv2); q1.addWhere(new Constraint(f1, Constraint.LT, c)); q1.addOrderBy(f1); Connection con = database.getConnection(); con.setAutoCommit(false); pt1 = new PrecomputedTable(q1, q1.getSQLString(), "precompA", "test", con); con.close(); }