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
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[versions]
opendcs = "7.5.1-RC04"
opendcs = "7.5.1-RC09"

servlet-api = "4.0.1" #Updating this further will require a change to the jakarta namespace.
slf4j = { strictly = "2.0.12" }
slf4j = { strictly = "2.0.17" }
jersey = "2.40"

swagger = "2.2.28"
Expand All @@ -20,7 +20,7 @@ mockito = "4.11.0"
byte-buddy = "1.15.3"
rest-assured = "5.5.0"
hamcrest = "3.0"
tomcat = "9.0.102"
tomcat = "9.0.107"
commons-io = "2.11.0"
commons-lang = "2.5"

Expand Down
2 changes: 2 additions & 0 deletions opendcs-integration-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ dependencies {
testRuntimeOnly(libs.junit.api)
testRuntimeOnly(libs.junit.engine)
testRuntimeOnly(libs.junit.params)
testRuntimeOnly(libs.slf4j.jdk14)
}

configurations.all {
Expand Down Expand Up @@ -187,6 +188,7 @@ tasks.register('integrationTestCWMS', Test) {
jvmArgs += "-Dorg.apache.tomcat.util.digester.PROPERTY_SOURCE=org.apache.tomcat.util.digester.EnvironmentPropertySource"
jvmArgs += "-Dcatalina.base=${layout.buildDirectory.file("tomcat")}"
jvmArgs += "-Dopendcs.test.integration.db=CWMS-Oracle"
jvmArgs += "-Dtestcontainer.cwms.bypass.cwms.pass=dcs_user"
def restWar = project(':opendcs-rest-api').tasks.named('war').get().archiveFile.get().asFile.getAbsolutePath()
def guiWar = project(':opendcs-web-client').tasks.named('war').get().archiveFile.get().asFile.getAbsolutePath()
jvmArgs += "-Dopendcs.restapi.warfile=${restWar}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,22 +278,30 @@ private static void setupClientUser(String dbType)
{
if(CwmsOracleConfiguration.NAME.equals(dbType))
{
String userPermissions = "begin execute immediate 'grant web_user to ?'; end;";
// I have no idea why this is suddenly required but it was also affecting operations in
// runtime test environments where the required entries weren't present.
String unlockUser = "begin cwms_sec.unlock_user(?,?); end;";
String userPermissions = "begin execute immediate 'grant web_user to ' || ?; end;";
String dbOffice = System.getProperty(DB_OFFICE);
String setWebUserPermissions = "begin\n" +
" cwms_sec.add_user_to_group(?, 'CWMS User Admins',?) ;\n" +
" commit;\n" +
"end;";
try(Connection connection = DriverManager.getConnection(System.getProperty(DB_URL), "CWMS_20",
System.getProperty(DB_PASSWORD));
PreparedStatement stmt1 = connection.prepareStatement(userPermissions);
PreparedStatement stmt2 = connection.prepareStatement(setWebUserPermissions))
PreparedStatement unlockUserStmt = connection.prepareStatement(unlockUser);
PreparedStatement userPermissionsStmt = connection.prepareStatement(userPermissions);
PreparedStatement setWebUserPermissionsStmt = connection.prepareStatement(setWebUserPermissions))
{
stmt1.setString(1, System.getProperty(DB_USERNAME));
stmt1.executeQuery();
stmt2.setString(1, System.getProperty(DB_USERNAME));
stmt2.setString(2, dbOffice);
stmt2.executeQuery();
final String username = System.getProperty(DB_USERNAME);
unlockUserStmt.setString(1, username);
unlockUserStmt.setString(2, dbOffice);
unlockUserStmt.executeQuery();
userPermissionsStmt.setString(1, username);
userPermissionsStmt.executeQuery();
setWebUserPermissionsStmt.setString(1, username);
setWebUserPermissionsStmt.setString(2, dbOffice);
setWebUserPermissionsStmt.executeQuery();
}
catch(SQLException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@
"code": "Ratio",
"displayName": "CWMS:Ratio"
},
{
"id": 128,
"standard": "CWMS",
"code": "%-RelativeHumidity",
"displayName": "CWMS:%-RelativeHumidity"
},
{
"id": 138,
"standard": "CWMS",
Expand Down Expand Up @@ -257,4 +263,5 @@
"code": "Pres",
"displayName": "CWMS:Pres"
}

]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#

handlers= java.util.logging.ConsoleHandler
.level=INFO
java.util.logging.ConsoleHandler.level=INFO
.level=FINE
java.util.logging.ConsoleHandler.level=FINE
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
org.apache.tomcat.util.scan.StandardJarScanner.level=SEVERE
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public Response getComputationRefs(
{
compFilter.setIntervalCode(interval);
}
List<ApiComputationRef> computationRefs = map(dai.compEditList(compFilter));
List<ApiComputationRef> computationRefs = map(dai.listComps(c -> compFilter.passes(c)));
return Response.status(HttpServletResponse.SC_OK).entity(computationRefs).build();
}
catch(DbIoException e)
Expand All @@ -133,13 +133,13 @@ public Response getComputationRefs(
}
}

static ArrayList<ApiComputationRef> map(ArrayList<ComputationInList> computations)
static ArrayList<ApiComputationRef> map(List<DbComputation> computations)
{
ArrayList<ApiComputationRef> ret = new ArrayList<>();
for (ComputationInList comp : computations)
for (DbComputation comp : computations)
{
ApiComputationRef ref = new ApiComputationRef();
ref.setComputationId(comp.getComputationId().getValue());
ref.setComputationId(comp.getId().getValue());
if (comp.getAlgorithmId() != null)
{
ref.setAlgorithmId(comp.getAlgorithmId().getValue());
Expand All @@ -149,13 +149,13 @@ static ArrayList<ApiComputationRef> map(ArrayList<ComputationInList> computation
ref.setAlgorithmId(DbKey.NullKey.getValue());
}
ref.setAlgorithmName(comp.getAlgorithmName());
ref.setName(comp.getComputationName());
ref.setName(comp.getName());
ref.setEnabled(comp.isEnabled());
ref.setDescription(comp.getDescription());
ref.setProcessName(comp.getProcessName());
if (comp.getProcessId() != null)
ref.setDescription(comp.getComment());
ref.setProcessName(comp.getApplicationName());
if (comp.getAppId() != null)
{
ref.setProcessId(comp.getProcessId().getValue());
ref.setProcessId(comp.getAppId().getValue());
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public Response getRouting(@Parameter(description = "Routing Spec ID", required
}
catch(DatabaseException e)
{
if(e.getCause() instanceof ValueNotFoundException)
if((e instanceof ValueNotFoundException) || (e.getCause() instanceof ValueNotFoundException))
{
throw new DatabaseItemNotFoundException("RoutingSpec with ID " + routingId + " not found");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public boolean isUserInRole(String role)
{
return principal.getRoles()
.stream()
.anyMatch(e -> e.getRole().equals(role));
.anyMatch(e ->
{
final String r = e.getRole();
return r.equals(role);
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ void testDbComputeMap()
@Test
void testComputationRefMap()
{
ArrayList<ComputationInList> comps = new ArrayList<>();
ComputationInList dbComp = new ComputationInList(DbKey.createDbKey(16704L), "Flow Computation",
DbKey.createDbKey(197865L), DbKey.createDbKey(51981L),
true, "Computation to find the flow rate of a body of water");
ArrayList<DbComputation> comps = new ArrayList<>();
DbComputation dbComp = new DbComputation(DbKey.createDbKey(16704L), "Flow Computation");
dbComp.setAlgorithmId(DbKey.createDbKey(197865L));
dbComp.setAppId(DbKey.createDbKey(51981L));
dbComp.setEnabled(true);
dbComp.setComment("Computation to find the flow rate of a body of water");
dbComp.setAlgorithmName("Flow Algorithm");
dbComp.setDescription("Computation to determine flow rate");
dbComp.setProcessId(DbKey.createDbKey(1L));
DbCompAlgorithm dbCompAlgorithm = new DbCompAlgorithm("Flow Algorithm");
dbCompAlgorithm.setId(DbKey.createDbKey(197865L));
dbComp.setEnabled(true);
Expand All @@ -127,12 +127,12 @@ void testComputationRefMap()
assertEquals(1, apiComps.size());
ApiComputationRef apiComp = apiComps.get(0);
assertNotNull(apiComp);
assertEquals(dbComp.getComputationId().getValue(), apiComp.getComputationId());
assertEquals(dbComp.getComputationName(), apiComp.getName());
assertEquals(dbComp.getId().getValue(), apiComp.getComputationId());
assertEquals(dbComp.getName(), apiComp.getName());
assertEquals(dbComp.getAlgorithmName(), apiComp.getAlgorithmName());
assertEquals(dbComp.getDescription(), apiComp.getDescription());
assertEquals(dbComp.getProcessId().getValue(), apiComp.getProcessId());
assertEquals(dbComp.getProcessName(), apiComp.getProcessName());
assertEquals(dbComp.getComment(), apiComp.getDescription());
assertEquals(dbComp.getAppId().getValue(), apiComp.getProcessId());
assertEquals(dbComp.getApplicationName(), apiComp.getProcessName());
assertEquals(dbComp.getAlgorithmId().getValue(), apiComp.getAlgorithmId());
}
}
Loading