uk.org.bryanray.testtoys.loader
Class Loader

java.lang.Object
  extended by uk.org.bryanray.testtoys.loader.Loader

public class Loader
extends java.lang.Object

A class that generates a SQL script to load test data, from a SQL template and CSV data describing the entities.


Constructor Summary
Loader()
           
 
Method Summary
 void configureValueFormatters()
          Reads the data types from the header and selects the appropriate formatter for the column.
 java.lang.String generateTestData()
           
static void main(java.lang.String[] args)
           
 void setTemplate(java.io.InputStream inputStream)
          The SQL template.
 void setTestDataEntities(java.io.InputStream inputStream)
          An iterator, which supplies a Map for each iteration.
 java.lang.String[] stripParameters(java.lang.String[] header)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Loader

public Loader()
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - The command line arguments.

stripParameters

public java.lang.String[] stripParameters(java.lang.String[] header)
Parameters:
header - The header from which to remove the data types.
Returns:
The header without the data types.

configureValueFormatters

public void configureValueFormatters()
Reads the data types from the header and selects the appropriate formatter for the column.


generateTestData

public java.lang.String generateTestData()
Parameters:
template - The SQL template.
entities - An iterator, which supplies a Map for each iteration. The map represents a single entity, with the place holder value in the map value.
Returns:
The SQL script that will insert test data.

setTestDataEntities

public void setTestDataEntities(java.io.InputStream inputStream)
An iterator, which supplies a Map for each iteration. The map represents a single entity, with the place holder value in the map value.

Parameters:
inputStream - The input stream to parse as CSV data.

setTemplate

public void setTemplate(java.io.InputStream inputStream)
The SQL template.

Parameters:
The - input stream that holds the template.


Copyright © 2008. All Rights Reserved.