iotagent-node-lib 4.3.0 → 4.5.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.
- package/config.js +2 -1
- package/doc/admin.md +16 -7
- package/doc/api.md +230 -45
- package/doc/requirements.txt +1 -1
- package/docker/Mosquitto/Dockerfile +1 -1
- package/lib/commonConfig.js +25 -1
- package/lib/errors.js +4 -1
- package/lib/services/devices/deviceRegistryMemory.js +1 -1
- package/lib/services/devices/deviceRegistryMongoDB.js +3 -10
- package/lib/services/devices/deviceService.js +5 -3
- package/lib/services/devices/devices-NGSI-LD.js +5 -5
- package/lib/services/devices/devices-NGSI-mixed.js +3 -3
- package/lib/services/devices/devices-NGSI-v2.js +5 -5
- package/lib/services/ngsi/entities-NGSI-LD.js +1 -1
- package/lib/services/ngsi/entities-NGSI-v2.js +324 -268
- package/lib/services/ngsi/ngsiService.js +2 -2
- package/lib/services/ngsi/subscription-NGSI-LD.js +2 -2
- package/lib/services/ngsi/subscription-NGSI-v2.js +2 -2
- package/lib/services/northBound/deviceProvisioningServer.js +5 -4
- package/lib/services/northBound/northboundServer.js +2 -2
- package/package.json +2 -2
- package/scripts/legacy_expression_tool/requirements.txt +1 -1
- package/test/functional/README.md +60 -37
- package/test/functional/testCases.js +2206 -722
- package/test/functional/testUtils.js +53 -20
- package/test/unit/examples/deviceProvisioningRequests/updateProvisionDeviceWithApikey.json +4 -0
- package/test/unit/ngsi-ld/provisioning/device-update-registration_test.js +5 -5
- package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +34 -2
- package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +6 -6
- package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +35 -0
|
@@ -445,9 +445,1314 @@ const testCases = [
|
|
|
445
445
|
}
|
|
446
446
|
]
|
|
447
447
|
},
|
|
448
|
+
{
|
|
449
|
+
describeName: '0021 - Simple group with active attributes with metadata',
|
|
450
|
+
provision: {
|
|
451
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
452
|
+
method: 'POST',
|
|
453
|
+
json: {
|
|
454
|
+
services: [
|
|
455
|
+
{
|
|
456
|
+
resource: '/iot/json',
|
|
457
|
+
apikey: globalEnv.apikey,
|
|
458
|
+
entity_type: globalEnv.entity_type,
|
|
459
|
+
commands: [],
|
|
460
|
+
lazy: [],
|
|
461
|
+
attributes: [
|
|
462
|
+
{
|
|
463
|
+
object_id: 'a',
|
|
464
|
+
name: 'attr_a',
|
|
465
|
+
type: 'Boolean',
|
|
466
|
+
metadata: {
|
|
467
|
+
accuracy: {
|
|
468
|
+
value: 0.8,
|
|
469
|
+
type: 'Float'
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
static_attributes: []
|
|
475
|
+
}
|
|
476
|
+
]
|
|
477
|
+
},
|
|
478
|
+
headers: {
|
|
479
|
+
'fiware-service': globalEnv.service,
|
|
480
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
should: [
|
|
484
|
+
{
|
|
485
|
+
shouldName:
|
|
486
|
+
'A - WHEN sending defined object_ids (measures) through http IT should send measures to Context Broker preserving value types, name mappings and metadatas',
|
|
487
|
+
type: 'single',
|
|
488
|
+
measure: {
|
|
489
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
490
|
+
method: 'POST',
|
|
491
|
+
qs: {
|
|
492
|
+
i: globalEnv.deviceId,
|
|
493
|
+
k: globalEnv.apikey
|
|
494
|
+
},
|
|
495
|
+
json: {
|
|
496
|
+
a: false
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
expectation: {
|
|
500
|
+
id: globalEnv.entity_name,
|
|
501
|
+
type: globalEnv.entity_type,
|
|
502
|
+
attr_a: {
|
|
503
|
+
value: false,
|
|
504
|
+
type: 'Boolean',
|
|
505
|
+
metadata: {
|
|
506
|
+
accuracy: {
|
|
507
|
+
value: 0.8,
|
|
508
|
+
type: 'Float'
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
]
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
describeName: '0022 - Simple group with active attributes and multimeasures',
|
|
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: 'Number'
|
|
534
|
+
}
|
|
535
|
+
],
|
|
536
|
+
static_attributes: []
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
headers: {
|
|
541
|
+
'fiware-service': globalEnv.service,
|
|
542
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
should: [
|
|
546
|
+
{
|
|
547
|
+
shouldName:
|
|
548
|
+
'A - WHEN sending defined object_ids (measures) through http IT should send measures to Context Broker preserving value types and name mappings',
|
|
549
|
+
type: 'multimeasure',
|
|
550
|
+
measure: {
|
|
551
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
552
|
+
method: 'POST',
|
|
553
|
+
qs: {
|
|
554
|
+
i: globalEnv.deviceId,
|
|
555
|
+
k: globalEnv.apikey
|
|
556
|
+
},
|
|
557
|
+
json: [
|
|
558
|
+
{
|
|
559
|
+
a: 0
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
a: 1
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
a: 2
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
a: 3
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
a: 4
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
a: 5
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
a: 6
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
},
|
|
581
|
+
expectation: {
|
|
582
|
+
actionType: 'append',
|
|
583
|
+
entities: [
|
|
584
|
+
{
|
|
585
|
+
attr_a: {
|
|
586
|
+
type: 'Number',
|
|
587
|
+
value: 0
|
|
588
|
+
},
|
|
589
|
+
id: globalEnv.entity_name,
|
|
590
|
+
type: globalEnv.entity_type
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
attr_a: {
|
|
594
|
+
type: 'Number',
|
|
595
|
+
value: 1
|
|
596
|
+
},
|
|
597
|
+
id: globalEnv.entity_name,
|
|
598
|
+
type: globalEnv.entity_type
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
attr_a: {
|
|
602
|
+
type: 'Number',
|
|
603
|
+
value: 2
|
|
604
|
+
},
|
|
605
|
+
id: globalEnv.entity_name,
|
|
606
|
+
type: globalEnv.entity_type
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
attr_a: {
|
|
610
|
+
type: 'Number',
|
|
611
|
+
value: 3
|
|
612
|
+
},
|
|
613
|
+
id: globalEnv.entity_name,
|
|
614
|
+
type: globalEnv.entity_type
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
attr_a: {
|
|
618
|
+
type: 'Number',
|
|
619
|
+
value: 4
|
|
620
|
+
},
|
|
621
|
+
id: globalEnv.entity_name,
|
|
622
|
+
type: globalEnv.entity_type
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
attr_a: {
|
|
626
|
+
type: 'Number',
|
|
627
|
+
value: 5
|
|
628
|
+
},
|
|
629
|
+
id: globalEnv.entity_name,
|
|
630
|
+
type: globalEnv.entity_type
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
attr_a: {
|
|
634
|
+
type: 'Number',
|
|
635
|
+
value: 6
|
|
636
|
+
},
|
|
637
|
+
id: globalEnv.entity_name,
|
|
638
|
+
type: globalEnv.entity_type
|
|
639
|
+
}
|
|
640
|
+
]
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
shouldName:
|
|
645
|
+
'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',
|
|
646
|
+
type: 'multimeasure',
|
|
647
|
+
measure: {
|
|
648
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
649
|
+
method: 'POST',
|
|
650
|
+
qs: {
|
|
651
|
+
i: globalEnv.deviceId,
|
|
652
|
+
k: globalEnv.apikey
|
|
653
|
+
},
|
|
654
|
+
json: [
|
|
655
|
+
{
|
|
656
|
+
a: 0,
|
|
657
|
+
TimeInstant: '2024-04-10T10:00:00Z'
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
a: 1,
|
|
661
|
+
TimeInstant: '2024-04-10T10:05:00Z'
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
a: 2,
|
|
665
|
+
TimeInstant: '2024-04-10T10:10:00Z'
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
a: 3,
|
|
669
|
+
TimeInstant: '2024-04-10T10:15:00Z'
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
a: 4,
|
|
673
|
+
TimeInstant: '2024-04-10T10:20:00Z'
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
a: 5,
|
|
677
|
+
TimeInstant: '2024-04-10T10:25:00Z'
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
a: 6,
|
|
681
|
+
TimeInstant: '2024-04-10T10:30:00Z'
|
|
682
|
+
}
|
|
683
|
+
]
|
|
684
|
+
},
|
|
685
|
+
expectation: {
|
|
686
|
+
actionType: 'append',
|
|
687
|
+
entities: [
|
|
688
|
+
{
|
|
689
|
+
attr_a: {
|
|
690
|
+
type: 'Number',
|
|
691
|
+
value: 0
|
|
692
|
+
},
|
|
693
|
+
TimeInstant: {
|
|
694
|
+
type: 'DateTime',
|
|
695
|
+
value: '2024-04-10T10:00:00Z'
|
|
696
|
+
},
|
|
697
|
+
id: globalEnv.entity_name,
|
|
698
|
+
type: globalEnv.entity_type
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
attr_a: {
|
|
702
|
+
type: 'Number',
|
|
703
|
+
value: 1
|
|
704
|
+
},
|
|
705
|
+
TimeInstant: {
|
|
706
|
+
type: 'DateTime',
|
|
707
|
+
value: '2024-04-10T10:05:00Z'
|
|
708
|
+
},
|
|
709
|
+
id: globalEnv.entity_name,
|
|
710
|
+
type: globalEnv.entity_type
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
attr_a: {
|
|
714
|
+
type: 'Number',
|
|
715
|
+
value: 2
|
|
716
|
+
},
|
|
717
|
+
TimeInstant: {
|
|
718
|
+
type: 'DateTime',
|
|
719
|
+
value: '2024-04-10T10:10:00Z'
|
|
720
|
+
},
|
|
721
|
+
id: globalEnv.entity_name,
|
|
722
|
+
type: globalEnv.entity_type
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
attr_a: {
|
|
726
|
+
type: 'Number',
|
|
727
|
+
value: 3
|
|
728
|
+
},
|
|
729
|
+
TimeInstant: {
|
|
730
|
+
type: 'DateTime',
|
|
731
|
+
value: '2024-04-10T10:15:00Z'
|
|
732
|
+
},
|
|
733
|
+
id: globalEnv.entity_name,
|
|
734
|
+
type: globalEnv.entity_type
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
attr_a: {
|
|
738
|
+
type: 'Number',
|
|
739
|
+
value: 4
|
|
740
|
+
},
|
|
741
|
+
TimeInstant: {
|
|
742
|
+
type: 'DateTime',
|
|
743
|
+
value: '2024-04-10T10:20:00Z'
|
|
744
|
+
},
|
|
745
|
+
id: globalEnv.entity_name,
|
|
746
|
+
type: globalEnv.entity_type
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
attr_a: {
|
|
750
|
+
type: 'Number',
|
|
751
|
+
value: 5
|
|
752
|
+
},
|
|
753
|
+
TimeInstant: {
|
|
754
|
+
type: 'DateTime',
|
|
755
|
+
value: '2024-04-10T10:25:00Z'
|
|
756
|
+
},
|
|
757
|
+
id: globalEnv.entity_name,
|
|
758
|
+
type: globalEnv.entity_type
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
attr_a: {
|
|
762
|
+
type: 'Number',
|
|
763
|
+
value: 6
|
|
764
|
+
},
|
|
765
|
+
TimeInstant: {
|
|
766
|
+
type: 'DateTime',
|
|
767
|
+
value: '2024-04-10T10:30:00Z'
|
|
768
|
+
},
|
|
769
|
+
id: globalEnv.entity_name,
|
|
770
|
+
type: globalEnv.entity_type
|
|
771
|
+
}
|
|
772
|
+
]
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
shouldName:
|
|
777
|
+
'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',
|
|
778
|
+
type: 'multimeasure',
|
|
779
|
+
measure: {
|
|
780
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
781
|
+
method: 'POST',
|
|
782
|
+
qs: {
|
|
783
|
+
i: globalEnv.deviceId,
|
|
784
|
+
k: globalEnv.apikey
|
|
785
|
+
},
|
|
786
|
+
json: [
|
|
787
|
+
{
|
|
788
|
+
a: 0,
|
|
789
|
+
TimeInstant: '2024-04-10T10:15:00Z'
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
a: 1,
|
|
793
|
+
TimeInstant: '2024-04-10T10:05:00Z'
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
a: 2,
|
|
797
|
+
TimeInstant: '2024-04-10T10:20:00Z'
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
a: 3,
|
|
801
|
+
TimeInstant: '2024-04-10T10:00:00Z'
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
a: 4,
|
|
805
|
+
TimeInstant: '2024-04-10T10:10:00Z'
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
a: 5,
|
|
809
|
+
TimeInstant: '2024-04-10T10:30:00Z'
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
a: 6,
|
|
813
|
+
TimeInstant: '2024-04-10T10:25:00Z'
|
|
814
|
+
}
|
|
815
|
+
]
|
|
816
|
+
},
|
|
817
|
+
expectation: {
|
|
818
|
+
actionType: 'append',
|
|
819
|
+
entities: [
|
|
820
|
+
{
|
|
821
|
+
attr_a: {
|
|
822
|
+
type: 'Number',
|
|
823
|
+
value: 3
|
|
824
|
+
},
|
|
825
|
+
TimeInstant: {
|
|
826
|
+
type: 'DateTime',
|
|
827
|
+
value: '2024-04-10T10:00:00Z'
|
|
828
|
+
},
|
|
829
|
+
id: globalEnv.entity_name,
|
|
830
|
+
type: globalEnv.entity_type
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
attr_a: {
|
|
834
|
+
type: 'Number',
|
|
835
|
+
value: 1
|
|
836
|
+
},
|
|
837
|
+
TimeInstant: {
|
|
838
|
+
type: 'DateTime',
|
|
839
|
+
value: '2024-04-10T10:05:00Z'
|
|
840
|
+
},
|
|
841
|
+
id: globalEnv.entity_name,
|
|
842
|
+
type: globalEnv.entity_type
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
attr_a: {
|
|
846
|
+
type: 'Number',
|
|
847
|
+
value: 4
|
|
848
|
+
},
|
|
849
|
+
TimeInstant: {
|
|
850
|
+
type: 'DateTime',
|
|
851
|
+
value: '2024-04-10T10:10:00Z'
|
|
852
|
+
},
|
|
853
|
+
id: globalEnv.entity_name,
|
|
854
|
+
type: globalEnv.entity_type
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
attr_a: {
|
|
858
|
+
type: 'Number',
|
|
859
|
+
value: 0
|
|
860
|
+
},
|
|
861
|
+
TimeInstant: {
|
|
862
|
+
type: 'DateTime',
|
|
863
|
+
value: '2024-04-10T10:15:00Z'
|
|
864
|
+
},
|
|
865
|
+
id: globalEnv.entity_name,
|
|
866
|
+
type: globalEnv.entity_type
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
attr_a: {
|
|
870
|
+
type: 'Number',
|
|
871
|
+
value: 2
|
|
872
|
+
},
|
|
873
|
+
TimeInstant: {
|
|
874
|
+
type: 'DateTime',
|
|
875
|
+
value: '2024-04-10T10:20:00Z'
|
|
876
|
+
},
|
|
877
|
+
id: globalEnv.entity_name,
|
|
878
|
+
type: globalEnv.entity_type
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
attr_a: {
|
|
882
|
+
type: 'Number',
|
|
883
|
+
value: 6
|
|
884
|
+
},
|
|
885
|
+
TimeInstant: {
|
|
886
|
+
type: 'DateTime',
|
|
887
|
+
value: '2024-04-10T10:25:00Z'
|
|
888
|
+
},
|
|
889
|
+
id: globalEnv.entity_name,
|
|
890
|
+
type: globalEnv.entity_type
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
attr_a: {
|
|
894
|
+
type: 'Number',
|
|
895
|
+
value: 5
|
|
896
|
+
},
|
|
897
|
+
TimeInstant: {
|
|
898
|
+
type: 'DateTime',
|
|
899
|
+
value: '2024-04-10T10:30:00Z'
|
|
900
|
+
},
|
|
901
|
+
id: globalEnv.entity_name,
|
|
902
|
+
type: globalEnv.entity_type
|
|
903
|
+
}
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
]
|
|
908
|
+
},
|
|
448
909
|
// 0100 - JEXL TESTS
|
|
449
910
|
{
|
|
450
|
-
describeName: '0100 - Simple group with active attribute + JEXL expression boolean (!)',
|
|
911
|
+
describeName: '0100 - Simple group with active attribute + JEXL expression boolean (!)',
|
|
912
|
+
provision: {
|
|
913
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
914
|
+
method: 'POST',
|
|
915
|
+
json: {
|
|
916
|
+
services: [
|
|
917
|
+
{
|
|
918
|
+
resource: '/iot/json',
|
|
919
|
+
apikey: globalEnv.apikey,
|
|
920
|
+
entity_type: globalEnv.entity_type,
|
|
921
|
+
commands: [],
|
|
922
|
+
lazy: [],
|
|
923
|
+
attributes: [
|
|
924
|
+
{
|
|
925
|
+
object_id: 'a',
|
|
926
|
+
name: 'attr_a',
|
|
927
|
+
type: 'Boolean',
|
|
928
|
+
expression: '!a'
|
|
929
|
+
}
|
|
930
|
+
],
|
|
931
|
+
static_attributes: []
|
|
932
|
+
}
|
|
933
|
+
]
|
|
934
|
+
},
|
|
935
|
+
headers: {
|
|
936
|
+
'fiware-service': globalEnv.service,
|
|
937
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
938
|
+
}
|
|
939
|
+
},
|
|
940
|
+
should: [
|
|
941
|
+
{
|
|
942
|
+
shouldName:
|
|
943
|
+
'A - WHEN sending a boolean value (false) through http IT should send to Context Broker the value true ',
|
|
944
|
+
type: 'single',
|
|
945
|
+
measure: {
|
|
946
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
947
|
+
method: 'POST',
|
|
948
|
+
qs: {
|
|
949
|
+
i: globalEnv.deviceId,
|
|
950
|
+
k: globalEnv.apikey
|
|
951
|
+
},
|
|
952
|
+
json: {
|
|
953
|
+
a: false
|
|
954
|
+
}
|
|
955
|
+
},
|
|
956
|
+
expectation: {
|
|
957
|
+
id: globalEnv.entity_name,
|
|
958
|
+
type: globalEnv.entity_type,
|
|
959
|
+
attr_a: {
|
|
960
|
+
value: true,
|
|
961
|
+
type: 'Boolean'
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
shouldName:
|
|
967
|
+
'B - WHEN sending a numeric value (3) through http IT should send to Context Broker the value false ',
|
|
968
|
+
type: 'single',
|
|
969
|
+
measure: {
|
|
970
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
971
|
+
method: 'POST',
|
|
972
|
+
qs: {
|
|
973
|
+
i: globalEnv.deviceId,
|
|
974
|
+
k: globalEnv.apikey
|
|
975
|
+
},
|
|
976
|
+
json: {
|
|
977
|
+
a: 3
|
|
978
|
+
}
|
|
979
|
+
},
|
|
980
|
+
expectation: {
|
|
981
|
+
id: globalEnv.entity_name,
|
|
982
|
+
type: globalEnv.entity_type,
|
|
983
|
+
attr_a: {
|
|
984
|
+
value: false,
|
|
985
|
+
type: 'Boolean'
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
shouldName:
|
|
991
|
+
'C - WHEN sending a text value (abcd) through http IT should send to Context Broker the value false ',
|
|
992
|
+
type: 'single',
|
|
993
|
+
measure: {
|
|
994
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
995
|
+
method: 'POST',
|
|
996
|
+
qs: {
|
|
997
|
+
i: globalEnv.deviceId,
|
|
998
|
+
k: globalEnv.apikey
|
|
999
|
+
},
|
|
1000
|
+
json: {
|
|
1001
|
+
a: 'abcd'
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
expectation: {
|
|
1005
|
+
id: globalEnv.entity_name,
|
|
1006
|
+
type: globalEnv.entity_type,
|
|
1007
|
+
attr_a: {
|
|
1008
|
+
value: false,
|
|
1009
|
+
type: 'Boolean'
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
shouldName:
|
|
1015
|
+
'D - WHEN not sending the object ID (undefined) required by the expression through http IT should send to Context Broker the value true ',
|
|
1016
|
+
type: 'single',
|
|
1017
|
+
measure: {
|
|
1018
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1019
|
+
method: 'POST',
|
|
1020
|
+
qs: {
|
|
1021
|
+
i: globalEnv.deviceId,
|
|
1022
|
+
k: globalEnv.apikey
|
|
1023
|
+
},
|
|
1024
|
+
json: {
|
|
1025
|
+
b: 1
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
expectation: {
|
|
1029
|
+
id: globalEnv.entity_name,
|
|
1030
|
+
type: globalEnv.entity_type,
|
|
1031
|
+
attr_a: {
|
|
1032
|
+
value: true,
|
|
1033
|
+
type: 'Boolean'
|
|
1034
|
+
},
|
|
1035
|
+
b: {
|
|
1036
|
+
value: 1,
|
|
1037
|
+
type: 'Text'
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
]
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
describeName: '0110 - Simple group with active attribute + JEXL expression numeric (+3)',
|
|
1045
|
+
provision: {
|
|
1046
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1047
|
+
method: 'POST',
|
|
1048
|
+
json: {
|
|
1049
|
+
services: [
|
|
1050
|
+
{
|
|
1051
|
+
resource: '/iot/json',
|
|
1052
|
+
apikey: globalEnv.apikey,
|
|
1053
|
+
entity_type: globalEnv.entity_type,
|
|
1054
|
+
commands: [],
|
|
1055
|
+
lazy: [],
|
|
1056
|
+
attributes: [
|
|
1057
|
+
{
|
|
1058
|
+
object_id: 'a',
|
|
1059
|
+
name: 'attr_a',
|
|
1060
|
+
type: 'Number',
|
|
1061
|
+
expression: 'a+3'
|
|
1062
|
+
}
|
|
1063
|
+
],
|
|
1064
|
+
static_attributes: []
|
|
1065
|
+
}
|
|
1066
|
+
]
|
|
1067
|
+
},
|
|
1068
|
+
headers: {
|
|
1069
|
+
'fiware-service': globalEnv.service,
|
|
1070
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
should: [
|
|
1074
|
+
{
|
|
1075
|
+
shouldName:
|
|
1076
|
+
'A - WHEN sending a boolean value (true) through http IT should send to Context Broker the value 4 ',
|
|
1077
|
+
type: 'single',
|
|
1078
|
+
measure: {
|
|
1079
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1080
|
+
method: 'POST',
|
|
1081
|
+
qs: {
|
|
1082
|
+
i: globalEnv.deviceId,
|
|
1083
|
+
k: globalEnv.apikey
|
|
1084
|
+
},
|
|
1085
|
+
json: {
|
|
1086
|
+
a: true
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
expectation: {
|
|
1090
|
+
id: globalEnv.entity_name,
|
|
1091
|
+
type: globalEnv.entity_type,
|
|
1092
|
+
attr_a: {
|
|
1093
|
+
value: 4,
|
|
1094
|
+
type: 'Number'
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
shouldName:
|
|
1100
|
+
'B - WHEN sending a boolean value (false) through http IT should send to Context Broker the value 3 ',
|
|
1101
|
+
type: 'single',
|
|
1102
|
+
measure: {
|
|
1103
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1104
|
+
method: 'POST',
|
|
1105
|
+
qs: {
|
|
1106
|
+
i: globalEnv.deviceId,
|
|
1107
|
+
k: globalEnv.apikey
|
|
1108
|
+
},
|
|
1109
|
+
json: {
|
|
1110
|
+
a: false
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
expectation: {
|
|
1114
|
+
id: globalEnv.entity_name,
|
|
1115
|
+
type: globalEnv.entity_type,
|
|
1116
|
+
attr_a: {
|
|
1117
|
+
value: 3,
|
|
1118
|
+
type: 'Number'
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
shouldName:
|
|
1124
|
+
'C - WHEN sending a numeric value (-7) through http IT should send to Context Broker the value -4 ',
|
|
1125
|
+
type: 'single',
|
|
1126
|
+
measure: {
|
|
1127
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1128
|
+
method: 'POST',
|
|
1129
|
+
qs: {
|
|
1130
|
+
i: globalEnv.deviceId,
|
|
1131
|
+
k: globalEnv.apikey
|
|
1132
|
+
},
|
|
1133
|
+
json: {
|
|
1134
|
+
a: -7
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
expectation: {
|
|
1138
|
+
id: globalEnv.entity_name,
|
|
1139
|
+
type: globalEnv.entity_type,
|
|
1140
|
+
attr_a: {
|
|
1141
|
+
value: -4,
|
|
1142
|
+
type: 'Number'
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
shouldName:
|
|
1148
|
+
'D - WHEN sending a text value (abcd) through http IT should send to Context Broker the value abcd3',
|
|
1149
|
+
type: 'single',
|
|
1150
|
+
measure: {
|
|
1151
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1152
|
+
method: 'POST',
|
|
1153
|
+
qs: {
|
|
1154
|
+
i: globalEnv.deviceId,
|
|
1155
|
+
k: globalEnv.apikey
|
|
1156
|
+
},
|
|
1157
|
+
json: {
|
|
1158
|
+
a: 'abcd'
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1161
|
+
expectation: {
|
|
1162
|
+
id: globalEnv.entity_name,
|
|
1163
|
+
type: globalEnv.entity_type,
|
|
1164
|
+
attr_a: {
|
|
1165
|
+
value: 'abcd3',
|
|
1166
|
+
type: 'Number'
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
shouldName:
|
|
1172
|
+
'E - WHEN not sending the object ID (undefined) required by the expression through http IT should not send that attribute to Context Broker',
|
|
1173
|
+
type: 'single',
|
|
1174
|
+
measure: {
|
|
1175
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1176
|
+
method: 'POST',
|
|
1177
|
+
qs: {
|
|
1178
|
+
i: globalEnv.deviceId,
|
|
1179
|
+
k: globalEnv.apikey
|
|
1180
|
+
},
|
|
1181
|
+
json: {
|
|
1182
|
+
b: 1
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1185
|
+
expectation: {
|
|
1186
|
+
id: globalEnv.entity_name,
|
|
1187
|
+
type: globalEnv.entity_type,
|
|
1188
|
+
b: {
|
|
1189
|
+
value: 1,
|
|
1190
|
+
type: 'Text'
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
]
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
describeName: '0120 - Simple group with active attribute + JEXL expression numeric (*3)',
|
|
1198
|
+
provision: {
|
|
1199
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1200
|
+
method: 'POST',
|
|
1201
|
+
json: {
|
|
1202
|
+
services: [
|
|
1203
|
+
{
|
|
1204
|
+
resource: '/iot/json',
|
|
1205
|
+
apikey: globalEnv.apikey,
|
|
1206
|
+
entity_type: globalEnv.entity_type,
|
|
1207
|
+
commands: [],
|
|
1208
|
+
lazy: [],
|
|
1209
|
+
attributes: [
|
|
1210
|
+
{
|
|
1211
|
+
object_id: 'a',
|
|
1212
|
+
name: 'attr_a',
|
|
1213
|
+
type: 'Number',
|
|
1214
|
+
expression: 'a*3'
|
|
1215
|
+
}
|
|
1216
|
+
],
|
|
1217
|
+
static_attributes: []
|
|
1218
|
+
}
|
|
1219
|
+
]
|
|
1220
|
+
},
|
|
1221
|
+
headers: {
|
|
1222
|
+
'fiware-service': globalEnv.service,
|
|
1223
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1224
|
+
}
|
|
1225
|
+
},
|
|
1226
|
+
should: [
|
|
1227
|
+
{
|
|
1228
|
+
shouldName:
|
|
1229
|
+
'A - WHEN sending a boolean value (true) through http IT should send to Context Broker the value 3 ',
|
|
1230
|
+
type: 'single',
|
|
1231
|
+
measure: {
|
|
1232
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1233
|
+
method: 'POST',
|
|
1234
|
+
qs: {
|
|
1235
|
+
i: globalEnv.deviceId,
|
|
1236
|
+
k: globalEnv.apikey
|
|
1237
|
+
},
|
|
1238
|
+
json: {
|
|
1239
|
+
a: true
|
|
1240
|
+
}
|
|
1241
|
+
},
|
|
1242
|
+
expectation: {
|
|
1243
|
+
id: globalEnv.entity_name,
|
|
1244
|
+
type: globalEnv.entity_type,
|
|
1245
|
+
attr_a: {
|
|
1246
|
+
value: 3,
|
|
1247
|
+
type: 'Number'
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
{
|
|
1252
|
+
shouldName:
|
|
1253
|
+
'B - WHEN sending a boolean value (false) through http IT should send to Context Broker the value 0',
|
|
1254
|
+
type: 'single',
|
|
1255
|
+
measure: {
|
|
1256
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1257
|
+
method: 'POST',
|
|
1258
|
+
qs: {
|
|
1259
|
+
i: globalEnv.deviceId,
|
|
1260
|
+
k: globalEnv.apikey
|
|
1261
|
+
},
|
|
1262
|
+
json: {
|
|
1263
|
+
a: false
|
|
1264
|
+
}
|
|
1265
|
+
},
|
|
1266
|
+
expectation: {
|
|
1267
|
+
id: globalEnv.entity_name,
|
|
1268
|
+
type: globalEnv.entity_type,
|
|
1269
|
+
attr_a: {
|
|
1270
|
+
value: 0,
|
|
1271
|
+
type: 'Number'
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
shouldName:
|
|
1277
|
+
'C - WHEN sending a numeric value (-7) through http IT should send to Context Broker the value -21 ',
|
|
1278
|
+
type: 'single',
|
|
1279
|
+
measure: {
|
|
1280
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1281
|
+
method: 'POST',
|
|
1282
|
+
qs: {
|
|
1283
|
+
i: globalEnv.deviceId,
|
|
1284
|
+
k: globalEnv.apikey
|
|
1285
|
+
},
|
|
1286
|
+
json: {
|
|
1287
|
+
a: -7
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
expectation: {
|
|
1291
|
+
id: globalEnv.entity_name,
|
|
1292
|
+
type: globalEnv.entity_type,
|
|
1293
|
+
attr_a: {
|
|
1294
|
+
value: -21,
|
|
1295
|
+
type: 'Number'
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
shouldName:
|
|
1301
|
+
'D - WHEN sending a text value (abcd) through http IT should not send to anything to Context Broker',
|
|
1302
|
+
type: 'single',
|
|
1303
|
+
measure: {
|
|
1304
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1305
|
+
method: 'POST',
|
|
1306
|
+
qs: {
|
|
1307
|
+
i: globalEnv.deviceId,
|
|
1308
|
+
k: globalEnv.apikey
|
|
1309
|
+
},
|
|
1310
|
+
json: {
|
|
1311
|
+
a: 'abcd'
|
|
1312
|
+
}
|
|
1313
|
+
},
|
|
1314
|
+
expectation: []
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
shouldName:
|
|
1318
|
+
'E - WHEN not sending the object ID (undefined) required by the expression through http IT should not send that attribute to Context Broker',
|
|
1319
|
+
type: 'single',
|
|
1320
|
+
measure: {
|
|
1321
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1322
|
+
method: 'POST',
|
|
1323
|
+
qs: {
|
|
1324
|
+
i: globalEnv.deviceId,
|
|
1325
|
+
k: globalEnv.apikey
|
|
1326
|
+
},
|
|
1327
|
+
json: {
|
|
1328
|
+
b: 1
|
|
1329
|
+
}
|
|
1330
|
+
},
|
|
1331
|
+
expectation: {
|
|
1332
|
+
id: globalEnv.entity_name,
|
|
1333
|
+
type: globalEnv.entity_type,
|
|
1334
|
+
b: {
|
|
1335
|
+
value: 1,
|
|
1336
|
+
type: 'Text'
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
]
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
describeName: '0130 - Simple group with active attribute + JEXL expression text (a|substr(0,2))',
|
|
1344
|
+
provision: {
|
|
1345
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1346
|
+
method: 'POST',
|
|
1347
|
+
json: {
|
|
1348
|
+
services: [
|
|
1349
|
+
{
|
|
1350
|
+
resource: '/iot/json',
|
|
1351
|
+
apikey: globalEnv.apikey,
|
|
1352
|
+
entity_type: globalEnv.entity_type,
|
|
1353
|
+
commands: [],
|
|
1354
|
+
lazy: [],
|
|
1355
|
+
attributes: [
|
|
1356
|
+
{
|
|
1357
|
+
object_id: 'a',
|
|
1358
|
+
name: 'attr_a',
|
|
1359
|
+
type: 'Number',
|
|
1360
|
+
expression: 'a|substr(0,3)'
|
|
1361
|
+
}
|
|
1362
|
+
],
|
|
1363
|
+
static_attributes: []
|
|
1364
|
+
}
|
|
1365
|
+
]
|
|
1366
|
+
},
|
|
1367
|
+
headers: {
|
|
1368
|
+
'fiware-service': globalEnv.service,
|
|
1369
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1370
|
+
}
|
|
1371
|
+
},
|
|
1372
|
+
should: [
|
|
1373
|
+
{
|
|
1374
|
+
shouldName:
|
|
1375
|
+
'A - WHEN sending a boolean value (true) through http IT should send to Context Broker the value "tru" ',
|
|
1376
|
+
type: 'single',
|
|
1377
|
+
measure: {
|
|
1378
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1379
|
+
method: 'POST',
|
|
1380
|
+
qs: {
|
|
1381
|
+
i: globalEnv.deviceId,
|
|
1382
|
+
k: globalEnv.apikey
|
|
1383
|
+
},
|
|
1384
|
+
json: {
|
|
1385
|
+
a: true
|
|
1386
|
+
}
|
|
1387
|
+
},
|
|
1388
|
+
expectation: {
|
|
1389
|
+
id: globalEnv.entity_name,
|
|
1390
|
+
type: globalEnv.entity_type,
|
|
1391
|
+
attr_a: {
|
|
1392
|
+
value: 'tru',
|
|
1393
|
+
type: 'Number'
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
{
|
|
1398
|
+
shouldName:
|
|
1399
|
+
'B - WHEN sending a boolean value (false) through http IT should send to Context Broker the value "fal"',
|
|
1400
|
+
type: 'single',
|
|
1401
|
+
measure: {
|
|
1402
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1403
|
+
method: 'POST',
|
|
1404
|
+
qs: {
|
|
1405
|
+
i: globalEnv.deviceId,
|
|
1406
|
+
k: globalEnv.apikey
|
|
1407
|
+
},
|
|
1408
|
+
json: {
|
|
1409
|
+
a: false
|
|
1410
|
+
}
|
|
1411
|
+
},
|
|
1412
|
+
expectation: {
|
|
1413
|
+
id: globalEnv.entity_name,
|
|
1414
|
+
type: globalEnv.entity_type,
|
|
1415
|
+
attr_a: {
|
|
1416
|
+
value: 'fal',
|
|
1417
|
+
type: 'Number'
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
{
|
|
1422
|
+
shouldName:
|
|
1423
|
+
'C - WHEN sending a numeric value (-7) through http IT should send to Context Broker the value "-7" ',
|
|
1424
|
+
type: 'single',
|
|
1425
|
+
measure: {
|
|
1426
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1427
|
+
method: 'POST',
|
|
1428
|
+
qs: {
|
|
1429
|
+
i: globalEnv.deviceId,
|
|
1430
|
+
k: globalEnv.apikey
|
|
1431
|
+
},
|
|
1432
|
+
json: {
|
|
1433
|
+
a: -7
|
|
1434
|
+
}
|
|
1435
|
+
},
|
|
1436
|
+
expectation: {
|
|
1437
|
+
id: globalEnv.entity_name,
|
|
1438
|
+
type: globalEnv.entity_type,
|
|
1439
|
+
attr_a: {
|
|
1440
|
+
value: '-7',
|
|
1441
|
+
type: 'Number'
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
shouldName:
|
|
1447
|
+
'D - WHEN sending a text value (abcd) through http IT should not send to anything to Context Broker',
|
|
1448
|
+
type: 'single',
|
|
1449
|
+
measure: {
|
|
1450
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1451
|
+
method: 'POST',
|
|
1452
|
+
qs: {
|
|
1453
|
+
i: globalEnv.deviceId,
|
|
1454
|
+
k: globalEnv.apikey
|
|
1455
|
+
},
|
|
1456
|
+
json: {
|
|
1457
|
+
a: 'abcd'
|
|
1458
|
+
}
|
|
1459
|
+
},
|
|
1460
|
+
expectation: {
|
|
1461
|
+
id: globalEnv.entity_name,
|
|
1462
|
+
type: globalEnv.entity_type,
|
|
1463
|
+
attr_a: {
|
|
1464
|
+
value: 'abc',
|
|
1465
|
+
type: 'Number'
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
shouldName:
|
|
1471
|
+
'E - WHEN not sending the object ID (undefined) required by the expression through http IT should not send that attribute to Context Broker',
|
|
1472
|
+
type: 'single',
|
|
1473
|
+
measure: {
|
|
1474
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1475
|
+
method: 'POST',
|
|
1476
|
+
qs: {
|
|
1477
|
+
i: globalEnv.deviceId,
|
|
1478
|
+
k: globalEnv.apikey
|
|
1479
|
+
},
|
|
1480
|
+
json: {
|
|
1481
|
+
b: 1
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
expectation: {
|
|
1485
|
+
id: globalEnv.entity_name,
|
|
1486
|
+
type: globalEnv.entity_type,
|
|
1487
|
+
attr_a: {
|
|
1488
|
+
value: 'und',
|
|
1489
|
+
type: 'Number'
|
|
1490
|
+
},
|
|
1491
|
+
b: {
|
|
1492
|
+
value: 1,
|
|
1493
|
+
type: 'Text'
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
]
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
describeName:
|
|
1501
|
+
'0140 - Simple group with active attribute + chained JEXL expression text (a | trim | replacestr("hello","hi"))',
|
|
1502
|
+
provision: {
|
|
1503
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1504
|
+
method: 'POST',
|
|
1505
|
+
json: {
|
|
1506
|
+
services: [
|
|
1507
|
+
{
|
|
1508
|
+
resource: '/iot/json',
|
|
1509
|
+
apikey: globalEnv.apikey,
|
|
1510
|
+
entity_type: globalEnv.entity_type,
|
|
1511
|
+
commands: [],
|
|
1512
|
+
lazy: [],
|
|
1513
|
+
attributes: [
|
|
1514
|
+
{
|
|
1515
|
+
object_id: 'a',
|
|
1516
|
+
name: 'a',
|
|
1517
|
+
type: 'Text',
|
|
1518
|
+
expression: 'a | trim | replacestr("hello","hi")'
|
|
1519
|
+
}
|
|
1520
|
+
],
|
|
1521
|
+
static_attributes: []
|
|
1522
|
+
}
|
|
1523
|
+
]
|
|
1524
|
+
},
|
|
1525
|
+
headers: {
|
|
1526
|
+
'fiware-service': globalEnv.service,
|
|
1527
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1528
|
+
}
|
|
1529
|
+
},
|
|
1530
|
+
should: [
|
|
1531
|
+
{
|
|
1532
|
+
shouldName:
|
|
1533
|
+
'A - WHEN sending a expected value ("Say hello and smile") through http IT should send to Context Broker the value "Say hi and smile" ',
|
|
1534
|
+
type: 'single',
|
|
1535
|
+
measure: {
|
|
1536
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1537
|
+
method: 'POST',
|
|
1538
|
+
qs: {
|
|
1539
|
+
i: globalEnv.deviceId,
|
|
1540
|
+
k: globalEnv.apikey
|
|
1541
|
+
},
|
|
1542
|
+
json: {
|
|
1543
|
+
a: 'Say hello and smile'
|
|
1544
|
+
}
|
|
1545
|
+
},
|
|
1546
|
+
expectation: {
|
|
1547
|
+
id: globalEnv.entity_name,
|
|
1548
|
+
type: globalEnv.entity_type,
|
|
1549
|
+
a: {
|
|
1550
|
+
value: 'Say hi and smile',
|
|
1551
|
+
type: 'Text'
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
]
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
describeName: '0150 - Simple group with active attribute + JEXL expression text reusing previous values)',
|
|
1559
|
+
provision: {
|
|
1560
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1561
|
+
method: 'POST',
|
|
1562
|
+
json: {
|
|
1563
|
+
services: [
|
|
1564
|
+
{
|
|
1565
|
+
resource: '/iot/json',
|
|
1566
|
+
apikey: globalEnv.apikey,
|
|
1567
|
+
entity_type: globalEnv.entity_type,
|
|
1568
|
+
commands: [],
|
|
1569
|
+
lazy: [],
|
|
1570
|
+
attributes: [
|
|
1571
|
+
{
|
|
1572
|
+
object_id: 'a',
|
|
1573
|
+
name: 'attr_a',
|
|
1574
|
+
type: 'Number',
|
|
1575
|
+
expression: 'a*10'
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
object_id: 'b',
|
|
1579
|
+
name: 'attr_b',
|
|
1580
|
+
type: 'Number',
|
|
1581
|
+
expression: 'attr_a*10'
|
|
1582
|
+
}
|
|
1583
|
+
],
|
|
1584
|
+
static_attributes: []
|
|
1585
|
+
}
|
|
1586
|
+
]
|
|
1587
|
+
},
|
|
1588
|
+
headers: {
|
|
1589
|
+
'fiware-service': globalEnv.service,
|
|
1590
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1591
|
+
}
|
|
1592
|
+
},
|
|
1593
|
+
should: [
|
|
1594
|
+
{
|
|
1595
|
+
shouldName:
|
|
1596
|
+
'A - WHEN sending a value (a:3) through http IT should apply nested expressions and send to Context Broker the value "attr_b=300" ',
|
|
1597
|
+
type: 'single',
|
|
1598
|
+
measure: {
|
|
1599
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1600
|
+
method: 'POST',
|
|
1601
|
+
qs: {
|
|
1602
|
+
i: globalEnv.deviceId,
|
|
1603
|
+
k: globalEnv.apikey
|
|
1604
|
+
},
|
|
1605
|
+
json: {
|
|
1606
|
+
a: 3
|
|
1607
|
+
}
|
|
1608
|
+
},
|
|
1609
|
+
expectation: {
|
|
1610
|
+
id: globalEnv.entity_name,
|
|
1611
|
+
type: globalEnv.entity_type,
|
|
1612
|
+
attr_a: {
|
|
1613
|
+
value: 30,
|
|
1614
|
+
type: 'Number'
|
|
1615
|
+
},
|
|
1616
|
+
attr_b: {
|
|
1617
|
+
value: 300,
|
|
1618
|
+
type: 'Number'
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
]
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
describeName: '0160 - Simple group with active attribute + JEXL expression referencing static attributes',
|
|
1626
|
+
provision: {
|
|
1627
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1628
|
+
method: 'POST',
|
|
1629
|
+
json: {
|
|
1630
|
+
services: [
|
|
1631
|
+
{
|
|
1632
|
+
resource: '/iot/json',
|
|
1633
|
+
apikey: globalEnv.apikey,
|
|
1634
|
+
entity_type: globalEnv.entity_type,
|
|
1635
|
+
commands: [],
|
|
1636
|
+
lazy: [],
|
|
1637
|
+
attributes: [
|
|
1638
|
+
{
|
|
1639
|
+
object_id: 'a',
|
|
1640
|
+
name: 'attr_a',
|
|
1641
|
+
type: 'Number',
|
|
1642
|
+
expression: 'a*coef'
|
|
1643
|
+
}
|
|
1644
|
+
],
|
|
1645
|
+
static_attributes: [
|
|
1646
|
+
{
|
|
1647
|
+
name: 'coef',
|
|
1648
|
+
type: 'Number',
|
|
1649
|
+
value: 1.5
|
|
1650
|
+
}
|
|
1651
|
+
]
|
|
1652
|
+
}
|
|
1653
|
+
]
|
|
1654
|
+
},
|
|
1655
|
+
headers: {
|
|
1656
|
+
'fiware-service': globalEnv.service,
|
|
1657
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
should: [
|
|
1661
|
+
{
|
|
1662
|
+
shouldName:
|
|
1663
|
+
'A - WHEN sending a value (a:6) through http IT should apply the expression using the static attribute value and send to Context Broker the value "attr_a:9" ',
|
|
1664
|
+
type: 'single',
|
|
1665
|
+
measure: {
|
|
1666
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1667
|
+
method: 'POST',
|
|
1668
|
+
qs: {
|
|
1669
|
+
i: globalEnv.deviceId,
|
|
1670
|
+
k: globalEnv.apikey
|
|
1671
|
+
},
|
|
1672
|
+
json: {
|
|
1673
|
+
a: 6
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
expectation: {
|
|
1677
|
+
id: globalEnv.entity_name,
|
|
1678
|
+
type: globalEnv.entity_type,
|
|
1679
|
+
attr_a: {
|
|
1680
|
+
value: 9,
|
|
1681
|
+
type: 'Number'
|
|
1682
|
+
},
|
|
1683
|
+
coef: {
|
|
1684
|
+
value: 1.5,
|
|
1685
|
+
type: 'Number'
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
]
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
describeName: '0170 - Simple group with active attribute + JEXL expression referencing context attributes',
|
|
1693
|
+
skip: 'lib', // Explanation in #1523
|
|
1694
|
+
provision: {
|
|
1695
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1696
|
+
method: 'POST',
|
|
1697
|
+
json: {
|
|
1698
|
+
services: [
|
|
1699
|
+
{
|
|
1700
|
+
resource: '/iot/json',
|
|
1701
|
+
apikey: globalEnv.apikey,
|
|
1702
|
+
entity_type: globalEnv.entity_type,
|
|
1703
|
+
commands: [],
|
|
1704
|
+
lazy: [],
|
|
1705
|
+
attributes: [
|
|
1706
|
+
{
|
|
1707
|
+
object_id: 'a',
|
|
1708
|
+
name: 'attr_a',
|
|
1709
|
+
type: 'Text',
|
|
1710
|
+
expression: 'a+":"+service+subservice+id+type'
|
|
1711
|
+
}
|
|
1712
|
+
]
|
|
1713
|
+
}
|
|
1714
|
+
]
|
|
1715
|
+
},
|
|
1716
|
+
headers: {
|
|
1717
|
+
'fiware-service': globalEnv.service,
|
|
1718
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1719
|
+
}
|
|
1720
|
+
},
|
|
1721
|
+
should: [
|
|
1722
|
+
{
|
|
1723
|
+
shouldName:
|
|
1724
|
+
'A - WHEN sending a value (text) through http IT should apply the expression using the context attributes value and send to Context Broker the value "text:smartgondor/gardensTestDeviceTestType" ',
|
|
1725
|
+
type: 'single',
|
|
1726
|
+
measure: {
|
|
1727
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1728
|
+
method: 'POST',
|
|
1729
|
+
qs: {
|
|
1730
|
+
i: globalEnv.deviceId,
|
|
1731
|
+
k: globalEnv.apikey
|
|
1732
|
+
},
|
|
1733
|
+
json: {
|
|
1734
|
+
a: 'text'
|
|
1735
|
+
}
|
|
1736
|
+
},
|
|
1737
|
+
expectation: {
|
|
1738
|
+
id: globalEnv.entity_name,
|
|
1739
|
+
type: globalEnv.entity_type,
|
|
1740
|
+
attr_a: {
|
|
1741
|
+
value:
|
|
1742
|
+
'text:' +
|
|
1743
|
+
globalEnv.service +
|
|
1744
|
+
globalEnv.servicePath +
|
|
1745
|
+
globalEnv.deviceId +
|
|
1746
|
+
globalEnv.entity_type,
|
|
1747
|
+
type: 'Text'
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
]
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
describeName: '0180 - Simple group with active attributes + JEXL multiples expressions at same time',
|
|
1755
|
+
skip: 'lib', // Explanation in #1523
|
|
451
1756
|
provision: {
|
|
452
1757
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
453
1758
|
method: 'POST',
|
|
@@ -465,6 +1770,36 @@ const testCases = [
|
|
|
465
1770
|
name: 'attr_a',
|
|
466
1771
|
type: 'Boolean',
|
|
467
1772
|
expression: '!a'
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
object_id: 'b',
|
|
1776
|
+
name: 'attr_b',
|
|
1777
|
+
type: 'Integer',
|
|
1778
|
+
expression: 'b+1'
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
object_id: 'c',
|
|
1782
|
+
name: 'attr_c',
|
|
1783
|
+
type: 'Text',
|
|
1784
|
+
expression: 'c+":"+service+subservice+id+type'
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
object_id: 'd',
|
|
1788
|
+
name: 'attr_d',
|
|
1789
|
+
type: 'Float',
|
|
1790
|
+
expression: 'd/2+attr_b'
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
object_id: 'e',
|
|
1794
|
+
name: 'attr_e',
|
|
1795
|
+
type: 'Array',
|
|
1796
|
+
expression: 'e|concatarr([3,4])'
|
|
1797
|
+
},
|
|
1798
|
+
{
|
|
1799
|
+
object_id: 'f',
|
|
1800
|
+
name: 'attr_f',
|
|
1801
|
+
type: 'Object',
|
|
1802
|
+
expression: '{coordinates: [f.a,f.b], type: "Point"}'
|
|
468
1803
|
}
|
|
469
1804
|
],
|
|
470
1805
|
static_attributes: []
|
|
@@ -479,7 +1814,7 @@ const testCases = [
|
|
|
479
1814
|
should: [
|
|
480
1815
|
{
|
|
481
1816
|
shouldName:
|
|
482
|
-
'A - WHEN sending
|
|
1817
|
+
'A - WHEN sending multiples object_ids (measures) through http IT should send measures to Context Broker applying all expressions at same time',
|
|
483
1818
|
type: 'single',
|
|
484
1819
|
measure: {
|
|
485
1820
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -489,7 +1824,12 @@ const testCases = [
|
|
|
489
1824
|
k: globalEnv.apikey
|
|
490
1825
|
},
|
|
491
1826
|
json: {
|
|
492
|
-
a: false
|
|
1827
|
+
a: false,
|
|
1828
|
+
b: 10,
|
|
1829
|
+
c: 'text',
|
|
1830
|
+
d: 10.5,
|
|
1831
|
+
e: [1, 2],
|
|
1832
|
+
f: { a: 1, b: 2 }
|
|
493
1833
|
}
|
|
494
1834
|
},
|
|
495
1835
|
expectation: {
|
|
@@ -498,13 +1838,84 @@ const testCases = [
|
|
|
498
1838
|
attr_a: {
|
|
499
1839
|
value: true,
|
|
500
1840
|
type: 'Boolean'
|
|
1841
|
+
},
|
|
1842
|
+
attr_b: {
|
|
1843
|
+
value: 11,
|
|
1844
|
+
type: 'Integer'
|
|
1845
|
+
},
|
|
1846
|
+
attr_c: {
|
|
1847
|
+
type: 'Text',
|
|
1848
|
+
value:
|
|
1849
|
+
'text:' +
|
|
1850
|
+
globalEnv.service +
|
|
1851
|
+
globalEnv.servicePath +
|
|
1852
|
+
globalEnv.deviceId +
|
|
1853
|
+
globalEnv.entity_type
|
|
1854
|
+
},
|
|
1855
|
+
attr_d: {
|
|
1856
|
+
type: 'Float',
|
|
1857
|
+
value: 16.25
|
|
1858
|
+
},
|
|
1859
|
+
attr_e: {
|
|
1860
|
+
type: 'Array',
|
|
1861
|
+
value: [1, 2, 3, 4]
|
|
1862
|
+
},
|
|
1863
|
+
attr_f: {
|
|
1864
|
+
type: 'Object',
|
|
1865
|
+
value: { coordinates: [1, 2], type: 'Point' }
|
|
501
1866
|
}
|
|
502
1867
|
}
|
|
1868
|
+
}
|
|
1869
|
+
]
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
describeName:
|
|
1873
|
+
'0190 - Simple group with JEXL expression using static attribute - addressing structured values (JSON)',
|
|
1874
|
+
provision: {
|
|
1875
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1876
|
+
method: 'POST',
|
|
1877
|
+
json: {
|
|
1878
|
+
services: [
|
|
1879
|
+
{
|
|
1880
|
+
resource: '/iot/json',
|
|
1881
|
+
apikey: globalEnv.apikey,
|
|
1882
|
+
entity_type: globalEnv.entity_type,
|
|
1883
|
+
commands: [],
|
|
1884
|
+
lazy: [],
|
|
1885
|
+
attributes: [
|
|
1886
|
+
{
|
|
1887
|
+
object_id: 'a',
|
|
1888
|
+
name: 'attr_a',
|
|
1889
|
+
type: 'Boolean',
|
|
1890
|
+
expression: 'a?threshold[90|tostring].max:true'
|
|
1891
|
+
}
|
|
1892
|
+
],
|
|
1893
|
+
static_attributes: [
|
|
1894
|
+
{
|
|
1895
|
+
name: 'threshold',
|
|
1896
|
+
type: 'Object',
|
|
1897
|
+
value: {
|
|
1898
|
+
'90': { max: 10, min: 1 },
|
|
1899
|
+
'92': { max: 12, min: 2 },
|
|
1900
|
+
'93': { max: 13, min: 3 }
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
],
|
|
1904
|
+
explicitAttrs: "['attr_a']"
|
|
1905
|
+
}
|
|
1906
|
+
]
|
|
503
1907
|
},
|
|
1908
|
+
headers: {
|
|
1909
|
+
'fiware-service': globalEnv.service,
|
|
1910
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1911
|
+
}
|
|
1912
|
+
},
|
|
1913
|
+
should: [
|
|
504
1914
|
{
|
|
505
1915
|
shouldName:
|
|
506
|
-
'
|
|
1916
|
+
'A - WHEN sending a numeric value () through http IT should send to Context Broker the value true ',
|
|
507
1917
|
type: 'single',
|
|
1918
|
+
isRegex: true,
|
|
508
1919
|
measure: {
|
|
509
1920
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
510
1921
|
method: 'POST',
|
|
@@ -513,22 +1924,61 @@ const testCases = [
|
|
|
513
1924
|
k: globalEnv.apikey
|
|
514
1925
|
},
|
|
515
1926
|
json: {
|
|
516
|
-
a:
|
|
1927
|
+
a: false
|
|
517
1928
|
}
|
|
518
1929
|
},
|
|
519
1930
|
expectation: {
|
|
520
1931
|
id: globalEnv.entity_name,
|
|
521
1932
|
type: globalEnv.entity_type,
|
|
522
1933
|
attr_a: {
|
|
523
|
-
value:
|
|
1934
|
+
value: true,
|
|
524
1935
|
type: 'Boolean'
|
|
525
1936
|
}
|
|
526
1937
|
}
|
|
1938
|
+
}
|
|
1939
|
+
]
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
describeName: '0191 - Simple group with JEXL expression in metadata',
|
|
1943
|
+
provision: {
|
|
1944
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1945
|
+
method: 'POST',
|
|
1946
|
+
json: {
|
|
1947
|
+
services: [
|
|
1948
|
+
{
|
|
1949
|
+
resource: '/iot/json',
|
|
1950
|
+
apikey: globalEnv.apikey,
|
|
1951
|
+
entity_type: globalEnv.entity_type,
|
|
1952
|
+
commands: [],
|
|
1953
|
+
lazy: [],
|
|
1954
|
+
attributes: [
|
|
1955
|
+
{
|
|
1956
|
+
object_id: 'a',
|
|
1957
|
+
name: 'attr_a',
|
|
1958
|
+
type: 'Boolean',
|
|
1959
|
+
expression: 'a?threshold[90|tostring].max:true',
|
|
1960
|
+
metadata: {
|
|
1961
|
+
unit: {
|
|
1962
|
+
type: 'Text',
|
|
1963
|
+
expression: '"hola" + "adios"'
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
]
|
|
1968
|
+
}
|
|
1969
|
+
]
|
|
527
1970
|
},
|
|
1971
|
+
headers: {
|
|
1972
|
+
'fiware-service': globalEnv.service,
|
|
1973
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
1974
|
+
}
|
|
1975
|
+
},
|
|
1976
|
+
should: [
|
|
528
1977
|
{
|
|
529
1978
|
shouldName:
|
|
530
|
-
'
|
|
1979
|
+
'A - WHEN sending a measure through http IT should send to Context Broker expanded metadata value ',
|
|
531
1980
|
type: 'single',
|
|
1981
|
+
isRegex: true,
|
|
532
1982
|
measure: {
|
|
533
1983
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
534
1984
|
method: 'POST',
|
|
@@ -537,22 +1987,63 @@ const testCases = [
|
|
|
537
1987
|
k: globalEnv.apikey
|
|
538
1988
|
},
|
|
539
1989
|
json: {
|
|
540
|
-
a:
|
|
1990
|
+
a: false
|
|
541
1991
|
}
|
|
542
1992
|
},
|
|
543
1993
|
expectation: {
|
|
544
1994
|
id: globalEnv.entity_name,
|
|
545
1995
|
type: globalEnv.entity_type,
|
|
546
1996
|
attr_a: {
|
|
547
|
-
value:
|
|
548
|
-
type: 'Boolean'
|
|
1997
|
+
value: true,
|
|
1998
|
+
type: 'Boolean',
|
|
1999
|
+
metadata: {
|
|
2000
|
+
unit: {
|
|
2001
|
+
type: 'Text',
|
|
2002
|
+
value: 'holaadios'
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
549
2005
|
}
|
|
550
2006
|
}
|
|
2007
|
+
}
|
|
2008
|
+
]
|
|
2009
|
+
},
|
|
2010
|
+
// 0200 - COMMANDS TESTS
|
|
2011
|
+
{
|
|
2012
|
+
describeName: '0200 - Simple group with commands',
|
|
2013
|
+
provision: {
|
|
2014
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
2015
|
+
method: 'POST',
|
|
2016
|
+
json: {
|
|
2017
|
+
services: [
|
|
2018
|
+
{
|
|
2019
|
+
resource: '/iot/json',
|
|
2020
|
+
apikey: globalEnv.apikey,
|
|
2021
|
+
entity_type: globalEnv.entity_type,
|
|
2022
|
+
commands: [
|
|
2023
|
+
{
|
|
2024
|
+
name: 'cmd1',
|
|
2025
|
+
type: 'command'
|
|
2026
|
+
}
|
|
2027
|
+
],
|
|
2028
|
+
endpoint: 'http://myendpoint.com',
|
|
2029
|
+
transport: 'http',
|
|
2030
|
+
lazy: [],
|
|
2031
|
+
attributes: [],
|
|
2032
|
+
static_attributes: []
|
|
2033
|
+
}
|
|
2034
|
+
]
|
|
551
2035
|
},
|
|
2036
|
+
headers: {
|
|
2037
|
+
'fiware-service': globalEnv.service,
|
|
2038
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
2039
|
+
}
|
|
2040
|
+
},
|
|
2041
|
+
should: [
|
|
552
2042
|
{
|
|
553
2043
|
shouldName:
|
|
554
|
-
'
|
|
2044
|
+
'A - WHEN sending not provisioned object_ids (measures) through http IT should store commands into Context Broker',
|
|
555
2045
|
type: 'single',
|
|
2046
|
+
skip: '!lib', // there is not CB registration mock
|
|
556
2047
|
measure: {
|
|
557
2048
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
558
2049
|
method: 'POST',
|
|
@@ -561,26 +2052,24 @@ const testCases = [
|
|
|
561
2052
|
k: globalEnv.apikey
|
|
562
2053
|
},
|
|
563
2054
|
json: {
|
|
564
|
-
b:
|
|
2055
|
+
b: 10
|
|
565
2056
|
}
|
|
566
2057
|
},
|
|
567
2058
|
expectation: {
|
|
568
2059
|
id: globalEnv.entity_name,
|
|
569
2060
|
type: globalEnv.entity_type,
|
|
570
|
-
attr_a: {
|
|
571
|
-
value: true,
|
|
572
|
-
type: 'Boolean'
|
|
573
|
-
},
|
|
574
2061
|
b: {
|
|
575
|
-
value:
|
|
2062
|
+
value: 10,
|
|
576
2063
|
type: 'Text'
|
|
577
2064
|
}
|
|
578
2065
|
}
|
|
579
2066
|
}
|
|
580
2067
|
]
|
|
581
2068
|
},
|
|
2069
|
+
// 0300 - STATIC ATTRIBUTES TESTS
|
|
582
2070
|
{
|
|
583
|
-
describeName:
|
|
2071
|
+
describeName:
|
|
2072
|
+
'0300 - Simple group with active attributes + Static attributes + JEXL expression using static attribute value',
|
|
584
2073
|
provision: {
|
|
585
2074
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
586
2075
|
method: 'POST',
|
|
@@ -597,10 +2086,16 @@ const testCases = [
|
|
|
597
2086
|
object_id: 'a',
|
|
598
2087
|
name: 'attr_a',
|
|
599
2088
|
type: 'Number',
|
|
600
|
-
expression: 'a
|
|
2089
|
+
expression: 'a*static_a'
|
|
601
2090
|
}
|
|
602
2091
|
],
|
|
603
|
-
static_attributes: [
|
|
2092
|
+
static_attributes: [
|
|
2093
|
+
{
|
|
2094
|
+
name: 'static_a',
|
|
2095
|
+
type: 'Number',
|
|
2096
|
+
value: 3
|
|
2097
|
+
}
|
|
2098
|
+
]
|
|
604
2099
|
}
|
|
605
2100
|
]
|
|
606
2101
|
},
|
|
@@ -612,7 +2107,7 @@ const testCases = [
|
|
|
612
2107
|
should: [
|
|
613
2108
|
{
|
|
614
2109
|
shouldName:
|
|
615
|
-
'A - WHEN sending
|
|
2110
|
+
'A - WHEN sending not provisioned object_ids (measures) through http IT should store static attributes into Context Broker',
|
|
616
2111
|
type: 'single',
|
|
617
2112
|
measure: {
|
|
618
2113
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -622,37 +2117,17 @@ const testCases = [
|
|
|
622
2117
|
k: globalEnv.apikey
|
|
623
2118
|
},
|
|
624
2119
|
json: {
|
|
625
|
-
|
|
2120
|
+
b: 10
|
|
626
2121
|
}
|
|
627
2122
|
},
|
|
628
2123
|
expectation: {
|
|
629
2124
|
id: globalEnv.entity_name,
|
|
630
2125
|
type: globalEnv.entity_type,
|
|
631
|
-
|
|
632
|
-
value:
|
|
633
|
-
type: '
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
},
|
|
637
|
-
{
|
|
638
|
-
shouldName:
|
|
639
|
-
'B - WHEN sending a boolean value (false) through http IT should send to Context Broker the value 3 ',
|
|
640
|
-
type: 'single',
|
|
641
|
-
measure: {
|
|
642
|
-
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
643
|
-
method: 'POST',
|
|
644
|
-
qs: {
|
|
645
|
-
i: globalEnv.deviceId,
|
|
646
|
-
k: globalEnv.apikey
|
|
2126
|
+
b: {
|
|
2127
|
+
value: 10,
|
|
2128
|
+
type: 'Text'
|
|
647
2129
|
},
|
|
648
|
-
|
|
649
|
-
a: false
|
|
650
|
-
}
|
|
651
|
-
},
|
|
652
|
-
expectation: {
|
|
653
|
-
id: globalEnv.entity_name,
|
|
654
|
-
type: globalEnv.entity_type,
|
|
655
|
-
attr_a: {
|
|
2130
|
+
static_a: {
|
|
656
2131
|
value: 3,
|
|
657
2132
|
type: 'Number'
|
|
658
2133
|
}
|
|
@@ -660,7 +2135,7 @@ const testCases = [
|
|
|
660
2135
|
},
|
|
661
2136
|
{
|
|
662
2137
|
shouldName:
|
|
663
|
-
'
|
|
2138
|
+
'B - WHEN sending provisioned object_ids (measures) through http IT should store static attributes into Context Broker + calculate expression based on static',
|
|
664
2139
|
type: 'single',
|
|
665
2140
|
measure: {
|
|
666
2141
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -670,45 +2145,63 @@ const testCases = [
|
|
|
670
2145
|
k: globalEnv.apikey
|
|
671
2146
|
},
|
|
672
2147
|
json: {
|
|
673
|
-
a:
|
|
2148
|
+
a: 10
|
|
674
2149
|
}
|
|
675
2150
|
},
|
|
676
2151
|
expectation: {
|
|
677
2152
|
id: globalEnv.entity_name,
|
|
678
2153
|
type: globalEnv.entity_type,
|
|
679
2154
|
attr_a: {
|
|
680
|
-
value:
|
|
2155
|
+
value: 30,
|
|
681
2156
|
type: 'Number'
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
shouldName:
|
|
687
|
-
'D - WHEN sending a text value (abcd) through http IT should send to Context Broker the value abcd3',
|
|
688
|
-
type: 'single',
|
|
689
|
-
measure: {
|
|
690
|
-
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
691
|
-
method: 'POST',
|
|
692
|
-
qs: {
|
|
693
|
-
i: globalEnv.deviceId,
|
|
694
|
-
k: globalEnv.apikey
|
|
695
2157
|
},
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}
|
|
699
|
-
},
|
|
700
|
-
expectation: {
|
|
701
|
-
id: globalEnv.entity_name,
|
|
702
|
-
type: globalEnv.entity_type,
|
|
703
|
-
attr_a: {
|
|
704
|
-
value: 'abcd3',
|
|
2158
|
+
static_a: {
|
|
2159
|
+
value: 3,
|
|
705
2160
|
type: 'Number'
|
|
706
2161
|
}
|
|
707
2162
|
}
|
|
2163
|
+
}
|
|
2164
|
+
]
|
|
2165
|
+
},
|
|
2166
|
+
{
|
|
2167
|
+
describeName: '0310 - Simple group with active attributes + JSON value Static attributes ',
|
|
2168
|
+
provision: {
|
|
2169
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
2170
|
+
method: 'POST',
|
|
2171
|
+
json: {
|
|
2172
|
+
services: [
|
|
2173
|
+
{
|
|
2174
|
+
resource: '/iot/json',
|
|
2175
|
+
apikey: globalEnv.apikey,
|
|
2176
|
+
entity_type: globalEnv.entity_type,
|
|
2177
|
+
commands: [],
|
|
2178
|
+
lazy: [],
|
|
2179
|
+
attributes: [],
|
|
2180
|
+
static_attributes: [
|
|
2181
|
+
{
|
|
2182
|
+
name: 'static_a',
|
|
2183
|
+
type: 'Number',
|
|
2184
|
+
value: {
|
|
2185
|
+
v1: 1,
|
|
2186
|
+
v2: {
|
|
2187
|
+
v3: 3,
|
|
2188
|
+
v4: 4
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
]
|
|
2193
|
+
}
|
|
2194
|
+
]
|
|
708
2195
|
},
|
|
2196
|
+
headers: {
|
|
2197
|
+
'fiware-service': globalEnv.service,
|
|
2198
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
2199
|
+
}
|
|
2200
|
+
},
|
|
2201
|
+
should: [
|
|
709
2202
|
{
|
|
710
2203
|
shouldName:
|
|
711
|
-
'
|
|
2204
|
+
'A - WHEN sending measures through http IT should store complex static attributes into Context Broker',
|
|
712
2205
|
type: 'single',
|
|
713
2206
|
measure: {
|
|
714
2207
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -718,22 +2211,32 @@ const testCases = [
|
|
|
718
2211
|
k: globalEnv.apikey
|
|
719
2212
|
},
|
|
720
2213
|
json: {
|
|
721
|
-
|
|
2214
|
+
a: 10
|
|
722
2215
|
}
|
|
723
2216
|
},
|
|
724
2217
|
expectation: {
|
|
725
2218
|
id: globalEnv.entity_name,
|
|
726
2219
|
type: globalEnv.entity_type,
|
|
727
|
-
|
|
728
|
-
value:
|
|
2220
|
+
a: {
|
|
2221
|
+
value: 10,
|
|
729
2222
|
type: 'Text'
|
|
2223
|
+
},
|
|
2224
|
+
static_a: {
|
|
2225
|
+
value: {
|
|
2226
|
+
v1: 1,
|
|
2227
|
+
v2: {
|
|
2228
|
+
v3: 3,
|
|
2229
|
+
v4: 4
|
|
2230
|
+
}
|
|
2231
|
+
},
|
|
2232
|
+
type: 'Number'
|
|
730
2233
|
}
|
|
731
2234
|
}
|
|
732
2235
|
}
|
|
733
2236
|
]
|
|
734
2237
|
},
|
|
735
2238
|
{
|
|
736
|
-
describeName: '
|
|
2239
|
+
describeName: '0320 - Simple group with active attributes + metadata in Static attributes ',
|
|
737
2240
|
provision: {
|
|
738
2241
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
739
2242
|
method: 'POST',
|
|
@@ -745,15 +2248,20 @@ const testCases = [
|
|
|
745
2248
|
entity_type: globalEnv.entity_type,
|
|
746
2249
|
commands: [],
|
|
747
2250
|
lazy: [],
|
|
748
|
-
attributes: [
|
|
2251
|
+
attributes: [],
|
|
2252
|
+
static_attributes: [
|
|
749
2253
|
{
|
|
750
|
-
|
|
751
|
-
name: 'attr_a',
|
|
2254
|
+
name: 'static_a',
|
|
752
2255
|
type: 'Number',
|
|
753
|
-
|
|
2256
|
+
value: 4,
|
|
2257
|
+
metadata: {
|
|
2258
|
+
accuracy: {
|
|
2259
|
+
value: 0.8,
|
|
2260
|
+
type: 'Float'
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
754
2263
|
}
|
|
755
|
-
]
|
|
756
|
-
static_attributes: []
|
|
2264
|
+
]
|
|
757
2265
|
}
|
|
758
2266
|
]
|
|
759
2267
|
},
|
|
@@ -765,7 +2273,7 @@ const testCases = [
|
|
|
765
2273
|
should: [
|
|
766
2274
|
{
|
|
767
2275
|
shouldName:
|
|
768
|
-
'A - WHEN sending
|
|
2276
|
+
'A - WHEN sending measures through http IT should store metatada static attributes into Context Broker',
|
|
769
2277
|
type: 'single',
|
|
770
2278
|
measure: {
|
|
771
2279
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -775,69 +2283,64 @@ const testCases = [
|
|
|
775
2283
|
k: globalEnv.apikey
|
|
776
2284
|
},
|
|
777
2285
|
json: {
|
|
778
|
-
a:
|
|
2286
|
+
a: 10
|
|
779
2287
|
}
|
|
780
2288
|
},
|
|
781
2289
|
expectation: {
|
|
782
2290
|
id: globalEnv.entity_name,
|
|
783
2291
|
type: globalEnv.entity_type,
|
|
784
|
-
|
|
785
|
-
value:
|
|
786
|
-
type: '
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
},
|
|
790
|
-
{
|
|
791
|
-
shouldName:
|
|
792
|
-
'B - WHEN sending a boolean value (false) through http IT should send to Context Broker the value 0',
|
|
793
|
-
type: 'single',
|
|
794
|
-
measure: {
|
|
795
|
-
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
796
|
-
method: 'POST',
|
|
797
|
-
qs: {
|
|
798
|
-
i: globalEnv.deviceId,
|
|
799
|
-
k: globalEnv.apikey
|
|
2292
|
+
a: {
|
|
2293
|
+
value: 10,
|
|
2294
|
+
type: 'Text'
|
|
800
2295
|
},
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
type: 'Number'
|
|
2296
|
+
static_a: {
|
|
2297
|
+
value: 4,
|
|
2298
|
+
type: 'Number',
|
|
2299
|
+
metadata: {
|
|
2300
|
+
accuracy: {
|
|
2301
|
+
value: 0.8,
|
|
2302
|
+
type: 'Float'
|
|
2303
|
+
}
|
|
2304
|
+
}
|
|
811
2305
|
}
|
|
812
2306
|
}
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
2307
|
+
}
|
|
2308
|
+
]
|
|
2309
|
+
},
|
|
2310
|
+
// 0400 - TIMESTAMP TESTS
|
|
2311
|
+
{
|
|
2312
|
+
describeName: '0400 - Simple group with active attribute + timestamp:false',
|
|
2313
|
+
provision: {
|
|
2314
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
2315
|
+
method: 'POST',
|
|
2316
|
+
json: {
|
|
2317
|
+
services: [
|
|
2318
|
+
{
|
|
2319
|
+
resource: '/iot/json',
|
|
2320
|
+
apikey: globalEnv.apikey,
|
|
2321
|
+
entity_type: globalEnv.entity_type,
|
|
2322
|
+
timestamp: false,
|
|
2323
|
+
commands: [],
|
|
2324
|
+
lazy: [],
|
|
2325
|
+
attributes: [
|
|
2326
|
+
{
|
|
2327
|
+
object_id: 'a',
|
|
2328
|
+
name: 'attr_a',
|
|
2329
|
+
type: 'Number'
|
|
2330
|
+
}
|
|
2331
|
+
]
|
|
835
2332
|
}
|
|
836
|
-
|
|
2333
|
+
]
|
|
837
2334
|
},
|
|
2335
|
+
headers: {
|
|
2336
|
+
'fiware-service': globalEnv.service,
|
|
2337
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
2338
|
+
}
|
|
2339
|
+
},
|
|
2340
|
+
should: [
|
|
838
2341
|
{
|
|
839
2342
|
shouldName:
|
|
840
|
-
'
|
|
2343
|
+
'A - WHEN sending a measure not named TimeInstant through http IT should not add the timestamp to the attributes sent to Context Broker',
|
|
841
2344
|
type: 'single',
|
|
842
2345
|
measure: {
|
|
843
2346
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -847,14 +2350,21 @@ const testCases = [
|
|
|
847
2350
|
k: globalEnv.apikey
|
|
848
2351
|
},
|
|
849
2352
|
json: {
|
|
850
|
-
a:
|
|
2353
|
+
a: 23
|
|
851
2354
|
}
|
|
852
2355
|
},
|
|
853
|
-
expectation:
|
|
2356
|
+
expectation: {
|
|
2357
|
+
id: globalEnv.entity_name,
|
|
2358
|
+
type: globalEnv.entity_type,
|
|
2359
|
+
attr_a: {
|
|
2360
|
+
value: 23,
|
|
2361
|
+
type: 'Number'
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
854
2364
|
},
|
|
855
2365
|
{
|
|
856
2366
|
shouldName:
|
|
857
|
-
'
|
|
2367
|
+
'B - WHEN sending a measure named TimeInstant through http IT should not add the timestamp to the other attributes sent to Context Broker',
|
|
858
2368
|
type: 'single',
|
|
859
2369
|
measure: {
|
|
860
2370
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -864,22 +2374,27 @@ const testCases = [
|
|
|
864
2374
|
k: globalEnv.apikey
|
|
865
2375
|
},
|
|
866
2376
|
json: {
|
|
867
|
-
|
|
2377
|
+
TimeInstant: '2015-12-14T08:06:01.468Z',
|
|
2378
|
+
a: 23
|
|
868
2379
|
}
|
|
869
2380
|
},
|
|
870
2381
|
expectation: {
|
|
871
2382
|
id: globalEnv.entity_name,
|
|
872
2383
|
type: globalEnv.entity_type,
|
|
873
|
-
|
|
874
|
-
value:
|
|
875
|
-
type: '
|
|
2384
|
+
attr_a: {
|
|
2385
|
+
value: 23,
|
|
2386
|
+
type: 'Number'
|
|
2387
|
+
},
|
|
2388
|
+
TimeInstant: {
|
|
2389
|
+
value: '2015-12-14T08:06:01.468Z',
|
|
2390
|
+
type: 'DateTime'
|
|
876
2391
|
}
|
|
877
2392
|
}
|
|
878
2393
|
}
|
|
879
2394
|
]
|
|
880
2395
|
},
|
|
881
2396
|
{
|
|
882
|
-
describeName: '
|
|
2397
|
+
describeName: '0410 - Simple group with active attribute + timestamp:true',
|
|
883
2398
|
provision: {
|
|
884
2399
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
885
2400
|
method: 'POST',
|
|
@@ -889,17 +2404,16 @@ const testCases = [
|
|
|
889
2404
|
resource: '/iot/json',
|
|
890
2405
|
apikey: globalEnv.apikey,
|
|
891
2406
|
entity_type: globalEnv.entity_type,
|
|
2407
|
+
timestamp: true,
|
|
892
2408
|
commands: [],
|
|
893
2409
|
lazy: [],
|
|
894
2410
|
attributes: [
|
|
895
2411
|
{
|
|
896
2412
|
object_id: 'a',
|
|
897
2413
|
name: 'attr_a',
|
|
898
|
-
type: 'Number'
|
|
899
|
-
expression: 'a|substr(0,3)'
|
|
2414
|
+
type: 'Number'
|
|
900
2415
|
}
|
|
901
|
-
]
|
|
902
|
-
static_attributes: []
|
|
2416
|
+
]
|
|
903
2417
|
}
|
|
904
2418
|
]
|
|
905
2419
|
},
|
|
@@ -911,8 +2425,9 @@ const testCases = [
|
|
|
911
2425
|
should: [
|
|
912
2426
|
{
|
|
913
2427
|
shouldName:
|
|
914
|
-
'A - WHEN sending a
|
|
2428
|
+
'A - WHEN sending a measure not named TimeInstant through http IT should add the timestamp to the attributes sent to Context Broker',
|
|
915
2429
|
type: 'single',
|
|
2430
|
+
isRegex: true,
|
|
916
2431
|
measure: {
|
|
917
2432
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
918
2433
|
method: 'POST',
|
|
@@ -921,45 +2436,31 @@ const testCases = [
|
|
|
921
2436
|
k: globalEnv.apikey
|
|
922
2437
|
},
|
|
923
2438
|
json: {
|
|
924
|
-
a:
|
|
2439
|
+
a: 21
|
|
925
2440
|
}
|
|
926
2441
|
},
|
|
927
2442
|
expectation: {
|
|
928
2443
|
id: globalEnv.entity_name,
|
|
929
2444
|
type: globalEnv.entity_type,
|
|
930
2445
|
attr_a: {
|
|
931
|
-
value:
|
|
932
|
-
type: 'Number'
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
type: 'single',
|
|
940
|
-
measure: {
|
|
941
|
-
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
942
|
-
method: 'POST',
|
|
943
|
-
qs: {
|
|
944
|
-
i: globalEnv.deviceId,
|
|
945
|
-
k: globalEnv.apikey
|
|
2446
|
+
value: 21,
|
|
2447
|
+
type: 'Number',
|
|
2448
|
+
metadata: {
|
|
2449
|
+
TimeInstant: {
|
|
2450
|
+
type: 'DateTime',
|
|
2451
|
+
value: _.isDateString
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
946
2454
|
},
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
},
|
|
951
|
-
expectation: {
|
|
952
|
-
id: globalEnv.entity_name,
|
|
953
|
-
type: globalEnv.entity_type,
|
|
954
|
-
attr_a: {
|
|
955
|
-
value: 'fal',
|
|
956
|
-
type: 'Number'
|
|
2455
|
+
TimeInstant: {
|
|
2456
|
+
type: 'DateTime',
|
|
2457
|
+
value: _.isDateString
|
|
957
2458
|
}
|
|
958
2459
|
}
|
|
959
2460
|
},
|
|
960
2461
|
{
|
|
961
2462
|
shouldName:
|
|
962
|
-
'
|
|
2463
|
+
'B - WHEN sending a measure named TimeInstant through http IT should not add the timestamp to the other attributes sent to Context Broker',
|
|
963
2464
|
type: 'single',
|
|
964
2465
|
measure: {
|
|
965
2466
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -969,21 +2470,63 @@ const testCases = [
|
|
|
969
2470
|
k: globalEnv.apikey
|
|
970
2471
|
},
|
|
971
2472
|
json: {
|
|
972
|
-
|
|
2473
|
+
TimeInstant: '2015-12-14T08:06:01.468Z',
|
|
2474
|
+
a: 23
|
|
973
2475
|
}
|
|
974
2476
|
},
|
|
975
2477
|
expectation: {
|
|
976
2478
|
id: globalEnv.entity_name,
|
|
977
2479
|
type: globalEnv.entity_type,
|
|
978
2480
|
attr_a: {
|
|
979
|
-
value:
|
|
980
|
-
type: 'Number'
|
|
2481
|
+
value: 23,
|
|
2482
|
+
type: 'Number',
|
|
2483
|
+
metadata: {
|
|
2484
|
+
TimeInstant: {
|
|
2485
|
+
type: 'DateTime',
|
|
2486
|
+
value: '2015-12-14T08:06:01.468Z'
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
},
|
|
2490
|
+
TimeInstant: {
|
|
2491
|
+
value: '2015-12-14T08:06:01.468Z',
|
|
2492
|
+
type: 'DateTime'
|
|
981
2493
|
}
|
|
982
2494
|
}
|
|
2495
|
+
}
|
|
2496
|
+
]
|
|
2497
|
+
},
|
|
2498
|
+
{
|
|
2499
|
+
describeName: '0420 - Simple group with active attribute + timestamp not defined',
|
|
2500
|
+
provision: {
|
|
2501
|
+
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
2502
|
+
method: 'POST',
|
|
2503
|
+
json: {
|
|
2504
|
+
services: [
|
|
2505
|
+
{
|
|
2506
|
+
resource: '/iot/json',
|
|
2507
|
+
apikey: globalEnv.apikey,
|
|
2508
|
+
entity_type: globalEnv.entity_type,
|
|
2509
|
+
commands: [],
|
|
2510
|
+
lazy: [],
|
|
2511
|
+
attributes: [
|
|
2512
|
+
{
|
|
2513
|
+
object_id: 'a',
|
|
2514
|
+
name: 'attr_a',
|
|
2515
|
+
type: 'Number'
|
|
2516
|
+
}
|
|
2517
|
+
]
|
|
2518
|
+
}
|
|
2519
|
+
]
|
|
983
2520
|
},
|
|
2521
|
+
headers: {
|
|
2522
|
+
'fiware-service': globalEnv.service,
|
|
2523
|
+
'fiware-servicepath': globalEnv.servicePath
|
|
2524
|
+
}
|
|
2525
|
+
},
|
|
2526
|
+
should: [
|
|
984
2527
|
{
|
|
985
2528
|
shouldName:
|
|
986
|
-
'
|
|
2529
|
+
'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',
|
|
987
2530
|
type: 'single',
|
|
988
2531
|
measure: {
|
|
989
2532
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -993,21 +2536,21 @@ const testCases = [
|
|
|
993
2536
|
k: globalEnv.apikey
|
|
994
2537
|
},
|
|
995
2538
|
json: {
|
|
996
|
-
a:
|
|
2539
|
+
a: 21
|
|
997
2540
|
}
|
|
998
2541
|
},
|
|
999
2542
|
expectation: {
|
|
1000
2543
|
id: globalEnv.entity_name,
|
|
1001
2544
|
type: globalEnv.entity_type,
|
|
1002
2545
|
attr_a: {
|
|
1003
|
-
value:
|
|
2546
|
+
value: 21,
|
|
1004
2547
|
type: 'Number'
|
|
1005
2548
|
}
|
|
1006
2549
|
}
|
|
1007
2550
|
},
|
|
1008
2551
|
{
|
|
1009
2552
|
shouldName:
|
|
1010
|
-
'
|
|
2553
|
+
'B - WHEN sending a measure named TimeInstant through http IT should not add the timestamp to the other attributes sent to Context Broker',
|
|
1011
2554
|
type: 'single',
|
|
1012
2555
|
measure: {
|
|
1013
2556
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -1017,26 +2560,27 @@ const testCases = [
|
|
|
1017
2560
|
k: globalEnv.apikey
|
|
1018
2561
|
},
|
|
1019
2562
|
json: {
|
|
1020
|
-
|
|
2563
|
+
TimeInstant: '2015-12-14T08:06:01.468Z',
|
|
2564
|
+
a: 23
|
|
1021
2565
|
}
|
|
1022
2566
|
},
|
|
1023
2567
|
expectation: {
|
|
1024
2568
|
id: globalEnv.entity_name,
|
|
1025
2569
|
type: globalEnv.entity_type,
|
|
1026
2570
|
attr_a: {
|
|
1027
|
-
value:
|
|
2571
|
+
value: 23,
|
|
1028
2572
|
type: 'Number'
|
|
1029
2573
|
},
|
|
1030
|
-
|
|
1031
|
-
value:
|
|
1032
|
-
type: '
|
|
2574
|
+
TimeInstant: {
|
|
2575
|
+
value: '2015-12-14T08:06:01.468Z',
|
|
2576
|
+
type: 'DateTime'
|
|
1033
2577
|
}
|
|
1034
2578
|
}
|
|
1035
2579
|
}
|
|
1036
2580
|
]
|
|
1037
2581
|
},
|
|
1038
2582
|
{
|
|
1039
|
-
describeName: '
|
|
2583
|
+
describeName: '0430 - Simple group with active attribute + timestamp mapping defined',
|
|
1040
2584
|
provision: {
|
|
1041
2585
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1042
2586
|
method: 'POST',
|
|
@@ -1045,18 +2589,17 @@ const testCases = [
|
|
|
1045
2589
|
{
|
|
1046
2590
|
resource: '/iot/json',
|
|
1047
2591
|
apikey: globalEnv.apikey,
|
|
2592
|
+
timestamp: true,
|
|
1048
2593
|
entity_type: globalEnv.entity_type,
|
|
1049
2594
|
commands: [],
|
|
1050
2595
|
lazy: [],
|
|
1051
2596
|
attributes: [
|
|
1052
2597
|
{
|
|
1053
|
-
object_id: '
|
|
1054
|
-
name: '
|
|
1055
|
-
type: '
|
|
1056
|
-
expression: 'a | trim | replacestr("hello","hi")'
|
|
2598
|
+
object_id: 'mydatetime',
|
|
2599
|
+
name: 'TimeInstant',
|
|
2600
|
+
type: 'DateTime'
|
|
1057
2601
|
}
|
|
1058
|
-
]
|
|
1059
|
-
static_attributes: []
|
|
2602
|
+
]
|
|
1060
2603
|
}
|
|
1061
2604
|
]
|
|
1062
2605
|
},
|
|
@@ -1068,7 +2611,7 @@ const testCases = [
|
|
|
1068
2611
|
should: [
|
|
1069
2612
|
{
|
|
1070
2613
|
shouldName:
|
|
1071
|
-
'A - WHEN sending a
|
|
2614
|
+
'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',
|
|
1072
2615
|
type: 'single',
|
|
1073
2616
|
measure: {
|
|
1074
2617
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -1078,61 +2621,34 @@ const testCases = [
|
|
|
1078
2621
|
k: globalEnv.apikey
|
|
1079
2622
|
},
|
|
1080
2623
|
json: {
|
|
1081
|
-
|
|
2624
|
+
mydatetime: '2022-02-02T02:22:22.222Z',
|
|
2625
|
+
a: 23
|
|
1082
2626
|
}
|
|
1083
2627
|
},
|
|
1084
2628
|
expectation: {
|
|
1085
2629
|
id: globalEnv.entity_name,
|
|
1086
2630
|
type: globalEnv.entity_type,
|
|
1087
2631
|
a: {
|
|
1088
|
-
value:
|
|
1089
|
-
type: 'Text'
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
},
|
|
1095
|
-
{
|
|
1096
|
-
describeName: '0150 - Simple group with active attribute + JEXL expression text reusing previous values)',
|
|
1097
|
-
provision: {
|
|
1098
|
-
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1099
|
-
method: 'POST',
|
|
1100
|
-
json: {
|
|
1101
|
-
services: [
|
|
1102
|
-
{
|
|
1103
|
-
resource: '/iot/json',
|
|
1104
|
-
apikey: globalEnv.apikey,
|
|
1105
|
-
entity_type: globalEnv.entity_type,
|
|
1106
|
-
commands: [],
|
|
1107
|
-
lazy: [],
|
|
1108
|
-
attributes: [
|
|
1109
|
-
{
|
|
1110
|
-
object_id: 'a',
|
|
1111
|
-
name: 'attr_a',
|
|
1112
|
-
type: 'Number',
|
|
1113
|
-
expression: 'a*10'
|
|
1114
|
-
},
|
|
1115
|
-
{
|
|
1116
|
-
object_id: 'b',
|
|
1117
|
-
name: 'attr_b',
|
|
1118
|
-
type: 'Number',
|
|
1119
|
-
expression: 'attr_a*10'
|
|
2632
|
+
value: 23,
|
|
2633
|
+
type: 'Text',
|
|
2634
|
+
metadata: {
|
|
2635
|
+
TimeInstant: {
|
|
2636
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
2637
|
+
type: 'DateTime'
|
|
1120
2638
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
2639
|
+
}
|
|
2640
|
+
},
|
|
2641
|
+
TimeInstant: {
|
|
2642
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
2643
|
+
type: 'DateTime'
|
|
1123
2644
|
}
|
|
1124
|
-
|
|
2645
|
+
}
|
|
1125
2646
|
},
|
|
1126
|
-
headers: {
|
|
1127
|
-
'fiware-service': globalEnv.service,
|
|
1128
|
-
'fiware-servicepath': globalEnv.servicePath
|
|
1129
|
-
}
|
|
1130
|
-
},
|
|
1131
|
-
should: [
|
|
1132
2647
|
{
|
|
1133
2648
|
shouldName:
|
|
1134
|
-
'A - WHEN sending a
|
|
2649
|
+
'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',
|
|
1135
2650
|
type: 'single',
|
|
2651
|
+
isRegex: true,
|
|
1136
2652
|
measure: {
|
|
1137
2653
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1138
2654
|
method: 'POST',
|
|
@@ -1141,64 +2657,31 @@ const testCases = [
|
|
|
1141
2657
|
k: globalEnv.apikey
|
|
1142
2658
|
},
|
|
1143
2659
|
json: {
|
|
1144
|
-
a:
|
|
2660
|
+
a: 23
|
|
1145
2661
|
}
|
|
1146
2662
|
},
|
|
1147
2663
|
expectation: {
|
|
1148
2664
|
id: globalEnv.entity_name,
|
|
1149
2665
|
type: globalEnv.entity_type,
|
|
1150
|
-
|
|
1151
|
-
value:
|
|
1152
|
-
type: '
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
]
|
|
1161
|
-
},
|
|
1162
|
-
{
|
|
1163
|
-
describeName: '0160 - Simple group with active attribute + JEXL expression referencing static attributes',
|
|
1164
|
-
provision: {
|
|
1165
|
-
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1166
|
-
method: 'POST',
|
|
1167
|
-
json: {
|
|
1168
|
-
services: [
|
|
1169
|
-
{
|
|
1170
|
-
resource: '/iot/json',
|
|
1171
|
-
apikey: globalEnv.apikey,
|
|
1172
|
-
entity_type: globalEnv.entity_type,
|
|
1173
|
-
commands: [],
|
|
1174
|
-
lazy: [],
|
|
1175
|
-
attributes: [
|
|
1176
|
-
{
|
|
1177
|
-
object_id: 'a',
|
|
1178
|
-
name: 'attr_a',
|
|
1179
|
-
type: 'Number',
|
|
1180
|
-
expression: 'a*coef'
|
|
1181
|
-
}
|
|
1182
|
-
],
|
|
1183
|
-
static_attributes: [
|
|
1184
|
-
{
|
|
1185
|
-
name: 'coef',
|
|
1186
|
-
type: 'Number',
|
|
1187
|
-
value: 1.5
|
|
2666
|
+
a: {
|
|
2667
|
+
value: 23,
|
|
2668
|
+
type: 'Text',
|
|
2669
|
+
metadata: {
|
|
2670
|
+
TimeInstant: {
|
|
2671
|
+
value: _.isDateString,
|
|
2672
|
+
type: 'DateTime'
|
|
1188
2673
|
}
|
|
1189
|
-
|
|
2674
|
+
}
|
|
2675
|
+
},
|
|
2676
|
+
TimeInstant: {
|
|
2677
|
+
value: _.isDateString,
|
|
2678
|
+
type: 'DateTime'
|
|
1190
2679
|
}
|
|
1191
|
-
|
|
2680
|
+
}
|
|
1192
2681
|
},
|
|
1193
|
-
headers: {
|
|
1194
|
-
'fiware-service': globalEnv.service,
|
|
1195
|
-
'fiware-servicepath': globalEnv.servicePath
|
|
1196
|
-
}
|
|
1197
|
-
},
|
|
1198
|
-
should: [
|
|
1199
2682
|
{
|
|
1200
2683
|
shouldName:
|
|
1201
|
-
'A - WHEN sending a
|
|
2684
|
+
'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',
|
|
1202
2685
|
type: 'single',
|
|
1203
2686
|
measure: {
|
|
1204
2687
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -1208,27 +2691,34 @@ const testCases = [
|
|
|
1208
2691
|
k: globalEnv.apikey
|
|
1209
2692
|
},
|
|
1210
2693
|
json: {
|
|
1211
|
-
|
|
2694
|
+
mydatetime: '2022-02-02T02:22:22.222Z',
|
|
2695
|
+
TimeInstant: '2033-03-03T03:33:33.333Z',
|
|
2696
|
+
a: 23
|
|
1212
2697
|
}
|
|
1213
2698
|
},
|
|
1214
2699
|
expectation: {
|
|
1215
2700
|
id: globalEnv.entity_name,
|
|
1216
2701
|
type: globalEnv.entity_type,
|
|
1217
|
-
|
|
1218
|
-
value:
|
|
1219
|
-
type: '
|
|
2702
|
+
a: {
|
|
2703
|
+
value: 23,
|
|
2704
|
+
type: 'Text',
|
|
2705
|
+
metadata: {
|
|
2706
|
+
TimeInstant: {
|
|
2707
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
2708
|
+
type: 'DateTime'
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
1220
2711
|
},
|
|
1221
|
-
|
|
1222
|
-
value:
|
|
1223
|
-
type: '
|
|
2712
|
+
TimeInstant: {
|
|
2713
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
2714
|
+
type: 'DateTime'
|
|
1224
2715
|
}
|
|
1225
2716
|
}
|
|
1226
2717
|
}
|
|
1227
2718
|
]
|
|
1228
2719
|
},
|
|
1229
2720
|
{
|
|
1230
|
-
describeName: '
|
|
1231
|
-
skip: 'lib', // Explanation in #1523
|
|
2721
|
+
describeName: '0431 - Simple group with active attribute + timestamp mapping defined + explicitAttrs',
|
|
1232
2722
|
provision: {
|
|
1233
2723
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1234
2724
|
method: 'POST',
|
|
@@ -1237,15 +2727,21 @@ const testCases = [
|
|
|
1237
2727
|
{
|
|
1238
2728
|
resource: '/iot/json',
|
|
1239
2729
|
apikey: globalEnv.apikey,
|
|
2730
|
+
timestamp: true,
|
|
2731
|
+
explicitAttrs: true,
|
|
1240
2732
|
entity_type: globalEnv.entity_type,
|
|
1241
2733
|
commands: [],
|
|
1242
2734
|
lazy: [],
|
|
1243
2735
|
attributes: [
|
|
2736
|
+
{
|
|
2737
|
+
object_id: 'mydatetime',
|
|
2738
|
+
name: 'TimeInstant',
|
|
2739
|
+
type: 'DateTime'
|
|
2740
|
+
},
|
|
1244
2741
|
{
|
|
1245
2742
|
object_id: 'a',
|
|
1246
|
-
name: '
|
|
1247
|
-
type: 'Text'
|
|
1248
|
-
expression: 'a+":"+service+subservice+id+type'
|
|
2743
|
+
name: 'a',
|
|
2744
|
+
type: 'Text'
|
|
1249
2745
|
}
|
|
1250
2746
|
]
|
|
1251
2747
|
}
|
|
@@ -1259,7 +2755,7 @@ const testCases = [
|
|
|
1259
2755
|
should: [
|
|
1260
2756
|
{
|
|
1261
2757
|
shouldName:
|
|
1262
|
-
'A - WHEN sending a
|
|
2758
|
+
'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',
|
|
1263
2759
|
type: 'single',
|
|
1264
2760
|
measure: {
|
|
1265
2761
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -1269,91 +2765,34 @@ const testCases = [
|
|
|
1269
2765
|
k: globalEnv.apikey
|
|
1270
2766
|
},
|
|
1271
2767
|
json: {
|
|
1272
|
-
|
|
2768
|
+
mydatetime: '2022-02-02T02:22:22.222Z',
|
|
2769
|
+
a: 23
|
|
1273
2770
|
}
|
|
1274
2771
|
},
|
|
1275
2772
|
expectation: {
|
|
1276
2773
|
id: globalEnv.entity_name,
|
|
1277
2774
|
type: globalEnv.entity_type,
|
|
1278
|
-
|
|
1279
|
-
value:
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
type: 'Text'
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
]
|
|
1290
|
-
},
|
|
1291
|
-
{
|
|
1292
|
-
describeName: '0180 - Simple group with active attributes + JEXL multiples expressions at same time',
|
|
1293
|
-
skip: 'lib', // Explanation in #1523
|
|
1294
|
-
provision: {
|
|
1295
|
-
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1296
|
-
method: 'POST',
|
|
1297
|
-
json: {
|
|
1298
|
-
services: [
|
|
1299
|
-
{
|
|
1300
|
-
resource: '/iot/json',
|
|
1301
|
-
apikey: globalEnv.apikey,
|
|
1302
|
-
entity_type: globalEnv.entity_type,
|
|
1303
|
-
commands: [],
|
|
1304
|
-
lazy: [],
|
|
1305
|
-
attributes: [
|
|
1306
|
-
{
|
|
1307
|
-
object_id: 'a',
|
|
1308
|
-
name: 'attr_a',
|
|
1309
|
-
type: 'Boolean',
|
|
1310
|
-
expression: '!a'
|
|
1311
|
-
},
|
|
1312
|
-
{
|
|
1313
|
-
object_id: 'b',
|
|
1314
|
-
name: 'attr_b',
|
|
1315
|
-
type: 'Integer',
|
|
1316
|
-
expression: 'b+1'
|
|
1317
|
-
},
|
|
1318
|
-
{
|
|
1319
|
-
object_id: 'c',
|
|
1320
|
-
name: 'attr_c',
|
|
1321
|
-
type: 'Text',
|
|
1322
|
-
expression: 'c+":"+service+subservice+id+type'
|
|
1323
|
-
},
|
|
1324
|
-
{
|
|
1325
|
-
object_id: 'd',
|
|
1326
|
-
name: 'attr_d',
|
|
1327
|
-
type: 'Float',
|
|
1328
|
-
expression: 'd/2+attr_b'
|
|
1329
|
-
},
|
|
1330
|
-
{
|
|
1331
|
-
object_id: 'e',
|
|
1332
|
-
name: 'attr_e',
|
|
1333
|
-
type: 'Array',
|
|
1334
|
-
expression: 'e|concatarr([3,4])'
|
|
1335
|
-
},
|
|
1336
|
-
{
|
|
1337
|
-
object_id: 'f',
|
|
1338
|
-
name: 'attr_f',
|
|
1339
|
-
type: 'Object',
|
|
1340
|
-
expression: '{coordinates: [f.a,f.b], type: "Point"}'
|
|
2775
|
+
a: {
|
|
2776
|
+
value: 23,
|
|
2777
|
+
type: 'Text',
|
|
2778
|
+
metadata: {
|
|
2779
|
+
TimeInstant: {
|
|
2780
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
2781
|
+
type: 'DateTime'
|
|
1341
2782
|
}
|
|
1342
|
-
|
|
1343
|
-
|
|
2783
|
+
}
|
|
2784
|
+
},
|
|
2785
|
+
TimeInstant: {
|
|
2786
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
2787
|
+
type: 'DateTime'
|
|
1344
2788
|
}
|
|
1345
|
-
|
|
2789
|
+
}
|
|
1346
2790
|
},
|
|
1347
|
-
headers: {
|
|
1348
|
-
'fiware-service': globalEnv.service,
|
|
1349
|
-
'fiware-servicepath': globalEnv.servicePath
|
|
1350
|
-
}
|
|
1351
|
-
},
|
|
1352
|
-
should: [
|
|
1353
2791
|
{
|
|
1354
2792
|
shouldName:
|
|
1355
|
-
'A - WHEN sending
|
|
2793
|
+
'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',
|
|
1356
2794
|
type: 'single',
|
|
2795
|
+
isRegex: true,
|
|
1357
2796
|
measure: {
|
|
1358
2797
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1359
2798
|
method: 'POST',
|
|
@@ -1362,98 +2801,32 @@ const testCases = [
|
|
|
1362
2801
|
k: globalEnv.apikey
|
|
1363
2802
|
},
|
|
1364
2803
|
json: {
|
|
1365
|
-
a:
|
|
1366
|
-
b: 10,
|
|
1367
|
-
c: 'text',
|
|
1368
|
-
d: 10.5,
|
|
1369
|
-
e: [1, 2],
|
|
1370
|
-
f: { a: 1, b: 2 }
|
|
2804
|
+
a: 23
|
|
1371
2805
|
}
|
|
1372
2806
|
},
|
|
1373
2807
|
expectation: {
|
|
1374
2808
|
id: globalEnv.entity_name,
|
|
1375
2809
|
type: globalEnv.entity_type,
|
|
1376
|
-
|
|
1377
|
-
value:
|
|
1378
|
-
type: 'Boolean'
|
|
1379
|
-
},
|
|
1380
|
-
attr_b: {
|
|
1381
|
-
value: 11,
|
|
1382
|
-
type: 'Integer'
|
|
1383
|
-
},
|
|
1384
|
-
attr_c: {
|
|
2810
|
+
a: {
|
|
2811
|
+
value: 23,
|
|
1385
2812
|
type: 'Text',
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
},
|
|
1393
|
-
attr_d: {
|
|
1394
|
-
type: 'Float',
|
|
1395
|
-
value: 16.25
|
|
1396
|
-
},
|
|
1397
|
-
attr_e: {
|
|
1398
|
-
type: 'Array',
|
|
1399
|
-
value: [1, 2, 3, 4]
|
|
2813
|
+
metadata: {
|
|
2814
|
+
TimeInstant: {
|
|
2815
|
+
value: _.isDateString,
|
|
2816
|
+
type: 'DateTime'
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
1400
2819
|
},
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
2820
|
+
TimeInstant: {
|
|
2821
|
+
value: _.isDateString,
|
|
2822
|
+
type: 'DateTime'
|
|
1404
2823
|
}
|
|
1405
2824
|
}
|
|
1406
|
-
}
|
|
1407
|
-
]
|
|
1408
|
-
},
|
|
1409
|
-
{
|
|
1410
|
-
describeName:
|
|
1411
|
-
'0190 - Simple group with JEXL expression using static attribute - addressing structured values (JSON)',
|
|
1412
|
-
provision: {
|
|
1413
|
-
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1414
|
-
method: 'POST',
|
|
1415
|
-
json: {
|
|
1416
|
-
services: [
|
|
1417
|
-
{
|
|
1418
|
-
resource: '/iot/json',
|
|
1419
|
-
apikey: globalEnv.apikey,
|
|
1420
|
-
entity_type: globalEnv.entity_type,
|
|
1421
|
-
commands: [],
|
|
1422
|
-
lazy: [],
|
|
1423
|
-
attributes: [
|
|
1424
|
-
{
|
|
1425
|
-
object_id: 'a',
|
|
1426
|
-
name: 'attr_a',
|
|
1427
|
-
type: 'Boolean',
|
|
1428
|
-
expression: 'a?threshold[90|tostring].max:true'
|
|
1429
|
-
}
|
|
1430
|
-
],
|
|
1431
|
-
static_attributes: [
|
|
1432
|
-
{
|
|
1433
|
-
name: 'threshold',
|
|
1434
|
-
type: 'Object',
|
|
1435
|
-
value: {
|
|
1436
|
-
'90': { max: 10, min: 1 },
|
|
1437
|
-
'92': { max: 12, min: 2 },
|
|
1438
|
-
'93': { max: 13, min: 3 }
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
],
|
|
1442
|
-
explicitAttrs: "['attr_a']"
|
|
1443
|
-
}
|
|
1444
|
-
]
|
|
1445
2825
|
},
|
|
1446
|
-
headers: {
|
|
1447
|
-
'fiware-service': globalEnv.service,
|
|
1448
|
-
'fiware-servicepath': globalEnv.servicePath
|
|
1449
|
-
}
|
|
1450
|
-
},
|
|
1451
|
-
should: [
|
|
1452
2826
|
{
|
|
1453
2827
|
shouldName:
|
|
1454
|
-
'A - WHEN sending a
|
|
2828
|
+
'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',
|
|
1455
2829
|
type: 'single',
|
|
1456
|
-
isRegex: true,
|
|
1457
2830
|
measure: {
|
|
1458
2831
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1459
2832
|
method: 'POST',
|
|
@@ -1462,23 +2835,34 @@ const testCases = [
|
|
|
1462
2835
|
k: globalEnv.apikey
|
|
1463
2836
|
},
|
|
1464
2837
|
json: {
|
|
1465
|
-
|
|
2838
|
+
mydatetime: '2022-02-02T02:22:22.222Z',
|
|
2839
|
+
TimeInstant: '2033-03-03T03:33:33.333Z',
|
|
2840
|
+
a: 23
|
|
1466
2841
|
}
|
|
1467
2842
|
},
|
|
1468
2843
|
expectation: {
|
|
1469
2844
|
id: globalEnv.entity_name,
|
|
1470
2845
|
type: globalEnv.entity_type,
|
|
1471
|
-
|
|
1472
|
-
value:
|
|
1473
|
-
type: '
|
|
2846
|
+
a: {
|
|
2847
|
+
value: 23,
|
|
2848
|
+
type: 'Text',
|
|
2849
|
+
metadata: {
|
|
2850
|
+
TimeInstant: {
|
|
2851
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
2852
|
+
type: 'DateTime'
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
},
|
|
2856
|
+
TimeInstant: {
|
|
2857
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
2858
|
+
type: 'DateTime'
|
|
1474
2859
|
}
|
|
1475
2860
|
}
|
|
1476
2861
|
}
|
|
1477
2862
|
]
|
|
1478
2863
|
},
|
|
1479
|
-
// 0200 - COMMANDS TESTS
|
|
1480
2864
|
{
|
|
1481
|
-
describeName: '
|
|
2865
|
+
describeName: '0432 - Simple group with active attribute + bad timestamp mapping defined',
|
|
1482
2866
|
provision: {
|
|
1483
2867
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1484
2868
|
method: 'POST',
|
|
@@ -1487,18 +2871,18 @@ const testCases = [
|
|
|
1487
2871
|
{
|
|
1488
2872
|
resource: '/iot/json',
|
|
1489
2873
|
apikey: globalEnv.apikey,
|
|
2874
|
+
timestamp: true,
|
|
1490
2875
|
entity_type: globalEnv.entity_type,
|
|
1491
|
-
commands: [
|
|
2876
|
+
commands: [],
|
|
2877
|
+
lazy: [],
|
|
2878
|
+
attributes: [
|
|
1492
2879
|
{
|
|
1493
|
-
|
|
1494
|
-
|
|
2880
|
+
object_id: 'mydatetime',
|
|
2881
|
+
name: 'TimeInstant',
|
|
2882
|
+
type: 'DateTime',
|
|
2883
|
+
expression: '"2033-03-03T" + "03:33:33.333Z"'
|
|
1495
2884
|
}
|
|
1496
|
-
]
|
|
1497
|
-
endpoint: 'http://myendpoint.com',
|
|
1498
|
-
transport: 'http',
|
|
1499
|
-
lazy: [],
|
|
1500
|
-
attributes: [],
|
|
1501
|
-
static_attributes: []
|
|
2885
|
+
]
|
|
1502
2886
|
}
|
|
1503
2887
|
]
|
|
1504
2888
|
},
|
|
@@ -1510,9 +2894,8 @@ const testCases = [
|
|
|
1510
2894
|
should: [
|
|
1511
2895
|
{
|
|
1512
2896
|
shouldName:
|
|
1513
|
-
'A - WHEN sending
|
|
2897
|
+
'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',
|
|
1514
2898
|
type: 'single',
|
|
1515
|
-
skip: '!lib', // there is not CB registration mock
|
|
1516
2899
|
measure: {
|
|
1517
2900
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1518
2901
|
method: 'POST',
|
|
@@ -1521,24 +2904,33 @@ const testCases = [
|
|
|
1521
2904
|
k: globalEnv.apikey
|
|
1522
2905
|
},
|
|
1523
2906
|
json: {
|
|
1524
|
-
|
|
2907
|
+
mydatetime: '2022-02-02T02:22:22.222Z',
|
|
2908
|
+
a: 23
|
|
1525
2909
|
}
|
|
1526
2910
|
},
|
|
1527
2911
|
expectation: {
|
|
1528
2912
|
id: globalEnv.entity_name,
|
|
1529
2913
|
type: globalEnv.entity_type,
|
|
1530
|
-
|
|
1531
|
-
value:
|
|
1532
|
-
type: 'Text'
|
|
2914
|
+
a: {
|
|
2915
|
+
value: 23,
|
|
2916
|
+
type: 'Text',
|
|
2917
|
+
metadata: {
|
|
2918
|
+
TimeInstant: {
|
|
2919
|
+
value: '2033-03-03T03:33:33.333Z',
|
|
2920
|
+
type: 'DateTime'
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
},
|
|
2924
|
+
TimeInstant: {
|
|
2925
|
+
value: '2033-03-03T03:33:33.333Z',
|
|
2926
|
+
type: 'DateTime'
|
|
1533
2927
|
}
|
|
1534
2928
|
}
|
|
1535
2929
|
}
|
|
1536
2930
|
]
|
|
1537
2931
|
},
|
|
1538
|
-
// 0300 - STATIC ATTRIBUTES TESTS
|
|
1539
2932
|
{
|
|
1540
|
-
describeName:
|
|
1541
|
-
'0300 - Simple group with active attributes + Static attributes + JEXL expression using static attribute value',
|
|
2933
|
+
describeName: '0433 - Simple group with active attribute + several timestamp mappings defined in multientity',
|
|
1542
2934
|
provision: {
|
|
1543
2935
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1544
2936
|
method: 'POST',
|
|
@@ -1547,22 +2939,45 @@ const testCases = [
|
|
|
1547
2939
|
{
|
|
1548
2940
|
resource: '/iot/json',
|
|
1549
2941
|
apikey: globalEnv.apikey,
|
|
2942
|
+
timestamp: true,
|
|
1550
2943
|
entity_type: globalEnv.entity_type,
|
|
1551
2944
|
commands: [],
|
|
1552
2945
|
lazy: [],
|
|
1553
2946
|
attributes: [
|
|
1554
2947
|
{
|
|
1555
2948
|
object_id: 'a',
|
|
1556
|
-
name: '
|
|
1557
|
-
type: '
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1560
|
-
],
|
|
1561
|
-
static_attributes: [
|
|
2949
|
+
name: 'a',
|
|
2950
|
+
type: 'Text'
|
|
2951
|
+
},
|
|
1562
2952
|
{
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
2953
|
+
object_id: 'mydatetime1',
|
|
2954
|
+
name: 'TimeInstant',
|
|
2955
|
+
type: 'DateTime',
|
|
2956
|
+
entity_name: 'TestType:TestDevice1',
|
|
2957
|
+
entity_type: 'TestType'
|
|
2958
|
+
},
|
|
2959
|
+
{
|
|
2960
|
+
object_id: 'mydatetime2',
|
|
2961
|
+
name: 'TimeInstant',
|
|
2962
|
+
type: 'DateTime',
|
|
2963
|
+
entity_name: 'TestType:TestDevice2',
|
|
2964
|
+
entity_type: 'TestType'
|
|
2965
|
+
},
|
|
2966
|
+
{
|
|
2967
|
+
object_id: 'a1',
|
|
2968
|
+
name: 'a1',
|
|
2969
|
+
type: 'Text',
|
|
2970
|
+
expression: 'a',
|
|
2971
|
+
entity_name: 'TestType:TestDevice1',
|
|
2972
|
+
entity_type: 'TestType'
|
|
2973
|
+
},
|
|
2974
|
+
{
|
|
2975
|
+
object_id: 'a2',
|
|
2976
|
+
name: 'a2',
|
|
2977
|
+
type: 'Text',
|
|
2978
|
+
expression: 'a',
|
|
2979
|
+
entity_name: 'TestType:TestDevice2',
|
|
2980
|
+
entity_type: 'TestType'
|
|
1566
2981
|
}
|
|
1567
2982
|
]
|
|
1568
2983
|
}
|
|
@@ -1576,8 +2991,9 @@ const testCases = [
|
|
|
1576
2991
|
should: [
|
|
1577
2992
|
{
|
|
1578
2993
|
shouldName:
|
|
1579
|
-
'A - WHEN sending
|
|
1580
|
-
type: '
|
|
2994
|
+
'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',
|
|
2995
|
+
type: 'multientity',
|
|
2996
|
+
isRegex: true,
|
|
1581
2997
|
measure: {
|
|
1582
2998
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1583
2999
|
method: 'POST',
|
|
@@ -1586,26 +3002,76 @@ const testCases = [
|
|
|
1586
3002
|
k: globalEnv.apikey
|
|
1587
3003
|
},
|
|
1588
3004
|
json: {
|
|
1589
|
-
|
|
3005
|
+
a: 23,
|
|
3006
|
+
mydatetime1: '2011-01-01T01:11:11.111Z',
|
|
3007
|
+
mydatetime2: '2022-02-02T02:22:22.222Z'
|
|
1590
3008
|
}
|
|
1591
3009
|
},
|
|
1592
3010
|
expectation: {
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
3011
|
+
actionType: 'append',
|
|
3012
|
+
entities: [
|
|
3013
|
+
{
|
|
3014
|
+
id: 'TestType:TestDevice1',
|
|
3015
|
+
type: globalEnv.entity_type,
|
|
3016
|
+
a1: {
|
|
3017
|
+
value: 23,
|
|
3018
|
+
type: 'Text',
|
|
3019
|
+
metadata: {
|
|
3020
|
+
TimeInstant: {
|
|
3021
|
+
value: '2011-01-01T01:11:11.111Z',
|
|
3022
|
+
type: 'DateTime'
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
},
|
|
3026
|
+
TimeInstant: {
|
|
3027
|
+
value: '2011-01-01T01:11:11.111Z',
|
|
3028
|
+
type: 'DateTime'
|
|
3029
|
+
}
|
|
3030
|
+
},
|
|
3031
|
+
{
|
|
3032
|
+
id: 'TestType:TestDevice2',
|
|
3033
|
+
type: globalEnv.entity_type,
|
|
3034
|
+
a2: {
|
|
3035
|
+
value: 23,
|
|
3036
|
+
type: 'Text',
|
|
3037
|
+
metadata: {
|
|
3038
|
+
TimeInstant: {
|
|
3039
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
3040
|
+
type: 'DateTime'
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
},
|
|
3044
|
+
TimeInstant: {
|
|
3045
|
+
value: '2022-02-02T02:22:22.222Z',
|
|
3046
|
+
type: 'DateTime'
|
|
3047
|
+
}
|
|
3048
|
+
},
|
|
3049
|
+
{
|
|
3050
|
+
id: globalEnv.entity_name,
|
|
3051
|
+
type: globalEnv.entity_type,
|
|
3052
|
+
a: {
|
|
3053
|
+
value: 23,
|
|
3054
|
+
type: 'Text',
|
|
3055
|
+
metadata: {
|
|
3056
|
+
TimeInstant: {
|
|
3057
|
+
value: _.isDateString,
|
|
3058
|
+
type: 'DateTime'
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
},
|
|
3062
|
+
TimeInstant: {
|
|
3063
|
+
value: _.isDateString,
|
|
3064
|
+
type: 'DateTime'
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
]
|
|
1603
3068
|
}
|
|
1604
3069
|
},
|
|
1605
3070
|
{
|
|
1606
3071
|
shouldName:
|
|
1607
|
-
'
|
|
1608
|
-
type: '
|
|
3072
|
+
'A - WHEN sending a measure through http IT should map the measure to timestamp attributes for just mapped entity and sent to Context Broker',
|
|
3073
|
+
type: 'multientity',
|
|
3074
|
+
isRegex: true,
|
|
1609
3075
|
measure: {
|
|
1610
3076
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1611
3077
|
method: 'POST',
|
|
@@ -1614,26 +3080,29 @@ const testCases = [
|
|
|
1614
3080
|
k: globalEnv.apikey
|
|
1615
3081
|
},
|
|
1616
3082
|
json: {
|
|
1617
|
-
|
|
3083
|
+
mydatetime1: '2011-01-01T01:11:11.111Z'
|
|
1618
3084
|
}
|
|
1619
3085
|
},
|
|
1620
3086
|
expectation: {
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
3087
|
+
actionType: 'append',
|
|
3088
|
+
entities: [
|
|
3089
|
+
{
|
|
3090
|
+
id: 'TestType:TestDevice1',
|
|
3091
|
+
type: globalEnv.entity_type,
|
|
3092
|
+
TimeInstant: {
|
|
3093
|
+
value: '2011-01-01T01:11:11.111Z',
|
|
3094
|
+
type: 'DateTime'
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
]
|
|
1631
3098
|
}
|
|
1632
3099
|
}
|
|
1633
3100
|
]
|
|
1634
3101
|
},
|
|
3102
|
+
|
|
3103
|
+
// 0500 - EXPLICIT ATTRIBUTES TESTS
|
|
1635
3104
|
{
|
|
1636
|
-
describeName: '
|
|
3105
|
+
describeName: '0500 - Group with explicit attrs:false (boolean) + active atributes',
|
|
1637
3106
|
provision: {
|
|
1638
3107
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1639
3108
|
method: 'POST',
|
|
@@ -1643,22 +3112,17 @@ const testCases = [
|
|
|
1643
3112
|
resource: '/iot/json',
|
|
1644
3113
|
apikey: globalEnv.apikey,
|
|
1645
3114
|
entity_type: globalEnv.entity_type,
|
|
3115
|
+
explicitAttrs: false,
|
|
1646
3116
|
commands: [],
|
|
1647
3117
|
lazy: [],
|
|
1648
|
-
attributes: [
|
|
1649
|
-
static_attributes: [
|
|
3118
|
+
attributes: [
|
|
1650
3119
|
{
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
v1: 1,
|
|
1655
|
-
v2: {
|
|
1656
|
-
v3: 3,
|
|
1657
|
-
v4: 4
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
3120
|
+
object_id: 'a',
|
|
3121
|
+
name: 'attr_a',
|
|
3122
|
+
type: 'Number'
|
|
1660
3123
|
}
|
|
1661
|
-
]
|
|
3124
|
+
],
|
|
3125
|
+
static_attributes: []
|
|
1662
3126
|
}
|
|
1663
3127
|
]
|
|
1664
3128
|
},
|
|
@@ -1670,7 +3134,7 @@ const testCases = [
|
|
|
1670
3134
|
should: [
|
|
1671
3135
|
{
|
|
1672
3136
|
shouldName:
|
|
1673
|
-
'A - WHEN sending measures through http IT should store
|
|
3137
|
+
'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
|
|
1674
3138
|
type: 'single',
|
|
1675
3139
|
measure: {
|
|
1676
3140
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -1680,33 +3144,27 @@ const testCases = [
|
|
|
1680
3144
|
k: globalEnv.apikey
|
|
1681
3145
|
},
|
|
1682
3146
|
json: {
|
|
1683
|
-
a:
|
|
3147
|
+
a: 3,
|
|
3148
|
+
b: 10
|
|
1684
3149
|
}
|
|
1685
3150
|
},
|
|
1686
3151
|
expectation: {
|
|
1687
3152
|
id: globalEnv.entity_name,
|
|
1688
3153
|
type: globalEnv.entity_type,
|
|
1689
|
-
|
|
3154
|
+
b: {
|
|
1690
3155
|
value: 10,
|
|
1691
3156
|
type: 'Text'
|
|
1692
3157
|
},
|
|
1693
|
-
|
|
1694
|
-
value:
|
|
1695
|
-
v1: 1,
|
|
1696
|
-
v2: {
|
|
1697
|
-
v3: 3,
|
|
1698
|
-
v4: 4
|
|
1699
|
-
}
|
|
1700
|
-
},
|
|
3158
|
+
attr_a: {
|
|
3159
|
+
value: 3,
|
|
1701
3160
|
type: 'Number'
|
|
1702
3161
|
}
|
|
1703
3162
|
}
|
|
1704
3163
|
}
|
|
1705
3164
|
]
|
|
1706
3165
|
},
|
|
1707
|
-
// 0400 - TIMESTAMP TESTS
|
|
1708
3166
|
{
|
|
1709
|
-
describeName: '
|
|
3167
|
+
describeName: '0510 - Group without explicit (not defined) + active atributes',
|
|
1710
3168
|
provision: {
|
|
1711
3169
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1712
3170
|
method: 'POST',
|
|
@@ -1716,7 +3174,6 @@ const testCases = [
|
|
|
1716
3174
|
resource: '/iot/json',
|
|
1717
3175
|
apikey: globalEnv.apikey,
|
|
1718
3176
|
entity_type: globalEnv.entity_type,
|
|
1719
|
-
timestamp: false,
|
|
1720
3177
|
commands: [],
|
|
1721
3178
|
lazy: [],
|
|
1722
3179
|
attributes: [
|
|
@@ -1725,7 +3182,8 @@ const testCases = [
|
|
|
1725
3182
|
name: 'attr_a',
|
|
1726
3183
|
type: 'Number'
|
|
1727
3184
|
}
|
|
1728
|
-
]
|
|
3185
|
+
],
|
|
3186
|
+
static_attributes: []
|
|
1729
3187
|
}
|
|
1730
3188
|
]
|
|
1731
3189
|
},
|
|
@@ -1737,7 +3195,7 @@ const testCases = [
|
|
|
1737
3195
|
should: [
|
|
1738
3196
|
{
|
|
1739
3197
|
shouldName:
|
|
1740
|
-
'A - WHEN sending
|
|
3198
|
+
'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
|
|
1741
3199
|
type: 'single',
|
|
1742
3200
|
measure: {
|
|
1743
3201
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -1747,51 +3205,27 @@ const testCases = [
|
|
|
1747
3205
|
k: globalEnv.apikey
|
|
1748
3206
|
},
|
|
1749
3207
|
json: {
|
|
1750
|
-
a:
|
|
3208
|
+
a: 3,
|
|
3209
|
+
b: 10
|
|
1751
3210
|
}
|
|
1752
3211
|
},
|
|
1753
3212
|
expectation: {
|
|
1754
3213
|
id: globalEnv.entity_name,
|
|
1755
3214
|
type: globalEnv.entity_type,
|
|
1756
|
-
|
|
1757
|
-
value:
|
|
1758
|
-
type: '
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
},
|
|
1762
|
-
{
|
|
1763
|
-
shouldName:
|
|
1764
|
-
'B - WHEN sending a measure named TimeInstant through http IT should not add the timestamp to the other attributes sent to Context Broker',
|
|
1765
|
-
type: 'single',
|
|
1766
|
-
measure: {
|
|
1767
|
-
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1768
|
-
method: 'POST',
|
|
1769
|
-
qs: {
|
|
1770
|
-
i: globalEnv.deviceId,
|
|
1771
|
-
k: globalEnv.apikey
|
|
3215
|
+
b: {
|
|
3216
|
+
value: 10,
|
|
3217
|
+
type: 'Text'
|
|
1772
3218
|
},
|
|
1773
|
-
json: {
|
|
1774
|
-
TimeInstant: '2015-12-14T08:06:01.468Z',
|
|
1775
|
-
a: 23
|
|
1776
|
-
}
|
|
1777
|
-
},
|
|
1778
|
-
expectation: {
|
|
1779
|
-
id: globalEnv.entity_name,
|
|
1780
|
-
type: globalEnv.entity_type,
|
|
1781
3219
|
attr_a: {
|
|
1782
|
-
value:
|
|
3220
|
+
value: 3,
|
|
1783
3221
|
type: 'Number'
|
|
1784
|
-
},
|
|
1785
|
-
TimeInstant: {
|
|
1786
|
-
value: '2015-12-14T08:06:01.468Z',
|
|
1787
|
-
type: 'DateTime'
|
|
1788
3222
|
}
|
|
1789
3223
|
}
|
|
1790
3224
|
}
|
|
1791
3225
|
]
|
|
1792
3226
|
},
|
|
1793
3227
|
{
|
|
1794
|
-
describeName: '
|
|
3228
|
+
describeName: '0520 - Group with explicit attrs:true (boolean) + active atributes',
|
|
1795
3229
|
provision: {
|
|
1796
3230
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1797
3231
|
method: 'POST',
|
|
@@ -1801,7 +3235,7 @@ const testCases = [
|
|
|
1801
3235
|
resource: '/iot/json',
|
|
1802
3236
|
apikey: globalEnv.apikey,
|
|
1803
3237
|
entity_type: globalEnv.entity_type,
|
|
1804
|
-
|
|
3238
|
+
explicitAttrs: true,
|
|
1805
3239
|
commands: [],
|
|
1806
3240
|
lazy: [],
|
|
1807
3241
|
attributes: [
|
|
@@ -1810,7 +3244,8 @@ const testCases = [
|
|
|
1810
3244
|
name: 'attr_a',
|
|
1811
3245
|
type: 'Number'
|
|
1812
3246
|
}
|
|
1813
|
-
]
|
|
3247
|
+
],
|
|
3248
|
+
static_attributes: []
|
|
1814
3249
|
}
|
|
1815
3250
|
]
|
|
1816
3251
|
},
|
|
@@ -1822,42 +3257,7 @@ const testCases = [
|
|
|
1822
3257
|
should: [
|
|
1823
3258
|
{
|
|
1824
3259
|
shouldName:
|
|
1825
|
-
'A - WHEN sending
|
|
1826
|
-
type: 'single',
|
|
1827
|
-
isRegex: true,
|
|
1828
|
-
measure: {
|
|
1829
|
-
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1830
|
-
method: 'POST',
|
|
1831
|
-
qs: {
|
|
1832
|
-
i: globalEnv.deviceId,
|
|
1833
|
-
k: globalEnv.apikey
|
|
1834
|
-
},
|
|
1835
|
-
json: {
|
|
1836
|
-
a: 21
|
|
1837
|
-
}
|
|
1838
|
-
},
|
|
1839
|
-
expectation: {
|
|
1840
|
-
id: globalEnv.entity_name,
|
|
1841
|
-
type: globalEnv.entity_type,
|
|
1842
|
-
attr_a: {
|
|
1843
|
-
value: 21,
|
|
1844
|
-
type: 'Number',
|
|
1845
|
-
metadata: {
|
|
1846
|
-
TimeInstant: {
|
|
1847
|
-
type: 'DateTime',
|
|
1848
|
-
value: _.isDateString
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
},
|
|
1852
|
-
TimeInstant: {
|
|
1853
|
-
type: 'DateTime',
|
|
1854
|
-
value: _.isDateString
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
},
|
|
1858
|
-
{
|
|
1859
|
-
shouldName:
|
|
1860
|
-
'B - WHEN sending a measure named TimeInstant through http IT should not add the timestamp to the other attributes sent to Context Broker',
|
|
3260
|
+
'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store all attributes into Context Broker',
|
|
1861
3261
|
type: 'single',
|
|
1862
3262
|
measure: {
|
|
1863
3263
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -1866,34 +3266,24 @@ const testCases = [
|
|
|
1866
3266
|
i: globalEnv.deviceId,
|
|
1867
3267
|
k: globalEnv.apikey
|
|
1868
3268
|
},
|
|
1869
|
-
json: {
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
}
|
|
1873
|
-
},
|
|
1874
|
-
expectation: {
|
|
1875
|
-
id: globalEnv.entity_name,
|
|
1876
|
-
type: globalEnv.entity_type,
|
|
1877
|
-
attr_a: {
|
|
1878
|
-
value:
|
|
1879
|
-
type: 'Number'
|
|
1880
|
-
metadata: {
|
|
1881
|
-
TimeInstant: {
|
|
1882
|
-
type: 'DateTime',
|
|
1883
|
-
value: '2015-12-14T08:06:01.468Z'
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
},
|
|
1887
|
-
TimeInstant: {
|
|
1888
|
-
value: '2015-12-14T08:06:01.468Z',
|
|
1889
|
-
type: 'DateTime'
|
|
3269
|
+
json: {
|
|
3270
|
+
a: 3,
|
|
3271
|
+
b: 10
|
|
3272
|
+
}
|
|
3273
|
+
},
|
|
3274
|
+
expectation: {
|
|
3275
|
+
id: globalEnv.entity_name,
|
|
3276
|
+
type: globalEnv.entity_type,
|
|
3277
|
+
attr_a: {
|
|
3278
|
+
value: 3,
|
|
3279
|
+
type: 'Number'
|
|
1890
3280
|
}
|
|
1891
3281
|
}
|
|
1892
3282
|
}
|
|
1893
3283
|
]
|
|
1894
3284
|
},
|
|
1895
3285
|
{
|
|
1896
|
-
describeName: '
|
|
3286
|
+
describeName: '0530 - Group with explicit attrs:[array] + active attributes + static attributes',
|
|
1897
3287
|
provision: {
|
|
1898
3288
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1899
3289
|
method: 'POST',
|
|
@@ -1903,13 +3293,31 @@ const testCases = [
|
|
|
1903
3293
|
resource: '/iot/json',
|
|
1904
3294
|
apikey: globalEnv.apikey,
|
|
1905
3295
|
entity_type: globalEnv.entity_type,
|
|
3296
|
+
explicitAttrs: "['attr_a','static_a']",
|
|
1906
3297
|
commands: [],
|
|
1907
3298
|
lazy: [],
|
|
1908
3299
|
attributes: [
|
|
1909
3300
|
{
|
|
1910
|
-
object_id: 'a',
|
|
1911
3301
|
name: 'attr_a',
|
|
3302
|
+
object_id: 'a',
|
|
1912
3303
|
type: 'Number'
|
|
3304
|
+
},
|
|
3305
|
+
{
|
|
3306
|
+
name: 'attr_b',
|
|
3307
|
+
object_id: 'b',
|
|
3308
|
+
type: 'Number'
|
|
3309
|
+
}
|
|
3310
|
+
],
|
|
3311
|
+
static_attributes: [
|
|
3312
|
+
{
|
|
3313
|
+
name: 'static_a',
|
|
3314
|
+
type: 'Number',
|
|
3315
|
+
value: 3
|
|
3316
|
+
},
|
|
3317
|
+
{
|
|
3318
|
+
name: 'static_b',
|
|
3319
|
+
type: 'Number',
|
|
3320
|
+
value: 4
|
|
1913
3321
|
}
|
|
1914
3322
|
]
|
|
1915
3323
|
}
|
|
@@ -1923,7 +3331,7 @@ const testCases = [
|
|
|
1923
3331
|
should: [
|
|
1924
3332
|
{
|
|
1925
3333
|
shouldName:
|
|
1926
|
-
'A - WHEN sending
|
|
3334
|
+
'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store only defined in explicitAttrs array into Context Broker',
|
|
1927
3335
|
type: 'single',
|
|
1928
3336
|
measure: {
|
|
1929
3337
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -1933,52 +3341,28 @@ const testCases = [
|
|
|
1933
3341
|
k: globalEnv.apikey
|
|
1934
3342
|
},
|
|
1935
3343
|
json: {
|
|
1936
|
-
a:
|
|
3344
|
+
a: 3,
|
|
3345
|
+
b: 10,
|
|
3346
|
+
c: 11
|
|
1937
3347
|
}
|
|
1938
3348
|
},
|
|
1939
3349
|
expectation: {
|
|
1940
3350
|
id: globalEnv.entity_name,
|
|
1941
3351
|
type: globalEnv.entity_type,
|
|
1942
3352
|
attr_a: {
|
|
1943
|
-
value:
|
|
3353
|
+
value: 3,
|
|
1944
3354
|
type: 'Number'
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
},
|
|
1948
|
-
{
|
|
1949
|
-
shouldName:
|
|
1950
|
-
'B - WHEN sending a measure named TimeInstant through http IT should not add the timestamp to the other attributes sent to Context Broker',
|
|
1951
|
-
type: 'single',
|
|
1952
|
-
measure: {
|
|
1953
|
-
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
1954
|
-
method: 'POST',
|
|
1955
|
-
qs: {
|
|
1956
|
-
i: globalEnv.deviceId,
|
|
1957
|
-
k: globalEnv.apikey
|
|
1958
3355
|
},
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
a: 23
|
|
1962
|
-
}
|
|
1963
|
-
},
|
|
1964
|
-
expectation: {
|
|
1965
|
-
id: globalEnv.entity_name,
|
|
1966
|
-
type: globalEnv.entity_type,
|
|
1967
|
-
attr_a: {
|
|
1968
|
-
value: 23,
|
|
3356
|
+
static_a: {
|
|
3357
|
+
value: 3,
|
|
1969
3358
|
type: 'Number'
|
|
1970
|
-
},
|
|
1971
|
-
TimeInstant: {
|
|
1972
|
-
value: '2015-12-14T08:06:01.468Z',
|
|
1973
|
-
type: 'DateTime'
|
|
1974
3359
|
}
|
|
1975
3360
|
}
|
|
1976
3361
|
}
|
|
1977
3362
|
]
|
|
1978
3363
|
},
|
|
1979
|
-
// 0500 - EXPLICIT ATTRIBUTES TESTS
|
|
1980
3364
|
{
|
|
1981
|
-
describeName: '
|
|
3365
|
+
describeName: '0531 - Group with explicit attrs:[ ] (empty array) + active attributes + static attributes',
|
|
1982
3366
|
provision: {
|
|
1983
3367
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
1984
3368
|
method: 'POST',
|
|
@@ -1988,17 +3372,33 @@ const testCases = [
|
|
|
1988
3372
|
resource: '/iot/json',
|
|
1989
3373
|
apikey: globalEnv.apikey,
|
|
1990
3374
|
entity_type: globalEnv.entity_type,
|
|
1991
|
-
explicitAttrs:
|
|
3375
|
+
explicitAttrs: '[ ]',
|
|
1992
3376
|
commands: [],
|
|
1993
3377
|
lazy: [],
|
|
1994
3378
|
attributes: [
|
|
1995
3379
|
{
|
|
1996
|
-
object_id: 'a',
|
|
1997
3380
|
name: 'attr_a',
|
|
3381
|
+
object_id: 'a',
|
|
3382
|
+
type: 'Number'
|
|
3383
|
+
},
|
|
3384
|
+
{
|
|
3385
|
+
name: 'attr_b',
|
|
3386
|
+
object_id: 'b',
|
|
1998
3387
|
type: 'Number'
|
|
1999
3388
|
}
|
|
2000
3389
|
],
|
|
2001
|
-
static_attributes: [
|
|
3390
|
+
static_attributes: [
|
|
3391
|
+
{
|
|
3392
|
+
name: 'static_a',
|
|
3393
|
+
type: 'Number',
|
|
3394
|
+
value: 3
|
|
3395
|
+
},
|
|
3396
|
+
{
|
|
3397
|
+
name: 'static_b',
|
|
3398
|
+
type: 'Number',
|
|
3399
|
+
value: 4
|
|
3400
|
+
}
|
|
3401
|
+
]
|
|
2002
3402
|
}
|
|
2003
3403
|
]
|
|
2004
3404
|
},
|
|
@@ -2010,7 +3410,7 @@ const testCases = [
|
|
|
2010
3410
|
should: [
|
|
2011
3411
|
{
|
|
2012
3412
|
shouldName:
|
|
2013
|
-
'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store
|
|
3413
|
+
'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)',
|
|
2014
3414
|
type: 'single',
|
|
2015
3415
|
measure: {
|
|
2016
3416
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -2021,26 +3421,17 @@ const testCases = [
|
|
|
2021
3421
|
},
|
|
2022
3422
|
json: {
|
|
2023
3423
|
a: 3,
|
|
2024
|
-
b: 10
|
|
3424
|
+
b: 10,
|
|
3425
|
+
c: 11
|
|
2025
3426
|
}
|
|
2026
3427
|
},
|
|
2027
|
-
expectation:
|
|
2028
|
-
id: globalEnv.entity_name,
|
|
2029
|
-
type: globalEnv.entity_type,
|
|
2030
|
-
b: {
|
|
2031
|
-
value: 10,
|
|
2032
|
-
type: 'Text'
|
|
2033
|
-
},
|
|
2034
|
-
attr_a: {
|
|
2035
|
-
value: 3,
|
|
2036
|
-
type: 'Number'
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
3428
|
+
expectation: [] // No payload expected
|
|
2039
3429
|
}
|
|
2040
3430
|
]
|
|
2041
3431
|
},
|
|
2042
3432
|
{
|
|
2043
|
-
describeName:
|
|
3433
|
+
describeName:
|
|
3434
|
+
'0532 - Group with explicit attrs:[ ] (empty array) + active attributes + static attributes + timestamp:true',
|
|
2044
3435
|
provision: {
|
|
2045
3436
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
2046
3437
|
method: 'POST',
|
|
@@ -2050,16 +3441,34 @@ const testCases = [
|
|
|
2050
3441
|
resource: '/iot/json',
|
|
2051
3442
|
apikey: globalEnv.apikey,
|
|
2052
3443
|
entity_type: globalEnv.entity_type,
|
|
3444
|
+
explicitAttrs: '[ ]',
|
|
3445
|
+
timestamp: true,
|
|
2053
3446
|
commands: [],
|
|
2054
3447
|
lazy: [],
|
|
2055
3448
|
attributes: [
|
|
2056
3449
|
{
|
|
2057
|
-
object_id: 'a',
|
|
2058
3450
|
name: 'attr_a',
|
|
3451
|
+
object_id: 'a',
|
|
3452
|
+
type: 'Number'
|
|
3453
|
+
},
|
|
3454
|
+
{
|
|
3455
|
+
name: 'attr_b',
|
|
3456
|
+
object_id: 'b',
|
|
2059
3457
|
type: 'Number'
|
|
2060
3458
|
}
|
|
2061
3459
|
],
|
|
2062
|
-
static_attributes: [
|
|
3460
|
+
static_attributes: [
|
|
3461
|
+
{
|
|
3462
|
+
name: 'static_a',
|
|
3463
|
+
type: 'Number',
|
|
3464
|
+
value: 3
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
name: 'static_b',
|
|
3468
|
+
type: 'Number',
|
|
3469
|
+
value: 4
|
|
3470
|
+
}
|
|
3471
|
+
]
|
|
2063
3472
|
}
|
|
2064
3473
|
]
|
|
2065
3474
|
},
|
|
@@ -2071,7 +3480,7 @@ const testCases = [
|
|
|
2071
3480
|
should: [
|
|
2072
3481
|
{
|
|
2073
3482
|
shouldName:
|
|
2074
|
-
'A - WHEN sending both provisioned and not object_ids (measures) through http IT should store
|
|
3483
|
+
'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)',
|
|
2075
3484
|
type: 'single',
|
|
2076
3485
|
measure: {
|
|
2077
3486
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -2082,26 +3491,37 @@ const testCases = [
|
|
|
2082
3491
|
},
|
|
2083
3492
|
json: {
|
|
2084
3493
|
a: 3,
|
|
2085
|
-
b: 10
|
|
3494
|
+
b: 10,
|
|
3495
|
+
c: 11
|
|
2086
3496
|
}
|
|
2087
3497
|
},
|
|
2088
|
-
expectation:
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
3498
|
+
expectation: [] // No payload expected
|
|
3499
|
+
},
|
|
3500
|
+
{
|
|
3501
|
+
shouldName:
|
|
3502
|
+
'B - WHEN sending data and a measure called TimeInstant through http IT should NOT store anything into the Context Broker (No request to CB)',
|
|
3503
|
+
type: 'single',
|
|
3504
|
+
measure: {
|
|
3505
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
3506
|
+
method: 'POST',
|
|
3507
|
+
qs: {
|
|
3508
|
+
i: globalEnv.deviceId,
|
|
3509
|
+
k: globalEnv.apikey
|
|
2094
3510
|
},
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
3511
|
+
json: {
|
|
3512
|
+
a: 3,
|
|
3513
|
+
b: 10,
|
|
3514
|
+
c: 11,
|
|
3515
|
+
TimeInstant: '2015-12-14T08:06:01.468Z'
|
|
2098
3516
|
}
|
|
2099
|
-
}
|
|
3517
|
+
},
|
|
3518
|
+
expectation: [] // No payload expected
|
|
2100
3519
|
}
|
|
2101
3520
|
]
|
|
2102
3521
|
},
|
|
2103
3522
|
{
|
|
2104
|
-
describeName:
|
|
3523
|
+
describeName:
|
|
3524
|
+
'0533 - Group with explicit attrs:[ ] (empty array) + active attributes + TimeInstant attribute + static attributes + timestamp:true',
|
|
2105
3525
|
provision: {
|
|
2106
3526
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
2107
3527
|
method: 'POST',
|
|
@@ -2111,17 +3531,44 @@ const testCases = [
|
|
|
2111
3531
|
resource: '/iot/json',
|
|
2112
3532
|
apikey: globalEnv.apikey,
|
|
2113
3533
|
entity_type: globalEnv.entity_type,
|
|
2114
|
-
explicitAttrs:
|
|
3534
|
+
explicitAttrs: '[ ]',
|
|
3535
|
+
timestamp: true,
|
|
2115
3536
|
commands: [],
|
|
2116
3537
|
lazy: [],
|
|
2117
3538
|
attributes: [
|
|
2118
3539
|
{
|
|
2119
|
-
object_id: 'a',
|
|
2120
3540
|
name: 'attr_a',
|
|
3541
|
+
object_id: 'a',
|
|
3542
|
+
type: 'Number'
|
|
3543
|
+
},
|
|
3544
|
+
{
|
|
3545
|
+
name: 'attr_b',
|
|
3546
|
+
object_id: 'b',
|
|
2121
3547
|
type: 'Number'
|
|
3548
|
+
},
|
|
3549
|
+
{
|
|
3550
|
+
name: 'DateIssued',
|
|
3551
|
+
object_id: 'TimeInstant',
|
|
3552
|
+
type: 'DateTime'
|
|
3553
|
+
},
|
|
3554
|
+
{
|
|
3555
|
+
name: 'TimeInstant',
|
|
3556
|
+
object_id: 't',
|
|
3557
|
+
type: 'DateTime'
|
|
2122
3558
|
}
|
|
2123
3559
|
],
|
|
2124
|
-
static_attributes: [
|
|
3560
|
+
static_attributes: [
|
|
3561
|
+
{
|
|
3562
|
+
name: 'static_a',
|
|
3563
|
+
type: 'Number',
|
|
3564
|
+
value: 3
|
|
3565
|
+
},
|
|
3566
|
+
{
|
|
3567
|
+
name: 'static_b',
|
|
3568
|
+
type: 'Number',
|
|
3569
|
+
value: 4
|
|
3570
|
+
}
|
|
3571
|
+
]
|
|
2125
3572
|
}
|
|
2126
3573
|
]
|
|
2127
3574
|
},
|
|
@@ -2133,7 +3580,7 @@ const testCases = [
|
|
|
2133
3580
|
should: [
|
|
2134
3581
|
{
|
|
2135
3582
|
shouldName:
|
|
2136
|
-
'A - WHEN sending
|
|
3583
|
+
'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)',
|
|
2137
3584
|
type: 'single',
|
|
2138
3585
|
measure: {
|
|
2139
3586
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -2144,22 +3591,38 @@ const testCases = [
|
|
|
2144
3591
|
},
|
|
2145
3592
|
json: {
|
|
2146
3593
|
a: 3,
|
|
2147
|
-
b: 10
|
|
3594
|
+
b: 10,
|
|
3595
|
+
c: 11,
|
|
3596
|
+
t: '2015-12-14T08:06:01.468Z'
|
|
2148
3597
|
}
|
|
2149
3598
|
},
|
|
2150
|
-
expectation:
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
3599
|
+
expectation: []
|
|
3600
|
+
},
|
|
3601
|
+
{
|
|
3602
|
+
shouldName:
|
|
3603
|
+
'B - WHEN sending data and a measure called TimeInstant through http IT should NOT store anything into the Context Broker (No request to CB)',
|
|
3604
|
+
type: 'single',
|
|
3605
|
+
measure: {
|
|
3606
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
3607
|
+
method: 'POST',
|
|
3608
|
+
qs: {
|
|
3609
|
+
i: globalEnv.deviceId,
|
|
3610
|
+
k: globalEnv.apikey
|
|
3611
|
+
},
|
|
3612
|
+
json: {
|
|
3613
|
+
a: 3,
|
|
3614
|
+
b: 10,
|
|
3615
|
+
c: 11,
|
|
3616
|
+
TimeInstant: '2015-12-14T08:06:01.468Z'
|
|
2156
3617
|
}
|
|
2157
|
-
}
|
|
3618
|
+
},
|
|
3619
|
+
expectation: [] // No payload expected
|
|
2158
3620
|
}
|
|
2159
3621
|
]
|
|
2160
3622
|
},
|
|
2161
3623
|
{
|
|
2162
|
-
describeName:
|
|
3624
|
+
describeName:
|
|
3625
|
+
'0534 - Group with explicit attrs:[ ] (empty array) + active attributes + TimeInstant attribute + static attributes + timestamp:false',
|
|
2163
3626
|
provision: {
|
|
2164
3627
|
url: 'http://localhost:' + config.iota.server.port + '/iot/services',
|
|
2165
3628
|
method: 'POST',
|
|
@@ -2169,7 +3632,8 @@ const testCases = [
|
|
|
2169
3632
|
resource: '/iot/json',
|
|
2170
3633
|
apikey: globalEnv.apikey,
|
|
2171
3634
|
entity_type: globalEnv.entity_type,
|
|
2172
|
-
explicitAttrs:
|
|
3635
|
+
explicitAttrs: '[ ]',
|
|
3636
|
+
timestamp: false,
|
|
2173
3637
|
commands: [],
|
|
2174
3638
|
lazy: [],
|
|
2175
3639
|
attributes: [
|
|
@@ -2182,6 +3646,16 @@ const testCases = [
|
|
|
2182
3646
|
name: 'attr_b',
|
|
2183
3647
|
object_id: 'b',
|
|
2184
3648
|
type: 'Number'
|
|
3649
|
+
},
|
|
3650
|
+
{
|
|
3651
|
+
name: 'DateIssued',
|
|
3652
|
+
object_id: 'TimeInstant',
|
|
3653
|
+
type: 'DateTime'
|
|
3654
|
+
},
|
|
3655
|
+
{
|
|
3656
|
+
name: 'TimeInstant',
|
|
3657
|
+
object_id: 't',
|
|
3658
|
+
type: 'DateTime'
|
|
2185
3659
|
}
|
|
2186
3660
|
],
|
|
2187
3661
|
static_attributes: [
|
|
@@ -2207,7 +3681,7 @@ const testCases = [
|
|
|
2207
3681
|
should: [
|
|
2208
3682
|
{
|
|
2209
3683
|
shouldName:
|
|
2210
|
-
'A - WHEN sending
|
|
3684
|
+
'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)',
|
|
2211
3685
|
type: 'single',
|
|
2212
3686
|
measure: {
|
|
2213
3687
|
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
@@ -2219,21 +3693,31 @@ const testCases = [
|
|
|
2219
3693
|
json: {
|
|
2220
3694
|
a: 3,
|
|
2221
3695
|
b: 10,
|
|
2222
|
-
c: 11
|
|
3696
|
+
c: 11,
|
|
3697
|
+
t: '2015-12-14T08:06:01.468Z'
|
|
2223
3698
|
}
|
|
2224
3699
|
},
|
|
2225
|
-
expectation:
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
3700
|
+
expectation: []
|
|
3701
|
+
},
|
|
3702
|
+
{
|
|
3703
|
+
shouldName:
|
|
3704
|
+
'B - WHEN sending data and a measure called TimeInstant through http IT should NOT store anything into the Context Broker (No request to CB)',
|
|
3705
|
+
type: 'single',
|
|
3706
|
+
measure: {
|
|
3707
|
+
url: 'http://localhost:' + config.http.port + '/iot/json',
|
|
3708
|
+
method: 'POST',
|
|
3709
|
+
qs: {
|
|
3710
|
+
i: globalEnv.deviceId,
|
|
3711
|
+
k: globalEnv.apikey
|
|
2231
3712
|
},
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
3713
|
+
json: {
|
|
3714
|
+
a: 3,
|
|
3715
|
+
b: 10,
|
|
3716
|
+
c: 11,
|
|
3717
|
+
TimeInstant: '2015-12-14T08:06:01.468Z'
|
|
2235
3718
|
}
|
|
2236
|
-
}
|
|
3719
|
+
},
|
|
3720
|
+
expectation: [] // No payload expected
|
|
2237
3721
|
}
|
|
2238
3722
|
]
|
|
2239
3723
|
},
|