iotagent-node-lib 4.4.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +67 -272
  2. package/config.js +2 -1
  3. package/doc/README.md +1 -1
  4. package/doc/admin.md +19 -22
  5. package/doc/api.md +621 -155
  6. package/doc/deprecated.md +4 -0
  7. package/doc/devel/architecture.md +5 -135
  8. package/doc/devel/development.md +224 -12
  9. package/doc/getting-started.md +114 -53
  10. package/doc/requirements.txt +1 -1
  11. package/doc/roadmap.md +5 -5
  12. package/docker/Mosquitto/Dockerfile +2 -2
  13. package/docker/Mosquitto/README.md +14 -11
  14. package/lib/commonConfig.js +7 -1
  15. package/lib/constants.js +3 -0
  16. package/lib/fiware-iotagent-lib.js +12 -15
  17. package/lib/jexlTranformsMap.js +3 -1
  18. package/lib/model/dbConn.js +1 -4
  19. package/lib/services/common/alarmManagement.js +3 -0
  20. package/lib/services/devices/deviceRegistryMemory.js +1 -1
  21. package/lib/services/devices/deviceRegistryMongoDB.js +2 -2
  22. package/lib/services/devices/deviceService.js +4 -3
  23. package/lib/services/devices/devices-NGSI-LD.js +5 -5
  24. package/lib/services/devices/devices-NGSI-mixed.js +3 -3
  25. package/lib/services/devices/devices-NGSI-v2.js +5 -5
  26. package/lib/services/groups/groupService.js +1 -1
  27. package/lib/services/ngsi/entities-NGSI-LD.js +321 -571
  28. package/lib/services/ngsi/entities-NGSI-v2.js +348 -281
  29. package/lib/services/ngsi/ngsiService.js +3 -1
  30. package/lib/services/ngsi/subscription-NGSI-LD.js +2 -2
  31. package/lib/services/ngsi/subscription-NGSI-v2.js +2 -2
  32. package/lib/services/northBound/deviceGroupAdministrationServer.js +42 -6
  33. package/lib/services/northBound/deviceProvisioningServer.js +5 -5
  34. package/lib/services/northBound/northboundServer.js +4 -2
  35. package/lib/services/stats/statsRegistry.js +128 -101
  36. package/lib/templates/createDevice.json +0 -24
  37. package/lib/templates/createDeviceLax.json +0 -23
  38. package/lib/templates/deviceGroup.json +1 -25
  39. package/lib/templates/updateDevice.json +0 -24
  40. package/lib/templates/updateDeviceLax.json +0 -23
  41. package/package.json +2 -2
  42. package/scripts/legacy_expression_tool/README.md +0 -1
  43. package/test/functional/README.md +75 -47
  44. package/test/functional/functional-tests-runner.js +9 -4
  45. package/test/functional/functional-tests.js +4 -4
  46. package/test/functional/testCases.js +1251 -257
  47. package/test/functional/testUtils.js +53 -20
  48. package/test/unit/examples/deviceProvisioningRequests/provisionFullDevice.json +1 -13
  49. package/test/unit/examples/deviceProvisioningRequests/updateProvisionDeviceWithApikey.json +4 -0
  50. package/test/unit/examples/groupProvisioningRequests/multipleConfigGroupsCreation.json +44 -0
  51. package/test/unit/examples/groupProvisioningRequests/provisionDuplicateConfigGroup.json +35 -0
  52. package/test/unit/examples/groupProvisioningRequests/provisionFullConfigGroup.json +36 -0
  53. package/test/unit/examples/groupProvisioningRequests/provisionFullConfigGroupAlternate.json +36 -0
  54. package/test/unit/general/deviceService-test.js +102 -0
  55. package/test/unit/general/statistics-service_test.js +1 -74
  56. package/test/unit/mongodb/mongodb-configGroup-registry-test.js +452 -0
  57. package/test/unit/mongodb/mongodb-connectionoptions-test.js +2 -3
  58. package/test/unit/mongodb/mongodb-group-registry-test.js +34 -33
  59. package/test/unit/mongodb/mongodb-service-registry-test.js +477 -0
  60. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin1a.json +4 -4
  61. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin2.json +22 -22
  62. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin29.json +4 -4
  63. package/test/unit/ngsi-ld/examples/contextRequests/updateContextExpressionPlugin32.json +14 -15
  64. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin1.json +23 -23
  65. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin15.json +0 -5
  66. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin4.json +11 -16
  67. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin5.json +23 -28
  68. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin6.json +8 -13
  69. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin7.json +0 -5
  70. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityPlugin8.json +24 -29
  71. package/test/unit/ngsi-ld/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +12 -17
  72. package/test/unit/ngsi-ld/examples/contextRequests/updateContextStaticLinkedAttributes.json +12 -10
  73. package/test/unit/ngsi-ld/expressions/jexlBasedTransformations-test.js +0 -102
  74. package/test/unit/ngsi-ld/plugins/multientity-plugin_test.js +4 -5
  75. package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +5 -5
  76. package/test/unit/ngsi-ld/provisioning/listProvisionedDevices-test.js +0 -4
  77. package/test/unit/ngsiv2/general/deviceService-test.js +94 -1
  78. package/test/unit/ngsiv2/general/iotam-autoregistration-test.js +195 -0
  79. package/test/unit/ngsiv2/provisioning/device-group-api-test.js +259 -0
  80. package/test/unit/ngsiv2/provisioning/device-provisioning-configGroup-api_test.js +1189 -0
  81. package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +6 -6
  82. package/test/unit/ngsiv2/provisioning/listProvisionedDevices-test.js +0 -4
  83. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +35 -0
  84. package/test/unit/statsRegistry/openmetrics-test.js +167 -0
  85. package/lib/templates/queryContext.json +0 -25
  86. package/test/unit/examples/deviceProvisioningRequests/provisionBidirectionalDevice.json +0 -35
  87. package/test/unit/examples/deviceProvisioningRequests/provisionDeviceBidirectionalGroup.json +0 -17
  88. package/test/unit/examples/groupProvisioningRequests/bidirectionalGroup.json +0 -31
  89. package/test/unit/general/statistics-persistence_test.js +0 -121
  90. package/test/unit/ngsi-ld/examples/contextRequests/createBidirectionalDevice.json +0 -17
  91. package/test/unit/ngsi-ld/examples/contextRequests/updateContextProcessTimestamp.json +0 -12
  92. package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotification.json +0 -13
  93. package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotificationWithDatasetId.json +0 -21
  94. package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalNotificationWithMetadata.json +0 -17
  95. package/test/unit/ngsi-ld/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +0 -23
  96. package/test/unit/ngsi-ld/plugins/timestamp-processing-plugin_test.js +0 -132
  97. package/test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json +0 -8
  98. package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalNotification.json +0 -13
  99. package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalNotificationWithMetadata.json +0 -19
  100. package/test/unit/ngsiv2/examples/subscriptionRequests/bidirectionalSubscriptionRequest.json +0 -24
@@ -446,7 +446,7 @@ const testCases = [
446
446
  ]
447
447
  },
448
448
  {
449
- describeName: '0021 Simple group with active attributes with metadata',
449
+ describeName: '0021 - Simple group with active attributes with metadata',
450
450
  provision: {
451
451
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
452
452
  method: 'POST',
@@ -513,6 +513,477 @@ const testCases = [
513
513
  }
514
514
  ]
515
515
  },
