package app;
import java.sql.SQLException;
import org.ytreza.data.database.jdbc.ConnectionNotDefinedException;
import org.ytreza.data.database.jdbc.JdbcConnectionManager;
import org.ytreza.data.database.jdbc.MainConnection;
import app.database.TableFactory;
import app.database.TableFactoryJdbc;
import org.ytreza.data.table.CantSetUpTableException;
import org.ytreza.data.table.UnexpectedFactoryTypeException;
import org.ytreza.data.table.exception.TableAlreadyRegisteredException;
public class ApplicationTest {
private static ApplicationTest mainApplication;
private JdbcConnectionManager connectionManager;
public TableFactoryJdbc factory;
private ApplicationTest() throws Exception {
setUp();
}
private void setUp() throws ClassNotFoundException, SQLException, ConnectionNotDefinedException, TableAlreadyRegisteredException, UnexpectedFactoryTypeException, CantSetUpTableException {
factory = new TableFactoryJdbc(getConnectionManager());
factory.buildTable();
}
public JdbcConnectionManager getConnectionManager() throws ClassNotFoundException, SQLException, ConnectionNotDefinedException {
if (connectionManager == null) {
MainConnection.initMainConnection("org.sqlite.JDBC", "jdbc:sqlite::memory:");
connectionManager = MainConnection.getMainConnection();
}
return connectionManager;
}
public static ApplicationTest getApplication() throws Exception {
if (mainApplication == null) {
mainApplication = new ApplicationTest();
}
return mainApplication;
}
public TableFactory getFactoryJdbc() {
return factory;
}
public void testRunMainWindow() {
}
}