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"); }
/** * {@inheritDoc} */ @Override public void execute() { if (database == null) { throw new BuildException("database attribute is not set"); } if (user == null) { throw new BuildException("user attribute is not set"); } if (perm == null) { throw new BuildException("perm attribute is not set"); } try { Database db = DatabaseFactory.getDatabase(database); DatabaseUtil.grant(db, user, perm); } catch (Exception e) { throw new BuildException(e); } } }
/** * {@inheritDoc} */ @Override public void execute() { if (database == null) { throw new BuildException("database attribute is not set"); } if (user == null) { throw new BuildException("user attribute is not set"); } if (perm == null) { throw new BuildException("perm attribute is not set"); } try { Database db = DatabaseFactory.getDatabase(database); DatabaseUtil.grant(db, user, perm); } catch (Exception e) { throw new BuildException(e); } } }
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); }
Database db = DatabaseFactory.getDatabase(database); System.err .println("Processing configuration file: " + configFile.getCanonicalPath()); LineNumberReader reader = new LineNumberReader(new FileReader(configFile));
Database db = DatabaseFactory.getDatabase(database); System.err .println("Processing configuration file: " + configFile.getCanonicalPath()); LineNumberReader reader = new LineNumberReader(new FileReader(configFile));
LOG.info("Query from database for: " + existedClsSet + " and caching id resolver to file."); createFromDb(existedClsSet, DatabaseFactory.getDatabase(propName)); resolver.writeToFile(f);
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); }
/** * {@inheritDoc} */ @Override public void execute() { if (database == null) { throw new BuildException("database attribute is not set"); } try { Database db = DatabaseFactory.getDatabase(database); if (clsName != null && !"".equals(clsName)) { if (model == null) { throw new BuildException("model attribute is not set"); } Model m = Model.getInstanceByName(model); ClassDescriptor cld = m.getClassDescriptorByName(clsName); if (cld == null) { throw new BuildException("class does not exist in model: " + clsName); } DatabaseUtil.analyse(db, cld, full); } else { DatabaseUtil.analyse(db, full); } } catch (Exception e) { throw new BuildException(e); } } }
/** * {@inheritDoc} */ @Override public void execute() { if (database == null) { throw new BuildException("database attribute is not set"); } try { Database db = DatabaseFactory.getDatabase(database); if (clsName != null && !"".equals(clsName)) { if (model == null) { throw new BuildException("model attribute is not set"); } Model m = Model.getInstanceByName(model); ClassDescriptor cld = m.getClassDescriptorByName(clsName); if (cld == null) { throw new BuildException("class does not exist in model: " + clsName); } DatabaseUtil.analyse(db, cld, full); } else { DatabaseUtil.analyse(db, full); } } catch (Exception e) { throw new BuildException(e); } } }
LOG.info("Creating id resolver from database and caching id resolver to file: " + idResolverCachedFileName); createFromDb(clsCol, DatabaseFactory.getDatabase(propName)); resolver.writeToFile(new File(idResolverCachedFileName));
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"); }