org.ipdr.test
Class IPDRWriteTool

java.lang.Object
  extended by org.ipdr.test.IPDRWriteTool

public class IPDRWriteTool
extends java.lang.Object

This class is used for generation of IPDRDoc in XDR/XML format. It takes input parameter as comma delimited test data file having its first line as SchemaURI. More than one input files can be passed as input command line arguments. Optional command line arguments are load and roundrobin. Load parameter is used for specifying number of CompositeData records to be written in IPDRDoc. Roundrobin parameter is used for writing of CompositeData records in a roundrobin fashion.


Field Summary
protected  int docTypeCount_
          To check that doctype parameter is not given twice.
protected  java.io.FileOutputStream fOut_
          Object of FileOutputStream class.
static java.lang.String ipdrVersion_
          String to store the IPDR Version.
protected  int loadCount_
          To check that load parameter is not given twice.
protected  boolean loadFlag_
          Flag indicating presence of load option as input.
protected  int loadParam_
          To store value of load.
protected  int loopIteration_
          LoopIteration is incremented when any parameter is succesful.
protected  java.io.File outFile_
          Object of File class.
protected  int outFileCount_
          To check that outfile parameter is not given twice.
protected  boolean outFileFlag_
          Flag indicating presence of outfile parameter.
protected  java.util.ArrayList passedArguments_
          To store all the input command line parameters for validation.
protected  int roundRobinCount_
          To check that roundrobin parameter is not given twice.
protected  boolean roundRobinFlag_
          Flag indicating presence of roundrobin option passed as input.
protected static boolean settlementDoc_
          Flag indicating document is Settlement Doc.
protected  java.util.ArrayList testDataFiles_
          To store all files location which are to be used for test data.
protected  int testFileCount_
          To store total test data files in an array.
protected  int totalArguments_
          Length of the input string.
static boolean validateSchema_
          Flag indicating validation of Schema.
protected  boolean xdrFlag_
          Flag indicating document type as XDR.
protected  boolean xmlFlag_
          Flag indicating document type as XML.
 
Constructor Summary
IPDRWriteTool()
           
 
Method Summary
protected  CompositeData generateCompositeData(java.util.ArrayList lineArray, int testNdx, OpenType[] openType, java.lang.String serviceType)
          This method is used to generate a CompositeData object when OpenType array and the test data line is passed corresponding to a CompositeData.
 CompositeData[] generateCompositeDataArray(java.io.File dataFile)
          This method is used to generate array of CompositeData objects when a CSV File (having its first line as SchemaURI) is passed as an input to it.
protected  java.lang.Object generateObject(java.lang.String str, OpenType type)
          This method is used to convert object of Object class to different data objects.
protected  java.lang.String getHeaderInfo(java.io.BufferedReader br)
          This method is used to obtain the header information.
protected  java.util.ArrayList inputFileProcessing()
          This method is used for code reuse in simpleProcessing and loadProcessing methods.
protected  void loadAndRoundRobinProcessing(IPDRDocWriter w)
          This method is used for when load parameter and roundrobin is specified in the input arguments of test tool.
protected  void loadProcessing(IPDRDocWriter w)
          This method is used for when load parameter is specified but roundrobin is not present in the input arguments of test tool.
static void main(java.lang.String[] args)
          Entry point to the write tool.
protected  void parameterHandling(java.lang.String[] arguments)
          This method is used for validation of command line arguments provided in the test tool.
protected  java.util.ArrayList readNameSpaces(java.io.BufferedReader br)
          This method is used to obtain the NameSpaceInfo information.
protected  java.util.ArrayList readServDefs(java.io.BufferedReader br)
          This method is used to obtain the ServiceDefinitionURI information.
protected  void roundRobinProcessing(IPDRDocWriter w)
          This method is used for when load parameter is not specified but roundrobin is specified in the input arguments of test tool.
protected  void simpleProcessing(IPDRDocWriter w)
          This method is used for when load and roundrobin is not present in the input arguments of test tool.
 void testFTP(int docType, java.lang.String[] testDataFiles, java.lang.String outFile)
          This method is used for testing purposes from File based transfer protocol APIs.
protected  void testToolUsage()
          This method is used for showing test tool usage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

validateSchema_

public static boolean validateSchema_
Flag indicating validation of Schema.


ipdrVersion_

public static java.lang.String ipdrVersion_
String to store the IPDR Version.


xdrFlag_

protected boolean xdrFlag_
Flag indicating document type as XDR.


xmlFlag_

protected boolean xmlFlag_
Flag indicating document type as XML.


settlementDoc_

protected static boolean settlementDoc_
Flag indicating document is Settlement Doc.


outFileFlag_

protected boolean outFileFlag_
Flag indicating presence of outfile parameter.


loadFlag_

protected boolean loadFlag_
Flag indicating presence of load option as input.


roundRobinFlag_

protected boolean roundRobinFlag_
Flag indicating presence of roundrobin option passed as input.


totalArguments_

protected int totalArguments_
Length of the input string.


loopIteration_

protected int loopIteration_
LoopIteration is incremented when any parameter is succesful.


loadCount_

protected int loadCount_
To check that load parameter is not given twice.


roundRobinCount_

protected int roundRobinCount_
To check that roundrobin parameter is not given twice.


testFileCount_

protected int testFileCount_
To store total test data files in an array.


loadParam_

protected int loadParam_
To store value of load.


outFileCount_

protected int outFileCount_
To check that outfile parameter is not given twice.


docTypeCount_

protected int docTypeCount_
To check that doctype parameter is not given twice.


outFile_

protected java.io.File outFile_
Object of File class.


fOut_

protected java.io.FileOutputStream fOut_
Object of FileOutputStream class.


testDataFiles_

