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
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* 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.res.it;

import java.util.List;
Expand Down Expand Up @@ -27,7 +42,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("integration-opentsdb-only")
@Tag("integration")
@ExtendWith(DatabaseContextProvider.class)
final class NetlistResourcesIT extends BaseIT
{
Expand All @@ -47,11 +62,33 @@ void setUp() throws Exception

siteId = storeSite("netlist_site_insert_data.json");

String configJson = getJsonFromResource("config_input_data.json");
ExtractableResponse<Response> response = given()
.log().ifValidationFails(LogDetail.ALL, true)
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON)
.header("Authorization", authHeader)
.filter(sessionFilter)
.body(configJson)
.when()
.redirects().follow(true)
.redirects().max(3)
.post("config")
.then()
.log().ifValidationFails(LogDetail.ALL, true)
.assertThat()
.statusCode(is(HttpServletResponse.SC_CREATED))
.extract()
;

long configId = response.body().jsonPath().getLong("configId");

ApiPlatform platform = getDtoFromResource("netlist_platform_insert_data.json", ApiPlatform.class);
platform.setSiteId(siteId);
platform.setConfigId(configId);
String platformJson = mapper.writeValueAsString(platform);

ExtractableResponse<Response> response = given()
response = given()
.log().ifValidationFails(LogDetail.ALL, true)
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"configId" : null,
"name" : "Test Platform",
"numPlatforms" : 0,
"description" : "Test Platform",
"configSensors" : [
{
"sensorNumber" : 0,
"sensorName" : "Test Sensor",
"recordingMode" : "U",
"recordingInterval" : 1500,
"timeOfFirstSample" : 0,
"absoluteMin" : 0.0,
"absoluteMax" : 100.0,
"properties" : {
"site" : "Test Site"
},
"dataTypes" : {},
"usgsStatCode" : null
}
],
"scripts" : [
{
"name" : "Test Script",
"dataOrder" : "U",
"headerType" : null,
"scriptSensors" : [ {
"sensorNumber" : 0,
"unitConverter" : {
"ucId" : null,
"fromAbbr" : "C",
"toAbbr" : "F",
"algorithm" : "Linear",
"a" : 100.0,
"b" : 32.0,
"c" : null,
"d" : null,
"e" : null,
"f" : null
}
}
],
"formatStatements" : [ ]
} ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"Stream" : "Stream test site"
},
"description" : "A stream site",
"latitude" : "76.3",
"longitude" : "-121.8",
"latitude" : "38.575764",
"longitude" : "-121.478851",
"elevation" : 150.0,
"elevUnits" : "ft",
"nearestCity" : "Sacramento",
Expand Down