From 66d49ca0073f5381680f8463e834d8cbf3972f7e Mon Sep 17 00:00:00 2001 From: rma-rripken <89810919+rma-rripken@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:58:43 -0800 Subject: [PATCH 1/4] Update build.gradle with jooq artifact from maven-public --- cwms-data-api/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cwms-data-api/build.gradle b/cwms-data-api/build.gradle index 8c2c64be6..5a2f46f17 100644 --- a/cwms-data-api/build.gradle +++ b/cwms-data-api/build.gradle @@ -69,7 +69,7 @@ dependencies { exclude group: "mil.army.usace.hec", module: "cwms-db-jooq-codegen" } - implementation('org.jooq.pro-java-8:jooq:3.18.7') { + implementation('org.jooq.pro-java-8:jooq:3.18.7-jdk8RC01') { exclude group: "com.oracle", module: "*" exclude group: "com.oracle.database.jdbc", module: "*" exclude group: "javax.xml.bind", module: "*" @@ -322,4 +322,4 @@ task generateTimeSeriesSamples(type: JavaExec) { args url args user args password -} \ No newline at end of file +} From 39079e33a3f5744e2b475722bc88a19c14130ddb Mon Sep 17 00:00:00 2001 From: rma-rripken <89810919+rma-rripken@users.noreply.github.com> Date: Wed, 27 Dec 2023 13:14:33 -0800 Subject: [PATCH 2/4] Changing to 3.18.7-jdk8RC02 --- cwms-data-api/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cwms-data-api/build.gradle b/cwms-data-api/build.gradle index 5a2f46f17..c0e8d8f2e 100644 --- a/cwms-data-api/build.gradle +++ b/cwms-data-api/build.gradle @@ -34,7 +34,7 @@ dependencies { exclude group: "mil.army.usace.hec", module: "cwms-db-jooq-codegen" } - implementation('mil.army.usace.hec:cwms-db-jooq-codegen_java8:23.03.16-1.0.2') { //was 7.0.0-SNAPSHOT, 23.03.16 or cwms-db-jooq-codegen_java11 23.03.16-1.0.2 + implementation('mil.army.usace.hec:cwms-db-jooq-codegen_java8:23.03.16-1.0.2') { exclude group: "com.oracle", module: "*" exclude group: "com.oracle.database.jdbc", module: "*" exclude group: "org.jooq.pro", module: "*" @@ -69,7 +69,7 @@ dependencies { exclude group: "mil.army.usace.hec", module: "cwms-db-jooq-codegen" } - implementation('org.jooq.pro-java-8:jooq:3.18.7-jdk8RC01') { + implementation('org.jooq.pro-java-8:jooq:3.18.7-jdk8RC02') { exclude group: "com.oracle", module: "*" exclude group: "com.oracle.database.jdbc", module: "*" exclude group: "javax.xml.bind", module: "*" From b97af83e9cbad5284b41f803beed8c8220d569a2 Mon Sep 17 00:00:00 2001 From: rma-rripken <89810919+rma-rripken@users.noreply.github.com> Date: Wed, 27 Dec 2023 13:25:04 -0800 Subject: [PATCH 3/4] Update mock_location_test.json --- cwms-data-api/src/test/resources/mock_location_test.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cwms-data-api/src/test/resources/mock_location_test.json b/cwms-data-api/src/test/resources/mock_location_test.json index 64e5e372b..ef9a3ed99 100644 --- a/cwms-data-api/src/test/resources/mock_location_test.json +++ b/cwms-data-api/src/test/resources/mock_location_test.json @@ -1,6 +1,6 @@ { "fields": [ - {"name": "location", "type": "object"} + {"name": "location"} ], "records": [ From f4fcf101ea53a25cbd00492949dc29ab214f9b4e Mon Sep 17 00:00:00 2001 From: rma-rripken <89810919+rma-rripken@users.noreply.github.com> Date: Wed, 27 Dec 2023 14:08:23 -0800 Subject: [PATCH 4/4] Minor cleanups --- .../java/cwms/cda/api/ClobController.java | 16 ++--- .../java/cwms/cda/api/CountyController.java | 29 +++++---- .../cwms/cda/api/auth/ApiKeyController.java | 36 +++++------ .../cwms/cda/api/CatalogControllerTest.java | 64 ++++++++----------- .../java/cwms/cda/api/ClobControllerTest.java | 62 ++++++------------ .../java/cwms/cda/api/ControllerTest.java | 45 ++++++------- 6 files changed, 111 insertions(+), 141 deletions(-) diff --git a/cwms-data-api/src/main/java/cwms/cda/api/ClobController.java b/cwms-data-api/src/main/java/cwms/cda/api/ClobController.java index 22384e59b..753fb0f41 100644 --- a/cwms-data-api/src/main/java/cwms/cda/api/ClobController.java +++ b/cwms-data-api/src/main/java/cwms/cda/api/ClobController.java @@ -122,10 +122,10 @@ protected DSLContext getDslContext(Context ctx) { tags = {TAG} ) @Override - public void getAll(Context ctx) { + public void getAll(@NotNull Context ctx) { - try (final Timer.Context ignored = markAndTime(GET_ALL);) { - DSLContext dsl = getDslContext(ctx); + try (final Timer.Context ignored = markAndTime(GET_ALL)) { + DSLContext dsl = getDslContext(ctx); String office = ctx.queryParam(OFFICE); Optional officeOpt = Optional.ofNullable(office); @@ -175,10 +175,10 @@ public void getAll(Context ctx) { tags = {TAG} ) @Override - public void getOne(Context ctx, @NotNull String clobId) { + public void getOne(@NotNull Context ctx, @NotNull String clobId) { - try (final Timer.Context ignored = markAndTime(GET_ONE);) { - DSLContext dsl = getDslContext(ctx); + try (final Timer.Context ignored = markAndTime(GET_ONE)) { + DSLContext dsl = getDslContext(ctx); ClobDao dao = new ClobDao(dsl); Optional office = Optional.ofNullable(ctx.queryParam(OFFICE)); Optional optAc = dao.getByUniqueName(clobId, office); @@ -219,8 +219,8 @@ public void getOne(Context ctx, @NotNull String clobId) { tags = {TAG} ) @Override - public void create(Context ctx) { - try (final Timer.Context ignored = markAndTime(CREATE)){ + public void create(@NotNull Context ctx) { + try (final Timer.Context ignored = markAndTime(CREATE)) { DSLContext dsl = getDslContext(ctx); String reqContentType = ctx.req.getContentType(); diff --git a/cwms-data-api/src/main/java/cwms/cda/api/CountyController.java b/cwms-data-api/src/main/java/cwms/cda/api/CountyController.java index a39c23be2..a2a7db910 100644 --- a/cwms-data-api/src/main/java/cwms/cda/api/CountyController.java +++ b/cwms-data-api/src/main/java/cwms/cda/api/CountyController.java @@ -24,6 +24,12 @@ package cwms.cda.api; +import static com.codahale.metrics.MetricRegistry.name; +import static cwms.cda.api.Controllers.GET_ALL; +import static cwms.cda.api.Controllers.RESULTS; +import static cwms.cda.api.Controllers.SIZE; +import static cwms.cda.data.dao.JooqDao.getDslContext; + import com.codahale.metrics.Histogram; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Timer; @@ -38,18 +44,14 @@ import io.javalin.plugin.openapi.annotations.OpenApi; import io.javalin.plugin.openapi.annotations.OpenApiContent; import io.javalin.plugin.openapi.annotations.OpenApiResponse; -import org.jooq.DSLContext; - -import javax.servlet.http.HttpServletResponse; import java.util.List; - -import static com.codahale.metrics.MetricRegistry.name; -import static cwms.cda.api.Controllers.*; -import static cwms.cda.data.dao.JooqDao.getDslContext; +import javax.servlet.http.HttpServletResponse; +import org.jetbrains.annotations.NotNull; +import org.jooq.DSLContext; /** * Handles all county CRUD methods. - * + * * @see CountyController */ public class CountyController implements CrudHandler { @@ -76,13 +78,14 @@ private Timer.Context markAndTime(String subject) { @OpenApiResponse(status = "" + HttpServletResponse.SC_OK, description = "A list of counties.", content = { - @OpenApiContent(from = County.class, isArray = true, type = Formats.JSONV2), + @OpenApiContent(from = County.class, isArray = true, + type = Formats.JSONV2), }), }, tags = {"Counties"} ) @Override - public void getAll(Context ctx) { + public void getAll(@NotNull Context ctx) { try (Timer.Context timeContext = markAndTime(GET_ALL)) { DSLContext dsl = getDslContext(ctx); CountyDao dao = new CountyDao(dsl); @@ -98,7 +101,7 @@ public void getAll(Context ctx) { @OpenApi(ignore = true) @Override - public void getOne(Context ctx, String county) { + public void getOne(Context ctx, @NotNull String county) { ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented()); } @@ -110,13 +113,13 @@ public void create(Context ctx) { @OpenApi(ignore = true) @Override - public void update(Context ctx, String county) { + public void update(Context ctx, @NotNull String county) { ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented()); } @OpenApi(ignore = true) @Override - public void delete(Context ctx, String county) { + public void delete(Context ctx, @NotNull String county) { ctx.status(HttpServletResponse.SC_NOT_IMPLEMENTED).json(CdaError.notImplemented()); } diff --git a/cwms-data-api/src/main/java/cwms/cda/api/auth/ApiKeyController.java b/cwms-data-api/src/main/java/cwms/cda/api/auth/ApiKeyController.java index 9dd81a0e4..c7f52740f 100644 --- a/cwms-data-api/src/main/java/cwms/cda/api/auth/ApiKeyController.java +++ b/cwms-data-api/src/main/java/cwms/cda/api/auth/ApiKeyController.java @@ -1,10 +1,14 @@ package cwms.cda.api.auth; +import static com.codahale.metrics.MetricRegistry.name; +import static cwms.cda.api.Controllers.RESULTS; +import static cwms.cda.api.Controllers.SIZE; +import static cwms.cda.api.Controllers.STATUS_201; +import static cwms.cda.data.dao.JooqDao.getDslContext; + import com.codahale.metrics.Histogram; import com.codahale.metrics.MetricRegistry; - import cwms.cda.api.errors.CdaError; -import cwms.cda.api.errors.NotFoundException; import cwms.cda.data.dao.AuthDao; import cwms.cda.data.dto.auth.ApiKey; import cwms.cda.formatters.Formats; @@ -18,13 +22,8 @@ import io.javalin.plugin.openapi.annotations.OpenApiParam; import io.javalin.plugin.openapi.annotations.OpenApiRequestBody; import io.javalin.plugin.openapi.annotations.OpenApiResponse; - -import static com.codahale.metrics.MetricRegistry.name; -import static cwms.cda.api.Controllers.*; -import static cwms.cda.data.dao.JooqDao.getDslContext; - import java.util.List; - +import org.jetbrains.annotations.NotNull; import org.jooq.DSLContext; public class ApiKeyController implements CrudHandler { @@ -61,14 +60,14 @@ public void create(Context ctx) { AuthDao auth = AuthDao.getInstance(dsl); ApiKey sourceData = ctx.bodyAsClass(ApiKey.class); ApiKey key = auth.createApiKey(p, sourceData); - if(key == null) { + if (key == null) { ctx.status(HttpCode.BAD_REQUEST); } else { ctx.json(key).status(HttpCode.CREATED); } } catch (CwmsAuthException ex) { - if( ex.getMessage().equals(AuthDao.ONLY_OWN_KEY_MESSAGE)) { - ctx.json(new CdaError(ex.getMessage(),true)).status(ex.getAuthFailCode()); + if (ex.getMessage().equals(AuthDao.ONLY_OWN_KEY_MESSAGE)) { + ctx.json(new CdaError(ex.getMessage(), true)).status(ex.getAuthFailCode()); } else { throw ex; } @@ -91,13 +90,14 @@ public void create(Context ctx) { tags = {"Authorization"} ) @Override - public void delete(Context ctx, String keyName) { + public void delete(@NotNull Context ctx, @NotNull String keyName) { DataApiPrincipal p = ctx.attribute(AuthDao.DATA_API_PRINCIPAL); - DSLContext dsl = getDslContext(ctx); + AuthDao auth = AuthDao.getInstance(dsl); auth.deleteKeyForUser(p, keyName); ctx.status(HttpCode.NO_CONTENT); + } @OpenApi( @@ -114,6 +114,7 @@ public void getAll(Context ctx) { DataApiPrincipal p = ctx.attribute(AuthDao.DATA_API_PRINCIPAL); DSLContext dsl = getDslContext(ctx); + AuthDao auth = AuthDao.getInstance(dsl); List keys = auth.apiKeysForUser(p); ctx.json(keys).status(HttpCode.OK); @@ -122,9 +123,7 @@ public void getAll(Context ctx) { @OpenApi( pathParams = { - @OpenApiParam( - name="key-name", - required = true, + @OpenApiParam(name = "key-name", required = true, description = "Name of the specific key to get more information for. NOTE: Case-sensitive.") }, responses = @OpenApiResponse( @@ -137,7 +136,7 @@ public void getAll(Context ctx) { tags = {"Authorization"} ) @Override - public void getOne(Context ctx, String keyName) { + public void getOne(Context ctx, @NotNull String keyName) { DataApiPrincipal p = ctx.attribute(AuthDao.DATA_API_PRINCIPAL); DSLContext dsl = getDslContext(ctx); AuthDao auth = AuthDao.getInstance(dsl); @@ -151,13 +150,14 @@ public void getOne(Context ctx, String keyName) { ); ctx.json(msg).status(HttpCode.NOT_FOUND); } + } @OpenApi( ignore = true // users should delete and recreate keys. There is nothing to update. ) @Override - public void update(Context ctx, String arg1) { + public void update(@NotNull Context ctx, @NotNull String arg1) { throw new UnsupportedOperationException("Update is not implemented. Delete and create a new key."); } diff --git a/cwms-data-api/src/test/java/cwms/cda/api/CatalogControllerTest.java b/cwms-data-api/src/test/java/cwms/cda/api/CatalogControllerTest.java index ab5a1ae46..f349f179b 100644 --- a/cwms-data-api/src/test/java/cwms/cda/api/CatalogControllerTest.java +++ b/cwms-data-api/src/test/java/cwms/cda/api/CatalogControllerTest.java @@ -7,25 +7,8 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; -import java.io.InputStream; -import java.sql.Connection; -import java.util.HashMap; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import com.codahale.metrics.MetricRegistry; - import cwms.cda.formatters.FormattingException; - -import org.jooq.tools.jdbc.MockConnection; -import org.jooq.tools.jdbc.MockFileDatabase; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; - import fixtures.TestHttpServletResponse; import fixtures.TestServletInputStream; import io.javalin.core.util.Header; @@ -35,36 +18,43 @@ import io.javalin.http.util.ContextUtil; import io.javalin.plugin.json.JavalinJackson; import io.javalin.plugin.json.JsonMapperKt; +import java.util.HashMap; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; -public class CatalogControllerTest extends ControllerTest{ +public class CatalogControllerTest extends ControllerTest { @Disabled // get all the infrastructure in place first. @ParameterizedTest - @ValueSource(strings = {"blurge,","appliation/json+fred"}) - public void bad_formats_return_501(String format ) throws Exception { + @ValueSource(strings = {"blurge,", "appliation/json+fred"}) + public void bad_formats_return_501(String format) throws Exception { final String testBody = "test"; CatalogController controller = spy(new CatalogController(new MetricRegistry())); HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); - HashMap attributes = new HashMap<>(); - attributes.put(ContextUtil.maxRequestSizeKey,Integer.MAX_VALUE); + HashMap attributes = new HashMap<>(); + attributes.put(ContextUtil.maxRequestSizeKey, Integer.MAX_VALUE); when(request.getInputStream()).thenReturn(new TestServletInputStream(testBody)); when(request.getAttribute("database")).thenReturn(this.conn); when(request.getRequestURI()).thenReturn("/catalog/TIMESERIES"); - Context context = ContextUtil.init(request,response,"*",new HashMap(), HandlerType.GET,attributes); - context.attribute("database",this.conn); + Context context = ContextUtil.init(request, response, "*", new HashMap<>(), + HandlerType.GET, attributes); + context.attribute("database", this.conn); - assertNotNull( context.attribute("database"), "could not get the connection back as an attribute"); + assertNotNull(context.attribute("database"), "could not get the connection back as an " + + "attribute"); when(request.getHeader(Header.ACCEPT)).thenReturn("BAD FORMAT"); - assertThrows( FormattingException.class, () -> { - controller.getAll(context); - }); + assertThrows(FormattingException.class, () -> controller.getAll(context)); } @Test @@ -73,9 +63,9 @@ public void catalog_returns_only_original_ids_by_default() throws Exception { HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = new TestHttpServletResponse(); - HashMap attributes = new HashMap<>(); - attributes.put(ContextUtil.maxRequestSizeKey,Integer.MAX_VALUE); - attributes.put(JsonMapperKt.JSON_MAPPER_KEY,new JavalinJackson()); + HashMap attributes = new HashMap<>(); + attributes.put(ContextUtil.maxRequestSizeKey, Integer.MAX_VALUE); + attributes.put(JsonMapperKt.JSON_MAPPER_KEY, new JavalinJackson()); attributes.put("PolicyFactory", this.sanitizer); when(request.getInputStream()).thenReturn(new TestServletInputStream("")); @@ -84,12 +74,12 @@ public void catalog_returns_only_original_ids_by_default() throws Exception { when(request.getHeader(Header.ACCEPT)).thenReturn("application/json;version=2"); Context context = ContextUtil.init(request, - response, - "*", - new HashMap(), - HandlerType.GET, - attributes); - context.attribute("database",this.conn); + response, + "*", + new HashMap<>(), + HandlerType.GET, + attributes); + context.attribute("database", this.conn); controller.getOne(context, CatalogableEndpoint.TIMESERIES.getValue()); diff --git a/cwms-data-api/src/test/java/cwms/cda/api/ClobControllerTest.java b/cwms-data-api/src/test/java/cwms/cda/api/ClobControllerTest.java index 97c0995a4..5c8726bba 100644 --- a/cwms-data-api/src/test/java/cwms/cda/api/ClobControllerTest.java +++ b/cwms-data-api/src/test/java/cwms/cda/api/ClobControllerTest.java @@ -14,7 +14,6 @@ import com.codahale.metrics.MetricRegistry; import com.fasterxml.jackson.core.JsonProcessingException; import com.google.common.flogger.FluentLogger; - import cwms.cda.data.dto.Clob; import cwms.cda.formatters.Formats; import cwms.cda.formatters.FormattingException; @@ -26,7 +25,6 @@ import io.javalin.http.util.ContextUtil; import io.javalin.plugin.json.JavalinJackson; import io.javalin.plugin.json.JsonMapperKt; -import java.sql.SQLException; import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -39,7 +37,7 @@ import org.jooq.tools.jdbc.MockResult; import org.junit.jupiter.api.Test; -public class ClobControllerTest extends ControllerTest{ +public class ClobControllerTest extends ControllerTest { public static final FluentLogger logger = FluentLogger.forEnclosingClass(); @@ -62,7 +60,8 @@ public void bad_format_returns_501() throws Exception { when(request.getAttribute("database")).thenReturn(getTestConnection()); - assertNotNull(context.attribute("database"), "could not get the connection back as an attribute"); + assertNotNull(context.attribute("database"), "could not get the connection back as an " + + "attribute"); when(request.getHeader(Header.ACCEPT)).thenReturn("BAD FORMAT"); @@ -70,59 +69,33 @@ public void bad_format_returns_501() throws Exception { } - /* - @Test - public void pagination_elements_returned_json(){ - given() - .header("Accept","application/json;version=2").param("pageSize", 2) - .get("/clobs") - .then() - .statusCode(HttpServletResponse.SC_OK) - .body("$", hasKey("next-page")) - .body("page-size", equalTo(2)) - .body("clobs.size()",is(2)); - - } - - @Test - public void pagination_elements_returned_xml(){ - given() - .header("Accept","application/xml;version=2").param("pageSize", 2) - .get("/clobs") - .then() - .statusCode(HttpServletResponse.SC_OK) - .body(hasXPath("/clobs/nextPage")) - .body("clobs.pageSize", equalTo("2")) - .body("clobs.clobs.children().size()",is(2)) - ; - } - */ // This is only supposed to test that when XML data is posted to create, // that data is forward to the method deserialize @Test - void post_to_create_passed_to_deserializeJson() throws Exception - { + void post_to_create_passed_to_deserializeJson() throws Exception { final String testBody = "could be anything"; ClobController controller = spy(new ClobController(new MetricRegistry())); HttpServletRequest request = mock(HttpServletRequest.class); HttpServletResponse response = mock(HttpServletResponse.class); - HashMap attributes = new HashMap<>(); - attributes.put(ContextUtil.maxRequestSizeKey,Integer.MAX_VALUE); - attributes.put(JsonMapperKt.JSON_MAPPER_KEY,new JavalinJackson()); + HashMap attributes = new HashMap<>(); + attributes.put(ContextUtil.maxRequestSizeKey, Integer.MAX_VALUE); + attributes.put(JsonMapperKt.JSON_MAPPER_KEY, new JavalinJackson()); when(request.getInputStream()).thenReturn(new TestServletInputStream(testBody)); - Context context = ContextUtil.init(request,response,"*",new HashMap<>(), HandlerType.POST,attributes); + Context context = ContextUtil.init(request, response, "*", new HashMap<>(), + HandlerType.POST, attributes); when(request.getContentLength()).thenReturn(testBody.length()); MockDataProvider provider = new MockDataProvider() { @Override - public MockResult[] execute(MockExecuteContext mockExecuteContext) throws SQLException { - fail(); // This test shouldn't call the database. It just needs a DSLContext for the try/finally. + public MockResult[] execute(MockExecuteContext mockExecuteContext) { + fail(); // This test shouldn't call the database. It just needs a DSLContext + // for the try/finally. return null; } }; @@ -134,12 +107,15 @@ public MockResult[] execute(MockExecuteContext mockExecuteContext) throws SQLExc when(request.getHeader(Header.ACCEPT)).thenReturn(Formats.JSONV2); when(request.getContentType()).thenReturn(Formats.JSONV2); - logger.atFine().log( "Test post_to_create_passed_to_deserializeJson may trigger a exception - this is fine."); + logger.atFine().log("Test post_to_create_passed_to_deserializeJson may trigger a " + + "exception - this is fine."); try { controller.create(context); - } catch (HttpResponseException e){ - // It's throwing this exception bc deserialize can't parse our garbage data. That's fine. - logger.atFine().log( "Test post_to_create_passed_to_deserializeJson caught an HttpResponseException - this is fine."); + } catch (HttpResponseException e) { + // It's throwing this exception bc deserialize can't parse our garbage data. That's + // fine. + logger.atFine().log("Test post_to_create_passed_to_deserializeJson caught an " + + "HttpResponseException - this is fine."); } // For this test, it's ok that the server throws a HttpResponseException // Only want to check that the controller accessed our mock dao in the expected way diff --git a/cwms-data-api/src/test/java/cwms/cda/api/ControllerTest.java b/cwms-data-api/src/test/java/cwms/cda/api/ControllerTest.java index e72cab74f..a83f27775 100644 --- a/cwms-data-api/src/test/java/cwms/cda/api/ControllerTest.java +++ b/cwms-data-api/src/test/java/cwms/cda/api/ControllerTest.java @@ -1,12 +1,13 @@ package cwms.cda.api; +import static org.junit.jupiter.api.Assertions.assertNotNull; + import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.SQLException; import java.util.Map; import java.util.Scanner; - import org.jetbrains.annotations.NotNull; import org.jooq.tools.jdbc.MockConnection; import org.jooq.tools.jdbc.MockFileDatabase; @@ -16,28 +17,27 @@ import org.owasp.html.HtmlPolicyBuilder; import org.owasp.html.PolicyFactory; -import static org.junit.jupiter.api.Assertions.assertNotNull; - @TestInstance(Lifecycle.PER_CLASS) -public class ControllerTest -{ +public class ControllerTest { protected Connection conn = null; - protected PolicyFactory sanitizer = new HtmlPolicyBuilder().disallowElements("