Skip to content

Commit 3331490

Browse files
Parse policy.rule_sets as a json array & fix stray metadata file creation in the bambi flow (#1233)
1 parent a5228fc commit 3331490

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

services/src/main/java/com/google/bos/iot/core/bambi/Utils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class Utils {
1717
public static final Set<String> LIST_TYPE_HEADERS = Set.of(
1818
"gateway.proxy_ids",
1919
"system.tags",
20-
"tags"
20+
"tags",
21+
"policy.rule_sets"
2122
);
2223
public static final Set<Pattern> NON_NUMERIC_HEADERS_REGEX = Set.of(
2324
Pattern.compile("pointset\\.points\\..*\\.ref"),

services/src/main/java/com/google/bos/iot/core/bambi/model/BambiSiteModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private void populateInDeviceMap(List<Map<String, String>> allDeviceData,
158158
if (allDeviceData != null) {
159159
for (Map<String, String> deviceData : allDeviceData) {
160160
String deviceId = deviceData.getOrDefault(DEVICE_ID, null);
161-
if (deviceId != null) {
161+
if (isNotEmpty(deviceId)) {
162162
deviceMap.putIfAbsent(deviceId, new LinkedHashMap<>());
163163
for (Entry<String, String> cell : deviceData.entrySet()) {
164164
deviceMap.get(deviceId)

services/src/test/java/com/google/bos/iot/core/bambi/BambiSiteModelTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,8 @@ public void populateInDeviceMap_skipsRowsWithoutDeviceIdValueOrColumn() {
418418
headerOnlySheet("h"), headerOnlySheet("h"), headerOnlySheet("h"), headerOnlySheet("h"));
419419

420420
Map<String, Map<String, String>> allMeta = model.getAllDevicesMetadata();
421-
assertEquals(3, allMeta.size());
421+
assertEquals(2, allMeta.size());
422422
assertNotNull(model.getDeviceMetadata("dev1"));
423-
assertEquals("val_for_empty_id", model.getDeviceMetadata("").get(PREFIX_SYSTEM + ".data"));
424423
assertEquals("val_for_null_string_id",
425424
model.getDeviceMetadata("null_string").get(PREFIX_SYSTEM + ".data"));
426425

0 commit comments

Comments
 (0)