org.appng.testsupport.persistence

## Class DatabaseUtil

- java.lang.Object
- - org.appng.testsupport.persistence.DatabaseUtil

-     public class DatabaseUtil
      extends Object

  A utility class helping importing/exporting data and retrieving connection information.
  Author:
    Matthias Müller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatabaseUtil(ConnectionInfo info)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearDB()`
    `void` | `clearDBJPA(boolean createSchema, boolean showSql, TestDataProvider testDataProvider)`
    `void` | `clearDBJPA(boolean createSchema, TestDataProvider testDataProvider)`
    `void` | `delete(String path)`
    `void` | `export(String name)`
    `void` | `exportData(String dataName)`
    `void` | `exportData(String dataName, boolean clearDb, Class<? extends TestDataProvider> testDataProviderClass)`
    `void` | `exportData(String dataName, Class<? extends TestDataProvider> testDataProvider)`
    `ConnectionInfo` | `getConnectionInfo()`
    `void` | `importData(Class<? extends TestDataProvider> testDataProviderClass)`
    `void` | `importData(Map<String,String> properties, Class<? extends TestDataProvider> testDataProvider)`
    `void` | `importData(String name)`
    `void` | `importData(String name, boolean force)`
    `void` | `importData(String name, boolean force, boolean clearDb)`
    `void` | `importData(TestDataProvider testDataProvider)`
    `static Map<String,String>` | `importTestData(Class<? extends TestDataProvider> class1)` Uses system-property 'hsqlPort' and returns a map containing "hibernate.connection.url" =
    `static Map<String,String>` | `importTestData(Class<? extends TestDataProvider> class1, ConnectionInfo connectionInfo)`
    `void` | `shutDown()`
    `void` | `xlsToXml(String file)`
    `void` | `xmlToXls(String file)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DatabaseUtil

          public DatabaseUtil(ConnectionInfo info)

  - ### Method Detail

    - #### importData

          public void importData(String name)
                          throws Exception

      Throws:
        `Exception`

    - #### importData

          public void importData(String name,
                                 boolean force)
                          throws Exception

      Throws:
        `Exception`

    - #### importData

          public void importData(Class<? extends TestDataProvider> testDataProviderClass)
                          throws Exception

      Throws:
        `Exception`

    - #### importData

          public void importData(TestDataProvider testDataProvider)
                          throws Exception

      Throws:
        `Exception`

    - #### importData

          public void importData(String name,
                                 boolean force,
                                 boolean clearDb)
                          throws Exception

      Throws:
        `Exception`

    - #### exportData

          public void exportData(String dataName)

    - #### exportData

          public void exportData(String dataName,
                                 boolean clearDb,
                                 Class<? extends TestDataProvider> testDataProviderClass)

    - #### exportData

          public void exportData(String dataName,
                                 Class<? extends TestDataProvider> testDataProvider)

    - #### shutDown

          public void shutDown()
                        throws SQLException

      Throws:
        `SQLException`

    - #### importData

          public void importData(Map<String,String> properties,
                                 Class<? extends TestDataProvider> testDataProvider)
                          throws Exception

      Throws:
        `Exception`

    - #### clearDBJPA

          public void clearDBJPA(boolean createSchema,
                                 TestDataProvider testDataProvider)
                          throws Exception

      Throws:
        `Exception`

    - #### clearDBJPA

          public void clearDBJPA(boolean createSchema,
                                 boolean showSql,
                                 TestDataProvider testDataProvider)
                          throws Exception

      Throws:
        `Exception`

    - #### clearDB

          public void clearDB()

    - #### delete

          public void delete(String path)

    - #### export

          public void export(String name)
                      throws Exception

      Throws:
        `Exception`

    - #### xlsToXml

          public void xlsToXml(String file)
                        throws Exception

      Throws:
        `Exception`

    - #### xmlToXls

          public void xmlToXls(String file)
                        throws Exception

      Throws:
        `Exception`

    - #### getConnectionInfo

          public ConnectionInfo getConnectionInfo()

    - #### importTestData

          public static Map<String,String> importTestData(Class<? extends TestDataProvider> class1)
                                                   throws Exception

      Uses system-property 'hsqlPort' and returns a map containing "hibernate.connection.url" =
      Parameters:
        `class1` -
      Returns:
        a `Map` containing the "hibernate.connection.url"-property
      Throws:
        `Exception`

    - #### importTestData

          public static Map<String,String> importTestData(Class<? extends TestDataProvider> class1,
                                                          ConnectionInfo connectionInfo)
                                                   throws Exception

      Throws:
        `Exception`

Copyright © 2011–2023 aiticon GmbH. All rights reserved.