Package org.dbunit

Examples of org.dbunit.JdbcDatabaseTester


    private java.sql.Statement statement;

    public DbUnitRule(Class<?> resourceBase, Class<?> driver, String url, String user, String password) {
        this.resourceBase = resourceBase;
        try {
            databaseTester = new JdbcDatabaseTester(driver.getName(), url, user, password);
            dbUnitConnection = databaseTester.getConnection();
            connection = dbUnitConnection.getConnection();
            statement = connection.createStatement();
        } catch (Exception e) {
            throw new RuntimeException(e);
View Full Code Here


    filePath.append("config").append(File.separator).append("database.properties");
    FileInputStream databaseUnderTestConnectionConfig = new FileInputStream(filePath.toString());   
    Properties props = new Properties();
    props.load(databaseUnderTestConnectionConfig);
   
    this.databaseTester = new JdbcDatabaseTester(props.getProperty(DATABASE_DRIVER_CLASS), props.getProperty(DATABASE_CONNECTION_URL), props.getProperty(DATABASE_USER), props.getProperty(DATABASE_PASSWORD));
    this.databaseTester.setSetUpOperation(DatabaseOperation.CLEAN_INSERT);
    FileInputStream dbFileStream = new FileInputStream(this.getInitialDatabaseFile());
   
    IDataSet set = new FlatXmlDataSetBuilder().build(dbFileStream);   
    this.databaseTester.setDataSet(set);
View Full Code Here

      String driverClass = credential.getDriverClass();
      String url = credential.getUrl();
      String username = credential.getUser();
      String password = credential.getPassword();

      return new JdbcDatabaseTester(driverClass, url, username, password);
    } catch (ClassNotFoundException e) {
      throw Throwables.propagate(e);
    }
  }
View Full Code Here

        @Override
        protected void configure() {
          try {
            install(new BaseModule());

            JdbcDatabaseTester tester = new JdbcDatabaseTester(driverClass, url, username, password);

            bind(IDatabaseTester.class) //
                .toInstance(tester);

            switch (vendor) {
View Full Code Here

    return dataSet;
  }

  @Override
  protected IDatabaseConnection getConnection() throws Exception {
    JdbcDatabaseTester dbTester = new JdbcDatabaseTester(DRIVER, URL, USER, PASSWORD);
    dbTester.setDataSet(getDataSet());
    IDatabaseConnection connection = dbTester.getConnection();
    DatabaseConfig memConfig = connection.getConfig();
    memConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
    return connection;
  }
View Full Code Here

     * @see junit.rules.TestFixture#setUp()
     */
    @Override
    protected final void setUp() throws Throwable {
        if (tester == null) {
            tester = new JdbcDatabaseTester(EmbeddedDriver.class.getName(), "jdbc:derby:test");
        }
        if (fixtureNames.isEmpty()) {
            logger.warn("No fixtures to load! Specify fixtures using @Fixtures.");
        } else {
            try {
View Full Code Here

     */
    @Before
    public final void initializeDbUnit() throws Throwable {
        entityManager = ENTITY_MANAGER_FACTORY.get().createEntityManager();

        jdbcDatabaseTester = new JdbcDatabaseTester(EmbeddedDriver.class.getName(), JDBC_DERBY_URL);
        final List<String> fixtureNames = FixturesUtil.getFixtureNames(getClass());
        if (fixtureNames.isEmpty()) {
            logger.warn("No fixtures to load! Specify fixtures using @Fixtures.");
        } else {
            loadFixtures(fixtureNames);
View Full Code Here

     *
     * @see junit.rules.TestFixture#setUp()
     */
    @Override
    protected final void setUp() throws Throwable {
        jdbcDatabaseTester = new JdbcDatabaseTester(EmbeddedDriver.class.getName(), DerbyHibernateUtil.JDBC_DERBY_URL);
        if (fixtureNames.isEmpty()) {
            logger.warn("No fixtures to load! Specify fixtures using @Fixtures.");
        } else {
            loadFixtures();
        }
View Full Code Here

    conexao = new ConexaoImpl();
    this.supplier = supplier;
    conexao.getConexao();

    try {
      this.databaseTester = new JdbcDatabaseTester(
          conexao.getDriverClass(),
          conexao.getUrl(),
          conexao.getUser(),
          conexao.getPassword());
View Full Code Here

TOP

Related Classes of org.dbunit.JdbcDatabaseTester

Copyright © 2018 www.massapicom. 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.