@@ -15,7 +15,7 @@ mod test_helpers;
15
15
16
16
use rabbitmq_http_client:: {
17
17
commons:: MessageTransferAcknowledgementMode ,
18
- responses:: { FederationUpstream , RuntimeParameter } ,
18
+ responses:: { FederationLink , FederationType , FederationUpstream , RuntimeParameter } ,
19
19
} ;
20
20
21
21
#[ test]
@@ -86,3 +86,65 @@ fn test_unit_deserialize_federation_upstream_case2() {
86
86
upstream. ack_mode
87
87
) ;
88
88
}
89
+
90
+ #[ test]
91
+ fn test_unit_deserialize_federation_link_case1 ( ) {
92
+ let json = r#"
93
+ {
94
+ "node": "rabbit@sunnyside",
95
+ "queue": "fed.cq.1",
96
+ "upstream_queue": "fed.cq.overridden",
97
+ "consumer_tag": "hgksdh98s7f98au9u",
98
+ "type": "queue",
99
+ "vhost": "/",
100
+ "upstream": "up-1",
101
+ "id": "e178dfad",
102
+ "status": "running",
103
+ "local_connection": "<[email protected] >",
104
+ "uri": "amqp://localhost:5672/fed",
105
+ "timestamp": "2025-03-16 0:41:29",
106
+ "local_channel": {
107
+ "acks_uncommitted": 0,
108
+ "confirm": true,
109
+ "connection_details": {
110
+
111
+ "peer_host": "undefined",
112
+ "peer_port": "undefined"
113
+ },
114
+ "consumer_count": 0,
115
+ "garbage_collection": {
116
+ "fullsweep_after": 65535,
117
+ "max_heap_size": 0,
118
+ "min_bin_vheap_size": 1727361,
119
+ "min_heap_size": 233,
120
+ "minor_gcs": 6
121
+ },
122
+ "idle_since": "2025-03-16T00:41:30.097-04:00",
123
+ "messages_unacknowledged": 0,
124
+ "messages_uncommitted": 0,
125
+ "messages_unconfirmed": 0,
126
+ "name": "<[email protected] > (1)",
127
+ "node": "rabbit@sunnyside",
128
+ "number": 1,
129
+ "pending_raft_commands": 0,
130
+ "prefetch_count": 0,
131
+ "reductions": 1127,
132
+ "reductions_details": {
133
+ "rate": 0.0
134
+ },
135
+ "state": "running",
136
+ "transactional": false,
137
+ "user": "none",
138
+ "user_who_performed_action": "none",
139
+ "vhost": "/"
140
+ }
141
+ }
142
+ "# ;
143
+
144
+ let link: FederationLink = serde_json:: from_str ( & json) . unwrap ( ) ;
145
+ assert_eq ! ( link. uri, "amqp://localhost:5672/fed" ) ;
146
+ assert_eq ! ( link. id, "e178dfad" ) ;
147
+ assert_eq ! ( link. typ, FederationType :: Queue ) ;
148
+ assert_eq ! ( link. upstream, "up-1" ) ;
149
+ assert_eq ! ( link. consumer_tag. unwrap( ) , "hgksdh98s7f98au9u" ) ;
150
+ }
0 commit comments