Ensure a '.' character is allowed to be used in target filter query for metadata key and attribute name (#1186)

* Adapted code to allow '.' inside of metadata key and attribute names


Signed-off-by: Markus Block <markus.block@bosch-si.com>

* added handling of corner cases

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* Adapted metadata and attribute tests to check that dot is allowed

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* fixed documentation

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* Allow usage of dot in key names for every map attribute, e.g. also for
metadata in distribution set

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* fixed typo

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* adapted test key to ensure a dot can be used

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* fixed typo

Signed-off-by: Markus Block <markus.block@bosch-si.com>
This commit is contained in:
Markus Block
2021-10-18 10:51:04 +02:00
committed by GitHub
parent 998518d8e0
commit be3dfbf617
9 changed files with 138 additions and 33 deletions

View File

@@ -1025,7 +1025,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
public void createMetadata() throws Exception {
final DistributionSet testDS = testdataFactory.createDistributionSet("one");
final String knownKey1 = "knownKey1";
final String knownKey1 = "known.key.1.1";
final String knownKey2 = "knownKey2";
final String knownValue1 = "knownValue1";

View File

@@ -9,8 +9,8 @@
package org.eclipse.hawkbit.mgmt.rest.resource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasItem;
@@ -1611,8 +1611,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
// create target with attributes
final String knownTargetId = "targetIdNeedsUpdate";
final Map<String, String> knownControllerAttrs = new HashMap<>();
knownControllerAttrs.put("a", "1");
knownControllerAttrs.put("b", "2");
knownControllerAttrs.put("a.1", "1");
knownControllerAttrs.put("b.2", "2");
testdataFactory.createTarget(knownTargetId);
controllerManagement.updateControllerAttributes(knownTargetId, knownControllerAttrs, null);
assertThat(targetManagement.isControllerAttributesRequested(knownTargetId)).isFalse();
@@ -1721,7 +1721,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final String knownControllerId = "targetIdWithMetadata";
testdataFactory.createTarget(knownControllerId);
final String knownKey1 = "knownKey1";
final String knownKey1 = "known.key.1";
final String knownKey2 = "knownKey2";
final String knownValue1 = "knownValue1";