@@ -20,6 +20,7 @@ impl transport::Transport for FakeTransport {
20
20
}
21
21
22
22
#[ test]
23
+ #[ cfg( feature = "devicemgmt" ) ]
23
24
fn basic_deserialization ( ) {
24
25
let response = r#"
25
26
<?xml version="1.0" encoding="UTF-8"?>
@@ -66,6 +67,7 @@ fn basic_deserialization() {
66
67
assert_eq ! ( de. utc_date_time. as_ref( ) . unwrap( ) . time. second, 9 ) ;
67
68
}
68
69
70
+ #[ cfg( feature = "devicemgmt" ) ]
69
71
#[ test]
70
72
fn basic_serialization ( ) {
71
73
let expected = r#"
@@ -327,6 +329,7 @@ fn duration_deserialization() {
327
329
}
328
330
329
331
#[ tokio:: test]
332
+ #[ cfg( feature = "devicemgmt" ) ]
330
333
async fn operation_get_system_date_and_time ( ) {
331
334
let req: devicemgmt:: GetSystemDateAndTime = Default :: default ( ) ;
332
335
@@ -369,6 +372,7 @@ async fn operation_get_system_date_and_time() {
369
372
}
370
373
371
374
#[ tokio:: test]
375
+ #[ cfg( feature = "devicemgmt" ) ]
372
376
async fn operation_get_device_information ( ) {
373
377
let req: devicemgmt:: GetDeviceInformation = Default :: default ( ) ;
374
378
@@ -693,3 +697,119 @@ fn media2_configs_name_serialization() {
693
697
type_of( & media2:: GetAudioDecoderConfigurationOptions :: default ( ) )
694
698
) ;
695
699
}
700
+
701
+ #[ tokio:: test]
702
+ #[ cfg( feature = "event" ) ]
703
+ async fn operation_pull_messages ( ) {
704
+ let req: event:: PullMessages = Default :: default ( ) ;
705
+
706
+ let transport = FakeTransport {
707
+ response : r#"
708
+ <tev:PullMessagesResponse
709
+ xmlns:tt="http://www.onvif.org/ver10/schema"
710
+ xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
711
+ xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
712
+ xmlns:wsa5="http://www.w3.org/2005/08/addressing"
713
+ xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
714
+ xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
715
+ xmlns:tns1="http://www.onvif.org/ver10/topics">
716
+ <tev:CurrentTime>
717
+ 2023-09-28T16:01:15Z
718
+ </tev:CurrentTime>
719
+ <tev:TerminationTime>
720
+ 2023-09-28T16:11:15Z
721
+ </tev:TerminationTime>
722
+ <wsnt:NotificationMessage>
723
+ <wsnt:Topic
724
+ Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">
725
+ tns1:RuleEngine/CellMotionDetector/Motion
726
+ </wsnt:Topic>
727
+ <wsnt:Message>
728
+ <tt:Message
729
+ UtcTime="2023-09-28T16:01:15Z"
730
+ PropertyOperation="Initialized">
731
+ <tt:Source>
732
+ <tt:SimpleItem
733
+ Name="VideoSourceConfigurationToken"
734
+ Value="00000"/>
735
+ <tt:SimpleItem
736
+ Name="VideoAnalyticsConfigurationToken"
737
+ Value="00000"/>
738
+ <tt:SimpleItem
739
+ Name="Rule"
740
+ Value="00000"/>
741
+ </tt:Source>
742
+ <tt:Data>
743
+ <tt:SimpleItem
744
+ Name="IsMotion"
745
+ Value="false"/>
746
+ </tt:Data>
747
+ </tt:Message>
748
+ </wsnt:Message>
749
+ </wsnt:NotificationMessage>
750
+ </tev:PullMessagesResponse>
751
+ "#
752
+ . into ( ) ,
753
+ } ;
754
+
755
+ let response = event:: pull_messages ( & transport, & req) . await ;
756
+
757
+ let resp = match response {
758
+ Ok ( resp) => resp,
759
+ Err ( err) => panic ! ( "Error: {:?}" , err) ,
760
+ } ;
761
+
762
+ assert_eq ! (
763
+ resp. notification_message[ 0 ] . message. msg. source. simple_item[ 0 ] . name,
764
+ "VideoSourceConfigurationToken"
765
+ ) ;
766
+ assert_eq ! (
767
+ resp. notification_message[ 0 ] . message. msg. source. simple_item[ 0 ] . value,
768
+ "00000"
769
+ ) ;
770
+ assert_eq ! (
771
+ resp. notification_message[ 0 ] . message. msg. data. simple_item[ 0 ] . name,
772
+ "IsMotion"
773
+ ) ;
774
+ assert_eq ! (
775
+ resp. notification_message[ 0 ] . message. msg. data. simple_item[ 0 ] . value,
776
+ "false"
777
+ ) ;
778
+ }
779
+
780
+ #[ tokio:: test]
781
+ #[ cfg( feature = "event" ) ]
782
+ async fn operation_create_pullpoint_subscription ( ) {
783
+ let req: event:: CreatePullPointSubscription = Default :: default ( ) ;
784
+
785
+ let transport = FakeTransport {
786
+ response : r#"
787
+ <tev:CreatePullPointSubscriptionResponse
788
+ xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
789
+ xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
790
+ xmlns:wsa5="http://www.w3.org/2005/08/addressing">
791
+ <tev:SubscriptionReference>
792
+ <wsa5:Address>
793
+ http://192.168.88.108/onvif/Subscription?Idx=5
794
+ </wsa5:Address>
795
+ </tev:SubscriptionReference>
796
+ <wsnt:CurrentTime>
797
+ 2023-09-28T16:01:15Z
798
+ </wsnt:CurrentTime>
799
+ <wsnt:TerminationTime>
800
+ 2023-09-28T16:11:15Z
801
+ </wsnt:TerminationTime>
802
+ </tev:CreatePullPointSubscriptionResponse>
803
+ "#
804
+ . into ( ) ,
805
+ } ;
806
+
807
+ let resp = event:: create_pull_point_subscription ( & transport, & req)
808
+ . await
809
+ . unwrap ( ) ;
810
+
811
+ assert_eq ! (
812
+ resp. subscription_reference. address,
813
+ "http://192.168.88.108/onvif/Subscription?Idx=5"
814
+ ) ;
815
+ }
0 commit comments