516
+ {
517
+ describeName: '0021b - Simple group with active attributes with special names in object_id',
518
+ provision: {
519
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
520
+ method: 'POST',
521
+ json: {
522
+ services: [
523
+ {
524
+ resource: '/iot/json',
525
+ apikey: globalEnv.apikey,
526
+ entity_type: globalEnv.entity_type,
527
+ commands: [],
528
+ lazy: [],
529
+ attributes: [
530
+ {
531
+ object_id: 'a',
532
+ name: 'attr_a',
533
+ type: 'Boolean',
534
+ metadata: {
535
+ accuracy: {
536
+ value: 0.8,
537
+ type: 'Float'
538
+ }
539
+ }
540
+ },
541
+ {
542
+ object_id: '.1.0.0.1',
543
+ name: 'psBatteryVoltage',
544
+ type: 'Number'
545
+ }
546
+ ],
547
+ static_attributes: []
548
+ }
549
+ ]
550
+ },
551
+ headers: {
552
+ 'fiware-service': globalEnv.service,
553
+ 'fiware-servicepath': globalEnv.servicePath
554
+ }
555
+ },
556
+ should: [
557
+ {
558
+ shouldName:
559
+ 'A - WHEN sending defined object_ids with special format names (measures) through http IT should send measures to Context Broker preserving value types, name mappings and metadatas',
560
+ type: 'single',
561
+ measure: {
562
+ url: 'http://localhost:' + config.http.port + '/iot/json',
563
+ method: 'POST',
564
+ qs: {
565
+ i: globalEnv.deviceId,
566
+ k: globalEnv.apikey
567
+ },
568
+ json: {
569
+ a: false,
570
+ '.1.0.0.1': 23.5
571
+ }
572
+ },
573
+ expectation: {
574
+ id: globalEnv.entity_name,
575
+ type: globalEnv.entity_type,
576
+ attr_a: {
577
+ value: false,
578
+ type: 'Boolean',
579
+ metadata: {
580
+ accuracy: {
581
+ value: 0.8,
582
+ type: 'Float'
583
+ }
584
+ }
585
+ },
586
+ psBatteryVoltage: {
587
+ type: 'Number',
588
+ value: 23.5
589
+ }
590
+ }
591
+ }
592
+ ]
593
+ },
594
+ {
595
+ describeName: '0022 - Simple group with active attributes and multimeasures',
596
+ provision: {
597
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
598
+ method: 'POST',
599
+ json: {
600
+ services: [
601
+ {
602
+ resource: '/iot/json',
603
+ apikey: globalEnv.apikey,
604
+ entity_type: globalEnv.entity_type,
605
+ commands: [],
606
+ lazy: [],
607
+ attributes: [
608
+ {
609
+ object_id: 'a',
610
+ name: 'attr_a',
611
+ type: 'Number'
612
+ }
613
+ ],
614
+ static_attributes: []
615
+ }
616
+ ]
617
+ },
618
+ headers: {
619
+ 'fiware-service': globalEnv.service,
620
+ 'fiware-servicepath': globalEnv.servicePath
621
+ }
622
+ },
623
+ should: [
624
+ {
625
+ shouldName:
626
+ 'A - WHEN sending defined object_ids (measures) through http IT should send measures to Context Broker preserving value types and name mappings',
627
+ type: 'multimeasure',
628
+ measure: {
629
+ url: 'http://localhost:' + config.http.port + '/iot/json',
630
+ method: 'POST',
631
+ qs: {
632
+ i: globalEnv.deviceId,
633
+ k: globalEnv.apikey
634
+ },
635
+ json: [
636
+ {
637
+ a: 0
638
+ },
639
+ {
640
+ a: 1
641
+ },
642
+ {
643
+ a: 2
644
+ },
645
+ {
646
+ a: 3
647
+ },
648
+ {
649
+ a: 4
650
+ },
651
+ {
652
+ a: 5
653
+ },
654
+ {
655
+ a: 6
656
+ }
657
+ ]
658
+ },
659
+ expectation: {
660
+ actionType: 'append',
661
+ entities: [
662
+ {
663
+ attr_a: {
664
+ type: 'Number',
665
+ value: 0
666
+ },
667
+ id: globalEnv.entity_name,
668
+ type: globalEnv.entity_type
669
+ },
670
+ {
671
+ attr_a: {
672
+ type: 'Number',
673
+ value: 1
674
+ },
675
+ id: globalEnv.entity_name,
676
+ type: globalEnv.entity_type
677
+ },
678
+ {
679
+ attr_a: {
680
+ type: 'Number',
681
+ value: 2
682
+ },
683
+ id: globalEnv.entity_name,
684
+ type: globalEnv.entity_type
685
+ },
686
+ {
687
+ attr_a: {
688
+ type: 'Number',
689
+ value: 3
690
+ },
691
+ id: globalEnv.entity_name,
692
+ type: globalEnv.entity_type
693
+ },
694
+ {
695
+ attr_a: {
696
+ type: 'Number',
697
+ value: 4
698
+ },
699
+ id: globalEnv.entity_name,
700
+ type: globalEnv.entity_type
701
+ },
702
+ {
703
+ attr_a: {
704
+ type: 'Number',
705
+ value: 5
706
+ },
707
+ id: globalEnv.entity_name,
708
+ type: globalEnv.entity_type
709
+ },
710
+ {
711
+ attr_a: {
712
+ type: 'Number',
713
+ value: 6
714
+ },
715
+ id: globalEnv.entity_name,
716
+ type: globalEnv.entity_type
717
+ }
718
+ ]
719
+ }
720
+ },
721
+ {
722
+ shouldName:
723
+ 'A - WHEN sending defined object_ids (measures) through http IT should send measures with TimeInstant to Context Broker preserving value types and name mappings and order',
724
+ type: 'multimeasure',
725
+ measure: {
726
+ url: 'http://localhost:' + config.http.port + '/iot/json',
727
+ method: 'POST',
728
+ qs: {
729
+ i: globalEnv.deviceId,
730
+ k: globalEnv.apikey
731
+ },
732
+ json: [
733
+ {
734
+ a: 0,
735
+ TimeInstant: '2024-04-10T10:00:00Z'
736
+ },
737
+ {
738
+ a: 1,
739
+ TimeInstant: '2024-04-10T10:05:00Z'
740
+ },
741
+ {
742
+ a: 2,
743
+ TimeInstant: '2024-04-10T10:10:00Z'
744
+ },
745
+ {
746
+ a: 3,
747
+ TimeInstant: '2024-04-10T10:15:00Z'
748
+ },
749
+ {
750
+ a: 4,
751
+ TimeInstant: '2024-04-10T10:20:00Z'
752
+ },
753
+ {
754
+ a: 5,
755
+ TimeInstant: '2024-04-10T10:25:00Z'
756
+ },
757
+ {
758
+ a: 6,
759
+ TimeInstant: '2024-04-10T10:30:00Z'
760
+ }
761
+ ]
762
+ },
763
+ expectation: {
764
+ actionType: 'append',
765
+ entities: [
766
+ {
767
+ attr_a: {
768
+ type: 'Number',
769
+ value: 0
770
+ },
771
+ TimeInstant: {
772
+ type: 'DateTime',
773
+ value: '2024-04-10T10:00:00Z'
774
+ },
775
+ id: globalEnv.entity_name,
776
+ type: globalEnv.entity_type
777
+ },
778
+ {
779
+ attr_a: {
780
+ type: 'Number',
781
+ value: 1
782
+ },
783
+ TimeInstant: {
784
+ type: 'DateTime',
785
+ value: '2024-04-10T10:05:00Z'
786
+ },
787
+ id: globalEnv.entity_name,
788
+ type: globalEnv.entity_type
789
+ },
790
+ {
791
+ attr_a: {
792
+ type: 'Number',
793
+ value: 2
794
+ },
795
+ TimeInstant: {
796
+ type: 'DateTime',
797
+ value: '2024-04-10T10:10:00Z'
798
+ },
799
+ id: globalEnv.entity_name,
800
+ type: globalEnv.entity_type
801
+ },
802
+ {
803
+ attr_a: {
804
+ type: 'Number',
805
+ value: 3
806
+ },
807
+ TimeInstant: {
808
+ type: 'DateTime',
809
+ value: '2024-04-10T10:15:00Z'
810
+ },
811
+ id: globalEnv.entity_name,
812
+ type: globalEnv.entity_type
813
+ },
814
+ {
815
+ attr_a: {
816
+ type: 'Number',
817
+ value: 4
818
+ },
819
+ TimeInstant: {
820
+ type: 'DateTime',
821
+ value: '2024-04-10T10:20:00Z'
822
+ },
823
+ id: globalEnv.entity_name,
824
+ type: globalEnv.entity_type
825
+ },
826
+ {
827
+ attr_a: {
828
+ type: 'Number',
829
+ value: 5
830
+ },
831
+ TimeInstant: {
832
+ type: 'DateTime',
833
+ value: '2024-04-10T10:25:00Z'
834
+ },
835
+ id: globalEnv.entity_name,
836
+ type: globalEnv.entity_type
837
+ },
838
+ {
839
+ attr_a: {
840
+ type: 'Number',
841
+ value: 6
842
+ },
843
+ TimeInstant: {
844
+ type: 'DateTime',
845
+ value: '2024-04-10T10:30:00Z'
846
+ },
847
+ id: globalEnv.entity_name,
848
+ type: globalEnv.entity_type
849
+ }
850
+ ]
851
+ }
852
+ },
853
+ {
854
+ shouldName:
855
+ 'A - WHEN sending defined object_ids (measures) through http IT should send measures with TimeInstant to Context Broker preserving value types and name mappings and sorted by TimeInstant',
856
+ type: 'multimeasure',
857
+ measure: {
858
+ url: 'http://localhost:' + config.http.port + '/iot/json',
859
+ method: 'POST',
860
+ qs: {
861
+ i: globalEnv.deviceId,
862
+ k: globalEnv.apikey
863
+ },
864
+ json: [
865
+ {
866
+ a: 0,
867
+ TimeInstant: '2024-04-10T10:15:00Z'
868
+ },
869
+ {
870
+ a: 1,
871
+ TimeInstant: '2024-04-10T10:05:00Z'
872
+ },
873
+ {
874
+ a: 2,
875
+ TimeInstant: '2024-04-10T10:20:00Z'
876
+ },
877
+ {
878
+ a: 3,
879
+ TimeInstant: '2024-04-10T10:00:00Z'
880
+ },
881
+ {
882
+ a: 4,
883
+ TimeInstant: '2024-04-10T10:10:00Z'
884
+ },
885
+ {
886
+ a: 5,
887
+ TimeInstant: '2024-04-10T10:30:00Z'
888
+ },
889
+ {
890
+ a: 6,
891
+ TimeInstant: '2024-04-10T10:25:00Z'
892
+ }
893
+ ]
894
+ },
895
+ expectation: {
896
+ actionType: 'append',
897
+ entities: [
898
+ {
899
+ attr_a: {
900
+ type: 'Number',
901
+ value: 3
902
+ },
903
+ TimeInstant: {
904
+ type: 'DateTime',
905
+ value: '2024-04-10T10:00:00Z'
906
+ },
907
+ id: globalEnv.entity_name,
908
+ type: globalEnv.entity_type
909
+ },
910
+ {
911
+ attr_a: {
912
+ type: 'Number',
913
+ value: 1
914
+ },
915
+ TimeInstant: {
916
+ type: 'DateTime',
917
+ value: '2024-04-10T10:05:00Z'
918
+ },
919
+ id: globalEnv.entity_name,
920
+ type: globalEnv.entity_type
921
+ },
922
+ {
923
+ attr_a: {
924
+ type: 'Number',
925
+ value: 4
926
+ },
927
+ TimeInstant: {
928
+ type: 'DateTime',
929
+ value: '2024-04-10T10:10:00Z'
930
+ },
931
+ id: globalEnv.entity_name,
932
+ type: globalEnv.entity_type
933
+ },
934
+ {
935
+ attr_a: {
936
+ type: 'Number',
937
+ value: 0
938
+ },
939
+ TimeInstant: {
940
+ type: 'DateTime',
941
+ value: '2024-04-10T10:15:00Z'
942
+ },
943
+ id: globalEnv.entity_name,
944
+ type: globalEnv.entity_type
945
+ },
946
+ {
947
+ attr_a: {
948
+ type: 'Number',
949
+ value: 2
950
+ },
951
+ TimeInstant: {
952
+ type: 'DateTime',
953
+ value: '2024-04-10T10:20:00Z'
954
+ },
955
+ id: globalEnv.entity_name,
956
+ type: globalEnv.entity_type
957
+ },
958
+ {
959
+ attr_a: {
960
+ type: 'Number',
961
+ value: 6
962
+ },
963
+ TimeInstant: {
964
+ type: 'DateTime',
965
+ value: '2024-04-10T10:25:00Z'
966
+ },
967
+ id: globalEnv.entity_name,
968
+ type: globalEnv.entity_type
969
+ },
970
+ {
971
+ attr_a: {
972
+ type: 'Number',
973
+ value: 5
974
+ },
975
+ TimeInstant: {
976
+ type: 'DateTime',
977
+ value: '2024-04-10T10:30:00Z'
978
+ },
979
+ id: globalEnv.entity_name,
980
+ type: globalEnv.entity_type
981
+ }
982
+ ]
983
+ }
984
+ }
985
+ ]
986
+ },
516
987
  // 0100 - JEXL TESTS
