Skip to main content

einvalid_messagetype

Function einvalid_messagetype 

Source
pub fn einvalid_messagetype() -> ErrorInfo
Examples found in repository?
examples/simple.rs (line 98)
51fn tests() {
52    let protocols = vec![
53        SupportedProtocol {
54            protocol: Protocol::Core as i32,
55            protocol_version: ETP12VERSION,
56            role: "Server".to_string(),
57            protocol_capabilities: HashMap::new(),
58        },
59        SupportedProtocol {
60            protocol: 3,
61            protocol_version: ETP12VERSION,
62            role: "Server".to_string(),
63            protocol_capabilities: HashMap::new(),
64        },
65        SupportedProtocol {
66            protocol: 4,
67            protocol_version: ETP12VERSION,
68            role: "Server".to_string(),
69            protocol_capabilities: HashMap::new(),
70        },
71    ];
72
73    let now = SystemTime::now();
74
75    let rq = RequestSession {
76        application_name: "etp-rs Client Library Application".to_string(),
77        application_version: "0.1".to_string(),
78        client_instance_id: random_uuid(),
79        requested_protocols: protocols,
80        supported_data_objects: vec![],
81        supported_compression: vec!["gzip".to_string()],
82        supported_formats: vec!["xml".to_string(), "json".to_string()],
83        current_date_time: time_to_etp(now),
84        earliest_retained_change_time: time_to_etp(now),
85        server_authorization_required: false,
86        endpoint_capabilities: HashMap::new(),
87    };
88
89    let ping = Ping {
90        current_date_time: time_to_etp(now),
91    };
92
93    for s in EndpointCapabilityKind::iter() {
94        println!("> {:?}", s);
95    }
96
97    println!("{:?}", rq);
98    println!("{:?}", einvalid_messagetype());
99    println!("{:?}", Protocol::Core);
100    println!(
101        "{:?}",
102        serde_json::from_str::<EndpointCapabilityKind>(r#""MaxWebSocketMessagePayloadSize""#)
103            .unwrap()
104    );
105    println!(
106        "{:?}",
107        serde_json::to_string_pretty(&EndpointCapabilityKind::ActiveTimeoutPeriod).unwrap()
108    );
109
110    // Ping
111    let record_a = ping.avro_serialize();
112    match record_a {
113        Err(ref e) => println!("{}", e),
114        _ => {}
115    }
116    let record = record_a.unwrap();
117    let mut record_slice = record.as_slice();
118    println!("{:?}", record_slice);
119    println!("{:?}", Ping::avro_deserialize(&mut record_slice));
120
121    // Request session
122
123    //println!("{:?}", RequestSession::avro_schema_str());
124    //println!("{:?}", RequestSession::avro_schema());
125    println!("{:?}", RequestSession::default());
126
127    let record_a = rq.avro_serialize();
128    match record_a {
129        Err(ref e) => println!("{}", e),
130        _ => {}
131    }
132    let record = record_a.unwrap();
133    let mut record_slice = record.as_slice();
134    println!("{:?}", record_slice);
135    println!("{:?}", RequestSession::avro_deserialize(&mut record_slice));
136    println!("{:?}", rq.as_protocol_message().avro_schema());
137    println!("{:?}", rq.as_protocol_message().avro_serialize());
138}