/** * Constructs a test executor with default options. */ public Test() { this.setupOpts = new SetupOptions(); this.runOpts = new RuntimeOptions(); }
/** * Default constructor sets the location of the test log directory to * TE_BASE/users/{user.name}; it is created if it does not exist. */ public RuntimeOptions() { File baseDir = SetupOptions.getBaseConfigDirectory(); File usersDir = new File(baseDir, "users"); File userDir = new File(usersDir, System.getProperty("user.name")); if (!userDir.exists()) { userDir.mkdirs(); } this.testLogDir = userDir; }
public void recordingStartClause(SuiteEntry suite) throws Exception{ if (null != suite && SetupOptions.recordingInfo(suite.getLocalName()) == true) { //Create a document builder for storing the data. TECore.icFactoryClause = DocumentBuilderFactory.newInstance(); // Fortify Mod: prevent external entity injection TECore.icFactoryClause.setExpandEntityReferences(false); try { TECore.icBuilderClause = TECore.icFactoryClause.newDocumentBuilder(); // Create a document for storing the xml data TECore.docClause = TECore.icBuilder.newDocument(); TECore.mainRootElementClause = TECore.docClause.createElement(Constants.Requests); //Append the data in previous saved data. TECore.docClause.appendChild(TECore.mainRootElementClause); } catch (Exception e) { System.out.println(ERROR_ON__RECORDING_AT_STARTING_ + e.toString()); } } } /**
File workDir = setupOpts.getWorkDir(); runOpts.setWorkDir(workDir); File logDir = runOpts.getLogDir(); if (!sourceFile.isAbsolute()) { File scriptsDir = new File( SetupOptions.getBaseConfigDirectory(), "scripts"); sourceFile = new File(scriptsDir, sourcePath); setupOpts.addSource(sourceFile); } else { System.out.println("Error: Cannot find CTL script(s) at " return; } else if (arg.equals("-validate=no")) { setupOpts.setValidate(false); } else if ((arg.startsWith("-form="))) { runOpts.addRecordedForm(arg.substring(6)); docCode.generateDocumentation(setupOpts.getSources().get(0).getAbsolutePath(), fos); fos.close(); System.out.println("Test documentation file \"" else masterIndex = new Index(); TEClassLoader cl = new TEClassLoader(findResourcesDirectory(sourceFile)); Engine engine = new Engine(masterIndex, setupOpts.getSourcesName(), cl); if (setupOpts.isPreload() || mode == CHECK_MODE) { engine.preload(masterIndex, setupOpts.getSourcesName());
public static void main(String[] args) throws Exception { SetupOptions setupOpts = new SetupOptions(); if (args[i].startsWith("-source=")) { File scriptsDir = new File( SetupOptions.getBaseConfigDirectory(), "scripts"); File f = new File(scriptsDir, args[i].substring(8)); if (f.exists()) { setupOpts.addSource(f); } else { System.out.println("Error: Can't find CTL script(s) at "
sources.add(f.getParentFile()); sources.addAll(opts.getSources()); source.getAbsolutePath()); String encodedName = createEncodedName(source); File workingDir = new File(opts.getWorkDir(), encodedName); if (!workingDir.exists() && !workingDir.mkdir()) { LOGR.log(Level.WARNING, if (opts.isValidate()) { int old_count = validation_eh.getErrorCount(); LOGR.log(Level.CONFIG, "Validating " + sourceFile);
TEClassLoader defaultLoader = new TEClassLoader(null); Engine engine = new Engine(masterIndex, setupOpts.getSourcesName(), defaultLoader); TECore ctlRunner = new TECore(engine, masterIndex, runOpts);
File workDir = setupOpts.getWorkDir(); runOpts.setWorkDir(workDir); File logDir = runOpts.getLogDir(); if (!sourceFile.isAbsolute()) { File scriptsDir = new File( SetupOptions.getBaseConfigDirectory(), "scripts"); sourceFile = new File(scriptsDir, sourcePath); setupOpts.addSource(sourceFile); } else { System.out.println("Error: Cannot find CTL script(s) at " return; } else if (arg.equals("-validate=no")) { setupOpts.setValidate(false); } else if ((arg.startsWith("-form="))) { runOpts.addRecordedForm(arg.substring(6)); docCode.generateDocumentation(setupOpts.getSources().get(0).getAbsolutePath(), fos); fos.close(); System.out.println("Test documentation file \"" else masterIndex = new Index(); TEClassLoader cl = new TEClassLoader(findResourcesDirectory(sourceFile)); Engine engine = new Engine(masterIndex, setupOpts.getSourcesName(), cl); if (setupOpts.isPreload() || mode == CHECK_MODE) { engine.preload(masterIndex, setupOpts.getSourcesName());
public static void main(String[] args) throws Exception { SetupOptions setupOpts = new SetupOptions(); if (args[i].startsWith("-source=")) { File scriptsDir = new File( SetupOptions.getBaseConfigDirectory(), "scripts"); File f = new File(scriptsDir, args[i].substring(8)); if (f.exists()) { setupOpts.addSource(f); } else { System.out.println("Error: Can't find CTL script(s) at "
sources.add(f.getParentFile()); sources.addAll(opts.getSources()); source.getAbsolutePath()); String encodedName = createEncodedName(source); File workingDir = new File(opts.getWorkDir(), encodedName); if (!workingDir.exists() && !workingDir.mkdir()) { LOGR.log(Level.WARNING, if (opts.isValidate()) { int old_count = validation_eh.getErrorCount(); LOGR.log(Level.CONFIG, "Validating " + sourceFile);
TEClassLoader defaultLoader = new TEClassLoader(null); Engine engine = new Engine(masterIndex, setupOpts.getSourcesName(), defaultLoader); TECore ctlRunner = new TECore(engine, masterIndex, runOpts);
public void recordingStartClause(SuiteEntry suite) throws Exception{ if (null != suite && SetupOptions.recordingInfo(suite.getLocalName()) == true) { //Create a document builder for storing the data. TECore.icFactoryClause = DocumentBuilderFactory.newInstance(); // Fortify Mod: prevent external entity injection TECore.icFactoryClause.setExpandEntityReferences(false); try { TECore.icBuilderClause = TECore.icFactoryClause.newDocumentBuilder(); // Create a document for storing the xml data TECore.docClause = TECore.icBuilder.newDocument(); TECore.mainRootElementClause = TECore.docClause.createElement(Constants.Requests); //Append the data in previous saved data. TECore.docClause.appendChild(TECore.mainRootElementClause); } catch (Exception e) { System.out.println(ERROR_ON__RECORDING_AT_STARTING_ + e.toString()); } } } /**
/** * Default constructor sets the location of the test log directory to * TE_BASE/users/{user.name}; it is created if it does not exist. */ public RuntimeOptions() { File baseDir = SetupOptions.getBaseConfigDirectory(); File usersDir = new File(baseDir, "users"); File userDir = new File(usersDir, System.getProperty("user.name")); if (!userDir.exists()) { userDir.mkdirs(); } this.testLogDir = userDir; }
/** * Constructs a test executor with default options. */ public Test() { this.setupOpts = new SetupOptions(); this.runOpts = new RuntimeOptions(); }
/** * Check Test recording ON or OFF if ON then create a builder for storing the * log in single file. * @param suite * @throws Exception */ public void recordingStartCheck(SuiteEntry suite) throws Exception { // Check suite variable is not empty and get suite local name. if (null != suite && SetupOptions.recordingInfo(suite.getLocalName()) == true) { //Create a document builder for storing the data. TECore.icFactory = DocumentBuilderFactory.newInstance(); // Fortify Mod: prevent external entity injection TECore.icFactory.setExpandEntityReferences(false); try { TECore.icBuilder = TECore.icFactory.newDocumentBuilder(); // Create a document for storing the xml data TECore.doc = TECore.icBuilder.newDocument(); TECore.mainRootElement = TECore.doc.createElement(Constants.Requests); //Append the data in previous saved data. TECore.doc.appendChild(TECore.mainRootElement); } catch (Exception e) { System.out.println(ERROR_ON__RECORDING_AT_STARTING_ + e.toString()); } } }
String path = getBaseConfigDirectory() + "/config.xml"; if (new File(path).exists()) {
/** * Check Test recording ON or OFF if ON then create a builder for storing the * log in single file. * @param suite * @throws Exception */ public void recordingStartCheck(SuiteEntry suite) throws Exception { // Check suite variable is not empty and get suite local name. if (null != suite && SetupOptions.recordingInfo(suite.getLocalName()) == true) { //Create a document builder for storing the data. TECore.icFactory = DocumentBuilderFactory.newInstance(); // Fortify Mod: prevent external entity injection TECore.icFactory.setExpandEntityReferences(false); try { TECore.icBuilder = TECore.icFactory.newDocumentBuilder(); // Create a document for storing the xml data TECore.doc = TECore.icBuilder.newDocument(); TECore.mainRootElement = TECore.doc.createElement(Constants.Requests); //Append the data in previous saved data. TECore.doc.appendChild(TECore.mainRootElement); } catch (Exception e) { System.out.println(ERROR_ON__RECORDING_AT_STARTING_ + e.toString()); } } }
String path = getBaseConfigDirectory() + "/config.xml"; if (new File(path).exists()) {
public void saveRecordingClause(SuiteEntry suite, File dirPath) throws Exception { if (null != suite && SetupOptions.recordingInfo(suite.getLocalName()) == true) { try {
public void saveRecordingClause(SuiteEntry suite, File dirPath) throws Exception { if (null != suite && SetupOptions.recordingInfo(suite.getLocalName()) == true) { try {