517
988
  {
518
989
  describeName: '0100 - Simple group with active attribute + JEXL expression boolean (!)',
@@ -1297,7 +1768,6 @@ const testCases = [
1297
1768
  },
1298
1769
  {
1299
1770
  describeName: '0170 - Simple group with active attribute + JEXL expression referencing context attributes',
1300
- skip: 'lib', // Explanation in #1523
1301
1771
  provision: {
1302
1772
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
1303
1773
  method: 'POST',
@@ -1357,9 +1827,101 @@ const testCases = [
1357
1827
  }
1358
1828
  ]
1359
1829
  },
1830
+ {
1831
+ describeName:
1832
+ '0175 - Simple group with active attribute + JEXL expression referencing metadata context attributes',
1833
+ provision: {
1834
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
1835
+ method: 'POST',
1836
+ json: {
1837
+ services: [
1838
+ {
1839
+ resource: '/iot/json',
1840
+ apikey: globalEnv.apikey,
1841
+ entity_type: globalEnv.entity_type,
1842
+ commands: [],
1843
+ lazy: [],
1844
+ static_attributes: [
1845
+ {
1846
+ name: 'st_attr1',
1847
+ type: 'Number',
1848
+ value: 1.5,
1849
+ metadata: {
1850
+ coef1: {
1851
+ value: 0.8,
1852
+ type: 'Float'
1853
+ }
1854
+ }
1855
+ },
1856
+ {
1857
+ name: 'st_attr',
1858
+ type: 'Number',
1859
+ value: 1.5,
1860
+ metadata: {
1861
+ coef: {
1862
+ value: 0.8,
1863
+ type: 'Float'
1864
+ }
1865
+ }
1866
+ },
1867
+ {
1868
+ name: 'st_attr2',
1869
+ type: 'Number',
1870
+ value: 1.5,
1871
+ metadata: {
1872
+ coef2: {
1873
+ value: 0.8,
1874
+ type: 'Float'
1875
+ }
1876
+ }
1877
+ }
1878
+ ],
1879
+ attributes: [
1880
+ {
1881
+ object_id: 'a',
1882
+ name: 'attr_a',
1883
+ type: 'Number',
1884
+ expression: 'a*st_attr*metadata.st_attr.coef'
1885
+ }
1886
+ ],
1887
+ explicitAttrs: "['attr_a']"
1888
+ }
1889
+ ]
1890
+ },
1891
+ headers: {
1892
+ 'fiware-service': globalEnv.service,
1893
+ 'fiware-servicepath': globalEnv.servicePath
1894
+ }
1895
+ },
1896
+ should: [
1897
+ {
1898
+ shouldName:
1899
+ 'A - WHEN sending a value (number) through http IT should apply the expression using the context attributes value and send to Context Broker the value "39.60" ',
1900
+ type: 'single',
1901
+ measure: {
1902
+ url: 'http://localhost:' + config.http.port + '/iot/json',
1903
+ method: 'POST',
1904
+ qs: {
1905
+ i: globalEnv.deviceId,
1906
+ k: globalEnv.apikey
1907
+ },
1908
+ json: {
1909
+ a: 33
1910
+ }
1911
+ },
1912
+ expectation: {
1913
+ id: globalEnv.entity_name,
1914
+ type: globalEnv.entity_type,
1915
+ attr_a: {
1916
+ value: 39.6,
1917
+ type: 'Number'
1918
+ }
1919
+ }
1920
+ }
1921
+ ]
1922
+ },
1360
1923
  {
1361
1924
  describeName: '0180 - Simple group with active attributes + JEXL multiples expressions at same time',
1362
- skip: 'lib', // Explanation in #1523
1363
1925
  provision: {
1364
1926
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
1365
1927
  method: 'POST',
@@ -2123,18 +2685,139 @@ const testCases = [
2123
2685
  }
2124
2686
  ]
2125
2687
  }
2126
- ]
2688
+ ]
2689
+ },
2690
+ headers: {
2691
+ 'fiware-service': globalEnv.service,
2692
+ 'fiware-servicepath': globalEnv.servicePath
2693
+ }
2694
+ },
2695
+ should: [
2696
+ {
2697
+ shouldName:
2698
+ 'A - WHEN sending a measure not named TimeInstant through http IT should not add the timestamp to the attributes or metadata sent to Context Broker',
2699
+ type: 'single',
2700
+ measure: {
2701
+ url: 'http://localhost:' + config.http.port + '/iot/json',
2702
+ method: 'POST',
2703
+ qs: {
2704
+ i: globalEnv.deviceId,
2705
+ k: globalEnv.apikey
2706
+ },
2707
+ json: {
2708
+ a: 21
2709
+ }
2710
+ },
2711
+ expectation: {
2712
+ id: globalEnv.entity_name,
2713
+ type: globalEnv.entity_type,
2714
+ attr_a: {
2715
+ value: 21,
2716
+ type: 'Number'
2717
+ }
2718
+ }
2719
+ },
2720
+ {
2721
+ shouldName:
2722
+ 'B - WHEN sending a measure named TimeInstant through http IT should not add the timestamp to the other attributes sent to Context Broker',
2723
+ type: 'single',
2724
+ measure: {
2725
+ url: 'http://localhost:' + config.http.port + '/iot/json',
2726
+ method: 'POST',
2727
+ qs: {
2728
+ i: globalEnv.deviceId,
2729
+ k: globalEnv.apikey
2730
+ },
2731
+ json: {
2732
+ TimeInstant: '2015-12-14T08:06:01.468Z',
2733
+ a: 23
2734
+ }
2735
+ },
2736
+ expectation: {
2737
+ id: globalEnv.entity_name,
2738
+ type: globalEnv.entity_type,
2739
+ attr_a: {
2740
+ value: 23,
2741
+ type: 'Number'
2742
+ },
2743
+ TimeInstant: {
2744
+ value: '2015-12-14T08:06:01.468Z',
2745
+ type: 'DateTime'
2746
+ }
2747
+ }
2748
+ }
2749
+ ]
2750
+ },
2751
+ {
2752
+ describeName: '0430 - Simple group with active attribute + timestamp mapping defined',
2753
+ provision: {
2754
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2755
+ method: 'POST',
2756
+ json: {
2757
+ services: [
2758
+ {
2759
+ resource: '/iot/json',
2760
+ apikey: globalEnv.apikey,
2761
+ timestamp: true,
2762
+ entity_type: globalEnv.entity_type,
2763
+ commands: [],
2764
+ lazy: [],
2765
+ attributes: [
2766
+ {
2767
+ object_id: 'mydatetime',
2768
+ name: 'TimeInstant',
2769
+ type: 'DateTime'
2770
+ }
2771
+ ]
2772
+ }
2773
+ ]
2774
+ },
2775
+ headers: {
2776
+ 'fiware-service': globalEnv.service,
2777
+ 'fiware-servicepath': globalEnv.servicePath
2778
+ }
2779
+ },
2780
+ should: [
2781
+ {
2782
+ shouldName:
2783
+ 'A - WHEN sending a measure through http IT should map the measure to timestamp attribute and use it for timestmap and other metadata attributes sent to Context Broker',
2784
+ type: 'single',
2785
+ measure: {
2786
+ url: 'http://localhost:' + config.http.port + '/iot/json',
2787
+ method: 'POST',
2788
+ qs: {
2789
+ i: globalEnv.deviceId,
2790
+ k: globalEnv.apikey
2791
+ },
2792
+ json: {
2793
+ mydatetime: '2022-02-02T02:22:22.222Z',
2794
+ a: 23
2795
+ }
2796
+ },
2797
+ expectation: {
2798
+ id: globalEnv.entity_name,
2799
+ type: globalEnv.entity_type,
2800
+ a: {
2801
+ value: 23,
2802
+ type: 'Text',
2803
+ metadata: {
2804
+ TimeInstant: {
2805
+ value: '2022-02-02T02:22:22.222Z',
2806
+ type: 'DateTime'
2807
+ }
2808
+ }
2809
+ },
2810
+ TimeInstant: {
2811
+ value: '2022-02-02T02:22:22.222Z',
2812
+ type: 'DateTime'
2813
+ }
2814
+ }
2127
2815
  },
2128
- headers: {
2129
- 'fiware-service': globalEnv.service,
2130
- 'fiware-servicepath': globalEnv.servicePath
2131
- }
2132
- },
2133
- should: [
2134
2816
  {
2135
2817
  shouldName:
2136
- 'A - WHEN sending a measure not named TimeInstant through http IT should not add the timestamp to the attributes or metadata sent to Context Broker',
2818
+ 'A - WHEN sending a measure without timestamp through http IT should use system timestamp for mapped attribute and use it for timestmap and other metadata attributes sent to Context Broker',
2137
2819
  type: 'single',
2820
+ isRegex: true,
2138
2821
  measure: {
2139
2822
  url: 'http://localhost:' + config.http.port + '/iot/json',
2140
2823
  method: 'POST',
@@ -2143,21 +2826,31 @@ const testCases = [
2143
2826
  k: globalEnv.apikey
2144
2827
  },
2145
2828
  json: {
2146
- a: 21
2829
+ a: 23
2147
2830
  }
2148
2831
  },
2149
2832
  expectation: {
2150
2833
  id: globalEnv.entity_name,
2151
2834
  type: globalEnv.entity_type,
2152
- attr_a: {
2153
- value: 21,
2154
- type: 'Number'
2835
+ a: {
2836
+ value: 23,
2837
+ type: 'Text',
2838
+ metadata: {
2839
+ TimeInstant: {
2840
+ value: _.isDateString,
2841
+ type: 'DateTime'
2842
+ }
2843
+ }
2844
+ },
2845
+ TimeInstant: {
2846
+ value: _.isDateString,
2847
+ type: 'DateTime'
2155
2848
  }
2156
2849
  }
2157
2850
  },
2158
2851
  {
2159
2852
  shouldName:
2160
- 'B - WHEN sending a measure named TimeInstant through http IT should not add the timestamp to the other attributes sent to Context Broker',
2853
+ 'A - WHEN sending a measure with timestamp through http IT should map the measure to timestamp attribute and use it for timestmap and other metadata attributes sent to Context Broker',
2161
2854
  type: 'single',
2162
2855
  measure: {
2163
2856
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2167,19 +2860,26 @@ const testCases = [
2167
2860
  k: globalEnv.apikey
2168
2861
  },
2169
2862
  json: {
2170
- TimeInstant: '2015-12-14T08:06:01.468Z',
2863
+ mydatetime: '2022-02-02T02:22:22.222Z',
2864
+ TimeInstant: '2033-03-03T03:33:33.333Z',
2171
2865
  a: 23
2172
2866
  }
2173
2867
  },
2174
2868
  expectation: {
2175
2869
  id: globalEnv.entity_name,
2176
2870
  type: globalEnv.entity_type,
2177
- attr_a: {
2871
+ a: {
2178
2872
  value: 23,
2179
- type: 'Number'
2873
+ type: 'Text',
2874
+ metadata: {
2875
+ TimeInstant: {
2876
+ value: '2022-02-02T02:22:22.222Z',
2877
+ type: 'DateTime'
2878
+ }
2879
+ }
2180
2880
  },
2181
2881
  TimeInstant: {
2182
- value: '2015-12-14T08:06:01.468Z',
2882
+ value: '2022-02-02T02:22:22.222Z',
2183
2883
  type: 'DateTime'
2184
2884
  }
2185
2885
  }
@@ -2187,7 +2887,7 @@ const testCases = [
2187
2887
  ]
2188
2888
  },
2189
2889
  {
2190
- describeName: '0430 - Simple group with active attribute + timestamp mapping defined',
2890
+ describeName: '0431 - Simple group with active attribute + timestamp mapping defined + explicitAttrs',
2191
2891
  provision: {
2192
2892
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2193
2893
  method: 'POST',
@@ -2197,6 +2897,7 @@ const testCases = [
2197
2897
  resource: '/iot/json',
2198
2898
  apikey: globalEnv.apikey,
2199
2899
  timestamp: true,
2900
+ explicitAttrs: true,
2200
2901
  entity_type: globalEnv.entity_type,
2201
2902
  commands: [],
2202
2903
  lazy: [],
@@ -2205,6 +2906,11 @@ const testCases = [
2205
2906
  object_id: 'mydatetime',
2206
2907
  name: 'TimeInstant',
2207
2908
  type: 'DateTime'
2909
+ },
2910
+ {
2911
+ object_id: 'a',
2912
+ name: 'a',
2913
+ type: 'Text'
2208
2914
  }
2209
2915
  ]
2210
2916
  }
@@ -2325,7 +3031,7 @@ const testCases = [
2325
3031
  ]
2326
3032
  },
2327
3033
  {
2328
- describeName: '0431 - Simple group with active attribute + timestamp mapping defined + explicitAttrs',
3034
+ describeName: '0432 - Simple group with active attribute + bad timestamp mapping defined',
2329
3035
  provision: {
2330
3036
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2331
3037
  method: 'POST',
@@ -2335,7 +3041,6 @@ const testCases = [
2335
3041
  resource: '/iot/json',
2336
3042
  apikey: globalEnv.apikey,
2337
3043
  timestamp: true,
2338
- explicitAttrs: true,
2339
3044
  entity_type: globalEnv.entity_type,
2340
3045
  commands: [],
2341
3046
  lazy: [],
@@ -2343,12 +3048,8 @@ const testCases = [
2343
3048
  {
2344
3049
  object_id: 'mydatetime',
2345
3050
  name: 'TimeInstant',
2346
- type: 'DateTime'
2347
- },
2348
- {
2349
- object_id: 'a',
2350
- name: 'a',
2351
- type: 'Text'
3051
+ type: 'DateTime',
3052
+ expression: '"2033-03-03T" + "03:33:33.333Z"'
2352
3053
  }
2353
3054
  ]
2354
3055
  }
@@ -2362,7 +3063,7 @@ const testCases = [
2362
3063
  should: [
2363
3064
  {
2364
3065
  shouldName:
2365
- 'A - WHEN sending a measure through http IT should map the measure to timestamp attribute and use it for timestmap and other metadata attributes sent to Context Broker',
3066
+ 'A - WHEN sending a measure through http IT should map the measure to fixed timestamp attribute and use it for timestmap sent to Context Broker',
2366
3067
  type: 'single',
2367
3068
  measure: {
2368
3069
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2384,21 +3085,83 @@ const testCases = [
2384
3085
  type: 'Text',
2385
3086
  metadata: {
2386
3087
  TimeInstant: {
2387
- value: '2022-02-02T02:22:22.222Z',
3088
+ value: '2033-03-03T03:33:33.333Z',
2388
3089
  type: 'DateTime'
2389
3090
  }
2390
3091
  }
2391
3092
  },
2392
3093
  TimeInstant: {
2393
- value: '2022-02-02T02:22:22.222Z',
3094
+ value: '2033-03-03T03:33:33.333Z',
2394
3095
  type: 'DateTime'
2395
3096
  }
2396
3097
  }
3098
+ }
3099
+ ]
3100
+ },
3101
+ {
3102
+ describeName: '0433 - Simple group with active attribute + several timestamp mappings defined in multientity',
3103
+ provision: {
3104
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
3105
+ method: 'POST',
3106
+ json: {
3107
+ services: [
3108
+ {
3109
+ resource: '/iot/json',
3110
+ apikey: globalEnv.apikey,
3111
+ timestamp: true,
3112
+ entity_type: globalEnv.entity_type,
3113
+ commands: [],
3114
+ lazy: [],
3115
+ attributes: [
3116
+ {
3117
+ object_id: 'a',
3118
+ name: 'a',
3119
+ type: 'Text'
3120
+ },
3121
+ {
3122
+ object_id: 'mydatetime1',
3123
+ name: 'TimeInstant',
3124
+ type: 'DateTime',
3125
+ entity_name: 'TestType:TestDevice1',
3126
+ entity_type: 'TestType'
3127
+ },
3128
+ {
3129
+ object_id: 'mydatetime2',
3130
+ name: 'TimeInstant',
3131
+ type: 'DateTime',
3132
+ entity_name: 'TestType:TestDevice2',
3133
+ entity_type: 'TestType'
3134
+ },
3135
+ {
3136
+ object_id: 'a1',
3137
+ name: 'a1',
3138
+ type: 'Text',
3139
+ expression: 'a',
3140
+ entity_name: 'TestType:TestDevice1',
3141
+ entity_type: 'TestType'
3142
+ },
3143
+ {
3144
+ object_id: 'a2',
3145
+ name: 'a2',
3146
+ type: 'Text',
3147
+ expression: 'a',
3148
+ entity_name: 'TestType:TestDevice2',
3149
+ entity_type: 'TestType'
3150
+ }
3151
+ ]
3152
+ }
3153
+ ]
2397
3154
  },
3155
+ headers: {
3156
+ 'fiware-service': globalEnv.service,
3157
+ 'fiware-servicepath': globalEnv.servicePath
3158
+ }
3159
+ },
3160
+ should: [
2398
3161
  {
2399
3162
  shouldName:
2400
- 'A - WHEN sending a measure without timestamp through http IT should use system timestamp for mapped attribute and use it for timestmap and other metadata attributes sent to Context Broker',
2401
- type: 'single',
3163
+ 'A - WHEN sending a measure through http IT should map the measure to timestamp attributes and use it for timestmap and other metadata attributes sent to Context Broker',
3164
+ type: 'multientity',
2402
3165
  isRegex: true,
2403
3166
  measure: {
2404
3167
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2408,31 +3171,139 @@ const testCases = [
2408
3171
  k: globalEnv.apikey
2409
3172
  },
2410
3173
  json: {
2411
- a: 23
3174
+ a: 23,
3175
+ mydatetime1: '2011-01-01T01:11:11.111Z',
3176
+ mydatetime2: '2022-02-02T02:22:22.222Z'
2412
3177
  }
2413
3178
  },
2414
3179
  expectation: {
2415
- id: globalEnv.entity_name,
2416
- type: globalEnv.entity_type,
2417
- a: {
2418
- value: 23,
2419
- type: 'Text',
2420
- metadata: {
3180
+ actionType: 'append',
3181
+ entities: [
3182
+ {
3183
+ id: 'TestType:TestDevice1',
3184
+ type: globalEnv.entity_type,
3185
+ a1: {
3186
+ value: 23,
3187
+ type: 'Text',
3188
+ metadata: {
3189
+ TimeInstant: {
3190
+ value: '2011-01-01T01:11:11.111Z',
3191
+ type: 'DateTime'
3192
+ }
3193
+ }
3194
+ },
3195
+ TimeInstant: {
3196
+ value: '2011-01-01T01:11:11.111Z',
3197
+ type: 'DateTime'
3198
+ }
3199
+ },
3200
+ {
3201
+ id: 'TestType:TestDevice2',
3202
+ type: globalEnv.entity_type,
3203
+ a2: {
3204
+ value: 23,
3205
+ type: 'Text',
3206
+ metadata: {
3207
+ TimeInstant: {
3208
+ value: '2022-02-02T02:22:22.222Z',
3209
+ type: 'DateTime'
3210
+ }
3211
+ }
3212
+ },
3213
+ TimeInstant: {
3214
+ value: '2022-02-02T02:22:22.222Z',
3215
+ type: 'DateTime'
3216
+ }
3217
+ },
3218
+ {
3219
+ id: globalEnv.entity_name,
3220
+ type: globalEnv.entity_type,
3221
+ a: {
3222
+ value: 23,
3223
+ type: 'Text',
3224
+ metadata: {
3225
+ TimeInstant: {
3226
+ value: _.isDateString,
3227
+ type: 'DateTime'
3228
+ }
3229
+ }
3230
+ },
2421
3231
  TimeInstant: {
2422
3232
  value: _.isDateString,
2423
3233
  type: 'DateTime'
2424
3234
  }
2425
3235
  }
3236
+ ]
3237
+ }
3238
+ },
3239
+ {
3240
+ shouldName:
3241
+ 'A - WHEN sending a measure through http IT should map the measure to timestamp attributes for just mapped entity and sent to Context Broker',
3242
+ type: 'multientity',
3243
+ isRegex: true,
3244
+ measure: {
3245
+ url: 'http://localhost:' + config.http.port + '/iot/json',
3246
+ method: 'POST',
3247
+ qs: {
3248
+ i: globalEnv.deviceId,
3249
+ k: globalEnv.apikey
2426
3250
  },
2427
- TimeInstant: {
2428
- value: _.isDateString,
2429
- type: 'DateTime'
3251
+ json: {
3252
+ mydatetime1: '2011-01-01T01:11:11.111Z'
3253
+ }
3254
+ },
3255
+ expectation: {
3256
+ actionType: 'append',
3257
+ entities: [
3258
+ {
3259
+ id: 'TestType:TestDevice1',
3260
+ type: globalEnv.entity_type,
3261
+ TimeInstant: {
3262
+ value: '2011-01-01T01:11:11.111Z',
3263
+ type: 'DateTime'
3264
+ }
3265
+ }
3266
+ ]
3267
+ }
3268
+ }
3269
+ ]
3270
+ },
3271
+
3272
+ // 0500 - EXPLICIT ATTRIBUTES TESTS
3273
+ {
3274
+ describeName: '0500 - Group with explicit attrs:false (boolean) + active atributes',
3275
+ provision: {
3276
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
3277
+ method: 'POST',
3278
+ json: {
3279
+ services: [
3280
+ {
3281
+ resource: '/iot/json',
3282
+ apikey: globalEnv.apikey,
3283
+ entity_type: globalEnv.entity_type,
3284
+ explicitAttrs: false,
3285
+ commands: [],
3286
+ lazy: [],
3287
+ attributes: [
3288
+ {
3289
+ object_id: 'a',
3290
+ name: 'attr_a',
3291
+ type: 'Number'
3292
+ }
3293
+ ],
3294
+ static_attributes: []
2430
3295
  }
2431
- }
3296
+ ]
2432
3297
  },
3298
+ headers: {
3299
+ 'fiware-service': globalEnv.service,
3300
+ 'fiware-servicepath': globalEnv.servicePath
3301
+ }
3302
+ },
3303
+ should: [
2433
3304
  {
2434
3305
  shouldName:
2435
- 'A - WHEN sending a measure with timestamp through http IT should map the measure to timestamp attribute and use it for timestmap and other metadata attributes sent to Context Broker',
3306
+ 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
2436
3307
  type: 'single',
2437
3308
  measure: {
2438
3309
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2442,34 +3313,27 @@ const testCases = [
2442
3313
  k: globalEnv.apikey
2443
3314
  },
2444
3315
  json: {
2445
- mydatetime: '2022-02-02T02:22:22.222Z',
2446
- TimeInstant: '2033-03-03T03:33:33.333Z',
2447
- a: 23
3316
+ a: 3,
3317
+ b: 10
2448
3318
  }
2449
3319
  },
2450
3320
  expectation: {
2451
3321
  id: globalEnv.entity_name,
2452
3322
  type: globalEnv.entity_type,
2453
- a: {
2454
- value: 23,
2455
- type: 'Text',
2456
- metadata: {
2457
- TimeInstant: {
2458
- value: '2022-02-02T02:22:22.222Z',
2459
- type: 'DateTime'
2460
- }
2461
- }
3323
+ b: {
3324
+ value: 10,
3325
+ type: 'Text'
2462
3326
  },
2463
- TimeInstant: {
2464
- value: '2022-02-02T02:22:22.222Z',
2465
- type: 'DateTime'
3327
+ attr_a: {
3328
+ value: 3,
3329
+ type: 'Number'
2466
3330
  }
2467
3331
  }
2468
3332
  }
2469
3333
  ]
2470
3334
  },
2471
3335
  {
2472
- describeName: '0432 - Simple group with active attribute + bad timestamp mapping defined',
3336
+ describeName: '0510 - Group without explicit (not defined) + active atributes',
2473
3337
  provision: {
2474
3338
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2475
3339
  method: 'POST',
@@ -2478,18 +3342,17 @@ const testCases = [
2478
3342
  {
2479
3343
  resource: '/iot/json',
2480
3344
  apikey: globalEnv.apikey,
2481
- timestamp: true,
2482
3345
  entity_type: globalEnv.entity_type,
2483
3346
  commands: [],
2484
3347
  lazy: [],
2485
3348
  attributes: [
2486
3349
  {
2487
- object_id: 'mydatetime',
2488
- name: 'TimeInstant',
2489
- type: 'DateTime',
2490
- expression: '"2033-03-03T" + "03:33:33.333Z"'
3350
+ object_id: 'a',
3351
+ name: 'attr_a',
3352
+ type: 'Number'
2491
3353
  }
2492
- ]
3354
+ ],
3355
+ static_attributes: []
2493
3356
  }
2494
3357
  ]
2495
3358
  },
@@ -2501,7 +3364,7 @@ const testCases = [
2501
3364
  should: [
2502
3365
  {
2503
3366
  shouldName:
2504
- 'A - WHEN sending a measure through http IT should map the measure to fixed timestamp attribute and use it for timestmap sent to Context Broker',
3367
+ 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
2505
3368
  type: 'single',
2506
3369
  measure: {
2507
3370
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2511,33 +3374,27 @@ const testCases = [
2511
3374
  k: globalEnv.apikey
2512
3375
  },
2513
3376
  json: {
2514
- mydatetime: '2022-02-02T02:22:22.222Z',
2515
- a: 23
3377
+ a: 3,
3378
+ b: 10
2516
3379
  }
2517
3380
  },
2518
3381
  expectation: {
2519
3382
  id: globalEnv.entity_name,
2520
3383
  type: globalEnv.entity_type,
2521
- a: {
2522
- value: 23,
2523
- type: 'Text',
2524
- metadata: {
2525
- TimeInstant: {
2526
- value: '2033-03-03T03:33:33.333Z',
2527
- type: 'DateTime'
2528
- }
2529
- }
3384
+ b: {
3385
+ value: 10,
3386
+ type: 'Text'
2530
3387
  },
2531
- TimeInstant: {
2532
- value: '2033-03-03T03:33:33.333Z',
2533
- type: 'DateTime'
3388
+ attr_a: {
3389
+ value: 3,
3390
+ type: 'Number'
2534
3391
  }
2535
3392
  }
2536
3393
  }
2537
3394
  ]
2538
3395
  },
2539
3396
  {
2540
- describeName: '0433 - Simple group with active attribute + several timestamp mappings defined in multientity',
3397
+ describeName: '0520 - Group with explicit attrs:true (boolean) + active atributes',
2541
3398
  provision: {
2542
3399
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2543
3400
  method: 'POST',
@@ -2546,47 +3403,18 @@ const testCases = [
2546
3403
  {
2547
3404
  resource: '/iot/json',
2548
3405
  apikey: globalEnv.apikey,
2549
- timestamp: true,
2550
3406
  entity_type: globalEnv.entity_type,
3407
+ explicitAttrs: true,
2551
3408
  commands: [],
2552
3409
  lazy: [],
2553
3410
  attributes: [
2554
3411
  {
2555
3412
  object_id: 'a',
2556
- name: 'a',
2557
- type: 'Text'
2558
- },
2559
- {
2560
- object_id: 'mydatetime1',
2561
- name: 'TimeInstant',
2562
- type: 'DateTime',
2563
- entity_name: 'TestType:TestDevice1',
2564
- entity_type: 'TestType'
2565
- },
2566
- {
2567
- object_id: 'mydatetime2',
2568
- name: 'TimeInstant',
2569
- type: 'DateTime',
2570
- entity_name: 'TestType:TestDevice2',
2571
- entity_type: 'TestType'
2572
- },
2573
- {
2574
- object_id: 'a1',
2575
- name: 'a1',
2576
- type: 'Text',
2577
- expression: 'a',
2578
- entity_name: 'TestType:TestDevice1',
2579
- entity_type: 'TestType'
2580
- },
2581
- {
2582
- object_id: 'a2',
2583
- name: 'a2',
2584
- type: 'Text',
2585
- expression: 'a',
2586
- entity_name: 'TestType:TestDevice2',
2587
- entity_type: 'TestType'
3413
+ name: 'attr_a',
3414
+ type: 'Number'
2588
3415
  }
2589
- ]
3416
+ ],
3417
+ static_attributes: []
2590
3418
  }
2591
3419
  ]
2592
3420
  },
@@ -2598,9 +3426,8 @@ const testCases = [
2598
3426
  should: [
2599
3427
  {
2600
3428
  shouldName:
2601
- 'A - WHEN sending a measure through http IT should map the measure to timestamp attributes and use it for timestmap and other metadata attributes sent to Context Broker',
2602
- type: 'multientity',
2603
- isRegex: true,
3429
+ 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
3430
+ type: 'single',
2604
3431
  measure: {
2605
3432
  url: 'http://localhost:' + config.http.port + '/iot/json',
2606
3433
  method: 'POST',
@@ -2609,76 +3436,72 @@ const testCases = [
2609
3436
  k: globalEnv.apikey
2610
3437
  },
2611
3438
  json: {
2612
- a: 23,
2613
- mydatetime1: '2011-01-01T01:11:11.111Z',
2614
- mydatetime2: '2022-02-02T02:22:22.222Z'
3439
+ a: 3,
3440
+ b: 10
2615
3441
  }
2616
3442
  },
2617
3443
  expectation: {
2618
- actionType: 'append',
2619
- entities: [
2620
- {
2621
- id: globalEnv.entity_name,
2622
- type: globalEnv.entity_type,
2623
- a: {
2624
- value: 23,
2625
- type: 'Text',
2626
- metadata: {
2627
- TimeInstant: {
2628
- value: _.isDateString,
2629
- type: 'DateTime'
2630
- }
2631
- }
2632
- },
2633
- TimeInstant: {
2634
- value: _.isDateString,
2635
- type: 'DateTime'
2636
- }
2637
- },
2638
- {
2639
- id: 'TestType:TestDevice1',
2640
- type: globalEnv.entity_type,
2641
- a1: {
2642
- value: 23,
2643
- type: 'Text',
2644
- metadata: {
2645
- TimeInstant: {
2646
- value: '2011-01-01T01:11:11.111Z',
2647
- type: 'DateTime'
2648
- }
2649
- }
3444
+ id: globalEnv.entity_name,
3445
+ type: globalEnv.entity_type,
3446
+ attr_a: {
3447
+ value: 3,
3448
+ type: 'Number'
3449
+ }
3450
+ }
3451
+ }
3452
+ ]
3453
+ },
3454
+ {
3455
+ describeName: '0530 - Group with explicit attrs:[array] + active attributes + static attributes',
3456
+ provision: {
3457
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
3458
+ method: 'POST',
3459
+ json: {
3460
+ services: [
3461
+ {
3462
+ resource: '/iot/json',
3463
+ apikey: globalEnv.apikey,
3464
+ entity_type: globalEnv.entity_type,
3465
+ explicitAttrs: "['attr_a','static_a']",
3466
+ commands: [],
3467
+ lazy: [],
3468
+ attributes: [
3469
+ {
3470
+ name: 'attr_a',
3471
+ object_id: 'a',
3472
+ type: 'Number'
2650
3473
  },
2651
- TimeInstant: {
2652
- value: '2011-01-01T01:11:11.111Z',
2653
- type: 'DateTime'
3474
+ {
3475
+ name: 'attr_b',
3476
+ object_id: 'b',
3477
+ type: 'Number'
2654
3478
  }
2655
- },
2656
- {
2657
- id: 'TestType:TestDevice2',
2658
- type: globalEnv.entity_type,
2659
- a2: {
2660
- value: 23,
2661
- type: 'Text',
2662
- metadata: {
2663
- TimeInstant: {
2664
- value: '2022-02-02T02:22:22.222Z',
2665
- type: 'DateTime'
2666
- }
2667
- }
3479
+ ],
3480
+ static_attributes: [
3481
+ {
3482
+ name: 'static_a',
3483
+ type: 'Number',
3484
+ value: 3
2668
3485
  },
2669
- TimeInstant: {
2670
- value: '2022-02-02T02:22:22.222Z',
2671
- type: 'DateTime'
3486
+ {
3487
+ name: 'static_b',
3488
+ type: 'Number',
3489
+ value: 4
2672
3490
  }
2673
- }
2674
- ]
2675
- }
3491
+ ]
3492
+ }
3493
+ ]
2676
3494
  },
3495
+ headers: {
3496
+ 'fiware-service': globalEnv.service,
3497
+ 'fiware-servicepath': globalEnv.servicePath
3498
+ }
3499
+ },
3500
+ should: [
2677
3501
  {
2678
3502
  shouldName:
2679
- 'A - WHEN sending a measure through http IT should map the measure to timestamp attributes for just mapped entity and sent to Context Broker',
2680
- type: 'multientity',
2681
- isRegex: true,
3503
+ 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store only defined in explicitAttrs array into Context Broker',
3504
+ type: 'single',
2682
3505
  measure: {
2683
3506
  url: 'http://localhost:' + config.http.port + '/iot/json',
2684
3507
  method: 'POST',
@@ -2687,29 +3510,28 @@ const testCases = [
2687
3510
  k: globalEnv.apikey
2688
3511
  },
2689
3512
  json: {
2690
- mydatetime1: '2011-01-01T01:11:11.111Z'
3513
+ a: 3,
3514
+ b: 10,
3515
+ c: 11
2691
3516
  }
2692
3517
  },
2693
3518
  expectation: {
2694
- actionType: 'append',
2695
- entities: [
2696
- {
2697
- id: 'TestType:TestDevice1',
2698
- type: globalEnv.entity_type,
2699
- TimeInstant: {
2700
- value: '2011-01-01T01:11:11.111Z',
2701
- type: 'DateTime'
2702
- }
2703
- }
2704
- ]
3519
+ id: globalEnv.entity_name,
3520
+ type: globalEnv.entity_type,
3521
+ attr_a: {
3522
+ value: 3,
3523
+ type: 'Number'
3524
+ },
3525
+ static_a: {
3526
+ value: 3,
3527
+ type: 'Number'
3528
+ }
2705
3529
  }
2706
3530
  }
2707
3531
  ]
2708
3532
  },
2709
-
2710
- // 0500 - EXPLICIT ATTRIBUTES TESTS
2711
3533
  {
2712
- describeName: '0500 - Group with explicit attrs:false (boolean) + active atributes',
3534
+ describeName: '0531 - Group with explicit attrs:[ ] (empty array) + active attributes + static attributes',
2713
3535
  provision: {
2714
3536
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2715
3537
  method: 'POST',
@@ -2719,17 +3541,33 @@ const testCases = [
2719
3541
  resource: '/iot/json',
2720
3542
  apikey: globalEnv.apikey,
2721
3543
  entity_type: globalEnv.entity_type,
2722
- explicitAttrs: false,
3544
+ explicitAttrs: '[ ]',
2723
3545
  commands: [],
2724
3546
  lazy: [],
2725
3547
  attributes: [
2726
3548
  {
2727
- object_id: 'a',
2728
3549
  name: 'attr_a',
3550
+ object_id: 'a',
3551
+ type: 'Number'
3552
+ },
3553
+ {
3554
+ name: 'attr_b',
3555
+ object_id: 'b',
2729
3556
  type: 'Number'
2730
3557
  }
2731
3558
  ],
2732
- static_attributes: []
3559
+ static_attributes: [
3560
+ {
3561
+ name: 'static_a',
3562
+ type: 'Number',
3563
+ value: 3
3564
+ },
3565
+ {
3566
+ name: 'static_b',
3567
+ type: 'Number',
3568
+ value: 4
3569
+ }
3570
+ ]
2733
3571
  }
2734
3572
  ]
2735
3573
  },
@@ -2741,7 +3579,7 @@ const testCases = [
2741
3579
  should: [
2742
3580
  {
2743
3581
  shouldName:
2744
- 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
3582
+ 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should NOT store anything into the Context Broker (No request to CB)',
2745
3583
  type: 'single',
2746
3584
  measure: {
2747
3585
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2752,26 +3590,17 @@ const testCases = [
2752
3590
  },
2753
3591
  json: {
2754
3592
  a: 3,
2755
- b: 10
3593
+ b: 10,
3594
+ c: 11
2756
3595
  }
2757
3596
  },
2758
- expectation: {
2759
- id: globalEnv.entity_name,
2760
- type: globalEnv.entity_type,
2761
- b: {
2762
- value: 10,
2763
- type: 'Text'
2764
- },
2765
- attr_a: {
2766
- value: 3,
2767
- type: 'Number'
2768
- }
2769
- }
3597
+ expectation: [] // No payload expected
2770
3598
  }
2771
3599
  ]
2772
3600
  },
2773
3601
  {
2774
- describeName: '0510 - Group without explicit (not defined) + active atributes',
3602
+ describeName:
3603
+ '0532 - Group with explicit attrs:[ ] (empty array) + active attributes + static attributes + timestamp:true',
2775
3604
  provision: {
2776
3605
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2777
3606
  method: 'POST',
@@ -2781,16 +3610,34 @@ const testCases = [
2781
3610
  resource: '/iot/json',
2782
3611
  apikey: globalEnv.apikey,
2783
3612
  entity_type: globalEnv.entity_type,
3613
+ explicitAttrs: '[ ]',
3614
+ timestamp: true,
2784
3615
  commands: [],
2785
3616
  lazy: [],
2786
3617
  attributes: [
2787
3618
  {
2788
- object_id: 'a',
2789
3619
  name: 'attr_a',
3620
+ object_id: 'a',
3621
+ type: 'Number'
3622
+ },
3623
+ {
3624
+ name: 'attr_b',
3625
+ object_id: 'b',
2790
3626
  type: 'Number'
2791
3627
  }
2792
3628
  ],
2793
- static_attributes: []
3629
+ static_attributes: [
3630
+ {
3631
+ name: 'static_a',
3632
+ type: 'Number',
3633
+ value: 3
3634
+ },
3635
+ {
3636
+ name: 'static_b',
3637
+ type: 'Number',
3638
+ value: 4
3639
+ }
3640
+ ]
2794
3641
  }
2795
3642
  ]
2796
3643
  },
@@ -2802,7 +3649,7 @@ const testCases = [
2802
3649
  should: [
2803
3650
  {
2804
3651
  shouldName:
2805
- 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
3652
+ 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should NOT store anything into the Context Broker (No request to CB)',
2806
3653
  type: 'single',
2807
3654
  measure: {
2808
3655
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2813,26 +3660,37 @@ const testCases = [
2813
3660
  },
2814
3661
  json: {
2815
3662
  a: 3,
2816
- b: 10
3663
+ b: 10,
3664
+ c: 11
2817
3665
  }
2818
3666
  },
2819
- expectation: {
2820
- id: globalEnv.entity_name,
2821
- type: globalEnv.entity_type,
2822
- b: {
2823
- value: 10,
2824
- type: 'Text'
3667
+ expectation: [] // No payload expected
3668
+ },
3669
+ {
3670
+ shouldName:
3671
+ 'B - WHEN sending data and a measure called TimeInstant through http IT should NOT store anything into the Context Broker (No request to CB)',
3672
+ type: 'single',
3673
+ measure: {
3674
+ url: 'http://localhost:' + config.http.port + '/iot/json',
3675
+ method: 'POST',
3676
+ qs: {
3677
+ i: globalEnv.deviceId,
3678
+ k: globalEnv.apikey
2825
3679
  },
2826
- attr_a: {
2827
- value: 3,
2828
- type: 'Number'
3680
+ json: {
3681
+ a: 3,
3682
+ b: 10,
3683
+ c: 11,
3684
+ TimeInstant: '2015-12-14T08:06:01.468Z'
2829
3685
  }
2830
- }
3686
+ },
3687
+ expectation: [] // No payload expected
2831
3688
  }
2832
3689
  ]
2833
3690
  },
2834
3691
  {
2835
- describeName: '0520 - Group with explicit attrs:true (boolean) + active atributes',
3692
+ describeName:
3693
+ '0533 - Group with explicit attrs:[ ] (empty array) + active attributes + TimeInstant attribute + static attributes + timestamp:true',
2836
3694
  provision: {
2837
3695
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2838
3696
  method: 'POST',
@@ -2842,17 +3700,44 @@ const testCases = [
2842
3700
  resource: '/iot/json',
2843
3701
  apikey: globalEnv.apikey,
2844
3702
  entity_type: globalEnv.entity_type,
2845
- explicitAttrs: true,
3703
+ explicitAttrs: '[ ]',
3704
+ timestamp: true,
2846
3705
  commands: [],
2847
3706
  lazy: [],
2848
3707
  attributes: [
2849
3708
  {
2850
- object_id: 'a',
2851
3709
  name: 'attr_a',
3710
+ object_id: 'a',
3711
+ type: 'Number'
3712
+ },
3713
+ {
3714
+ name: 'attr_b',
3715
+ object_id: 'b',
2852
3716
  type: 'Number'
3717
+ },
3718
+ {
3719
+ name: 'DateIssued',
3720
+ object_id: 'TimeInstant',
3721
+ type: 'DateTime'
3722
+ },
3723
+ {
3724
+ name: 'TimeInstant',
3725
+ object_id: 't',
3726
+ type: 'DateTime'
2853
3727
  }
2854
3728
  ],
2855
- static_attributes: []
3729
+ static_attributes: [
3730
+ {
3731
+ name: 'static_a',
3732
+ type: 'Number',
3733
+ value: 3
3734
+ },
3735
+ {
3736
+ name: 'static_b',
3737
+ type: 'Number',
3738
+ value: 4
3739
+ }
3740
+ ]
2856
3741
  }
2857
3742
  ]
2858
3743
  },
@@ -2864,7 +3749,7 @@ const testCases = [
2864
3749
  should: [
2865
3750
  {
2866
3751
  shouldName:
2867
- 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
3752
+ 'A - WHEN sending data and a measure called "t" (defined as TimeInstant attribte) through http IT should NOT store anything into the Context Broker (No request to CB)',
2868
3753
  type: 'single',
2869
3754
  measure: {
2870
3755
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2875,22 +3760,38 @@ const testCases = [
2875
3760
  },
2876
3761
  json: {
2877
3762
  a: 3,
2878
- b: 10
3763
+ b: 10,
3764
+ c: 11,
3765
+ t: '2015-12-14T08:06:01.468Z'
2879
3766
  }
2880
3767
  },
2881
- expectation: {
2882
- id: globalEnv.entity_name,
2883
- type: globalEnv.entity_type,
2884
- attr_a: {
2885
- value: 3,
2886
- type: 'Number'
3768
+ expectation: []
3769
+ },
3770
+ {
3771
+ shouldName:
3772
+ 'B - WHEN sending data and a measure called TimeInstant through http IT should NOT store anything into the Context Broker (No request to CB)',
3773
+ type: 'single',
3774
+ measure: {
3775
+ url: 'http://localhost:' + config.http.port + '/iot/json',
3776
+ method: 'POST',
3777
+ qs: {
3778
+ i: globalEnv.deviceId,
3779
+ k: globalEnv.apikey
3780
+ },
3781
+ json: {
3782
+ a: 3,
3783
+ b: 10,
3784
+ c: 11,
3785
+ TimeInstant: '2015-12-14T08:06:01.468Z'
2887
3786
  }
2888
- }
3787
+ },
3788
+ expectation: [] // No payload expected
2889
3789
  }
2890
3790
  ]
2891
3791
  },
2892
3792
  {
2893
- describeName: '0530 - Group with explicit attrs:[array] + active attributes + static attributes',
3793
+ describeName:
3794
+ '0534 - Group with explicit attrs:[ ] (empty array) + active attributes + TimeInstant attribute + static attributes + timestamp:false',
2894
3795
  provision: {
2895
3796
  url: 'http://localhost:' + config.iota.server.port + '/iot/services',
2896
3797
  method: 'POST',
@@ -2900,7 +3801,8 @@ const testCases = [
2900
3801
  resource: '/iot/json',
2901
3802
  apikey: globalEnv.apikey,
2902
3803
  entity_type: globalEnv.entity_type,
2903
- explicitAttrs: "['attr_a','static_a']",
3804
+ explicitAttrs: '[ ]',
3805
+ timestamp: false,
2904
3806
  commands: [],
2905
3807
  lazy: [],
2906
3808
  attributes: [
@@ -2913,6 +3815,16 @@ const testCases = [
2913
3815
  name: 'attr_b',
2914
3816
  object_id: 'b',
2915
3817
  type: 'Number'
3818
+ },
3819
+ {
3820
+ name: 'DateIssued',
3821
+ object_id: 'TimeInstant',
3822
+ type: 'DateTime'
3823
+ },
3824
+ {
3825
+ name: 'TimeInstant',
3826
+ object_id: 't',
3827
+ type: 'DateTime'
2916
3828
  }
2917
3829
  ],
2918
3830
  static_attributes: [
@@ -2938,7 +3850,7 @@ const testCases = [
2938
3850
  should: [
2939
3851
  {
2940
3852
  shouldName:
2941
- 'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store only defined in explicitAttrs array into Context Broker',
3853
+ 'A - WHEN sending data and a measure called "t" (defined as TimeInstant attribte) through http IT should NOT store anything into the Context Broker (No request to CB)',
2942
3854
  type: 'single',
2943
3855
  measure: {
2944
3856
  url: 'http://localhost:' + config.http.port + '/iot/json',
@@ -2950,21 +3862,31 @@ const testCases = [
2950
3862
  json: {
2951
3863
  a: 3,
2952
3864
  b: 10,
2953
- c: 11
3865
+ c: 11,
3866
+ t: '2015-12-14T08:06:01.468Z'
2954
3867
  }
2955
3868
  },
2956
- expectation: {
2957
- id: globalEnv.entity_name,
2958
- type: globalEnv.entity_type,
2959
- attr_a: {
2960
- value: 3,
2961
- type: 'Number'
3869
+ expectation: []
3870
+ },
3871
+ {
3872
+ shouldName:
3873
+ 'B - WHEN sending data and a measure called TimeInstant through http IT should NOT store anything into the Context Broker (No request to CB)',
3874
+ type: 'single',
3875
+ measure: {
3876
+ url: 'http://localhost:' + config.http.port + '/iot/json',
3877
+ method: 'POST',
3878
+ qs: {
3879
+ i: globalEnv.deviceId,
3880
+ k: globalEnv.apikey
2962
3881
  },
2963
- static_a: {
2964
- value: 3,
2965
- type: 'Number'
3882
+ json: {
3883
+ a: 3,
3884
+ b: 10,
3885
+ c: 11,
3886
+ TimeInstant: '2015-12-14T08:06:01.468Z'
2966
3887
  }
2967
- }
3888
+ },
3889
+ expectation: [] // No payload expected
2968
3890
  }
2969
3891
  ]
2970
3892
  },
@@ -3372,7 +4294,7 @@ const testCases = [
3372
4294
  type: 'Number',
3373
4295
  entity_name: 'TestType:TestDevice2',
3374
4296
  entity_type: 'TestType',
3375
- expression: 'type+":"+(t*2*static_a)' // Only type is used as JEXL context attr due to #1523
4297
+ expression: 'type+":"+(t*2*static_a)'
3376
4298
  }
3377
4299
  ],
3378
4300
  static_attributes: [
@@ -3458,7 +4380,7 @@ const testCases = [
3458
4380
  object_id: 't',
3459
4381
  name: 'temperature',
3460
4382
  type: 'Number',
3461
- entity_name: 'type+":"+(t*2*static_a)', // Only type is used as JEXL context attr due to #1523
4383
+ entity_name: 'type+":"+(t*2*static_a)',
3462
4384
  entity_type: 'TestType'
3463
4385
  }
3464
4386
  ],
@@ -3730,6 +4652,78 @@ const testCases = [
3730
4652
  }
3731
4653
  }
3732
4654
  ]
4655
+ },
4656
+ // 0900 - JEXL FUNCTION TESTS
4657
+ {
4658
+ describeName: '0900 - JEXL function - valuePicker and valuePickerMulti',
4659
+ provision: {
4660
+ url: 'http://localhost:' + config.iota.server.port + '/iot/services',
4661
+ method: 'POST',
4662
+ json: {
4663
+ services: [
4664
+ {
4665
+ resource: '/iot/json',
4666
+ apikey: globalEnv.apikey,
4667
+ entity_type: globalEnv.entity_type,
4668
+ explicitAttrs: true,
4669
+ commands: [],
4670
+ lazy: [],
4671
+ attributes: [
4672
+ {
4673
+ object_id: 'single',
4674
+ name: 'single',
4675
+ type: 'Number',
4676
+ expression: '{alarm1:alarm1,alarm2:alarm2,alarm3:alarm3}|valuePicker(true)'
4677
+ },
4678
+ {
4679
+ object_id: 'multi',
4680
+ name: 'multi',
4681
+ type: 'Number',
4682
+ expression: "a|valuePickerMulti([true,1,'on','nok'])"
4683
+ }
4684
+ ],
4685
+ static_attributes: []
4686
+ }
4687
+ ]
4688
+ },
4689
+ headers: {
4690
+ 'fiware-service': globalEnv.service,
4691
+ 'fiware-servicepath': globalEnv.servicePath
4692
+ }
4693
+ },
4694
+ should: [
4695
+ {
4696
+ shouldName:
4697
+ 'A - WHEN sending a boolean value (true) through http IT should send to Context Broker the value 3 ',
4698
+ type: 'single',
4699
+ measure: {
4700
+ url: 'http://localhost:' + config.http.port + '/iot/json',
4701
+ method: 'POST',
4702
+ qs: {
4703
+ i: globalEnv.deviceId,
4704
+ k: globalEnv.apikey
4705
+ },
4706
+ json: {
4707
+ a: { n1: true, n2: 1, n3: 'on', n4: 'nok', n5: 'ok', n6: true, n7: false, n8: 0 },
4708
+ alarm1: true,
4709
+ alarm2: false,
4710
+ alarm3: true
4711
+ }
4712
+ },
4713
+ expectation: {
4714
+ id: globalEnv.entity_name,
4715
+ type: globalEnv.entity_type,
4716
+ single: {
4717
+ value: ['alarm1', 'alarm3'],
4718
+ type: 'Number'
4719
+ },
4720
+ multi: {
4721
+ value: ['n1', 'n2', 'n3', 'n4', 'n6'],
4722
+ type: 'Number'
4723
+ }
4724
+ }
4725
+ }
4726
+ ]
3733
4727
  }
3734
4728
  ];
3735
4729