com.symbian.et.test.xmlimport
Class FrameworkGenerator

java.lang.Object
  extended bycom.symbian.et.test.xmlimport.FrameworkGenerator

public class FrameworkGenerator
extends java.lang.Object

Author:
EngineeringTools

Field Summary
static java.lang.String ERR_FILE_IGNORED
          Warning message if the file is ignored.
private  com.symbian.et.test.driver.DriverFactory iDriverFactory
           
private  java.io.File iImportDir
          The Import directory.
protected static java.util.logging.Logger LOGGER
          The logger for the Visitor class.
static java.lang.String ORIGINAL_XML_FILE_MARKER
          The orignal XML file marker.
static java.lang.String XML_FILE_MARKER
          XML File marker.
 
Constructor Summary
FrameworkGenerator(java.io.File aImportDir)
           
 
Method Summary
 com.symbian.et.test.driver.Task buildEmfModel()
          Build test framework from its root.
private  com.symbian.et.test.driver.Task buildTaskEmfModel(java.lang.String aXmlFilePath, boolean aIsRoot, com.symbian.et.test.driver.Task aBaseTask)
           
private  com.symbian.et.test.driver.Build createBuild(boolean aSync, boolean aTestBuild, java.lang.String aURI, java.lang.String aComponenetName, java.lang.String aHostPath, java.lang.String aDevicePath)
          Creates a build command.
private  void createDepBuild(com.symbian.et.test.driver.ExecuteOnPC aExecuteOnPC, com.symbian.et.test.driver.Task aTask, org.jdom.Element aRoot, boolean aResource, boolean aLegacyBuildable)
          Adds all the build dependencies to the current Task.
private  void createExecuteOnPc(com.symbian.et.test.driver.ExecuteOnPC aExecuteOnPC, com.symbian.et.test.driver.Task aTask, java.lang.String aCmd)
          Adds a Execute on PC command to the current Task.
private  void createExecuteOnSymbian(com.symbian.et.test.driver.Task aTask, java.lang.String aArgument, com.symbian.et.test.driver.StatCommand aStatCommand)
          Adds an Execute On Symbian task to the current Task.
private  void createResourceItem(com.symbian.et.test.driver.Task aTask, java.util.List aResource)
          Adds a resource to a Task.
private  void createRetrieveFromSymbian(com.symbian.et.test.driver.Task aTask, java.lang.String aRetrievePath, java.lang.String aHostPath)
          Adds a Retrieve from Symbian task to the current Task.
private  void createTransferToSymbian(com.symbian.et.test.driver.Task aTask, java.lang.String aDevicePath, java.lang.String aHostPath)
          Adds a Transfer To Symbian task to the current Task.
static void dtdResolver(org.jdom.input.SAXBuilder aBuilder)
          Resolves the DTD's of the files.
static java.lang.String fixXmlFile(java.lang.String aXMLFilePath)
          Fixes incorrect XML files with common known problems.
