diff --git a/src/main/java/io/github/mapepire_ibmi/types/ServerTraceLevel.java b/src/main/java/io/github/mapepire_ibmi/types/ServerTraceLevel.java index afa960d..dfae91f 100644 --- a/src/main/java/io/github/mapepire_ibmi/types/ServerTraceLevel.java +++ b/src/main/java/io/github/mapepire_ibmi/types/ServerTraceLevel.java @@ -1,64 +1,69 @@ -package io.github.mapepire_ibmi.types; - -/** - * Enum representing the possible server trace levels. - */ -public enum ServerTraceLevel { - /** - * Tracing is turned off. - */ - OFF("OFF"), - - /** - * All trace data is collected except datastream. - */ - ON("ON"), - - /** - * Only error trace data is collected. - */ - ERRORS("ERRORS"), - - /** - * All trace data is collected including datastream. - */ - DATASTREAM("DATASTREAM"); - - /** - * The server trace level. - */ - private String value; - - /** - * Construct a new ServerTraceLevel instance. - * - * @param value The server trace level. - */ - ServerTraceLevel(String value) { - this.value = value; - } - - /** - * Get the server trace level. - * - * @return The server trace level. - */ - public String getValue() { - return value; - } - - /** - * Get the enum server trace level representation of a string. - * - * @param value The string representation of the server trace level. - * @return The enum representation of the server trace level. - */ - public static ServerTraceLevel fromValue(String value) { - for (ServerTraceLevel type : values()) { - if (type.value.equals(value)) { - return type; - } - } - throw new IllegalArgumentException("Unknown value: " + value); - } -} +package io.github.mapepire_ibmi.types; + +/** + * Enum representing the possible server trace levels. + */ +public enum ServerTraceLevel { + /** + * Tracing is turned off. + */ + OFF("OFF"), + + /** + * All trace data is collected except datastream. + */ + ON("ON"), + + /** + * Only error trace data is collected. + */ + ERRORS("ERRORS"), + + /** + * All trace data is collected including datastream. + */ + DATASTREAM("DATASTREAM"), + + /** + * Input data stream and errors. + */ + INPUT_AND_ERRORS("INPUT_AND_ERRORS"); + + /** + * The server trace level. + */ + private String value; + + /** + * Construct a new ServerTraceLevel instance. + * + * @param value The server trace level. + */ + ServerTraceLevel(String value) { + this.value = value; + } + + /** + * Get the server trace level. + * + * @return The server trace level. + */ + public String getValue() { + return value; + } + + /** + * Get the enum server trace level representation of a string. + * + * @param value The string representation of the server trace level. + * @return The enum representation of the server trace level. + */ + public static ServerTraceLevel fromValue(String value) { + for (ServerTraceLevel type : values()) { + if (type.value.equals(value)) { + return type; + } + } + throw new IllegalArgumentException("Unknown value: " + value); + } +} diff --git a/src/test/java/io/github/mapepire_ibmi/TraceTest.java b/src/test/java/io/github/mapepire_ibmi/TraceTest.java index 630f2d5..2b5474d 100644 --- a/src/test/java/io/github/mapepire_ibmi/TraceTest.java +++ b/src/test/java/io/github/mapepire_ibmi/TraceTest.java @@ -47,15 +47,20 @@ void serverTracingOn() throws Exception { } @Test - void errorServerTracing() throws Exception { + void serverTracingErrors() throws Exception { assertTraceData(invalidQuery, ServerTraceLevel.ERRORS, true); } @Test - void dataStreamServerTracing() throws Exception { + void serverTracingDatastream() throws Exception { assertTraceData(invalidQuery, ServerTraceLevel.DATASTREAM, true); } + @Test + void serverTracingInputAndErrors() throws Exception { + assertTraceData(invalidQuery, ServerTraceLevel.INPUT_AND_ERRORS, true); + } + GetTraceDataResult assertTraceData(String sql, ServerTraceLevel level, boolean traceExists) throws Exception { SqlJob job = new SqlJob(); job.connect(MapepireTest.getCreds()).get();