protected java.util.ArrayList testDataFiles_
To store all files location which are to be used for test data.


passedArguments_

protected java.util.ArrayList passedArguments_
To store all the input command line parameters for validation.

Constructor Detail

IPDRWriteTool

public IPDRWriteTool()
Method Detail

generateCompositeDataArray

public CompositeData[] generateCompositeDataArray(java.io.File dataFile)
                                           throws IPDRException,
                                                  BadCompositeException,
                                                  org.xml.sax.SAXException
This method is used to generate array of CompositeData objects when a CSV File (having its first line as SchemaURI) is passed as an input to it.

Parameters:
dataFile - Input CSV file object
Returns:
testData Array of Composite Data
Throws:
IPDRException - when a IPDR functionality related exception occurs
org.xml.sax.SAXException - when an exception occurs during parsing
BadCompositeException - when an exception occurs during the creation of the Composite Type object

generateCompositeData

protected CompositeData generateCompositeData(java.util.ArrayList lineArray,
                                              int testNdx,
                                              OpenType[] openType,
                                              java.lang.String serviceType)
                                       throws IPDRException,
                                              BadCompositeException
This method is used to generate a CompositeData object when OpenType array and the test data line is passed corresponding to a CompositeData.

Parameters:
lineArray - Array of lines from the data file
testNdx - Index of line to process
openType - Array of OpenType
serviceType - The Service Type
Returns:
compData CompositeData Object generated.

Throws:
IPDRException
BadCompositeException

generateObject

protected java.lang.Object generateObject(java.lang.String str,
                                          OpenType type)
                                   throws BadCompositeException,
                                          IPDRException
This method is used to convert object of Object class to different data objects.

Parameters:
str - String containing object value
type - Type of the object
Returns:
Data converted according to the typecode.
Throws:
BadCompositeException
IPDRException

testToolUsage

protected void testToolUsage()
This method is used for showing test tool usage.


inputFileProcessing

protected java.util.ArrayList inputFileProcessing()
                                           throws IPDRException,
                                                  org.xml.sax.SAXException,
                                                  BadCompositeException
This method is used for code reuse in simpleProcessing and loadProcessing methods.

Returns:
ArrayList storing the CompositeData of input files.
Throws:
IPDRException
org.xml.sax.SAXException
BadCompositeException

simpleProcessing

protected void simpleProcessing(IPDRDocWriter w)
                         throws IPDRException,
                                org.xml.sax.SAXException,
                                BadCompositeException
This method is used for when load and roundrobin is not present in the input arguments of test tool.

Parameters:
w - Object of IPDRDocWriter
Throws:
IPDRException
org.xml.sax.SAXException
BadCompositeException

loadProcessing

protected void loadProcessing(IPDRDocWriter w)
                       throws org.xml.sax.SAXException,
                              IPDRException,
                              BadCompositeException
This method is used for when load parameter is specified but roundrobin is not present in the input arguments of test tool.

Parameters:
w - Object of IPDRDocWriter
Throws:
org.xml.sax.SAXException
IPDRException
BadCompositeException

roundRobinProcessing

protected void roundRobinProcessing(IPDRDocWriter w)
                             throws BadCompositeException,
                                    java.io.IOException,
                                    IPDRException,
                                    org.xml.sax.SAXException
This method is used for when load parameter is not specified but roundrobin is specified in the input arguments of test tool.

Parameters:
w - Object of IPDRDocWriter
Throws:
BadCompositeException
java.io.IOException
IPDRException
org.xml.sax.SAXException

loadAndRoundRobinProcessing

protected void loadAndRoundRobinProcessing(IPDRDocWriter w)
                                    throws BadCompositeException,
                                           java.io.IOException,
                                           IPDRException,
                                           org.xml.sax.SAXException
This method is used for when load parameter and roundrobin is specified in the input arguments of test tool.

Parameters:
w - Object of IPDRDocWriter.
Throws:
BadCompositeException
java.io.IOException
IPDRException
org.xml.sax.SAXException

parameterHandling

protected void parameterHandling(java.lang.String[] arguments)
This method is used for validation of command line arguments provided in the test tool.

Parameters:
arguments - Command line arguments.

getHeaderInfo

protected java.lang.String getHeaderInfo(java.io.BufferedReader br)
                                  throws java.io.IOException
This method is used to obtain the header information.

Parameters:
br - BufferedReader object for Input test data file.
Returns:
String for Schema and OtherNameSpace URI
Throws:
java.io.IOException

readNameSpaces

protected java.util.ArrayList readNameSpaces(java.io.BufferedReader br)
                                      throws java.io.IOException
This method is used to obtain the NameSpaceInfo information.

Parameters:
br - BufferedReader object for Input test data file.
Returns:
ArrayList of NameSpaceInfo objects.
Throws:
java.io.IOException

readServDefs

protected java.util.ArrayList readServDefs(java.io.BufferedReader br)
                                    throws java.io.IOException
This method is used to obtain the ServiceDefinitionURI information.

Parameters:
br - BufferedReader object for Input test data file.
Returns:
String for OtherNameSpace URI and prefix

Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws org.xml.sax.SAXException,
                        java.io.IOException,
                        BadCompositeException
Entry point to the write tool.

Throws:
org.xml.sax.SAXException
java.io.IOException
BadCompositeException

testFTP

public void testFTP(int docType,
                    java.lang.String[] testDataFiles,
                    java.lang.String outFile)
             throws IPDRException,
                    org.xml.sax.SAXException,
                    java.io.IOException,
                    BadCompositeException
This method is used for testing purposes from File based transfer protocol APIs.

Parameters:
docType - Document Type
testDataFiles - Array of input CSV file names
outFile - Output file name
Throws:
IPDRException
org.xml.sax.SAXException
java.io.IOException
BadCompositeException