Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ servlet-api = "6.1.0" #Updating this further will require a change to the jakart
slf4j = { strictly = "2.0.17" }
jersey = "4.0.0"

swagger = "2.2.28"
swagger = "2.2.41"
swagger-ui = "5.18.3"
swagger-parser = "2.1.25"
rs-api = "4.0.0"
jackson = "2.20.1"
jackson-annotations = "2.20"
selenium = "3.141.59"
selenium = "4.38.0"
nimbus = "9.41.1"
jwt = "4.4.0"
auto-service = "1.1.1"
Expand Down Expand Up @@ -51,7 +51,9 @@ jersey-core = { module = "org.glassfish.jersey.core:jersey-client", version.ref
jersey-media-multipart = { module = "org.glassfish.jersey.media:jersey-media-multipart", version.ref = "jersey" }

jstl = { module = "jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api", version = "3.0.2"}
jstl-impl = { module = "org.glassfish.web:jakarta.servlet.jsp.jstl", version = "3.0.1"}
swagger-jaxrs2 = { module = "io.swagger.core.v3:swagger-jaxrs2-jakarta", version.ref = "swagger" }
swagger-models = { module = "io.swagger.core.v3:swagger-models-jakarta", version.ref = "swagger" }
jackson = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }

swagger-codegen = { module = "io.swagger.codegen.v3:swagger-codegen-cli", version.ref = "swagger-codegen" }
Expand All @@ -66,6 +68,7 @@ jakarta-xml-bind-api = { module = "jakarta.xml.bind:jakarta.xml.bind-api", versi
org-glassfish-jaxb-runtime = {module = "org.glassfish.jaxb:jaxb-runtime", version.ref = "jaxb" }

selenium = { module = "org.seleniumhq.selenium:selenium-java", version.ref = "selenium" }
web-driver-manager = { module = "io.github.bonigarcia:webdrivermanager", version = "6.3.3" }
nimbus = { module = "com.nimbusds:nimbus-jose-jwt", version.ref = "nimbus" }
jwt = { module = "com.auth0:java-jwt", version.ref = "jwt" }
auto-service = { module = "com.google.auto.service:auto-service", version.ref = "auto-service" }
Expand Down
9 changes: 9 additions & 0 deletions opendcs-integration-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ dependencies {
testImplementation(libs.nimbus)
testImplementation(libs.jwt)
testImplementation(libs.swagger.parser)
testImplementation(libs.swagger.models)
testImplementation(libs.selenium)
testImplementation(libs.web.driver.manager)
testRuntimeOnly(libs.byte.buddy)
testImplementation enforcedPlatform(libs.junit.bom)
testImplementation(libs.bundles.junit)
Expand All @@ -61,6 +64,12 @@ configurations.all {
exclude group: "javax.media"
exclude group: "com.sun.media"
exclude group: "org.eclipse.jetty"
exclude group: "javax.xml.bind", module: "jaxb-api"
exclude group: "javax.transaction", module: "jta"
exclude group: "javax.xml.stream", module: "stax-api"
exclude group: "io.swagger.core.v3", module: "swagger-core"
exclude group: "io.swagger.core.v3", module: "swagger-models"

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,22 @@
import java.util.ServiceLoader;
import java.util.function.Supplier;

import decodes.util.DecodesSettings;
import org.apache.catalina.Host;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Manager;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.startup.Tomcat;
import org.apache.tomcat.jdbc.pool.DataSourceFactory;
import org.apache.tomcat.util.scan.StandardJarScanner;
import org.opendcs.database.api.DataTransaction;
import org.opendcs.database.api.OpenDcsDataException;
import org.opendcs.fixtures.configurations.cwms.CwmsOracleConfiguration;
import org.opendcs.fixtures.spi.Configuration;
import org.opendcs.fixtures.spi.ConfigurationProvider;
import org.slf4j.Logger;

import decodes.util.DecodesSettings;

import org.opendcs.utils.logging.OpenDcsLoggerFactory;
import org.slf4j.Logger;
import uk.org.webcompere.systemstubs.environment.EnvironmentVariables;
import uk.org.webcompere.systemstubs.properties.SystemProperties;
import uk.org.webcompere.systemstubs.security.SystemExit;
Expand Down Expand Up @@ -96,16 +95,13 @@ public TomcatServer(String baseDir, int port, String restWar, String guiWar) thr
restApiContext.setParentClassLoader(TomcatServer.class.getClassLoader());
restApiContext.setReloadable(true);
restApiContext.setPrivileged(true);
((StandardJarScanner) restApiContext.getJarScanner()).setScanClassPath(false);
sessionManager = restApiContext::getManager;
if(System.getProperty(DB_OFFICE) != null)
{
restApiContext.removeParameter("opendcs.rest.api.cwms.office");
restApiContext.addParameter("opendcs.rest.api.cwms.office", System.getProperty(DB_OFFICE));
}

StandardContext guiContext = (StandardContext) tomcatInstance.addWebapp("", guiWar);
((StandardJarScanner) guiContext.getJarScanner()).setScanClassPath(false);
guiContext.setDelegate(true);
guiContext.setParentClassLoader(TomcatServer.class.getClassLoader());
guiContext.setParentClassLoader(null);
guiContext.setReloadable(true);
guiContext.setPrivileged(true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright 2025 OpenDCS Consortium and its Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.opendcs.odcsapi.gui.login;

import java.time.Duration;

import io.github.bonigarcia.wdm.WebDriverManager;
import io.restassured.RestAssured;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.TestTemplate;
import org.junit.jupiter.api.extension.ExtendWith;
import org.opendcs.odcsapi.fixtures.DatabaseContextProvider;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.WebDriverWait;

import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("integration")
@ExtendWith(DatabaseContextProvider.class)
final class LoginPageTest
{

private WebDriver driver;
private WebDriverWait wait;

Check warning on line 41 in opendcs-integration-test/src/test/java/org/opendcs/odcsapi/gui/login/LoginPageTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "wait" private field.

See more on https://sonarcloud.io/project/issues?id=opendcs_rest_api&issues=AZr_kyu7d-vtahM3tr-d&open=AZr_kyu7d-vtahM3tr-d&pullRequest=597

@BeforeEach
public void setUp()

Check warning on line 44 in opendcs-integration-test/src/test/java/org/opendcs/odcsapi/gui/login/LoginPageTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this 'public' modifier.

See more on https://sonarcloud.io/project/issues?id=opendcs_rest_api&issues=AZr_kyu7d-vtahM3tr-a&open=AZr_kyu7d-vtahM3tr-a&pullRequest=597
{
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new");
options.addArguments("--disable-gpu");
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--window-size=1920,1080");
driver = new ChromeDriver(options);
wait = new WebDriverWait(driver, Duration.ofSeconds(10));
}

@AfterEach
public void tearDown()

Check warning on line 58 in opendcs-integration-test/src/test/java/org/opendcs/odcsapi/gui/login/LoginPageTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this 'public' modifier.

See more on https://sonarcloud.io/project/issues?id=opendcs_rest_api&issues=AZr_kyu7d-vtahM3tr-b&open=AZr_kyu7d-vtahM3tr-b&pullRequest=597
{
if(driver != null)
{
driver.quit();
}
}

@TestTemplate
public void testInvalidLoginShowsError()

Check warning on line 67 in opendcs-integration-test/src/test/java/org/opendcs/odcsapi/gui/login/LoginPageTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this 'public' modifier.

See more on https://sonarcloud.io/project/issues?id=opendcs_rest_api&issues=AZr_kyu7d-vtahM3tr-c&open=AZr_kyu7d-vtahM3tr-c&pullRequest=597
{
driver.get(RestAssured.baseURI + ":" + RestAssured.port + "/" + "login");
String pageSource = driver.getPageSource();
assertTrue(pageSource.contains("Login"), "The valid login page content was not found");
assertTrue(pageSource.contains("Don't have an account?"), "The valid login page content was not found");
}
}
1 change: 1 addition & 0 deletions opendcs-web-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
implementation(libs.auto.service)
annotationProcessor(libs.auto.service)
implementation(libs.jstl)
runtimeOnly(libs.jstl.impl)
runtimeOnly(libs.slf4j.jdk14)

local_js(project(":api-client-typescript"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="jakarta.tags.core" %>

<%-- Core JS files --%>
<script src="/webjars/jquery/jquery.min.js"></script>
Expand Down Expand Up @@ -27,6 +27,7 @@
<script src="/webjars/datatables.net-select/js/dataTables.select.min.js"></script>
<script src="/webjars/datatables.net-select-bs5/js/select.bootstrap5.min.js"></script>
<%-- OpenDCS Web Files --%>
<script src="../resources/js/main.js"></script>
<script src="../resources/js/decodes.js"></script>
<script src="../resources/js/lib/dom_utilities.js"></script>
<script src="../resources/js/lib/object_utilities.js"></script>
Expand All @@ -49,4 +50,3 @@
window.API_URL = new URL(apiBasePath, origin).href;
})();
</script>
<script src="../resources/js/main.js"></script>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<li class="nav-item dropdown dropstart ">
<button class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle d-flex align-items-center dropdown-item"
id="bd-theme-select"
Expand Down
3 changes: 2 additions & 1 deletion opendcs-web-client/src/test/java/selenium/LoginTest.java
Comment thread
adamkorynta marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

Check warning on line 15 in opendcs-web-client/src/test/java/selenium/LoginTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused import 'java.util.concurrent.TimeUnit'.

See more on https://sonarcloud.io/project/issues?id=opendcs_rest_api&issues=AZr_kyqPd-vtahM3tr-Z&open=AZr_kyqPd-vtahM3tr-Z&pullRequest=597

@Disabled("For demonstration purposes currently.")
@Tag("integration")
Expand Down Expand Up @@ -44,7 +45,7 @@
}

// Set implicit wait to handle any delays in finding elements
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));

// Open the login page
String baseUrl = System.getProperty("opendcs.webclient.url") + "/portal/login"; // Change to your actual URL
Expand Down
Loading