org.unitils.dbmaintainer.structure.impl
Class DtdDataSetStructureGenerator

java.lang.Object
  extended by org.unitils.dbmaintainer.util.BaseDatabaseAccessor
      extended by org.unitils.dbmaintainer.structure.impl.DtdDataSetStructureGenerator
All Implemented Interfaces:
DataSetStructureGenerator, DatabaseAccessing

public class DtdDataSetStructureGenerator
extends BaseDatabaseAccessor
implements DataSetStructureGenerator

Implementation of DataSetStructureGenerator for the DbUnit FlatXmlDataSet XML test data files format

todo test and fix for hsqldb (see sample project)

Author:
Filip Neven, Tim Ducheyne

Field Summary
static String PROPKEY_DTD_FILENAME
           
 
Fields inherited from class org.unitils.dbmaintainer.util.BaseDatabaseAccessor
configuration, dbSupports, defaultDbSupport, sqlHandler
 
Constructor Summary
DtdDataSetStructureGenerator()
           
 
Method Summary
protected  void doInit(Properties configuration)
          Initializes the generator by retrieving the name for the DTD file.
 void generateDataSetStructure()
          Generates the DTD, and writes it to the file specified by the property PROPKEY_DTD_FILENAME.
protected  String generateDtdContent()
          Generates the actual content of the DTD file as an in-memory string.
 
Methods inherited from class org.unitils.dbmaintainer.util.BaseDatabaseAccessor
getDbSupport, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.unitils.dbmaintainer.util.DatabaseAccessing
init
 

Field Detail

PROPKEY_DTD_FILENAME

public static final String PROPKEY_DTD_FILENAME
See Also:
Constant Field Values
Constructor Detail

DtdDataSetStructureGenerator

public DtdDataSetStructureGenerator()
Method Detail

doInit

protected void doInit(Properties configuration)
Initializes the generator by retrieving the name for the DTD file.

Overrides:
doInit in class BaseDatabaseAccessor
Parameters:
configuration - The config, not null

generateDataSetStructure

public void generateDataSetStructure()
Generates the DTD, and writes it to the file specified by the property PROPKEY_DTD_FILENAME. The DTD will contain the structure of the database. All tables will be written as optional elements and all columns will be optional attributes.

Specified by:
generateDataSetStructure in interface DataSetStructureGenerator

generateDtdContent

protected String generateDtdContent()
Generates the actual content of the DTD file as an in-memory string.

Returns:
the DTD content, not null


Copyright © 2011. All Rights Reserved.