Comparison

spec/scansion/pubsub_preconditions.scs @ 10356:0a2d7efca039

util.pubsub, pubsub.lib and tests: Add text to precondition-not-met error (fixes #1455)
author Matthew Wild <mwild1@gmail.com>
date Sun, 27 Oct 2019 14:45:57 +0000
child 11631:6641ca266d94
comparison
equal deleted inserted replaced
10355:cb9755d7a36e 10356:0a2d7efca039
1 # Pubsub preconditions are enforced
2
3 [Client] Romeo
4 password: password
5 jid: jqpcrbq2@localhost
6
7 -----
8
9 Romeo connects
10
11 Romeo sends:
12 <iq id="67eb1f47-1e69-4cb3-91e2-4d5943e72d4c" type="set">
13 <pubsub xmlns="http://jabber.org/protocol/pubsub">
14 <publish node="http://jabber.org/protocol/tune">
15 <item id="current">
16 <tune xmlns="http://jabber.org/protocol/tune"/>
17 </item>
18 </publish>
19 </pubsub>
20 </iq>
21
22 Romeo receives:
23 <iq id="67eb1f47-1e69-4cb3-91e2-4d5943e72d4c" type="result">
24 <pubsub xmlns="http://jabber.org/protocol/pubsub">
25 <publish node="http://jabber.org/protocol/tune">
26 <item id="current"/>
27 </publish>
28 </pubsub>
29 </iq>
30
31 Romeo sends:
32 <iq id="52d74a36-afb0-4028-87ed-b25b988b049e" type="get">
33 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
34 <configure node="http://jabber.org/protocol/tune"/>
35 </pubsub>
36 </iq>
37
38 Romeo receives:
39 <iq id="52d74a36-afb0-4028-87ed-b25b988b049e" type="result">
40 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
41 <configure node="http://jabber.org/protocol/tune">
42 <x xmlns="jabber:x:data" type="form">
43 <field var="FORM_TYPE" type="hidden">
44 <value>http://jabber.org/protocol/pubsub#node_config</value>
45 </field>
46 <field var="pubsub#title" label="Title" type="text-single"/>
47 <field var="pubsub#description" label="Description" type="text-single"/>
48 <field var="pubsub#type" label="The type of node data, usually specified by the namespace of the payload (if any)" type="text-single"/>
49 <field var="pubsub#max_items" label="Max # of items to persist" type="text-single">
50 <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="xs:integer"/>
51 <value>1</value>
52 </field>
53 <field var="pubsub#persist_items" label="Persist items to storage" type="boolean">
54 <value>1</value>
55 </field>
56 <field var="pubsub#access_model" label="Specify the subscriber model" type="list-single">
57 <option label="authorize">
58 <value>authorize</value>
59 </option>
60 <option label="open">
61 <value>open</value>
62 </option>
63 <option label="presence">
64 <value>presence</value>
65 </option>
66 <option label="roster">
67 <value>roster</value>
68 </option>
69 <option label="whitelist">
70 <value>whitelist</value>
71 </option>
72 <value>presence</value>
73 </field>
74 <field var="pubsub#publish_model" label="Specify the publisher model" type="list-single">
75 <option label="publishers">
76 <value>publishers</value>
77 </option>
78 <option label="subscribers">
79 <value>subscribers</value>
80 </option>
81 <option label="open">
82 <value>open</value>
83 </option>
84 <value>publishers</value>
85 </field>
86 <field var="pubsub#deliver_notifications" label="Whether to deliver event notifications" type="boolean">
87 <value>1</value>
88 </field>
89 <field var="pubsub#deliver_payloads" label="Whether to deliver payloads with event notifications" type="boolean">
90 <value>1</value>
91 </field>
92 <field var="pubsub#notification_type" label="Specify the delivery style for notifications" type="list-single">
93 <option label="Messages of type normal">
94 <value>normal</value>
95 </option>
96 <option label="Messages of type headline">
97 <value>headline</value>
98 </option>
99 <value>headline</value>
100 </field>
101 <field var="pubsub#notify_delete" label="Whether to notify subscribers when the node is deleted" type="boolean">
102 <value>1</value>
103 </field>
104 <field var="pubsub#notify_retract" label="Whether to notify subscribers when items are removed from the node" type="boolean">
105 <value>1</value>
106 </field>
107 </x>
108 </configure>
109 </pubsub>
110 </iq>
111
112 Romeo sends:
113 <iq id="a73aac09-74be-4ee2-97e5-571bbdbcd956" type="set">
114 <pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
115 <configure node="http://jabber.org/protocol/tune">
116 <x xmlns="jabber:x:data" type="submit">
117 <field var="FORM_TYPE" type="hidden">
118 <value>http://jabber.org/protocol/pubsub#node_config</value>
119 </field>
120 <field var="pubsub#title" type="text-single" label="Title">
121 <value>Nice tunes</value>
122 </field>
123 <field var="pubsub#description" type="text-single" label="Description"/>
124 <field var="pubsub#type" type="text-single" label="The type of node data, usually specified by the namespace of the payload (if any)"/>
125 <field var="pubsub#max_items" type="text-single" label="Max # of items to persist">
126 <validate xmlns="http://jabber.org/protocol/xdata-validate" datatype="xs:integer"/>
127 <value>1</value>
128 </field>
129 <field var="pubsub#persist_items" type="boolean" label="Persist items to storage">
130 <value>1</value>
131 </field>
132 <field var="pubsub#access_model" type="list-single" label="Specify the subscriber model">
133 <option label="authorize">
134 <value>authorize</value>
135 </option>
136 <option label="open">
137 <value>open</value>
138 </option>
139 <option label="presence">
140 <value>presence</value>
141 </option>
142 <option label="roster">
143 <value>roster</value>
144 </option>
145 <option label="whitelist">
146 <value>whitelist</value>
147 </option>
148 <value>presence</value>
149 </field>
150 <field var="pubsub#publish_model" type="list-single" label="Specify the publisher model">
151 <option label="publishers">
152 <value>publishers</value>
153 </option>
154 <option label="subscribers">
155 <value>subscribers</value>
156 </option>
157 <option label="open">
158 <value>open</value>
159 </option>
160 <value>publishers</value>
161 </field>
162 <field var="pubsub#deliver_notifications" type="boolean" label="Whether to deliver event notifications">
163 <value>1</value>
164 </field>
165 <field var="pubsub#deliver_payloads" type="boolean" label="Whether to deliver payloads with event notifications">
166 <value>1</value>
167 </field>
168 <field var="pubsub#notification_type" type="list-single" label="Specify the delivery style for notifications">
169 <option label="Messages of type normal">
170 <value>normal</value>
171 </option>
172 <option label="Messages of type headline">
173 <value>headline</value>
174 </option>
175 <value>headline</value>
176 </field>
177 <field var="pubsub#notify_delete" type="boolean" label="Whether to notify subscribers when the node is deleted">
178 <value>1</value>
179 </field>
180 <field var="pubsub#notify_retract" type="boolean" label="Whether to notify subscribers when items are removed from the node">
181 <value>1</value>
182 </field>
183 </x>
184 </configure>
185 </pubsub>
186 </iq>
187
188 Romeo receives:
189 <iq id="a73aac09-74be-4ee2-97e5-571bbdbcd956" type="result"/>
190
191 Romeo sends:
192 <iq id="ab0e92d2-c06b-4987-9d45-f9f9e7721709" type="get">
193 <query xmlns="http://jabber.org/protocol/disco#items"/>
194 </iq>
195
196 Romeo receives:
197 <iq id="ab0e92d2-c06b-4987-9d45-f9f9e7721709" type="result">
198 <query xmlns="http://jabber.org/protocol/disco#items">
199 <item name="Nice tunes" node="http://jabber.org/protocol/tune" jid="${Romeo's JID}"/>
200 </query>
201 </iq>
202
203 Romeo sends:
204 <iq id="67eb1f47-1e69-4cb3-91e2-4d5943e72d4c" type="set">
205 <pubsub xmlns="http://jabber.org/protocol/pubsub">
206 <publish node="http://jabber.org/protocol/tune">
207 <item id="current">
208 <tune xmlns="http://jabber.org/protocol/tune"/>
209 </item>
210 </publish>
211 <publish-options>
212 <x xmlns="jabber:x:data">
213 <field var="FORM_TYPE" type="hidden">
214 <value>http://jabber.org/protocol/pubsub#publish-options</value>
215 </field>
216 <field var="pubsub#access_model">
217 <value>whitelist</value>
218 </field>
219 </x>
220 </publish-options>
221 </pubsub>
222 </iq>
223
224 Romeo receives:
225 <iq type='error' id='67eb1f47-1e69-4cb3-91e2-4d5943e72d4c'>
226 <error type='cancel'>
227 <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
228 <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Field does not match: access_model</text>
229 <precondition-not-met xmlns='http://jabber.org/protocol/pubsub#errors'/>
230 </error>
231 </iq>
232
233 Romeo disconnects
234