Package org.ytreza

Source Code of org.ytreza.ApplicationTest

package org.ytreza;

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 org.ytreza.data.table.CantSetUpTableException;
import org.ytreza.data.table.UnexpectedFactoryTypeException;
import org.ytreza.data.table.exception.TableAlreadyRegisteredException;
import org.ytreza.data.table.jdbc.TableFactoryJdbc;

public class ApplicationTest {
  private static ApplicationTest mainApplication;
  private JdbcConnectionManager connectionManager;
  public TableFactoryJdbc factoryJdbc;

  private ApplicationTest() throws Exception {
    setUp();
  }
 
 
  private void setUp() throws ClassNotFoundException, SQLException, ConnectionNotDefinedException, TableAlreadyRegisteredException, UnexpectedFactoryTypeException, CantSetUpTableException {
    factoryJdbc = new TableFactoryJdbc(getConnectionManager());
  }


  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 TableFactoryJdbc getFactoryJdbc() {
    return factoryJdbc;
  }
 
 
 
 
 
 
 
}
TOP

Related Classes of org.ytreza.ApplicationTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.