diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c02cud/AdditionalTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c02cud/AdditionalTests.java index e14fbcb25..5fe3bfb3f 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c02cud/AdditionalTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c02cud/AdditionalTests.java @@ -19,7 +19,7 @@ import static de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11Sensing.EP_PHENOMENONTIME; import static de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11Sensing.EP_TIME; -import static de.fraunhofer.iosb.ilt.frostclient.utils.ParserUtils.formatKeyValuesForUrl; +import static de.fraunhofer.iosb.ilt.frostclient.utils.StringHelper.formatKeyValuesForUrl; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -254,13 +254,13 @@ void test04PostInvalidPath() throws ServiceFailureException { // PUT tests String urlObsGood = serverSettings.getServiceUrl(version) - + "/Things(" + formatKeyValuesForUrl(thing1.getPrimaryKeyValues()) + ")" - + "/Datastreams(" + formatKeyValuesForUrl(datastream1.getPrimaryKeyValues()) + ")" - + "/Observations(" + formatKeyValuesForUrl(obs1.getPrimaryKeyValues()) + ")"; + + "/Things(" + formatKeyValuesForUrl(thing1) + ")" + + "/Datastreams(" + formatKeyValuesForUrl(datastream1) + ")" + + "/Observations(" + formatKeyValuesForUrl(obs1) + ")"; String urlObsBad = serverSettings.getServiceUrl(version) - + "/Things(" + formatKeyValuesForUrl(thing2.getPrimaryKeyValues()) + ")" - + "/Datastreams(" + formatKeyValuesForUrl(datastream1.getPrimaryKeyValues()) + ")" - + "/Observations(" + formatKeyValuesForUrl(obs1.getPrimaryKeyValues()) + ")"; + + "/Things(" + formatKeyValuesForUrl(thing2) + ")" + + "/Datastreams(" + formatKeyValuesForUrl(datastream1) + ")" + + "/Observations(" + formatKeyValuesForUrl(obs1) + ")"; testPut(urlObsGood, urlObsBad); testPatch(urlObsGood, urlObsBad); @@ -270,16 +270,16 @@ void test04PostInvalidPath() throws ServiceFailureException { private void testGet(Entity thing1, Entity datastream1, Entity thing2) { // GET tests HTTPMethods.HttpResponse response; - String url = serverSettings.getServiceUrl(version) + "/Things(" + formatKeyValuesForUrl(thing1.getPrimaryKeyValues()) + ")/Datastreams(" + formatKeyValuesForUrl(datastream1.getPrimaryKeyValues()) + ")/Observations"; + String url = serverSettings.getServiceUrl(version) + "/Things(" + formatKeyValuesForUrl(thing1) + ")/Datastreams(" + formatKeyValuesForUrl(datastream1) + ")/Observations"; response = HTTPMethods.doGet(url); assertEquals(200, response.code, "Get should return 201 Created for url " + url); - url = serverSettings.getServiceUrl(version) + "/Things(" + formatKeyValuesForUrl(thing2.getPrimaryKeyValues()) + ")/Datastreams(" + formatKeyValuesForUrl(datastream1.getPrimaryKeyValues()) + ")/Observations"; + url = serverSettings.getServiceUrl(version) + "/Things(" + formatKeyValuesForUrl(thing2) + ")/Datastreams(" + formatKeyValuesForUrl(datastream1) + ")/Observations"; response = HTTPMethods.doGet(url); assertEquals(404, response.code, "Get should return 404 Not Found for url " + url); // POST tests - url = serverSettings.getServiceUrl(version) + "/Things(" + formatKeyValuesForUrl(thing1.getPrimaryKeyValues()) + ")/Datastreams(" + formatKeyValuesForUrl(datastream1.getPrimaryKeyValues()) + ")/Observations"; + url = serverSettings.getServiceUrl(version) + "/Things(" + formatKeyValuesForUrl(thing1) + ")/Datastreams(" + formatKeyValuesForUrl(datastream1) + ")/Observations"; String observationJson = "{\n" + " \"phenomenonTime\": \"2015-03-01T03:00:00.000Z\",\n" + " \"result\": 300\n" @@ -287,7 +287,7 @@ private void testGet(Entity thing1, Entity datastream1, Entity thing2) { response = HTTPMethods.doPost(url, observationJson); assertEquals(201, response.code, "Post should return 201 Created for url " + url); - url = serverSettings.getServiceUrl(version) + "/Things(" + formatKeyValuesForUrl(thing2.getPrimaryKeyValues()) + ")/Datastreams(" + formatKeyValuesForUrl(datastream1.getPrimaryKeyValues()) + ")/Observations"; + url = serverSettings.getServiceUrl(version) + "/Things(" + formatKeyValuesForUrl(thing2) + ")/Datastreams(" + formatKeyValuesForUrl(datastream1) + ")/Observations"; response = HTTPMethods.doPost(url, observationJson); assertNotEquals(201, response.code, "Post should not return 201 Created for url " + url); } diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c02cud/Capability2Tests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c02cud/Capability2Tests.java index 95bb42e0c..9dfbae639 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c02cud/Capability2Tests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c02cud/Capability2Tests.java @@ -1911,7 +1911,7 @@ private void createEntitiesForDelete() { String urlString = ServiceUrlHelper.buildURLString(serverSettings.getServiceUrl(version), EntityType.THING, null, null, null); HttpResponse responseMap = HTTPMethods.doPost(urlString, urlParameters); String response = responseMap.response; - THING_IDS.add(Utils.pkFromPostResult(response)[0]); + THING_IDS.add(Utils.pkFromPostResult(response).get(0)); urlString = ServiceUrlHelper.buildURLString(serverSettings.getServiceUrl(version), EntityType.THING, THING_IDS.get(0), EntityType.LOCATION, null); responseMap = HTTPMethods.doGet(urlString); @@ -1949,7 +1949,7 @@ private void createEntitiesForDelete() { }"""; responseMap = HTTPMethods.doPost(urlString, urlParameters); response = responseMap.response; - OBSERVATION_IDS.add(Utils.pkFromPostResult(response)[0]); + OBSERVATION_IDS.add(Utils.pkFromPostResult(response).get(0)); //FeatureOfInterest urlString = ServiceUrlHelper.buildURLString(serverSettings.getServiceUrl(version), EntityType.OBSERVATION, OBSERVATION_IDS.get(0), EntityType.FEATURE_OF_INTEREST, null); diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/Capability3Tests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/Capability3Tests.java index b508653ab..b3d204a57 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/Capability3Tests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/Capability3Tests.java @@ -1415,7 +1415,7 @@ private void checkPropertiesForFilter(String response, List properties, String sValue = (String) value; value = sValue.substring(1, sValue.length() - 1); if (!(propertyValue instanceof String)) { - propertyValue = propertyValue.toString(); + propertyValue = String.valueOf(propertyValue); } } else if (value instanceof ZonedDateTime) { propertyValue = ZonedDateTime.parse(propertyValue.toString()); @@ -1459,7 +1459,7 @@ private void checkPropertiesForFilter(String response, List properties, private static Object postAndGetId(String urlString, String postContent) { HttpResponse responseMap = HTTPMethods.doPost(urlString, postContent); String response = responseMap.response; - return Utils.pkFromPostResult(response)[0]; + return Utils.pkFromPostResult(response).get(0); } /** diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/FilterTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/FilterTests.java index e6eb3733a..198ef5a62 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/FilterTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/FilterTests.java @@ -19,7 +19,7 @@ import static de.fraunhofer.iosb.ilt.frostclient.models.CommonProperties.EP_PROPERTIES; import static de.fraunhofer.iosb.ilt.frostclient.utils.CollectionsHelper.propertiesBuilder; -import static de.fraunhofer.iosb.ilt.frostclient.utils.ParserUtils.formatKeyValuesForUrl; +import static de.fraunhofer.iosb.ilt.frostclient.utils.StringHelper.formatKeyValuesForUrl; import static de.fraunhofer.iosb.ilt.statests.util.EntityUtils.createDatastream; import static de.fraunhofer.iosb.ilt.statests.util.EntityUtils.createObservationSet; import static de.fraunhofer.iosb.ilt.statests.util.EntityUtils.createObservedProperty; diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/JsonPropertiesTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/JsonPropertiesTests.java index b07aee1f5..766e19dff 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/JsonPropertiesTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c03filtering/JsonPropertiesTests.java @@ -21,7 +21,7 @@ import static de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11Sensing.EP_PARAMETERS; import static de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11Sensing.EP_RESULTQUALITY; import static de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11Sensing.EP_UNITOFMEASUREMENT; -import static de.fraunhofer.iosb.ilt.frostclient.utils.ParserUtils.formatKeyValuesForUrl; +import static de.fraunhofer.iosb.ilt.frostclient.utils.StringHelper.formatKeyValuesForUrl; import static de.fraunhofer.iosb.ilt.statests.util.EntityUtils.testFilterResults; import static de.fraunhofer.iosb.ilt.statests.util.Utils.getFromList; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c04batch/BatchTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c04batch/BatchTests.java index 738db0d51..bf45a56ed 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c04batch/BatchTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c04batch/BatchTests.java @@ -19,7 +19,7 @@ import static de.fraunhofer.iosb.ilt.frostclient.models.CommonProperties.EP_NAME; import static de.fraunhofer.iosb.ilt.frostclient.models.CommonProperties.EP_PROPERTIES; -import static de.fraunhofer.iosb.ilt.frostclient.utils.ParserUtils.formatKeyValuesForUrl; +import static de.fraunhofer.iosb.ilt.frostclient.utils.StringHelper.formatKeyValuesForUrl; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; @@ -114,8 +114,8 @@ private static void createEntities() throws ServiceFailureException, URISyntaxEx sSrvc.create(obsProp); OBSERVED_PROPS.add(obsProp); - ID_TYPES.put(EntityType.THING, IdType.findFor(THINGS.get(0).getPrimaryKeyValues()[0])); - ID_TYPES.put(EntityType.OBSERVED_PROPERTY, IdType.findFor(OBSERVED_PROPS.get(0).getPrimaryKeyValues()[0])); + ID_TYPES.put(EntityType.THING, IdType.findFor(THINGS.get(0).getPrimaryKeyValues().get(0))); + ID_TYPES.put(EntityType.OBSERVED_PROPERTY, IdType.findFor(OBSERVED_PROPS.get(0).getPrimaryKeyValues().get(0))); } /** @@ -236,7 +236,7 @@ void test02BatchRequestWithChangeSetReferencingNewEntities() { + " \"definition\": \"http://unitsofmeasure.org/ucum.html#para-30\"\r\n" + " },\n" + " \"observationType\": \"http://www.opengis.net/def/observationType/OGCOM/2.0/OM_Measurement\",\r\n" - + " \"ObservedProperty\": {\"@iot.id\": " + Utils.quoteForJson(OBSERVED_PROPS.get(0).getPrimaryKeyValues()[0]) + "},\r\n" + + " \"ObservedProperty\": {\"@iot.id\": " + Utils.quoteForJson(OBSERVED_PROPS.get(0).getPrimaryKeyValues().get(0)) + "},\r\n" + " \"Sensor\": {\"@iot.id\": \"$sensor1\"}\r\n" + "}"; final String batchContent = "--batch_36522ad7-fc75-4b56-8c71-56071383e77b\r\n" @@ -496,7 +496,7 @@ void test07JsonBatchRequestWithChangeSetReferencingNewEntities() { "ObservedProperty": {"@iot.id": $ObservedProperty0}, "Sensor": {"@iot.id": "$sensor1"} }"""; - post2 = StringUtils.replace(post2, "$ObservedProperty0", Utils.quoteForJson(OBSERVED_PROPS.get(0).getPrimaryKeyValues()[0])); + post2 = StringUtils.replace(post2, "$ObservedProperty0", Utils.quoteForJson(OBSERVED_PROPS.get(0).getPrimaryKeyValues().get(0))); String request = """ { "requests":[{ diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c05multidatastream/MultiDatastreamObsPropTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c05multidatastream/MultiDatastreamObsPropTests.java index 883d16387..2e671092e 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c05multidatastream/MultiDatastreamObsPropTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c05multidatastream/MultiDatastreamObsPropTests.java @@ -18,7 +18,7 @@ package de.fraunhofer.iosb.ilt.statests.c05multidatastream; import static de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11MultiDatastream.EP_MULTIOBSERVATIONDATATYPES; -import static de.fraunhofer.iosb.ilt.frostclient.utils.ParserUtils.formatKeyValuesForUrl; +import static de.fraunhofer.iosb.ilt.frostclient.utils.StringHelper.formatKeyValuesForUrl; import static de.fraunhofer.iosb.ilt.statests.util.Utils.getFromList; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -305,9 +305,9 @@ void test05UnLinkObsProp1() throws ServiceFailureException { Entity md2 = MULTIDATASTREAMS.get(1); Entity op2 = OBSERVED_PROPS.get(1); Entity op3 = OBSERVED_PROPS.get(2); - String md2Id = formatKeyValuesForUrl(md2.getPrimaryKeyValues()); - String op2Id = formatKeyValuesForUrl(op2.getPrimaryKeyValues()); - String op3Id = formatKeyValuesForUrl(op3.getPrimaryKeyValues()); + String md2Id = formatKeyValuesForUrl(md2); + String op2Id = formatKeyValuesForUrl(op2); + String op3Id = formatKeyValuesForUrl(op3); HttpResponse response = HTTPMethods.doDelete(serverSettings.getServiceUrl(version) + "/MultiDatastreams(" + md2Id + ")/ObservedProperties/$ref?$id=../../Observations(" + op2Id + ")"); assertEquals(400, response.code); diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c05multidatastream/MultiDatastreamTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c05multidatastream/MultiDatastreamTests.java index bb81192f7..d0720821e 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c05multidatastream/MultiDatastreamTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c05multidatastream/MultiDatastreamTests.java @@ -17,7 +17,7 @@ */ package de.fraunhofer.iosb.ilt.statests.c05multidatastream; -import static de.fraunhofer.iosb.ilt.frostclient.utils.ParserUtils.formatKeyValuesForUrl; +import static de.fraunhofer.iosb.ilt.frostclient.utils.StringHelper.formatKeyValuesForUrl; import static de.fraunhofer.iosb.ilt.statests.util.Utils.getFromList; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c06dataarrays/DataArrayTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c06dataarrays/DataArrayTests.java index aee409346..0b87ede84 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c06dataarrays/DataArrayTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c06dataarrays/DataArrayTests.java @@ -17,13 +17,13 @@ */ package de.fraunhofer.iosb.ilt.statests.c06dataarrays; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; import com.fasterxml.jackson.databind.JsonNode; import de.fraunhofer.iosb.ilt.frostclient.exception.ServiceFailureException; import de.fraunhofer.iosb.ilt.frostclient.model.Entity; +import de.fraunhofer.iosb.ilt.frostclient.model.PkValue; import de.fraunhofer.iosb.ilt.frostclient.models.ext.UnitOfMeasurement; import de.fraunhofer.iosb.ilt.statests.AbstractTestClass; import de.fraunhofer.iosb.ilt.statests.ServerSettings; @@ -134,7 +134,7 @@ void test03PostDataArray() { String jsonString = "[\n" + " {\n" + " \"Datastream\": {\n" - + " \"@iot.id\": " + Utils.quoteForJson(ds1.getPrimaryKeyValues()[0]) + "\n" + + " \"@iot.id\": " + Utils.quoteForJson(ds1.getPrimaryKeyValues().get(0)) + "\n" + " },\n" + " \"components\": [\n" + " \"phenomenonTime\",\n" @@ -146,7 +146,7 @@ void test03PostDataArray() { + " [\n" + " \"2010-12-23T10:20:00-07:00\",\n" + " 20,\n" - + " " + Utils.quoteForJson(foi1.getPrimaryKeyValues()[0]) + "\n" + + " " + Utils.quoteForJson(foi1.getPrimaryKeyValues().get(0)) + "\n" + " ],\n" + " [\n" + " \"2010-12-23T10:21:00-07:00\",\n" @@ -157,7 +157,7 @@ void test03PostDataArray() { + " },\n" + " {\n" + " \"Datastream\": {\n" - + " \"@iot.id\": " + Utils.quoteForJson(ds2.getPrimaryKeyValues()[0]) + "\n" + + " \"@iot.id\": " + Utils.quoteForJson(ds2.getPrimaryKeyValues().get(0)) + "\n" + " },\n" + " \"components\": [\n" + " \"phenomenonTime\",\n" @@ -214,7 +214,7 @@ void test03PostDataArray() { continue; } - Object[] obsPk = Utils.pkFromPostResult(textValue); + PkValue obsPk = Utils.pkFromPostResult(textValue); Entity obs; try { obs = sSrvc.dao(sMdl.etObservation).find(obsPk); @@ -237,7 +237,7 @@ void test03PostDataArray() { return; } message = "Autogenerated Features of interest should be equal."; - assertArrayEquals(foiObs8.getPrimaryKeyValues(), foiObs7.getPrimaryKeyValues(), message); + assertEquals(foiObs8.getPrimaryKeyValues(), foiObs7.getPrimaryKeyValues(), message); } @Test @@ -252,7 +252,7 @@ void test04PostDataArrayMultiDatastream() { String jsonString = "[\n" + " {\n" + " \"MultiDatastream\": {\n" - + " \"@iot.id\": " + Utils.quoteForJson(mds1.getPrimaryKeyValues()[0]) + "\n" + + " \"@iot.id\": " + Utils.quoteForJson(mds1.getPrimaryKeyValues().get(0)) + "\n" + " },\n" + " \"components\": [\n" + " \"phenomenonTime\",\n" @@ -309,7 +309,7 @@ void test04PostDataArrayMultiDatastream() { continue; } - Object[] obsId = Utils.pkFromPostResult(textValue); + PkValue obsId = Utils.pkFromPostResult(textValue); Entity obs; try { obs = sSrvc.dao(sMdl.etObservation).find(obsId); diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c07mqttcreate/Capability7Tests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c07mqttcreate/Capability7Tests.java index 73366bedd..d3bcd470a 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c07mqttcreate/Capability7Tests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/c07mqttcreate/Capability7Tests.java @@ -192,8 +192,8 @@ private JsonNode getObservation() throws ServiceFailureException { + " \"validTime\": \"2016-01-01T01:01:01.000Z/2016-01-01T23:59:59.000Z\",\n" + " \"result\": " + value + ",\n" + " \"parameters\":{\"param1\": \"some value1\", \"param2\": \"some value2\"},\n" - + " \"Datastream\":{\"@iot.id\": " + Utils.quoteForJson(datastream.getPrimaryKeyValues()[0]) + "},\n" - + " \"FeatureOfInterest\": {\"@iot.id\": " + Utils.quoteForJson(featureOfInterest.getPrimaryKeyValues()[0]) + "} \n" + + " \"Datastream\":{\"@iot.id\": " + Utils.quoteForJson(datastream.getPrimaryKeyValues().get(0)) + "},\n" + + " \"FeatureOfInterest\": {\"@iot.id\": " + Utils.quoteForJson(featureOfInterest.getPrimaryKeyValues().get(0)) + "} \n" + "}"); } catch (IOException ex) { LOGGER.error("Exception:", ex); diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTests.java index cf22da038..ad9eb28ce 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/FineGrainedAuthTests.java @@ -35,6 +35,7 @@ import de.fraunhofer.iosb.ilt.frostclient.dao.Dao; import de.fraunhofer.iosb.ilt.frostclient.exception.ServiceFailureException; import de.fraunhofer.iosb.ilt.frostclient.model.Entity; +import de.fraunhofer.iosb.ilt.frostclient.model.PkValue; import de.fraunhofer.iosb.ilt.frostclient.model.property.EntityPropertyMain; import de.fraunhofer.iosb.ilt.frostclient.model.property.NavigationPropertyEntity; import de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11Sensing; @@ -231,7 +232,7 @@ public void createEntities() throws ServiceFailureException { LOGGER.info(" Posted Batch with {} results.", result.getResponses().size()); for (BatchResponseJson.ResponsePart part : result.getResponses()) { final String location = part.getLocation(); - Object[] pk = pkFromSelfLink(location); + PkValue pk = pkFromSelfLink(location); final String type = typeFromSelfLink(location); switch (type) { case "things": @@ -279,7 +280,7 @@ public void createEntities() throws ServiceFailureException { public abstract String getBatchPostData() throws IOException; - public static Object[] pkFromSelfLink(String selfLink) { + public static PkValue pkFromSelfLink(String selfLink) { String idString = selfLink.substring(selfLink.indexOf('(') + 1, selfLink.indexOf(')')); return ParserUtils.tryToParse(idString); } @@ -498,7 +499,7 @@ void test_08a_ObservationRead() { @Test void test_08b_ObservationReadFilter() { LOGGER.info(" test_08b_ObservationReadFilter"); - final String filter = "Datastreams/Observations/id eq " + StringHelper.quoteForUrl(OBSERVATIONS.get(0).getPrimaryKeyValues()[0]); + final String filter = "Datastreams/Observations/id eq " + StringHelper.quoteForUrl(OBSERVATIONS.get(0).getPrimaryKeyValues().get(0)); testFilterResults(ADMIN, serviceAdmin, mdlSensing.etObservedProperty, filter, Utils.getFromList(O_PROPS, 0)); testFilterResults(WRITE, serviceWrite, mdlSensing.etObservedProperty, filter, Utils.getFromList(O_PROPS, 0)); testFilterResults(READ, serviceRead, mdlSensing.etObservedProperty, filter, Utils.getFromList(O_PROPS, 0)); diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/SensorThingsUserModel.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/SensorThingsUserModel.java index 08711aa3b..95d41ae91 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/SensorThingsUserModel.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f01auth/SensorThingsUserModel.java @@ -29,6 +29,7 @@ import de.fraunhofer.iosb.ilt.frostclient.model.Entity; import de.fraunhofer.iosb.ilt.frostclient.model.EntityType; import de.fraunhofer.iosb.ilt.frostclient.model.ModelRegistry; +import de.fraunhofer.iosb.ilt.frostclient.model.PkValue; import de.fraunhofer.iosb.ilt.frostclient.model.property.EntityProperty; import de.fraunhofer.iosb.ilt.frostclient.model.property.EntityPropertyMain; import de.fraunhofer.iosb.ilt.frostclient.model.property.NavigationPropertyEntity; @@ -189,6 +190,11 @@ public Entity newUserProjectRole() { } public Entity newUserProjectRole(Object... pk) { + return newUserProjectRole() + .setPrimaryKeyValues(PkValue.of(pk)); + } + + public Entity newUserProjectRole(PkValue pk) { return newUserProjectRole() .setPrimaryKeyValues(pk); } diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f02customlinks/CustomLinksTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f02customlinks/CustomLinksTests.java index c3a9fca2c..c6429939f 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f02customlinks/CustomLinksTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f02customlinks/CustomLinksTests.java @@ -118,7 +118,7 @@ private static void createEntities() throws ServiceFailureException, URISyntaxEx private static void createThings() throws ServiceFailureException { Entity thing1 = sMdl.newThing("Thing 1", "The first thing."); MapValue properties = CollectionsHelper.propertiesBuilder() - .addItem("alternate.Location@iot.id", LOCATIONS.get(0).getPrimaryKeyValues()[0]) + .addItem("alternate.Location@iot.id", LOCATIONS.get(0).getPrimaryKeyValues().get(0)) .build(); thing1.setProperty(EP_PROPERTIES, properties); thing1.addNavigationEntity(sMdl.npThingLocations, LOCATIONS.get(0)); @@ -127,8 +127,8 @@ private static void createThings() throws ServiceFailureException { Entity thing2 = sMdl.newThing("Thing 2", "The second thing."); properties = CollectionsHelper.propertiesBuilder() - .addItem("parent.Thing@iot.id", thing1.getPrimaryKeyValues()[0]) - .addItem("alternate.Location@iot.id", LOCATIONS.get(0).getPrimaryKeyValues()[0]) + .addItem("parent.Thing@iot.id", thing1.getPrimaryKeyValues().get(0)) + .addItem("alternate.Location@iot.id", LOCATIONS.get(0).getPrimaryKeyValues().get(0)) .build(); thing2.setProperty(EP_PROPERTIES, properties); thing2.addNavigationEntity(sMdl.npThingLocations, LOCATIONS.get(1)); @@ -137,7 +137,7 @@ private static void createThings() throws ServiceFailureException { Entity thing3 = sMdl.newThing("Thing 3", "The third thing."); properties = CollectionsHelper.propertiesBuilder() - .addItem("parent.Thing@iot.id", thing1.getPrimaryKeyValues()[0]) + .addItem("parent.Thing@iot.id", thing1.getPrimaryKeyValues().get(0)) .addItem("alternate.Location@iot.id", -1) .build(); thing3.setProperty(EP_PROPERTIES, properties); @@ -147,7 +147,7 @@ private static void createThings() throws ServiceFailureException { Entity thing4 = sMdl.newThing("Thing 4", "The fourt thing."); properties = CollectionsHelper.propertiesBuilder() - .addItem("parent.Thing@iot.id", thing2.getPrimaryKeyValues()[0]) + .addItem("parent.Thing@iot.id", thing2.getPrimaryKeyValues().get(0)) .build(); thing4.setProperty(EP_PROPERTIES, properties); thing4.addNavigationEntity(sMdl.npThingLocations, LOCATIONS.get(3)); @@ -185,12 +185,12 @@ void testCustomLinks1() throws ServiceFailureException { Object navLink = thing.getProperty(EP_PROPERTIES).get("parent.Thing@iot.navigationLink"); String expected = getServerSettings().getServiceRootUrl() + "/" + version.urlPart + "/Things(" - + Utils.quoteForUrl(THINGS.get(0).getPrimaryKeyValues()[0]) + ")"; + + Utils.quoteForUrl(THINGS.get(0).getPrimaryKeyValues().get(0)) + ")"; assertEquals(expected, navLink, "Custom link does not have (correct) navigationLink."); navLink = thing.getProperty(EP_PROPERTIES).get("alternate.Location@iot.navigationLink"); expected = getServerSettings().getServiceRootUrl() + "/" + version.urlPart + "/Locations(" - + Utils.quoteForUrl(LOCATIONS.get(0).getPrimaryKeyValues()[0]) + ")"; + + Utils.quoteForUrl(LOCATIONS.get(0).getPrimaryKeyValues().get(0)) + ")"; assertEquals(expected, navLink, "Custom link does not have (correct) navigationLink."); } @@ -199,12 +199,12 @@ void testCustomLinksExpand() throws ServiceFailureException { LOGGER.info(" testCustomLinksExpand"); Entity thing = sSrvc.dao(sMdl.etThing) .query() - .filter("id eq " + Utils.quoteForUrl(THINGS.get(1).getPrimaryKeyValues()[0])) + .filter("id eq " + Utils.quoteForUrl(THINGS.get(1).getPrimaryKeyValues().get(0))) .expand("properties/parent.Thing,properties/alternate.Location") .first(); String expected = getServerSettings().getServiceRootUrl() + "/" + version.urlPart + "/Things(" - + Utils.quoteForUrl(THINGS.get(0).getPrimaryKeyValues()[0]) + ")"; + + Utils.quoteForUrl(THINGS.get(0).getPrimaryKeyValues().get(0)) + ")"; Object navLink = thing.getProperty(EP_PROPERTIES).get("parent.Thing@iot.navigationLink"); assertEquals(expected, navLink, "Custom link does not have (correct) navigationLink."); @@ -222,12 +222,12 @@ void testCustomLinksExpandSelect() throws ServiceFailureException { LOGGER.info(" testCustomLinksExpandSelect"); Entity thing = sSrvc.dao(sMdl.etThing) .query() - .filter("id eq " + Utils.quoteForUrl(THINGS.get(1).getPrimaryKeyValues()[0])) + .filter("id eq " + Utils.quoteForUrl(THINGS.get(1).getPrimaryKeyValues().get(0))) .expand("properties/parent.Thing($select=id),properties/alternate.Location($select=name)") .first(); String expected = getServerSettings().getServiceRootUrl() + "/" + version.urlPart + "/Things(" - + Utils.quoteForUrl(THINGS.get(0).getPrimaryKeyValues()[0]) + ")"; + + Utils.quoteForUrl(THINGS.get(0).getPrimaryKeyValues().get(0)) + ")"; Object navLink = thing.getProperty(EP_PROPERTIES).get("parent.Thing@iot.navigationLink"); assertEquals(expected, navLink, "Custom link does not have (correct) navigationLink."); diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f03metadata/MetadataTests.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f03metadata/MetadataTests.java index b5a1bc100..96026a226 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f03metadata/MetadataTests.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/f03metadata/MetadataTests.java @@ -28,6 +28,7 @@ import com.fasterxml.jackson.databind.JsonNode; import de.fraunhofer.iosb.ilt.frostclient.exception.ServiceFailureException; import de.fraunhofer.iosb.ilt.frostclient.model.Entity; +import de.fraunhofer.iosb.ilt.frostclient.model.PkValue; import de.fraunhofer.iosb.ilt.frostclient.models.ext.MapValue; import de.fraunhofer.iosb.ilt.frostclient.models.ext.UnitOfMeasurement; import de.fraunhofer.iosb.ilt.frostclient.utils.CollectionsHelper; @@ -120,7 +121,7 @@ private static void createEntities() throws ServiceFailureException, URISyntaxEx Entity thing2 = sMdl.newThing("Thing 2", "The second thing."); properties = CollectionsHelper.propertiesBuilder() - .addItem("parent.Thing@iot.id", thing1.getPrimaryKeyValues()[0]) + .addItem("parent.Thing@iot.id", thing1.getPrimaryKeyValues().get(0)) .build(); thing2.setProperty(EP_PROPERTIES, properties); sSrvc.create(thing2); @@ -128,7 +129,7 @@ private static void createEntities() throws ServiceFailureException, URISyntaxEx Entity thing3 = sMdl.newThing("Thing 3", "The third thing."); properties = CollectionsHelper.propertiesBuilder() - .addItem("parent.Thing@iot.id", thing1.getPrimaryKeyValues()[0]) + .addItem("parent.Thing@iot.id", thing1.getPrimaryKeyValues().get(0)) .build(); thing3.setProperty(EP_PROPERTIES, properties); sSrvc.create(thing3); @@ -136,7 +137,7 @@ private static void createEntities() throws ServiceFailureException, URISyntaxEx Entity thing4 = sMdl.newThing("Thing 4", "The fourth thing."); properties = CollectionsHelper.propertiesBuilder() - .addItem("parent.Thing@iot.id", thing2.getPrimaryKeyValues()[0]) + .addItem("parent.Thing@iot.id", thing2.getPrimaryKeyValues().get(0)) .build(); thing4.setProperty(EP_PROPERTIES, properties); sSrvc.create(thing4); @@ -248,7 +249,7 @@ private HttpResponse getEntity(String metadata) { String urlString = ServiceUrlHelper.buildURLString( serverSettings.getServiceUrl(version), EntityType.THING, - THINGS.get(1).getPrimaryKeyValues()[0], + THINGS.get(1).getPrimaryKeyValues().get(0), null, "?$resultMetadata=" + metadata); HttpResponse result = HTTPMethods.doGet(urlString); @@ -265,7 +266,7 @@ void test03MetadataInExpand() { } private void testMetadataInExpand(String metadata, boolean hasSelfLink, boolean hasNavigationLink) { - String queryString = "?$filter=id%20eq%20" + Utils.quoteForUrl(THINGS.get(1).getPrimaryKeyValues()[0]) + String queryString = "?$filter=id%20eq%20" + Utils.quoteForUrl(THINGS.get(1).getPrimaryKeyValues().get(0)) + "&$expand=properties/parent.Thing&$resultMetadata=" + metadata; String urlString = ServiceUrlHelper.buildURLString(serverSettings.getServiceUrl(version), EntityType.THING, null, null, queryString); HttpResponse result = HTTPMethods.doGet(urlString); @@ -303,7 +304,7 @@ private String generateSelfLink(int thingIndex) { .append('/') .append(version.urlPart) .append("/Things(") - .append(Utils.quoteForUrl(THINGS.get(thingIndex).getPrimaryKeyValues()[0])) + .append(Utils.quoteForUrl(THINGS.get(thingIndex).getPrimaryKeyValues().get(0))) .append(')') .toString(); } @@ -326,7 +327,7 @@ private void testPostDataArray(String metadata, boolean hasLinks) { String jsonString = "[\n" + " {\n" + " \"Datastream\": {\n" - + " \"@iot.id\": " + Utils.quoteForJson(ds1.getPrimaryKeyValues()[0]) + "\n" + + " \"@iot.id\": " + Utils.quoteForJson(ds1.getPrimaryKeyValues().get(0)) + "\n" + " },\n" + " \"components\": [\n" + " \"phenomenonTime\",\n" @@ -338,7 +339,7 @@ private void testPostDataArray(String metadata, boolean hasLinks) { + " [\n" + " \"2010-12-23T10:20:00-07:00\",\n" + " 20,\n" - + " " + Utils.quoteForJson(foi1.getPrimaryKeyValues()[0]) + "\n" + + " " + Utils.quoteForJson(foi1.getPrimaryKeyValues().get(0)) + "\n" + " ],\n" + " [\n" + " \"2010-12-23T10:21:00-07:00\",\n" @@ -349,7 +350,7 @@ private void testPostDataArray(String metadata, boolean hasLinks) { + " },\n" + " {\n" + " \"Datastream\": {\n" - + " \"@iot.id\": " + Utils.quoteForJson(ds2.getPrimaryKeyValues()[0]) + "\n" + + " \"@iot.id\": " + Utils.quoteForJson(ds2.getPrimaryKeyValues().get(0)) + "\n" + " },\n" + " \"components\": [\n" + " \"phenomenonTime\",\n" @@ -407,7 +408,7 @@ private void testPostDataArray(String metadata, boolean hasLinks) { } if (hasLinks) { - Object[] obsId = Utils.pkFromPostResult(textValue); + PkValue obsId = Utils.pkFromPostResult(textValue); Entity obs; try { obs = sSrvc.dao(sMdl.etObservation).find(obsId); @@ -433,7 +434,7 @@ private void testPostDataArray(String metadata, boolean hasLinks) { return; } message = "Autogenerated Features of interest should be equal."; - Assertions.assertArrayEquals(foiObs8.getPrimaryKeyValues(), foiObs7.getPrimaryKeyValues(), message); + Assertions.assertEquals(foiObs8.getPrimaryKeyValues(), foiObs7.getPrimaryKeyValues(), message); } } diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/EntityHelper2.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/EntityHelper2.java index 7d97456ed..f9d210556 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/EntityHelper2.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/EntityHelper2.java @@ -52,6 +52,7 @@ import de.fraunhofer.iosb.ilt.frostclient.json.serialize.JsonWriter; import de.fraunhofer.iosb.ilt.frostclient.model.Entity; import de.fraunhofer.iosb.ilt.frostclient.model.EntityType; +import de.fraunhofer.iosb.ilt.frostclient.model.PkValue; import de.fraunhofer.iosb.ilt.frostclient.model.property.EntityPropertyMain; import de.fraunhofer.iosb.ilt.frostclient.model.property.NavigationProperty; import de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11MultiDatastream; @@ -190,7 +191,7 @@ public JsonNode getEntity(EntityType entityType) { return getEntity(entityType, null, null, null, null, null); } - public JsonNode getEntity(EntityType entityType, Object[] pk) { + public JsonNode getEntity(EntityType entityType, PkValue pk) { return getEntity(entityType, pk, null, null, null, null); } @@ -223,7 +224,7 @@ public String createUrl(EntityType target, Object id, String subPath) { public String createUrl(Entity target) { return sSrvc.getVersion().getUrlPart() + '/' + target.getEntityType().getMainSetName() - + '(' + Utils.quoteForUrl(target.getPrimaryKeyValues()[0]) + ')'; + + '(' + Utils.quoteForUrl(target.getPrimaryKeyValues().get(0)) + ')'; } public JsonNode getEntityWithRetry(EntityType entityType, String expand, int retries) { @@ -245,8 +246,8 @@ public JsonNode getEntity(EntityType entityType, String expand) { return getEntity(entityType, null, null, null, expand, null); } - public JsonNode getEntity(EntityType entityType, Object[] pk, NavigationProperty np, List select, String expand, String orderby) { - if (pk != null && pk.length == 0) { + public JsonNode getEntity(EntityType entityType, PkValue pk, NavigationProperty np, List select, String expand, String orderby) { + if (pk != null && pk.size() == 0) { return null; } String query = ""; @@ -269,7 +270,7 @@ public JsonNode getEntity(EntityType entityType, Object[] pk, NavigationProperty String urlString = sSrvc.getBaseUrl().toString() + entityType.mainSet; if (pk != null) { - urlString += '(' + Utils.quoteForUrl(pk[0]) + ')'; + urlString += '(' + Utils.quoteForUrl(pk.get(0)) + ')'; } if (np != null) { urlString += '/' + np.getName(); @@ -572,10 +573,10 @@ public Entity putEntity(Entity original) throws ServiceFailureException { public JsonNode sendHttpPutEntity(Entity entity) { EntityType entityType = entity.getEntityType(); - Object[] pk = entity.getPrimaryKeyValues(); + PkValue pk = entity.getPrimaryKeyValues(); String urlString = sSrvc.getBaseUrl().toString() + '/' + entityType.mainSet - + '(' + Utils.quoteForUrl(pk[0]) + ')'; + + '(' + Utils.quoteForUrl(pk.get(0)) + ')'; try { String data = JsonWriter.writeEntity(entity); HTTPMethods.HttpResponse responseMap = HTTPMethods.doPut(urlString, data); diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/EntityUtils.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/EntityUtils.java index a08a83eec..cfef61714 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/EntityUtils.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/EntityUtils.java @@ -35,6 +35,7 @@ import de.fraunhofer.iosb.ilt.frostclient.model.Entity; import de.fraunhofer.iosb.ilt.frostclient.model.EntitySet; import de.fraunhofer.iosb.ilt.frostclient.model.ModelRegistry; +import de.fraunhofer.iosb.ilt.frostclient.model.PkValue; import de.fraunhofer.iosb.ilt.frostclient.model.property.EntityPropertyMain; import de.fraunhofer.iosb.ilt.frostclient.model.property.NavigationPropertyEntity; import de.fraunhofer.iosb.ilt.frostclient.models.SensorThingsV11Sensing; @@ -115,7 +116,7 @@ public static ResultTestResult resultContains(EntitySet result, List exp Entity inExpectedList = findEntityIn(nextResult, testExpectedList); if (!testExpectedList.remove(inExpectedList)) { LOGGER.info("Entity with pk {} found in result that is not expected.", nextResult.getPrimaryKeyValues()); - return new ResultTestResult(false, "Entity with pk " + Arrays.toString(nextResult.getPrimaryKeyValues()) + " found in result that is not expected."); + return new ResultTestResult(false, "Entity with pk " + nextResult.getPrimaryKeyValues() + " found in result that is not expected."); } } if (!testExpectedList.isEmpty()) { @@ -134,9 +135,9 @@ public static ResultTestResult resultContains(EntitySet result, List exp * or null. */ public static Entity findEntityIn(Entity entity, List entities) { - Object[] pk = entity.getPrimaryKeyValues(); + PkValue pk = entity.getPrimaryKeyValues(); for (Entity inList : entities) { - if (Arrays.equals(inList.getPrimaryKeyValues(), pk)) { + if (inList.getPrimaryKeyValues().equals(pk)) { return inList; } } @@ -432,7 +433,7 @@ public static void checkEntity(Set extensions, JsonNode entity, Expan public static String listEntities(List list) { StringBuilder result = new StringBuilder(); for (Entity item : list) { - result.append(Arrays.toString(item.getPrimaryKeyValues())); + result.append(item.getPrimaryKeyValues().toString()); result.append(", "); } if (result.length() == 0) { diff --git a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/Utils.java b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/Utils.java index 7a0a47b92..d463f9305 100644 --- a/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/Utils.java +++ b/FROST-Server.Tests/src/test/java/de/fraunhofer/iosb/ilt/statests/util/Utils.java @@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.node.NullNode; import com.fasterxml.jackson.databind.node.ObjectNode; import de.fraunhofer.iosb.ilt.frostclient.model.Entity; +import de.fraunhofer.iosb.ilt.frostclient.model.PkValue; import de.fraunhofer.iosb.ilt.frostclient.utils.StringHelper; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -100,18 +101,18 @@ public static String quoteForUrl(Object value) { return "'" + StringHelper.escapeForStringConstant(Objects.toString(value)) + "'"; } - public static Object[] pkFromPostResult(String postResultLine) { + public static PkValue pkFromPostResult(String postResultLine) { int pos1 = postResultLine.lastIndexOf('(') + 1; int pos2 = postResultLine.lastIndexOf(')'); String part = postResultLine.substring(pos1, pos2); try { - return new Object[]{Long.valueOf(part)}; + return PkValue.of(Long.valueOf(part)); } catch (NumberFormatException exc) { // Id was not a long, thus a String. if (!part.startsWith("'") || !part.endsWith("'")) { throw new IllegalArgumentException("Strings in urls must be quoted with single quotes."); } - return new Object[]{part.substring(1, part.length() - 1)}; + return PkValue.of(part.substring(1, part.length() - 1)); } } diff --git a/FROST-Server.Tests/src/test/resources/logback-test.xml b/FROST-Server.Tests/src/test/resources/logback-test.xml index d6cb29280..5a24526f8 100644 --- a/FROST-Server.Tests/src/test/resources/logback-test.xml +++ b/FROST-Server.Tests/src/test/resources/logback-test.xml @@ -7,6 +7,9 @@ + + + @@ -14,6 +17,9 @@ + + + diff --git a/helm/frost-server/README.md b/helm/frost-server/README.md index 70df97ed6..c60b53d4e 100644 --- a/helm/frost-server/README.md +++ b/helm/frost-server/README.md @@ -332,18 +332,15 @@ More information about the FROST-Server configuration can be found [here](https: ### ExtraEnv -It is possible to pass extra environment variables to FROST using `frost.http.extraEnv` and `frost.mqtt.extraEnv`. -This variable accepts a YAML string with the `env` variables. +It is possible to pass extra environment variables to FROST using `frost.envExtra`, `frost.http.envExtra` and `frost.mqtt.envExtra`. +This variable accepts key-value pairs. Keys must be names usable for environment variables, values are quoted automatically. ``` # values.yaml frost: - http: - extraEnv: | - - name: plugins_modelLoader_idType_User - value: "string" - - name: plugins_modelLoader_idType_Role - value: "string" + envExtra: + plugins_modelLoader_idType_User: string + plugins_modelLoader_idType_Role: string ``` They can also be passed directly on the command line. diff --git a/pom.xml b/pom.xml index b1184826c..945e49f40 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ java fraunhofer-iosb - 2.13 + 2.15 1.3.1 1.11.0 2.16.1