private  java.lang.String getNextFile(java.lang.String aXmlFilePath, java.lang.String aFileName, boolean aIsServer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iImportDir

private java.io.File iImportDir
The Import directory.


iDriverFactory

private final com.symbian.et.test.driver.DriverFactory iDriverFactory

XML_FILE_MARKER

public static final java.lang.String XML_FILE_MARKER
XML File marker.

See Also:
Constant Field Values

ORIGINAL_XML_FILE_MARKER

public static final java.lang.String ORIGINAL_XML_FILE_MARKER
The orignal XML file marker.

See Also:
Constant Field Values

ERR_FILE_IGNORED

public static final java.lang.String ERR_FILE_IGNORED
Warning message if the file is ignored.

See Also:
Constant Field Values

LOGGER

protected static final java.util.logging.Logger LOGGER
The logger for the Visitor class.

Constructor Detail

FrameworkGenerator

public FrameworkGenerator(java.io.File aImportDir)
Parameters:
aImportDir - The import directory of XML files.
Method Detail

buildEmfModel

public com.symbian.et.test.driver.Task buildEmfModel()
                                              throws java.io.IOException
Build test framework from its root.

Returns:
The root task for the EMF tree.
Throws:
java.io.IOException - If the XML root directory is invalid.

buildTaskEmfModel

private com.symbian.et.test.driver.Task buildTaskEmfModel(java.lang.String aXmlFilePath,
                                                          boolean aIsRoot,
                                                          com.symbian.et.test.driver.Task aBaseTask)
                                                   throws org.jdom.JDOMException,
                                                          java.io.IOException
Parameters:
aXmlFilePath - of the XML file associated to the suite
aIsRoot - if this suite is the root of the tree
aBaseTask -
Returns:
TstComponent
Throws:
org.jdom.JDOMException - If the parsing of the file fails.
java.io.IOException

getNextFile

private java.lang.String getNextFile(java.lang.String aXmlFilePath,
                                     java.lang.String aFileName,
                                     boolean aIsServer)
Parameters:
aXmlFilePath - The path to the next XML file.
aFileName - The actual file name for the next XML file.
aIsServer - true if the next XML file is a server, false otherwise.
Returns:
The path to the next XML file.

createResourceItem

private void createResourceItem(com.symbian.et.test.driver.Task aTask,
                                java.util.List aResource)
Adds a resource to a Task.

Parameters:
aTask - The Task to add the resource item to.
aResource - The list of resources to add to the Task

createTransferToSymbian

private void createTransferToSymbian(com.symbian.et.test.driver.Task aTask,
                                     java.lang.String aDevicePath,
                                     java.lang.String aHostPath)
Adds a Transfer To Symbian task to the current Task.

Parameters:
aTask - The Task to add the task to.
aDevicePath - The device path for the transfer to symbian task.
aHostPath - The host path for the transfer to symbian task.

createRetrieveFromSymbian

private void createRetrieveFromSymbian(com.symbian.et.test.driver.Task aTask,
                                       java.lang.String aRetrievePath,
                                       java.lang.String aHostPath)
Adds a Retrieve from Symbian task to the current Task.

Parameters:
aTask - The current task.
aRetrievePath - The path of the file to retrieve from.
aHostPath - The path of where to copy the file to.

createExecuteOnSymbian

private void createExecuteOnSymbian(com.symbian.et.test.driver.Task aTask,
                                    java.lang.String aArgument,
                                    com.symbian.et.test.driver.StatCommand aStatCommand)
Adds an Execute On Symbian task to the current Task.

Parameters:
aTask - The current Task.
aArgument - The arguments for the command.
aStatCommand - The command to run.

createDepBuild

private void createDepBuild(com.symbian.et.test.driver.ExecuteOnPC aExecuteOnPC,
                            com.symbian.et.test.driver.Task aTask,
                            org.jdom.Element aRoot,
                            boolean aResource,
                            boolean aLegacyBuildable)
Adds all the build dependencies to the current Task.

Parameters:
aExecuteOnPC -
aTask - The current Task.
aRoot - The root of the build dependencies
aResource - true if the build Task contains resources.
aLegacyBuildable - true if the code uses the tag "buildable" instead of "build".

createBuild

private com.symbian.et.test.driver.Build createBuild(boolean aSync,
                                                     boolean aTestBuild,
                                                     java.lang.String aURI,
                                                     java.lang.String aComponenetName,
                                                     java.lang.String aHostPath,
                                                     java.lang.String aDevicePath)
Creates a build command.

Parameters:
aSync - If the build command should be run syncronous.
aTestBuild - true if this is a test build.
aURI - The location of the group directory.
aComponenetName - The MMP file.
aHostPath -
aDevicePath - The location of where to put the file on the device.
Returns:
A build object for the EMF tree.

createExecuteOnPc

private void createExecuteOnPc(com.symbian.et.test.driver.ExecuteOnPC aExecuteOnPC,
                               com.symbian.et.test.driver.Task aTask,
                               java.lang.String aCmd)
Adds a Execute on PC command to the current Task.

Parameters:
aExecuteOnPC -
aTask - The current Task.
aCmd - The command to run in the task.

dtdResolver

public static void dtdResolver(org.jdom.input.SAXBuilder aBuilder)
Resolves the DTD's of the files.

Parameters:
aBuilder - The SAX builder.

fixXmlFile

public static java.lang.String fixXmlFile(java.lang.String aXMLFilePath)
                                   throws java.io.IOException
Fixes incorrect XML files with common known problems.

Parameters:
aXMLFilePath - of the XML file to check
Returns:
either the path of the XML file if it was valid or the path of a valid one
Throws:
java.io.IOException - If there is an I/O errors occurs with the XML files.