Commit 0c828d26 authored by Jonathan Shahen's avatar Jonathan Shahen

Reduced messages when running test

parent ff3be132
......@@ -75,8 +75,25 @@ public class ConverterInstance {
specHelper.loadSpecFiles();
/* Timing */timing.stopTimer("loadFile");
logger.info("Spec File(s) to Convert: " + specHelper.specFiles);
if (!cmd.hasOption(OptionString.TO_ALL.toString())) {
if (!cmd.hasOption(OptionString.TO_ASAPTIME_NSA.toString())) {
logger.info("[SKIP] Skipping converting to ASAPTime NSA");
}
if (!cmd.hasOption(OptionString.TO_ASAPTIME_SA.toString())) {
logger.info("[SKIP] Skipping converting to ASAPTime SA");
}
if (!cmd.hasOption(OptionString.TO_TROLE.toString())) {
logger.info("[SKIP] Skipping converting to TRole");
}
if (!cmd.hasOption(OptionString.TO_TRULE.toString())) {
logger.info("[SKIP] Skipping converting to TRule");
}
if (!cmd.hasOption(OptionString.TO_MOHAWK.toString())) {
logger.info("[SKIP] Skipping converting to Mohawk");
}
}
logger.info("Spec File(s) to Convert: " + specHelper.specFiles);
for (Integer i = 1; i <= specHelper.specFiles.size(); i++) {
File specFile = specHelper.specFiles.get(i - 1);
......@@ -98,8 +115,8 @@ public class ConverterInstance {
if (cmd.hasOption(OptionString.TO_ASAPTIME_NSA.toString())
|| cmd.hasOption(OptionString.TO_ALL.toString())) {
logger.info("[CONVERTING] Converting to Rainse...");
/* Timing */timing.startTimer("convertToRanise (" + i + ")");
logger.info("[CONVERTING] Converting to ASAPTime NSA...");
/* Timing */timing.startTimer("convertToASAPTimeNSA (" + i + ")");
ConvertToASAPTimeNSA toRanise = new ConvertToASAPTimeNSA();
toRanise.convert(m, specFile, true);
......@@ -112,18 +129,16 @@ public class ConverterInstance {
}
/* Timing */timing.stopTimer("convertToRanise (" + i + ")");
logger.info("[CONVERTING] ...Done Converting to Rainse");
} else {
logger.info("[SKIP] Skipping converting to Ranise");
logger.info("[CONVERTING] ...Done Converting to ASAPTime NSA");
}
if (cmd.hasOption(OptionString.TO_TROLE.toString()) || cmd.hasOption(OptionString.TO_ALL.toString())) {
logger.info("[CONVERTING] Converting to Uzun...");
/* Timing */timing.startTimer("convertToUzun (" + i + ")");
if (cmd.hasOption(OptionString.TO_TRULE.toString()) || cmd.hasOption(OptionString.TO_ALL.toString())) {
logger.info("[CONVERTING] Converting to TRule...");
/* Timing */timing.startTimer("convertToTRule (" + i + ")");
// TODO: Convert imported spec files to Uzun format
ConvertToTRule toUzun = new ConvertToTRule();
String uzunStr = toUzun.convert(m, specFile, true);
toUzun.convert(m, specFile, true);
if (toUzun.lastError == null) {
logger.info("[SUCCESS] Successfully converted to Uzun's Input Format");
......@@ -132,10 +147,8 @@ public class ConverterInstance {
+ toUzun.lastError);
}
/* Timing */timing.stopTimer("convertToUzun (" + i + ")");
logger.info("[CONVERTING] ...Done Converting to Uzun");
} else {
logger.info("[SKIP] Skipping converting to Uzun");
/* Timing */timing.stopTimer("convertToTRule (" + i + ")");
logger.info("[CONVERTING] ...Done Converting to TRule");
}
if (cmd.hasOption(OptionString.TO_MOHAWK.toString()) || cmd.hasOption(OptionString.TO_ALL.toString())) {
......@@ -144,7 +157,7 @@ public class ConverterInstance {
// TODO: Convert imported spec files to Mohawk format
ConvertToMohawk toMohawk = new ConvertToMohawk();
String mohawkStr = toMohawk.convert(m, specFile, true);
toMohawk.convert(m, specFile, true);
if (toMohawk.lastError == null) {
logger.info("[SUCCESS] Successfully converted to Mohawk's Input Format");
......@@ -155,8 +168,6 @@ public class ConverterInstance {
/* Timing */timing.stopTimer("convertToMohawk (" + i + ")");
logger.info("[CONVERTING] ...Done Converting to Mohawk");
} else {
logger.info("[SKIP] Skipping converting to Mohawk");
}
if (cmd.hasOption(OptionString.TO_MOHAWK_T.toString())) {
......@@ -169,8 +180,6 @@ public class ConverterInstance {
/* Timing */timing.stopTimer("convertToMohawkT (" + i + ")");
logger.info("[CONVERTING] ...Done Converting to Mohawk-T");
} else {
logger.info("[SKIP] Skipping converting to Mohawk");
}
}
/* Timing */timing.stopTimer("totalTime");
......
......@@ -8,7 +8,7 @@ package mohawk.converter.generated;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.logging.Logger;
import java.util.logging.*;
import org.apache.commons.lang3.StringUtils;
import mohawk.converter.helper.*;
......@@ -32,8 +32,10 @@ import mohawk.global.helper.*;
private void logmsg(String msg) {
if(logger.getLevel() == Level.FINE) {
System.out.println(StringUtils.repeat(" ", tabsize) + msg);
}
}
}
init
......
......@@ -108,7 +108,7 @@ public class SpecHelper {
FileInputStream fis = new FileInputStream(specFile);
error.errorFound = false; // reset the error listener
MohawkTARBACParser parser = ConverterRegressionTests.runParser(fis, error);
MohawkTARBACParser parser = ConverterRegressionTests.runParser(fis, error, false);
if (error.errorFound) {
logger.warning("Unable to parse the file: " + specFile.getAbsolutePath());
......
......@@ -198,19 +198,24 @@ public class ConverterRegressionTests {
}
public static MohawkTARBACParser runParser(InputStream is, BaseErrorListener errorListener) throws IOException {
return runParser(is, errorListener, true);
}
public static MohawkTARBACParser runParser(InputStream is, BaseErrorListener errorListener, Boolean displayStats)
throws IOException {
ANTLRInputStream input = new ANTLRInputStream(is);
MohawkTARBACLexer lexer = new MohawkTARBACLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
MohawkTARBACParser parser = new MohawkTARBACParser(tokens);
System.out.println(tokens.getText());
parser.removeErrorListeners();
parser.addErrorListener(errorListener);
parser.init();
if (displayStats) {
MohawkT m = parser.mohawkT;
System.out.println("Tokes: " + tokens.getText());
System.out.println("Roles: " + m.roleHelper);
System.out.println("Timeslots: " + m.timeIntervalHelper);
System.out.println("Max Timeslot: " + m.timeIntervalHelper.maxTimeSlot);
......@@ -220,6 +225,7 @@ public class ConverterRegressionTests {
System.out.println(m.canDisable.toString());
System.out.println(m.canEnable.toString());
System.out.println(m.canRevoke.toString());
}
return parser;
}
......
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