Package org.dbunit.database

Examples of org.dbunit.database.DatabaseConnection


          .getProperty("hibernate.connection.url");
    }
    Connection jdbcConnection = DriverManager.getConnection(
        databaseURL, "sysdba",
        "masterkey");
    IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);

    // EKSPORT
//     XmlDataSetWriter exportBase = new XmlDataSetWriter(new FileOutputStream(
//     "c:/dataset.xml"), "UTF-8");
//     exportBase.write(connection.createDataSet());
View Full Code Here


        this.datasource = datasource;
       

        // prepare the database
        IDatabaseConnection connection = new DatabaseConnection(datasource.getConnection());
        IDataSet dataSet = new XmlDataSet(new FileInputStream("conf/dataset.xml"));

        try
        {
            DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
        }
        finally
        {
            connection.close();
        }
    }
View Full Code Here

        this.datasource = datasource;


        // prepare the database
        IDatabaseConnection connection = new DatabaseConnection(datasource.getConnection());
        IDataSet dataSet = new XmlDataSet(new FileInputStream("conf/dataset.xml"));

        try
        {
            DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
        }
        finally
        {
            connection.close();
        }
    }
View Full Code Here

        ds.setPassword(DATABASE_PASSWORD);
        ds.setDefaultAutoCommit(!isAutoCommit());

        // prepare the database
        Connection conn = ds.getConnection();
        IDatabaseConnection connection = new DatabaseConnection(conn);
        IDataSet dataSet = new XmlDataSet(new FileInputStream(
                ConfigurationAssert.getTestFile("dataset.xml")));

        try
        {
            DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
        }
        finally
        {
            if (!isAutoCommit())
            {
                conn.commit();
            }
            connection.close();
        }

        return ds;
    }
View Full Code Here

    public void initDB() throws Exception {
        Connection connection = null;

        try {
            connection = getConnection();
            IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection);
            setDbType(dbUnitConnection);
            DatabaseOperation.REFRESH.execute(dbUnitConnection, getDataSet());
        } finally {
            if (connection != null) {
                connection.close();
View Full Code Here

        }

        try {
            connection = getConnection();

            IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection);
            setDbType(dbUnitConnection);
            DatabaseOperation.DELETE.execute(dbUnitConnection, getDataSet());
        } finally {
            if (connection != null) {
                connection.close();
View Full Code Here

    public void initDB() throws Exception {
        Connection connection = null;

        try {
            connection = getConnection();
            IDatabaseConnection conn = new DatabaseConnection(connection);
            setDbType(conn);
            DatabaseOperation.REFRESH.execute(conn, getDataSet());
        } finally {
            if (connection != null) {
                connection.close();
View Full Code Here

    public void cleanDB() throws Exception {
        Connection connection = null;

        try {
            connection = getConnection();
            IDatabaseConnection conn = new DatabaseConnection(connection);
            setDbType(conn);
            DatabaseOperation.DELETE.execute(conn, getDataSet());
        } finally {
            if (connection != null) {
                connection.close();
View Full Code Here

    protected void setupDB() throws Exception {
        Connection connection = null;

        try {
            connection = getConnection();
            DatabaseConnection dbunitConnection = new DatabaseConnection(connection);
            setDbType(dbunitConnection);
            // note - this info should already be in the db as part of dbsetup, but just in case
            // perform the refresh. Do not DELETE this data set as it may be assumed in other tests.
            DatabaseOperation.REFRESH.execute(dbunitConnection, getDataSet());
        } finally {
View Full Code Here

     * @param jdbcConnection
     * @param input
     * @throws Exception
     */
    public static void run(Connection jdbcConnection, Input input) throws Exception {
        run(new DatabaseConnection(jdbcConnection), input);
    }
View Full Code Here

TOP

Related Classes of org.dbunit.database.DatabaseConnection

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.