Commit 3731938f authored by Jonathan Shahen's avatar Jonathan Shahen

Moving things around and changing the values that "Expected" can take (now it...

Moving things around and changing the values that "Expected" can take (now it is more like the toString version in mohawk.global.pieces.ExpectedResult)
parent 2c9354de
......@@ -24,7 +24,7 @@ CanDisable {
// same as above
}
// Expected solution: {TRUE, FALSE, UNKNOWN}; where for TRUE is means that we can achieve the Query
// Expected solution: {REACHABLE, UNREACHABLE, UNKNOWN}; where for TRUE is means that we can achieve the Query
Expected: UNKNOWN
// Query: timeslot to check, [set of roles that the user must have in the timeslot (no NOTs allowed)]
......
......@@ -23,7 +23,7 @@ CanEnable {}
CanDisable {}
// Expected solution: {TRUE, FALSE, UNKNOWN}; where for TRUE is means that we can achieve the Query
// Expected solution: {REACHABLE, UNREACHABLE, UNKNOWN}; where for TRUE is means that we can achieve the Query
Expected: UNKNOWN
// Query: timeslot to check, [set of roles that the user must have in the timeslot (no NOTs allowed)]
......
......@@ -50,17 +50,17 @@ public class ConverterInstance {
CommandLineParser cmdParser = new BasicParser();
CommandLine cmd = cmdParser.parse(options, args);
setupLoggerOptions(cmd, options, args);
setupLoggerOptions(cmd, options);
if (setupReturnImmediatelyOptions(cmd, options, args)) { return 0; }
if (setupReturnImmediatelyOptions(cmd, options)) { return 0; }
/* Timing */timing.startTimer("totalTime");
setupUserPreferenceOptions(cmd, options, args);
setupUserPreferenceOptions(cmd, options);
setupSpecOptions(cmd, options, args);
setupSpecOptions(cmd, options);
setupResultOptions(cmd, options, args);
setupResultOptions(cmd, options);
/* Timing */timing.startTimer("loadFile");
if (cmd.hasOption("bulk")) {
......@@ -230,8 +230,7 @@ public class ConverterInstance {
LoggerLevel = loggerLevel;
}
private void setupLoggerOptions(CommandLine cmd, Options options, String[] args) throws SecurityException,
IOException {
private void setupLoggerOptions(CommandLine cmd, Options options) throws SecurityException, IOException {
// Logging Level
logger.setUseParentHandlers(false);
consoleHandler.setFormatter(new MohawkConsoleFormatter());
......@@ -312,8 +311,8 @@ public class ConverterInstance {
}
}
private Boolean setupReturnImmediatelyOptions(CommandLine cmd, Options options, String[] args) {
if (cmd.hasOption("help") == true || args.length < 1) {
private Boolean setupReturnImmediatelyOptions(CommandLine cmd, Options options) {
if (cmd.hasOption("help") == true || cmd.getArgs().length == 0) {
HelpFormatter f = new HelpFormatter();
if (cmd.hasOption("maxw")) {
try {
......@@ -346,7 +345,7 @@ public class ConverterInstance {
return false;
}
private void setupSpecOptions(CommandLine cmd, Options options, String[] args) {
private void setupSpecOptions(CommandLine cmd, Options options) {
// Grab the SPEC file
if (cmd.hasOption("rbacspec")) {
logger.fine("[OPTION] Using a specific SPEC File: " + cmd.getOptionValue("rbacspec"));
......@@ -371,7 +370,7 @@ public class ConverterInstance {
}
}
private void setupUserPreferenceOptions(CommandLine cmd, Options options, String[] args) {
private void setupUserPreferenceOptions(CommandLine cmd, Options options) {
// Set the Console's Max Width
if (cmd.hasOption("maxw")) {
logger.fine("[OPTION] Setting the console's maximum width");
......@@ -396,7 +395,7 @@ public class ConverterInstance {
}
private void setupResultOptions(CommandLine cmd, Options options, String[] args) {
private void setupResultOptions(CommandLine cmd, Options options) {
if (cmd.hasOption("results")) {
logger.fine("[OPTION] Changing the results file");
resultsFile = cmd.getOptionValue("results");
......
......@@ -13,6 +13,7 @@ import java.util.logging.Logger;
import org.apache.commons.lang3.StringUtils;
import mohawk.converter.helper.*;
import mohawk.global.pieces.*;
import mohawk.global.helper.*;
}
@members {
......@@ -167,11 +168,11 @@ expected
:
Expected Colon
(
True
{expectedResult = ExpectedResult.TRUE;}
Reachable
{expectedResult = ExpectedResult.REACHABLE;}
| False
{expectedResult = ExpectedResult.FALSE;}
| Unreachable
{expectedResult = ExpectedResult.UNREACHABLE;}
| Unknown
{expectedResult = ExpectedResult.UNKNOWN;}
......@@ -257,19 +258,19 @@ roleArray returns [ArrayList<Role> r] @init {
)* RightBracket
;
timeslotArray returns [ArrayList<Integer> t] @init {
$t = new ArrayList<Integer>();
timeslotArray returns [ArrayList<TimeSlot> t] @init {
$t = new ArrayList<TimeSlot>();
}
:
LeftBracket a = timeslot
{$t.add($a.val);}
{$t.add(new TimeSlot($a.val));}
(
',' b = timeslot
{$t.add($b.val);}
{$t.add(new TimeSlot($b.val));}
)? RightBracket
| c = timeslot {$t.add($c.val);}
| c = timeslot {$t.add(new TimeSlot($c.val));}
;
timeInterval returns [Integer t0, Integer t1]
......@@ -401,6 +402,16 @@ Unknown
'UNKNOWN'
;
Reachable
:
'REACHABLE'
;
Unreachable
:
'UNREACHABLE'
;
// Special Notation
/*
RoleStrict
......
......@@ -8,7 +8,7 @@ import java.util.logging.Logger;
import mohawk.converter.generated.MohawkTARBACParser;
import mohawk.converter.testing.BooleanErrorListener;
import mohawk.converter.testing.RegressionTests;
import mohawk.converter.testing.ConverterRegressionTests;
public class SpecHelper {
public final static Logger logger = Logger.getLogger("mohawk");
......@@ -108,7 +108,7 @@ public class SpecHelper {
FileInputStream fis = new FileInputStream(specFile);
error.errorFound = false; // reset the error listener
MohawkTARBACParser parser = RegressionTests.runParser(fis, error);
MohawkTARBACParser parser = ConverterRegressionTests.runParser(fis, error);
if (error.errorFound) {
logger.warning("Unable to parse the file: " + specFile.getAbsolutePath());
......
package mohawk.converter.pieces.rules;
import mohawk.converter.helper.RoleHelper;
import mohawk.converter.helper.TimeIntervalHelper;
import mohawk.global.helper.RoleHelper;
import mohawk.global.helper.TimeIntervalHelper;
import mohawk.global.pieces.Role;
import mohawk.global.pieces.Rule;
......
package mohawk.converter.pieces.rules;
import mohawk.converter.helper.RoleHelper;
import mohawk.converter.helper.TimeIntervalHelper;
import mohawk.global.helper.RoleHelper;
import mohawk.global.helper.TimeIntervalHelper;
import mohawk.global.pieces.Role;
import mohawk.global.pieces.Rule;
......
package mohawk.converter.pieces.rules;
import mohawk.converter.helper.RoleHelper;
import mohawk.converter.helper.TimeIntervalHelper;
import mohawk.global.helper.RoleHelper;
import mohawk.global.helper.TimeIntervalHelper;
import mohawk.global.pieces.Role;
import mohawk.global.pieces.Rule;
......
package mohawk.converter.pieces.rules;
import mohawk.converter.helper.RoleHelper;
import mohawk.converter.helper.TimeIntervalHelper;
import mohawk.global.helper.RoleHelper;
import mohawk.global.helper.TimeIntervalHelper;
import mohawk.global.pieces.Role;
import mohawk.global.pieces.Rule;
......
package mohawk.converter.pieces.rules;
import mohawk.converter.helper.RoleHelper;
import mohawk.converter.helper.TimeIntervalHelper;
import mohawk.global.helper.RoleHelper;
import mohawk.global.helper.TimeIntervalHelper;
import mohawk.global.pieces.Role;
import mohawk.global.pieces.Rule;
......
......@@ -32,7 +32,7 @@ import org.junit.Test;
*
*/
public class RegressionTests {
public class ConverterRegressionTests {
public final Logger logger = Logger.getLogger("mohawk-converter");
public String folderbase = "data/regressiontests/";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment