issrg.test.ptb
Class PTBRequestGenerator

java.lang.Object
  extended by issrg.test.ptb.PTBRequestGenerator

public class PTBRequestGenerator
extends java.lang.Object

This is the main class of the Permis Test Bench Request Generator Program. With this application you can create, in an automated manner, request files from independent text files containing entries for users, targets and actions. The generated request file can be used by the Permis Test Bench without further editing.

Version:
0.1
Author:
O Canovas, O Otenko

Field Summary
protected  java.util.ArrayList actions
           
protected  java.util.ArrayList targets
           
protected  java.util.ArrayList users
           
 
Constructor Summary
PTBRequestGenerator()
          Constructs a Permis Test Bench Request Generator.
 
Method Summary
protected  void generateRequestFile(java.lang.String file)
          Generates the request file according to the format expected by the Permis Test Bench
protected  boolean loadActionsFile(java.lang.String file)
          Reads the list of actions contained in a actions file.
 boolean loadTargetsFile(java.lang.String file)
          Reads the list of targets contained in a targets file.
 boolean loadUsersFile(java.lang.String file)
          Reads the list of users contained in a users file.
protected  java.lang.String[] loadVarValue(java.io.BufferedReader in)
          Reads (attribute,value) pairs from a buffered reader.
static void main(java.lang.String[] args)
           
static void printUsage()
          Prints how to use this application (number and order of parameters)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

users

protected java.util.ArrayList users

targets

protected java.util.ArrayList targets

actions

protected java.util.ArrayList actions
Constructor Detail

PTBRequestGenerator

public PTBRequestGenerator()
Constructs a Permis Test Bench Request Generator. It has no parameters, and its main function is to initialise the Array Lists

Method Detail

main

public static void main(java.lang.String[] args)

printUsage

public static void printUsage()
Prints how to use this application (number and order of parameters)


loadVarValue

protected java.lang.String[] loadVarValue(java.io.BufferedReader in)
Reads (attribute,value) pairs from a buffered reader. This method processes each line of the buffered reader looking for the PARAMETER=VALUE pattern. Once that pattern is found, it returns an array of Strings containing the name of the parameter in the first element and the value in the second element. On the other hand, when the end of the buffered reader is reached, it returns null.

Parameters:
in - is the buffered reader
Returns:
String[2]: [0] is the name of the parameter; [1] is the value; null if EOF

loadUsersFile

public boolean loadUsersFile(java.lang.String file)
Reads the list of users contained in a users file. Each user entry has the following format:

If a line starts with #, it will be considered as a comment (it is ignored).

Parameters:
file - is the name of the file containing the set of users
Returns:
true if file was successfully read

loadTargetsFile

public boolean loadTargetsFile(java.lang.String file)
Reads the list of targets contained in a targets file. Each target entry has the following format:

If a line starts with #, it will be considered as a comment (it is ignored).

Parameters:
file - is the name of the file containing the set of targets
Returns:
true if file was successfully read

loadActionsFile

protected boolean loadActionsFile(java.lang.String file)
Reads the list of actions contained in a actions file. Each action has the following format (the number of entries, NOE, specifies the minimun and maximun number):

If a line starts with #, it will be considered as a comment (it is ignored).

Parameters:
file - is the name of the file containing the set of actions
Returns:
true if file was successfully read

generateRequestFile

protected void generateRequestFile(java.lang.String file)
Generates the request file according to the format expected by the Permis Test Bench

Parameters:
file - is the name which is going to contain the requests