|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.upm.dit.gsi.beast.reader.Reader
public class Reader
Project: beast File: es.upm.dit.gsi.beast.reader.Reader.java Main class to transform the plain text given by the client to the necessary classes to run each Test. These classes are the Scenario, Setup and Evaluation, which emulate the GIVEN, WHEN and THEN parts of the plain text; the .story file whit the plain text of the test and the its .java class with the same name to interpret it. Furthermore, one casemanager must be created, which will run all the tests. Grupo de Sistemas Inteligentes Departamento de Ingeniería de Sistemas Telemáticos Universidad Politécnica de Madrid (UPM)
Field Summary | |
---|---|
static String |
MAS
Multi Agent System Test Reader |
static String |
SYSTEM
System Test Reader |
Constructor Summary | |
---|---|
Reader()
|
Method Summary | |
---|---|
static String |
changeFirstLetterToCapital(String word)
Method used to write the name of the scenarios |
static String |
changeFirstLetterToLowerCase(String word)
Method used to write the name of the scenarios methods |
static String |
createClassName(String scenarioDescription)
Given a string with the scenario or story name, creates a Class Name with no spaces and first letter capital |
static void |
createDotStoryFile(String scenarioName,
String srcTestRootFolder,
String packagePath,
String givenDescription,
String whenDescription,
String thenDescription)
Creates the .story file necessary for every Beast Test Case. |
protected static String |
createDotStoryName(String scenarioName)
Creates the name of the .story file to be wrote with the testcase. |
protected static BufferedReader |
createFileReader(String file_name)
Method to read our client's plain text |
protected static FileWriter |
createFileWriter(String scenarioName,
String aux_package_path,
String dest_dir)
Method to get the file writer required for the .story files |
static String |
createFirstLowCaseName(String scenarioDescription)
Given a string with method or package name, creates a Class Name with no spaces and first letter lower case |
static File |
createFolder(String path,
String dest_dir)
This method returns the existing folder, and if it does not exist, the method generates it. |
static String |
createFolderPath(String path)
This method changes package_path into folder's path |
protected static String |
createTestPath(String aux_package_path,
String scenarioName)
This method will generate the paths that casemanager must include in its code |
protected static boolean |
fileDoesNotExist(String file,
String path,
String dest_dir)
Method to know if already exists one file with the same name in the same folder |
static void |
generateJavaFiles(String requirementsFolder,
String platformName,
String src_test_dir,
String tests_package,
String casemanager_package,
String loggingPropFile,
String specificationPhase)
Main method of the class, which handles all the process to create all tests. |
static void |
main(String[] args)
Main method to start reading the plain text given by the client |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MAS
public static final String SYSTEM
Constructor Detail |
---|
public Reader()
Method Detail |
---|
public static void generateJavaFiles(String requirementsFolder, String platformName, String src_test_dir, String tests_package, String casemanager_package, String loggingPropFile, String specificationPhase) throws Exception
requirementsFolder
- , it is the folder where the plain text given by the client is
storedplatformName
- , to choose the MAS platform (JADE, JADEX, etc.)src_test_dir
- , the folder where our classes are createdtests_package
- , the name of the package where the stories are createdcasemanager_package
- , the path where casemanager must be createdloggingPropFile
- , properties filespecificationPhase
- , the Type of reader (MAS or SYSTEM). By default, uses a MAS
Reader
Exception
- , if any error is found in the configurationpublic static String changeFirstLetterToCapital(String word)
word
-
public static String changeFirstLetterToLowerCase(String word)
word
-
public static String createClassName(String scenarioDescription)
String
- - The name of the scenario/story. It should be in lower case.public static String createFirstLowCaseName(String scenarioDescription)
String
- - The name of the scenario/story. It should be in lower case.protected static boolean fileDoesNotExist(String file, String path, String dest_dir)
scenario_name
- path
- dest_dir
-
public static File createFolder(String path, String dest_dir) throws BeastException
path
- dest_dir
-
BeastException
public static String createFolderPath(String path)
path
- , as es.upm.gsi
protected static String createTestPath(String aux_package_path, String scenarioName)
aux_package_path
- the path of the .story files, similar than es.upm.dit.gsi...scenarioName
-
protected static BufferedReader createFileReader(String file_name) throws BeastException
file_name
-
BeastException
- if any problem is found whit the filepublic static void createDotStoryFile(String scenarioName, String srcTestRootFolder, String packagePath, String givenDescription, String whenDescription, String thenDescription) throws BeastException
scenarioName
- - The name of the scenario, with spacessrcTestRootFolder
- - The test root folderpackagePath
- - The package of the BeastTestCasescenarioDescription
- - the scenario namegivenDescription
- - The given descriptionwhenDescription
- - The when descriptionthenDescription
- - The then description
BeastException
protected static FileWriter createFileWriter(String scenarioName, String aux_package_path, String dest_dir) throws BeastException
scenarioName
- aux_package_path
- dest_dir
-
BeastException
protected static String createDotStoryName(String scenarioName)
scenarioName
- - The scenario name, with spaces
public static void main(String[] args) throws Exception
args
- , where arg[0] is Beast configuration file (beast.properties)
and arg[1] is Logger configuration file (logger.properties)
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |