Output fixes
This commit is contained in:
parent
cdc6ddb331
commit
5f1059da6f
@ -17,6 +17,7 @@
|
||||
<include name="**/*.err" />
|
||||
<include name="**/*.dat" />
|
||||
<include name="**/*.log" />
|
||||
<include name="**/*.serialized" />
|
||||
<include name="**/failures" />
|
||||
<include name="**/test.gz" />
|
||||
<include name="**/test.zip" />
|
||||
|
@ -176,7 +176,9 @@
|
||||
<fileset dir="${basedir}" casesensitive="yes">
|
||||
<include name="**/update_output.bat" />
|
||||
<include name="**/validate_failures.txt" />
|
||||
<include name="**/validate_successes.txt" />
|
||||
<include name="**/strategies.txt" />
|
||||
<include name="**/edit_errors.bat" />
|
||||
</fileset>
|
||||
</delete>
|
||||
<echo message="verifyclean successful"/>
|
||||
|
@ -17,8 +17,8 @@ public class AtUnitComposition {
|
||||
return testObject.methodTwo() == 2;
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit AtUnitComposition.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit AtUnitComposition.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -23,8 +23,8 @@ public class AtUnitExample1 {
|
||||
@Test boolean failureTest() { return false; }
|
||||
@Test boolean anotherDisappointment() { return false; }
|
||||
public static void main(String[] args) throws Exception {
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit AtUnitExample1.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit AtUnitExample1.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -31,8 +31,8 @@ public class AtUnitExample2 {
|
||||
return methodOne().equals("This is methodOne");
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit AtUnitExample2.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit AtUnitExample2.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -26,8 +26,8 @@ public class AtUnitExample3 {
|
||||
}
|
||||
@Test boolean m2() { return methodTwo() == 2; }
|
||||
public static void main(String[] args) throws Exception {
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit AtUnitExample3.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit AtUnitExample3.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -57,8 +57,8 @@ public class AtUnitExample4 {
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("starting");
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit AtUnitExample4.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit AtUnitExample4.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -41,8 +41,8 @@ public class AtUnitExample5 {
|
||||
return true;
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit AtUnitExample5.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit AtUnitExample5.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -13,8 +13,8 @@ public class AtUnitExternalTest extends AtUnitExample1 {
|
||||
}
|
||||
@Test boolean _methodTwo() { return methodTwo() == 2; }
|
||||
public static void main(String[] args) throws Exception{
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit AtUnitExternalTest.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit AtUnitExternalTest.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -22,8 +22,8 @@ public class HashSetTest {
|
||||
assert testObject.isEmpty();
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit HashSetTest.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit HashSetTest.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -27,8 +27,8 @@ public class StackLStringTest extends StackL<String> {
|
||||
assert top().equals("B");
|
||||
}
|
||||
public static void main(String[] args) throws Exception {
|
||||
OSExecute.command(
|
||||
"java -cp .. onjava.atunit.AtUnit StackLStringTest.class");
|
||||
OSExecute.command("java -cp .. " +
|
||||
"onjava.atunit.AtUnit StackLStringTest.class");
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
|
@ -111,7 +111,7 @@
|
||||
<antcall target="finish"/>
|
||||
</target>
|
||||
|
||||
<target name="testable" description="Compiles and runs all examples">
|
||||
<target name="testable" description="Compiles and runs testable examples">
|
||||
<delete file="errors.txt"/>
|
||||
<subant>
|
||||
<filelist refid="testablefiles"/>
|
||||
@ -140,7 +140,9 @@
|
||||
<fileset dir="${basedir}" casesensitive="yes">
|
||||
<include name="update_output.bat" />
|
||||
<include name="validate_failures.txt" />
|
||||
<include name="validate_successes.txt" />
|
||||
<include name="strategies.txt" />
|
||||
<include name="edit_errors.bat" />
|
||||
</fileset>
|
||||
</delete>
|
||||
<echo message="verifyclean successful"/>
|
||||
|
@ -32,7 +32,7 @@ public class ApplesAndOrangesWithoutGenerics {
|
||||
___[ Error Output ]___
|
||||
Exception in thread "main" java.lang.ClassCastException:
|
||||
Orange cannot be cast to Apple
|
||||
at ApplesAndOrangesWithoutGenerics.main(ApplesAndOr
|
||||
angesWithoutGenerics.java:23)
|
||||
at ApplesAndOrangesWithoutGenerics.main(Unknown
|
||||
Source)
|
||||
___[ Exception is Expected ]___
|
||||
*/
|
||||
|
@ -52,6 +52,32 @@ public class ExplicitCriticalSection {
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
pm1: Pair: x: 10, y: 10 checkCounter = 2115789
|
||||
pm2: Pair: x: 10, y: 10 checkCounter = 2124465
|
||||
pm1: Pair: x: 10, y: 10 checkCounter = 2193118
|
||||
pm2: Pair: x: 10, y: 10 checkCounter = 2184256
|
||||
___[ Error Output ]___
|
||||
Exception in thread "pool-1-thread-4" Exception in thread
|
||||
"pool-1-thread-3"
|
||||
concurrency.Pair$PairValuesNotEqualException: Pair values
|
||||
not equal: x: 2, y: 1
|
||||
at
|
||||
concurrency.Pair.checkState(CriticalSection.java:36)
|
||||
at
|
||||
concurrency.PairChecker.run(CriticalSection.java:110)
|
||||
at java.util.concurrent.ThreadPoolExecutor.runWorke
|
||||
r(ThreadPoolExecutor.java:1142)
|
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.r
|
||||
un(ThreadPoolExecutor.java:617)
|
||||
at java.lang.Thread.run(Thread.java:745)
|
||||
concurrency.Pair$PairValuesNotEqualException: Pair values
|
||||
not equal: x: 2, y: 1
|
||||
at
|
||||
concurrency.Pair.checkState(CriticalSection.java:36)
|
||||
at
|
||||
concurrency.PairChecker.run(CriticalSection.java:110)
|
||||
at java.util.concurrent.ThreadPoolExecutor.runWorke
|
||||
r(ThreadPoolExecutor.java:1142)
|
||||
at java.util.concurrent.ThreadPoolExecutor$Worker.r
|
||||
un(ThreadPoolExecutor.java:617)
|
||||
at java.lang.Thread.run(Thread.java:745)
|
||||
___[ Exception is Expected ]___
|
||||
*/
|
||||
|
@ -26,7 +26,7 @@
|
||||
<jrun cls="DaemonsDoRunFinally" />
|
||||
<jrun cls="DeadlockingDiningPhilosophers" arguments="0 5 timeout" />
|
||||
<jrun cls="DelayQueueDemo" />
|
||||
<jrun cls="EvenSupplier" />
|
||||
<jrun cls="EvenSupplier" failOnError='false' timeOut='4000' msg='* Timeout for Testing *' />
|
||||
<jrun cls="ExchangerDemo" />
|
||||
<jrun cls="concurrency.ExplicitCriticalSection" dirpath="../concurrency" failOnError='false' msg='* Exception was Expected *' />
|
||||
<jrun cls="FastSimulation" />
|
||||
|
@ -3,6 +3,7 @@
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// An exception that reports through a Logger.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
import java.io.*;
|
||||
|
||||
@ -32,14 +33,17 @@ public class LoggingExceptions {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:40 PM LoggingException <init>
|
||||
Dec 15, 2015 10:34:24 PM LoggingException <init>
|
||||
SEVERE: LoggingException
|
||||
at
|
||||
LoggingExceptions.main(LoggingExceptions.java:19)
|
||||
LoggingExceptions.main(LoggingExceptions.java:20)
|
||||
|
||||
Caught LoggingException
|
||||
Jun 15, 2015 3:47:40 PM LoggingException <init>
|
||||
Dec 15, 2015 10:34:24 PM LoggingException <init>
|
||||
SEVERE: LoggingException
|
||||
at
|
||||
LoggingExceptions.main(LoggingExceptions.java:24)
|
||||
LoggingExceptions.main(LoggingExceptions.java:25)
|
||||
|
||||
Caught LoggingException
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// Logging caught exceptions.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
import java.io.*;
|
||||
|
||||
@ -24,8 +25,9 @@ public class LoggingExceptions2 {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:40 PM LoggingExceptions2 logException
|
||||
Dec 15, 2015 10:34:25 PM LoggingExceptions2 logException
|
||||
SEVERE: java.lang.NullPointerException
|
||||
at
|
||||
LoggingExceptions2.main(LoggingExceptions2.java:16)
|
||||
LoggingExceptions2.main(LoggingExceptions2.java:17)
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {JVMArgs: -Djava.util.logging.config.file=log.prop}
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class ConfigureLogging {
|
||||
@ -43,46 +44,41 @@ public class ConfigureLogging {
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
Logger Name : net Level: SEVERE
|
||||
Logger Name : com.mindviewinc Level: FINEST
|
||||
Logger Name : onjava Level: INFO
|
||||
Logger Name : com.mindviewinc.test Level: FINER
|
||||
Logger Name : random Level: SEVERE
|
||||
Logger Name : com Level: null
|
||||
Logger Name : com.mindviewinc Level: null
|
||||
Logger Name : onjava Level: null
|
||||
Logger Name : com.mindviewinc.test Level: null
|
||||
Logger Name : random Level: null
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
SEVERE: Severe
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
FINEST: Finest
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
FINER: Finer
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
FINE: Fine
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
CONFIG: Config
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
INFO: Info
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
WARNING: Warning
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
SEVERE: Severe
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
INFO: Info
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
WARNING: Warning
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
SEVERE: Severe
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
FINER: Finer
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
FINE: Fine
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
CONFIG: Config
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
INFO: Info
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
WARNING: Warning
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
SEVERE: Severe
|
||||
Jun 15, 2015 3:47:52 PM ConfigureLogging sendLogMessages
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
INFO: Info
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
WARNING: Warning
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
SEVERE: Severe
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
INFO: Info
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
WARNING: Warning
|
||||
Dec 15, 2015 9:58:42 PM ConfigureLogging sendLogMessages
|
||||
SEVERE: Severe
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// How to write custom handler
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
import java.util.*;
|
||||
|
||||
@ -39,8 +40,9 @@ public class CustomHandler {
|
||||
, INFO:, CustomHandler:, main:, <Logging Info>,
|
||||
]
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM CustomHandler main
|
||||
Dec 15, 2015 9:58:42 PM CustomHandler main
|
||||
WARNING: Logging Warning
|
||||
Jun 15, 2015 3:47:52 PM CustomHandler main
|
||||
Dec 15, 2015 9:58:42 PM CustomHandler main
|
||||
INFO: Logging Info
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class InfoLogging {
|
||||
@ -13,6 +14,7 @@ public class InfoLogging {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM InfoLogging main
|
||||
Dec 15, 2015 9:58:43 PM InfoLogging main
|
||||
INFO: Logging: INFO-level message
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -3,6 +3,7 @@
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// Guaranteeing proper class and method names
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class InfoLogging2 {
|
||||
@ -15,6 +16,7 @@ public class InfoLogging2 {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM InfoLogging2 main
|
||||
Dec 15, 2015 9:58:43 PM InfoLogging2 main
|
||||
INFO: Logging an INFO-level message
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class LogToFile {
|
||||
@ -16,6 +17,7 @@ public class LogToFile {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM LogToFile main
|
||||
Dec 15, 2015 9:58:43 PM LogToFile main
|
||||
INFO: A message logged to the file
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class LogToFile2 {
|
||||
@ -18,6 +19,7 @@ public class LogToFile2 {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM LogToFile2 main
|
||||
Dec 15, 2015 9:58:43 PM LogToFile2 main
|
||||
INFO: A message logged to the file
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -61,143 +62,124 @@ public class LoggingLevelManipulation {
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
-- printing levels -- net : null com.mindviewinc : null
|
||||
onjava : null com.mindviewinc.test : null
|
||||
random : null
|
||||
-- printing levels -- net : SEVERE com.mindviewinc : null
|
||||
onjava : null com.mindviewinc.test : null
|
||||
random : null
|
||||
-- printing levels -- com : null com.mindviewinc : null
|
||||
onjava : null com.mindviewinc.test : null random : null
|
||||
-- printing levels -- com : SEVERE com.mindviewinc : null
|
||||
onjava : null com.mindviewinc.test : null random : null
|
||||
net level: SEVERE
|
||||
-- printing levels -- net : SEVERE com.mindviewinc : null
|
||||
onjava : FINEST com.mindviewinc.test : FINEST
|
||||
random : FINEST
|
||||
-- printing levels -- com : SEVERE com.mindviewinc : null
|
||||
onjava : FINEST com.mindviewinc.test : FINEST random :
|
||||
FINEST
|
||||
individual loggers set to FINEST
|
||||
-- printing levels -- net : FINEST com.mindviewinc : null
|
||||
onjava : FINEST com.mindviewinc.test : FINEST
|
||||
random : FINEST
|
||||
-- printing levels -- com : FINEST com.mindviewinc : null
|
||||
onjava : FINEST com.mindviewinc.test : FINEST random :
|
||||
FINEST
|
||||
net level: FINEST
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: net Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: com.mindviewinc Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: com.mindviewinc Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
SEVERE: com Severe
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: com.mindviewinc Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: onjava Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: onjava Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: onjava Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: com.mindviewinc.test Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: com.mindviewinc.test Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: com.mindviewinc.test Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: random Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: random Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: random Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: net Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: com.mindviewinc Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: com.mindviewinc Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
SEVERE: com Severe
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: com.mindviewinc Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: onjava Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: onjava Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: onjava Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: com.mindviewinc.test Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: com.mindviewinc.test Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: com.mindviewinc.test Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: random Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: random Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: random Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: net Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
INFO: com Info
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: net Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
WARNING: com Warning
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: net Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
SEVERE: com Severe
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: com.mindviewinc Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: com.mindviewinc Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: com.mindviewinc Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: onjava Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: onjava Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: onjava Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: com.mindviewinc.test Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: com.mindviewinc.test Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: com.mindviewinc.test Severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
INFO: random Info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
WARNING: random Warning
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevelManipulation
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevelManipulation
|
||||
printLogMessages
|
||||
SEVERE: random Severe
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -39,20 +40,23 @@ com level: SEVERE
|
||||
individual loggers set to FINEST
|
||||
com level: SEVERE
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevels logMessages
|
||||
SEVERE: test : severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevels logMessages
|
||||
INFO: random : info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevels logMessages
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
INFO: util : info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevels logMessages
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
SEVERE: test : severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevels logMessages
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
INFO: random : info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevels logMessages
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
INFO: util : info
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevels logMessages
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
SEVERE: test : severe
|
||||
Jun 15, 2015 3:47:52 PM LoggingLevels logMessages
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
INFO: random : info
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
INFO: util : info
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
SEVERE: test : severe
|
||||
Dec 15, 2015 9:58:43 PM LoggingLevels logMessages
|
||||
INFO: random : info
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class MultipleHandlers {
|
||||
@ -19,8 +20,9 @@ public class MultipleHandlers {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM MultipleHandlers main
|
||||
Dec 15, 2015 9:58:43 PM MultipleHandlers main
|
||||
WARNING: Output to multiple handlers
|
||||
Jun 15, 2015 3:47:52 PM MultipleHandlers main
|
||||
Dec 15, 2015 9:58:43 PM MultipleHandlers main
|
||||
WARNING: Output to multiple handlers
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class MultipleHandlers2 {
|
||||
@ -20,6 +21,7 @@ public class MultipleHandlers2 {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM MultipleHandlers2 main
|
||||
Dec 15, 2015 9:58:43 PM MultipleHandlers2 main
|
||||
WARNING: Output to multiple handlers
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class SimpleFilter {
|
||||
@ -33,12 +34,13 @@ public class SimpleFilter {
|
||||
}
|
||||
/* Output:
|
||||
___[ Error Output ]___
|
||||
Jun 15, 2015 3:47:52 PM SimpleFilter sendLogMessages
|
||||
Dec 15, 2015 9:58:44 PM SimpleFilter sendLogMessages
|
||||
WARNING: A duck in the house!
|
||||
Jun 15, 2015 3:47:52 PM SimpleFilter sendLogMessages
|
||||
Dec 15, 2015 9:58:44 PM SimpleFilter sendLogMessages
|
||||
WARNING: A Wombat at large!
|
||||
Jun 15, 2015 3:47:52 PM SimpleFilter main
|
||||
Dec 15, 2015 9:58:44 PM SimpleFilter main
|
||||
INFO: After setting filter..
|
||||
Jun 15, 2015 3:47:52 PM SimpleFilter sendLogMessages
|
||||
Dec 15, 2015 9:58:44 PM SimpleFilter sendLogMessages
|
||||
WARNING: A duck in the house!
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@
|
||||
// (c)2016 MindView LLC: see Copyright.txt
|
||||
// We make no guarantees that this code is fit for any purpose.
|
||||
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
|
||||
// {ErrorOutputExpected}
|
||||
import java.util.logging.*;
|
||||
|
||||
public class SimpleFormatterExample {
|
||||
@ -34,4 +35,5 @@ INFO : SimpleFormatterExample -:- logMessages -:- Line
|
||||
One
|
||||
INFO : SimpleFormatterExample -:- logMessages -:- Line
|
||||
Two
|
||||
___[ Error Output is Expected ]___
|
||||
*/
|
||||
|
@ -183,35 +183,61 @@ class Duet:
|
||||
"""
|
||||
|
||||
def __init__(self, out_filename):
|
||||
if not out_filename.suffix == ".out" or out_filename.suffix == ".err":
|
||||
print("Error: argument to Duet() must end with '.out' or '.err'")
|
||||
|
||||
if not (out_filename.suffix == ".out" or
|
||||
out_filename.suffix == ".err" or
|
||||
out_filename.suffix == ".new"):
|
||||
print("Error: argument to Duet() must end with '.out' or '.err' or '.new'")
|
||||
print("Argument was {}".format(out_filename))
|
||||
sys.exit()
|
||||
|
||||
self.java_file = None # Full contents of Java code file
|
||||
self.java_slugline = None # First (marker) line of Java code file
|
||||
|
||||
self.out_path = out_filename.with_suffix(".out")
|
||||
self.out = None
|
||||
self.generated = ""
|
||||
if self.out_path.exists():
|
||||
self.out = self.out_path.read_text()
|
||||
self.out = self.out_path.read_text().strip()
|
||||
trace("{} file exists".format(self.out_path))
|
||||
self.generated = self.fill_to_width(self.out)
|
||||
|
||||
self.error = False
|
||||
self.err_path = out_filename.with_suffix(".err")
|
||||
self.errors = None
|
||||
if self.err_path.exists():
|
||||
self.errors = self.err_path.read_text()
|
||||
print("{} file exists".format(self.err_path))
|
||||
self.error = True
|
||||
self.generated += "\n___[ Error Output ]___\n"
|
||||
self.generated += self.fill_to_width(self.err_path.read_text())
|
||||
trace("{} file exists".format(self.err_path))
|
||||
|
||||
self.new = None
|
||||
self.new_path = out_filename.with_suffix(".new")
|
||||
if self.new_path.exists():
|
||||
self.new = self.new_path.read_text().strip()
|
||||
print("{} file exists".format(self.new_path))
|
||||
|
||||
self.java_path = self.calculate_java_path()
|
||||
# This also fills self.java_file and self.java_slugline:
|
||||
self.embedded = self.embedded_output()
|
||||
|
||||
self.ignore = False
|
||||
if "{IgnoreOutput}" in self.java_file:
|
||||
self.ignore = True
|
||||
trace("Ignoring .out for {}".format(self.java_path))
|
||||
return
|
||||
self.generated = self.out_path.read_text().strip()
|
||||
self.generated = self.fill_to_width(self.generated)
|
||||
|
||||
if "{ThrowsException}" in self.java_file:
|
||||
self.generated = self.generated.strip() + "\n___[ Exception is Expected ]___"
|
||||
trace("Exception expected for {}".format(self.java_path))
|
||||
|
||||
if "{ErrorOutputExpected}" in self.java_file:
|
||||
self.generated = self.generated.strip() + "\n___[ Error Output is Expected ]___"
|
||||
trace("OK: 'Error Output' expected for {}".format(self.java_path))
|
||||
|
||||
self.embedded_adjusted = self.adjust(self.embedded)
|
||||
self.generated_un_adjusted = self.generated
|
||||
self.generated_adjusted = None
|
||||
if self.generated:
|
||||
self.generated_adjusted = self.adjust(self.generated)
|
||||
|
||||
def calculate_java_path(self):
|
||||
|
@ -11,11 +11,25 @@ from output_duet import Duet, Valid
|
||||
import os
|
||||
import collections
|
||||
import pprint
|
||||
import itertools
|
||||
|
||||
def trace(*str): pass
|
||||
# trace = print
|
||||
|
||||
def clean():
|
||||
for p in (Path(f) for f in [
|
||||
"update_output.bat",
|
||||
"edit_errors.bat",
|
||||
"strategies.txt",
|
||||
"validate_successes.txt",
|
||||
"validate_failures.txt",
|
||||
]):
|
||||
if p.exists():
|
||||
p.unlink()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
clean()
|
||||
jfiles = sorted([java.name for java in Path(".").glob("**/*.java")])
|
||||
duplicates = sorted([x for x, y in collections.Counter(jfiles).items() if y > 1])
|
||||
if duplicates:
|
||||
@ -23,8 +37,10 @@ if __name__ == '__main__':
|
||||
pprint.pprint(duplicates)
|
||||
|
||||
count = 0
|
||||
for output in Path(".").glob("**/*.out"):
|
||||
for output in itertools.chain(Path(".").glob("**/*.out"), Path(".").glob("**/*.err")):
|
||||
duet = Duet(output)
|
||||
# if duet.error:
|
||||
# os.system("subl {}".format(duet.java_path))
|
||||
trace("duet.ignore:", duet.ignore, duet.java_path )
|
||||
if duet.ignore:
|
||||
continue
|
||||
@ -35,10 +51,24 @@ if __name__ == '__main__':
|
||||
with Path("strategies.txt").open('a') as st:
|
||||
print(' "' + duet.java_path.name + '" : IgnoreSortedLines(),', file = st)
|
||||
with Path("update_output.bat").open('a') as uo:
|
||||
print('call u ' + str(duet.out_path), file = uo)
|
||||
print('call no ' + str(duet.out_path.with_suffix(".new")), file = uo)
|
||||
with Path("edit_errors.bat").open('a') as eo:
|
||||
print('subl ' + str(duet.java_path), file = eo)
|
||||
if duet.error:
|
||||
duet.out_path.with_suffix(".new").write_text(duet.generated_un_adjusted)
|
||||
os.system('subl ' + str(duet.out_path.with_suffix(".new")))
|
||||
else:
|
||||
with Path("validate_successes.txt").open('a') as vs:
|
||||
print("{:<20}".format(v) + "{}".format(duet.java_path), file = vs)
|
||||
count += 1
|
||||
print("\n" + " Verified files = {} ".format(count).center(60, "*"))
|
||||
|
||||
if Path("validate_failures.txt").exists():
|
||||
os.system("subl update_output.bat strategies.txt validate_failures.txt")
|
||||
os.system("subl "
|
||||
"update_output.bat "
|
||||
"edit_errors.bat "
|
||||
"strategies.txt "
|
||||
"validate_successes.txt "
|
||||
"validate_failures.txt")
|
||||
else:
|
||||
print("\n" + " No Output Errors ".center(60, "="))
|
||||
|
Loading…
x
Reference in New Issue
Block a user