Revision 4508
Added by daigle about 16 years ago
test/edu/ucsb/nceas/metacattest/AccessControlTest.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
package edu.ucsb.nceas.metacattest; |
27 | 27 |
|
28 |
import java.io.Reader; |
|
29 |
import java.io.StringReader; |
|
30 |
import java.util.Calendar; |
|
31 |
import java.util.Date; |
|
32 |
import java.util.GregorianCalendar; |
|
33 |
import java.util.SimpleTimeZone; |
|
34 |
import java.util.TimeZone; |
|
35 | 28 |
import java.util.Vector; |
36 | 29 |
|
37 | 30 |
import edu.ucsb.nceas.MCTestCase; |
38 |
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException; |
|
39 |
import edu.ucsb.nceas.metacat.client.Metacat; |
|
40 | 31 |
import edu.ucsb.nceas.metacat.client.MetacatAuthException; |
41 | 32 |
import edu.ucsb.nceas.metacat.client.MetacatException; |
42 |
import edu.ucsb.nceas.metacat.client.MetacatFactory; |
|
43 | 33 |
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException; |
44 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
|
45 |
import edu.ucsb.nceas.utilities.IOUtil; |
|
46 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
|
47 | 34 |
import junit.framework.Test; |
48 | 35 |
import junit.framework.TestSuite; |
49 |
import java.io.File; |
|
36 |
// import java.io.File;
|
|
50 | 37 |
|
51 | 38 |
/** |
52 | 39 |
* A JUnit test for testing Access Control in Metacat |
53 | 40 |
*/ |
54 | 41 |
public class AccessControlTest extends MCTestCase { |
55 | 42 |
|
56 |
private static String metacatUrl; |
|
57 |
private static String username; |
|
58 |
private static String password; |
|
59 |
private static String anotheruser; |
|
60 |
private static String anotherpassword; |
|
61 |
static { |
|
62 |
try { |
|
63 |
metacatUrl = PropertyService.getProperty("test.metacatUrl"); |
|
64 |
username = PropertyService.getProperty("test.mcUser"); |
|
65 |
password = PropertyService.getProperty("test.mcPassword"); |
|
66 |
anotheruser = PropertyService.getProperty("test.mcAnotherUser"); |
|
67 |
anotherpassword = PropertyService.getProperty("test.mcAnotherPassword"); |
|
68 |
} catch (PropertyNotFoundException pnfe) { |
|
69 |
System.err.println("Could not get property in static block: " |
|
70 |
+ pnfe.getMessage()); |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 |
private String prefix = "test"; |
|
75 | 43 |
private String newdocid = null; |
76 |
private String testdocument = ""; |
|
77 | 44 |
private String onlineDocid; |
78 | 45 |
private String onlinetestdatafile1 = "test/onlineDataFile1"; |
79 |
// private String onlinetestdatafile2 = "test/onlineDataFile2"; |
|
80 |
private static final String ALLOWFIRST = "allowFirst"; |
|
81 |
private static final String DENYFIRST = "denyFirst"; |
|
82 | 46 |
|
83 |
private Metacat m; |
|
84 |
|
|
85 | 47 |
/** |
86 |
* These variables are for eml-2.0.1 only. For other eml versions, this |
|
87 |
* function might have to modified |
|
88 |
*/ |
|
89 |
private String testEml_200_Header = "<?xml version=\"1.0\"?><eml:eml" |
|
90 |
+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.0\"" |
|
91 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" |
|
92 |
+ " packageId=\"eml.1.1\" system=\"knb\"" |
|
93 |
+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.0 eml.xsd\"" |
|
94 |
+ " scope=\"system\">"; |
|
95 |
|
|
96 |
private String testEml_201_Header = "<?xml version=\"1.0\"?><eml:eml" |
|
97 |
+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.0.1\"" |
|
98 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" |
|
99 |
+ " packageId=\"eml.1.1\" system=\"knb\"" |
|
100 |
+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.0.1 eml.xsd\"" |
|
101 |
+ " scope=\"system\">"; |
|
102 |
|
|
103 |
private String testEml_210_Header = "<?xml version=\"1.0\"?><eml:eml" |
|
104 |
+ " xmlns:eml=\"eml://ecoinformatics.org/eml-2.1.0\"" |
|
105 |
+ " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" |
|
106 |
+ " packageId=\"eml.1.1\" system=\"knb\"" |
|
107 |
+ " xsi:schemaLocation=\"eml://ecoinformatics.org/eml-2.1.0 eml.xsd\"" |
|
108 |
+ " scope=\"system\">"; |
|
109 |
|
|
110 |
private String testEmlCreatorBlock = "<creator scope=\"document\"> " |
|
111 |
+ " <individualName> " |
|
112 |
+ " <surName>Smith</surName> " |
|
113 |
+ " </individualName> " |
|
114 |
+ "</creator> "; |
|
115 |
|
|
116 |
private String testEmlContactBlock = "<contact scope=\"document\"> " |
|
117 |
+ " <individualName> " |
|
118 |
+ " <surName>Jackson</surName> " |
|
119 |
+ " </individualName> " |
|
120 |
+ "</contact> "; |
|
121 |
|
|
122 |
private String testEmlInlineBlock1 = "<inline> " |
|
123 |
+ " <admin> " |
|
124 |
+ " <contact> " |
|
125 |
+ " <name>Operator</name> " |
|
126 |
+ " <institution>PSI</institution> " |
|
127 |
+ " </contact> " |
|
128 |
+ " </admin> " |
|
129 |
+ "</inline> "; |
|
130 |
|
|
131 |
private String testEmlInlineBlock2 = "<inline> " |
|
132 |
+ " <instrument> " |
|
133 |
+ " <instName>LCQ</instName> " |
|
134 |
+ " <source type=\"ESI\"></source> " |
|
135 |
+ " <detector type=\"EM\"></detector> " |
|
136 |
+ " </instrument> " |
|
137 |
+ "</inline> "; |
|
138 |
|
|
139 |
/* |
|
140 |
* Retrus an access block base on params passed and the defaul perm order - |
|
141 |
* allow first |
|
142 |
*/ |
|
143 |
private String getAccessBlock(String principal, boolean grantAccess, boolean read, |
|
144 |
boolean write, boolean changePermission, boolean all) { |
|
145 |
return getAccessBlock(principal, grantAccess, read, write, changePermission, all, |
|
146 |
ALLOWFIRST); |
|
147 |
} |
|
148 |
|
|
149 |
/** |
|
150 |
* This function returns an access block based on the params passed |
|
151 |
*/ |
|
152 |
private String getAccessBlock(String principal, boolean grantAccess, boolean read, |
|
153 |
boolean write, boolean changePermission, boolean all, String permOrder) { |
|
154 |
String accessBlock = "<access " |
|
155 |
+ "authSystem=\"ldap://ldap.ecoinformatics.org:389/dc=ecoinformatics,dc=org\"" |
|
156 |
+ " order=\"" + permOrder + "\"" + " scope=\"document\"" + ">"; |
|
157 |
|
|
158 |
accessBlock += generateOneAccessRule(principal, grantAccess, read, write, |
|
159 |
changePermission, all); |
|
160 |
accessBlock += "</access>"; |
|
161 |
|
|
162 |
return accessBlock; |
|
163 |
|
|
164 |
} |
|
165 |
|
|
166 |
/* |
|
167 |
* Gets eml access block base on given acccess rules and perm order |
|
168 |
*/ |
|
169 |
private String getAccessBlock(Vector<String> accessRules, String permOrder) { |
|
170 |
String accessBlock = "<access " |
|
171 |
+ "authSystem=\"ldap://ldap.ecoinformatics.org:389/dc=ecoinformatics,dc=org\"" |
|
172 |
+ " order=\"" + permOrder + "\"" + " scope=\"document\"" + ">"; |
|
173 |
// adding rules |
|
174 |
if (accessRules != null && !accessRules.isEmpty()) { |
|
175 |
for (int i = 0; i < accessRules.size(); i++) { |
|
176 |
String rule = (String) accessRules.elementAt(i); |
|
177 |
accessBlock += rule; |
|
178 |
|
|
179 |
} |
|
180 |
} |
|
181 |
accessBlock += "</access>"; |
|
182 |
return accessBlock; |
|
183 |
} |
|
184 |
|
|
185 |
/* |
|
186 |
* Generates a access rule for given parameter. Note this xml portion |
|
187 |
* doesn't include <access></access> |
|
188 |
*/ |
|
189 |
private String generateOneAccessRule(String principal, boolean grantAccess, |
|
190 |
boolean read, boolean write, boolean changePermission, boolean all) { |
|
191 |
String accessBlock = ""; |
|
192 |
|
|
193 |
if (grantAccess) { |
|
194 |
accessBlock = "<allow>"; |
|
195 |
} else { |
|
196 |
accessBlock = "<deny>"; |
|
197 |
} |
|
198 |
|
|
199 |
accessBlock = accessBlock + "<principal>" + principal + "</principal>"; |
|
200 |
|
|
201 |
if (all) { |
|
202 |
accessBlock += "<permission>all</permission>"; |
|
203 |
} else { |
|
204 |
if (read) { |
|
205 |
accessBlock += "<permission>read</permission>"; |
|
206 |
} |
|
207 |
if (write) { |
|
208 |
accessBlock += "<permission>write</permission>"; |
|
209 |
} |
|
210 |
if (changePermission) { |
|
211 |
accessBlock += "<permission>changePermission</permission>"; |
|
212 |
} |
|
213 |
} |
|
214 |
|
|
215 |
if (grantAccess) { |
|
216 |
accessBlock += "</allow>"; |
|
217 |
} else { |
|
218 |
accessBlock += "</deny>"; |
|
219 |
} |
|
220 |
return accessBlock; |
|
221 |
|
|
222 |
} |
|
223 |
|
|
224 |
/** |
|
225 |
* This function returns a valid eml document with no access rules |
|
226 |
*/ |
|
227 |
private String getTestEmlDoc(String title, String emlVersion, String inlineData1, |
|
228 |
String inlineData2, String onlineUrl1, String onlineUrl2, |
|
229 |
String docAccessBlock, String inlineAccessBlock1, String inlineAccessBlock2, |
|
230 |
String onlineAccessBlock1, String onlineAccessBlock2) { |
|
231 |
|
|
232 |
debug("getTestEmlDoc(): title=" + title + " inlineData1=" + inlineData1 |
|
233 |
+ " inlineData2=" + inlineData2 + " onlineUrl1=" + onlineUrl1 |
|
234 |
+ " onlineUrl2=" + onlineUrl2 + " docAccessBlock=" + docAccessBlock |
|
235 |
+ " inlineAccessBlock1=" + inlineAccessBlock1 + " inlineAccessBlock2=" |
|
236 |
+ inlineAccessBlock2 + " onlineAccessBlock1=" + onlineAccessBlock1 |
|
237 |
+ " onlineAccessBlock2=" + onlineAccessBlock2); |
|
238 |
String testDocument = ""; |
|
239 |
String header; |
|
240 |
if (emlVersion == EML2_0_0) { |
|
241 |
header = testEml_200_Header; |
|
242 |
} else if (emlVersion == EML2_0_1) { |
|
243 |
header = testEml_201_Header; |
|
244 |
} else { |
|
245 |
header = testEml_210_Header; |
|
246 |
} |
|
247 |
testDocument += header; |
|
248 |
|
|
249 |
// if this is a 2.1.0+ document, the document level access block sits |
|
250 |
// at the same level and before the dataset element. |
|
251 |
if (docAccessBlock != null && emlVersion.equals(EML2_1_0)) { |
|
252 |
testDocument += docAccessBlock; |
|
253 |
} |
|
254 |
|
|
255 |
testDocument += "<dataset scope=\"document\"><title>" |
|
256 |
+ title + "</title>" + testEmlCreatorBlock; |
|
257 |
|
|
258 |
if (inlineData1 != null) { |
|
259 |
testDocument = testDocument |
|
260 |
+ "<distribution scope=\"document\" id=\"inlineEntity1\">" |
|
261 |
+ inlineData1 + "</distribution>"; |
|
262 |
} |
|
263 |
if (inlineData2 != null) { |
|
264 |
testDocument = testDocument |
|
265 |
+ "<distribution scope=\"document\" id=\"inlineEntity2\">" |
|
266 |
+ inlineData2 + "</distribution>"; |
|
267 |
} |
|
268 |
if (onlineUrl1 != null) { |
|
269 |
testDocument = testDocument |
|
270 |
+ "<distribution scope=\"document\" id=\"onlineEntity1\">" |
|
271 |
+ "<online><url function=\"download\">" + onlineUrl1 |
|
272 |
+ "</url></online></distribution>"; |
|
273 |
} |
|
274 |
if (onlineUrl2 != null) { |
|
275 |
testDocument = testDocument |
|
276 |
+ "<distribution scope=\"document\" id=\"onlineEntity2\">" |
|
277 |
+ "<online><url function=\"download\">" + onlineUrl2 |
|
278 |
+ "</url></online></distribution>"; |
|
279 |
} |
|
280 |
testDocument += testEmlContactBlock; |
|
281 |
|
|
282 |
// if this is a 2.0.X document, the document level access block sits |
|
283 |
// inside the dataset element. |
|
284 |
if (docAccessBlock != null && |
|
285 |
(emlVersion.equals(EML2_0_0) || emlVersion.equals(EML2_0_1))) { |
|
286 |
testDocument += docAccessBlock; |
|
287 |
} |
|
288 |
|
|
289 |
testDocument += "</dataset>"; |
|
290 |
|
|
291 |
if (inlineAccessBlock1 != null) { |
|
292 |
testDocument += "<additionalMetadata>"; |
|
293 |
testDocument += "<describes>inlineEntity1</describes>"; |
|
294 |
testDocument += inlineAccessBlock1; |
|
295 |
testDocument += "</additionalMetadata>"; |
|
296 |
} |
|
297 |
|
|
298 |
if (inlineAccessBlock2 != null) { |
|
299 |
testDocument += "<additionalMetadata>"; |
|
300 |
testDocument += "<describes>inlineEntity2</describes>"; |
|
301 |
testDocument += inlineAccessBlock2; |
|
302 |
testDocument += "</additionalMetadata>"; |
|
303 |
} |
|
304 |
|
|
305 |
if (onlineAccessBlock1 != null) { |
|
306 |
testDocument += "<additionalMetadata>"; |
|
307 |
testDocument += "<describes>onlineEntity1</describes>"; |
|
308 |
testDocument += onlineAccessBlock1; |
|
309 |
testDocument += "</additionalMetadata>"; |
|
310 |
} |
|
311 |
|
|
312 |
if (onlineAccessBlock2 != null) { |
|
313 |
testDocument += "<additionalMetadata>"; |
|
314 |
testDocument += "<describes>onlineEntity2</describes>"; |
|
315 |
testDocument += onlineAccessBlock2; |
|
316 |
testDocument += "</additionalMetadata>"; |
|
317 |
} |
|
318 |
|
|
319 |
testDocument += "</eml:eml>"; |
|
320 |
|
|
321 |
// System.out.println("Returning following document" + testDocument); |
|
322 |
return testDocument; |
|
323 |
} |
|
324 |
|
|
325 |
/** |
|
326 | 48 |
* Constructor to build the test |
327 | 49 |
* |
328 | 50 |
* @param name |
... | ... | |
330 | 52 |
*/ |
331 | 53 |
public AccessControlTest(String name) { |
332 | 54 |
super(name); |
333 |
newdocid = generateDocid();
|
|
55 |
newdocid = generateDocumentId();
|
|
334 | 56 |
} |
335 | 57 |
|
336 | 58 |
/** |
337 | 59 |
* Establish a testing framework by initializing appropriate objects |
338 | 60 |
*/ |
339 |
public void setUp() { |
|
340 |
try { |
|
341 |
debug("Test Metacat: " + metacatUrl); |
|
342 |
m = MetacatFactory.createMetacatConnection(metacatUrl); |
|
343 |
} catch (MetacatInaccessibleException mie) { |
|
344 |
System.err.println("Metacat is: " + metacatUrl); |
|
345 |
fail("Metacat connection failed." + mie.getMessage()); |
|
346 |
} |
|
61 |
public void setUp() throws Exception { |
|
62 |
metacatConnectionNeeded = true; |
|
63 |
super.setUp(); |
|
347 | 64 |
} |
348 | 65 |
|
349 | 66 |
/** |
... | ... | |
439 | 156 |
try { |
440 | 157 |
debug("\nRunning: test201AllowFirst test"); |
441 | 158 |
String emlVersion = EML2_0_1; |
442 |
newdocid = generateDocid();
|
|
159 |
newdocid = generateDocumentId();
|
|
443 | 160 |
// ====1 inserts a document with access rules (allowFirst) - allow |
444 | 161 |
// READ rule for another user, |
445 | 162 |
// deny READ rule for public. |
... | ... | |
458 | 175 |
// login |
459 | 176 |
debug("logging in as: username=" + username + " password=" + password); |
460 | 177 |
m.login(username, password); |
461 |
insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
|
|
178 |
insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
|
|
462 | 179 |
debug("logging out"); |
463 | 180 |
m.logout(); |
464 | 181 |
// login as another user |
... | ... | |
466 | 183 |
+ anotherpassword); |
467 | 184 |
m.login(anotheruser, anotherpassword); |
468 | 185 |
// fails to read this document |
469 |
readDocidWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
|
|
186 |
readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
|
|
470 | 187 |
// fails to update this document |
471 |
updateDocid(newdocid + ".2", testdocument, FAILURE, true);
|
|
188 |
updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
|
|
472 | 189 |
// fails to update access part |
473 | 190 |
testdocument = getTestEmlDoc( |
474 | 191 |
"Testing user can not read, write and delete a document", emlVersion, |
475 | 192 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
476 | 193 |
false, false, false), null, null, null, null); |
477 |
updateDocid(newdocid + ".2", testdocument, FAILURE, true);
|
|
194 |
updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
|
|
478 | 195 |
// fails to delete the document |
479 |
deleteDocid(newdocid + ".1", FAILURE, true);
|
|
196 |
deleteDocumentId(newdocid + ".1", FAILURE, true);
|
|
480 | 197 |
// logout |
481 | 198 |
debug("logging out"); |
482 | 199 |
m.logout(); |
... | ... | |
498 | 215 |
// login |
499 | 216 |
debug("logging in as: username=" + username + " password=" + password); |
500 | 217 |
m.login(username, password); |
501 |
updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
|
|
218 |
updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
|
|
502 | 219 |
debug("logging out"); |
503 | 220 |
m.logout(); |
504 | 221 |
// login as another user |
... | ... | |
506 | 223 |
+ anotherpassword); |
507 | 224 |
m.login(anotheruser, anotherpassword); |
508 | 225 |
// fails to read this document |
509 |
readDocidWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
|
|
226 |
readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
|
|
510 | 227 |
// fails to update this document |
511 |
updateDocid(newdocid + ".3", testdocument, FAILURE, true);
|
|
228 |
updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
|
|
512 | 229 |
// fails to update access part |
513 | 230 |
testdocument = getTestEmlDoc( |
514 | 231 |
"Testing user can not read, write and delete a document", emlVersion, |
515 | 232 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
516 | 233 |
false, false, false), null, null, null, null); |
517 |
updateDocid(newdocid + ".3", testdocument, FAILURE, true);
|
|
234 |
updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
|
|
518 | 235 |
// fails to delete the document |
519 |
deleteDocid(newdocid + ".2", FAILURE, true);
|
|
236 |
deleteDocumentId(newdocid + ".2", FAILURE, true);
|
|
520 | 237 |
// logout |
521 | 238 |
debug("logging out"); |
522 | 239 |
m.logout(); |
... | ... | |
537 | 254 |
// login |
538 | 255 |
debug("logging in as: username=" + username + " password=" + password); |
539 | 256 |
m.login(username, password); |
540 |
updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
|
|
257 |
updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
|
|
541 | 258 |
debug("logging out"); |
542 | 259 |
m.logout(); |
543 | 260 |
// login as another user |
... | ... | |
545 | 262 |
+ anotherpassword); |
546 | 263 |
m.login(anotheruser, anotherpassword); |
547 | 264 |
// fails to read this document |
548 |
readDocidWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
|
|
265 |
readDocumentIdWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
|
|
549 | 266 |
// fails to update this document |
550 |
updateDocid(newdocid + ".4", testdocument, FAILURE, true);
|
|
267 |
updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
|
|
551 | 268 |
// fails to update access part |
552 | 269 |
testdocument = getTestEmlDoc( |
553 | 270 |
"Testing user can not read, write and delete a document", emlVersion, |
554 | 271 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
555 | 272 |
false, false, false), null, null, null, null); |
556 |
updateDocid(newdocid + ".4", testdocument, FAILURE, true);
|
|
273 |
updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
|
|
557 | 274 |
// fails to delete the document |
558 |
deleteDocid(newdocid + ".3", FAILURE, true);
|
|
275 |
deleteDocumentId(newdocid + ".3", FAILURE, true);
|
|
559 | 276 |
// logout |
560 | 277 |
debug("logging out"); |
561 | 278 |
m.logout(); |
... | ... | |
578 | 295 |
// login |
579 | 296 |
debug("logging in as: username=" + username + " password=" + password); |
580 | 297 |
m.login(username, password); |
581 |
updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
|
|
298 |
updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
|
|
582 | 299 |
m.logout(); |
583 | 300 |
debug("logging out"); |
584 | 301 |
// login as another user |
... | ... | |
586 | 303 |
+ anotherpassword); |
587 | 304 |
m.login(anotheruser, anotherpassword); |
588 | 305 |
// fails to read this document |
589 |
readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
|
|
306 |
readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
|
|
590 | 307 |
// fails to update this document |
591 |
updateDocid(newdocid + ".5", testdocument, FAILURE, true);
|
|
308 |
updateDocumentId(newdocid + ".5", testdocument, FAILURE, true);
|
|
592 | 309 |
// fails to update access part |
593 | 310 |
testdocument = getTestEmlDoc( |
594 | 311 |
"Testing user can not read, write and delete a document", emlVersion, |
595 | 312 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
596 | 313 |
false, false, false), null, null, null, null); |
597 |
updateDocid(newdocid + ".5", testdocument, FAILURE, true);
|
|
314 |
updateDocumentId(newdocid + ".5", testdocument, FAILURE, true);
|
|
598 | 315 |
// fails to delete the document |
599 |
deleteDocid(newdocid + ".4", FAILURE, true);
|
|
316 |
deleteDocumentId(newdocid + ".4", FAILURE, true);
|
|
600 | 317 |
// logout |
601 | 318 |
m.logout(); |
602 | 319 |
|
... | ... | |
618 | 335 |
// login |
619 | 336 |
debug("logging in as: username=" + username + " password=" + password); |
620 | 337 |
m.login(username, password); |
621 |
updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
|
|
338 |
updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
|
|
622 | 339 |
debug("logging out"); |
623 | 340 |
m.logout(); |
624 | 341 |
// login as another user |
... | ... | |
626 | 343 |
+ anotherpassword); |
627 | 344 |
m.login(anotheruser, anotherpassword); |
628 | 345 |
// fails to read this document |
629 |
readDocidWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
|
|
346 |
readDocumentIdWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
|
|
630 | 347 |
// fails to update this document |
631 |
updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
|
|
348 |
updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
|
|
632 | 349 |
// fails to update access part |
633 | 350 |
testdocument = getTestEmlDoc( |
634 | 351 |
"Testing user can not read, write and delete a document", emlVersion, |
635 | 352 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
636 | 353 |
false, false, false), null, null, null, null); |
637 |
updateDocid(newdocid + ".7", testdocument, FAILURE, true);
|
|
354 |
updateDocumentId(newdocid + ".7", testdocument, FAILURE, true);
|
|
638 | 355 |
// fails to delete the document |
639 |
deleteDocid(newdocid + ".6", FAILURE, true);
|
|
356 |
deleteDocumentId(newdocid + ".6", FAILURE, true);
|
|
640 | 357 |
// logout |
641 | 358 |
debug("logging out"); |
642 | 359 |
m.logout(); |
... | ... | |
662 | 379 |
// login |
663 | 380 |
debug("logging in as: username=" + username + " password=" + password); |
664 | 381 |
m.login(username, password); |
665 |
updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
|
|
382 |
updateDocumentId(newdocid + ".7", testdocument, SUCCESS, false);
|
|
666 | 383 |
debug("logging out"); |
667 | 384 |
m.logout(); |
668 | 385 |
// login as another user |
... | ... | |
670 | 387 |
+ anotherpassword); |
671 | 388 |
m.login(anotheruser, anotherpassword); |
672 | 389 |
// fails to read this document |
673 |
readDocidWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
|
|
390 |
readDocumentIdWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
|
|
674 | 391 |
// fails to update this document |
675 |
updateDocid(newdocid + ".8", testdocument, FAILURE, true);
|
|
392 |
updateDocumentId(newdocid + ".8", testdocument, FAILURE, true);
|
|
676 | 393 |
// fails to update access part |
677 | 394 |
testdocument = getTestEmlDoc( |
678 | 395 |
"Testing user can not read, write and delete a document", emlVersion, |
679 | 396 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
680 | 397 |
false, false, false), null, null, null, null); |
681 |
updateDocid(newdocid + ".8", testdocument, FAILURE, true);
|
|
398 |
updateDocumentId(newdocid + ".8", testdocument, FAILURE, true);
|
|
682 | 399 |
// fails to delete the document |
683 |
deleteDocid(newdocid + ".7", FAILURE, true);
|
|
400 |
deleteDocumentId(newdocid + ".7", FAILURE, true);
|
|
684 | 401 |
// logout |
685 | 402 |
debug("logging out"); |
686 | 403 |
m.logout(); |
... | ... | |
706 | 423 |
// login |
707 | 424 |
debug("logging in as: username=" + username + " password=" + password); |
708 | 425 |
m.login(username, password); |
709 |
updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
|
|
426 |
updateDocumentId(newdocid + ".8", testdocument, SUCCESS, false);
|
|
710 | 427 |
debug("logging out"); |
711 | 428 |
m.logout(); |
712 | 429 |
// login as another user |
... | ... | |
714 | 431 |
+ anotherpassword); |
715 | 432 |
m.login(anotheruser, anotherpassword); |
716 | 433 |
// fails to read this document |
717 |
readDocidWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
|
|
434 |
readDocumentIdWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
|
|
718 | 435 |
// fails to update this document |
719 |
updateDocid(newdocid + ".9", testdocument, FAILURE, true);
|
|
436 |
updateDocumentId(newdocid + ".9", testdocument, FAILURE, true);
|
|
720 | 437 |
// fails to update access part |
721 | 438 |
testdocument = getTestEmlDoc( |
722 | 439 |
"Testing user can not read, write and delete a document", emlVersion, |
723 | 440 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
724 | 441 |
false, false, false), null, null, null, null); |
725 |
updateDocid(newdocid + ".9", testdocument, FAILURE, true);
|
|
442 |
updateDocumentId(newdocid + ".9", testdocument, FAILURE, true);
|
|
726 | 443 |
// fails to delete the document |
727 |
deleteDocid(newdocid + ".8", FAILURE, true);
|
|
444 |
deleteDocumentId(newdocid + ".8", FAILURE, true);
|
|
728 | 445 |
// logout |
729 | 446 |
debug("logging out"); |
730 | 447 |
m.logout(); |
... | ... | |
749 | 466 |
// login |
750 | 467 |
debug("logging in as: username=" + username + " password=" + password); |
751 | 468 |
m.login(username, password); |
752 |
updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
|
|
469 |
updateDocumentId(newdocid + ".9", testdocument, SUCCESS, false);
|
|
753 | 470 |
debug("logging out"); |
754 | 471 |
m.logout(); |
755 | 472 |
// login as another user |
... | ... | |
757 | 474 |
+ anotherpassword); |
758 | 475 |
m.login(anotheruser, anotherpassword); |
759 | 476 |
// fails to read this document |
760 |
readDocidWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
|
|
477 |
readDocumentIdWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
|
|
761 | 478 |
// fails to update this document |
762 |
updateDocid(newdocid + ".10", testdocument, FAILURE, true);
|
|
479 |
updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
|
|
763 | 480 |
// fails to update access part |
764 | 481 |
testdocument = getTestEmlDoc( |
765 | 482 |
"Testing user can not read, write and delete a document", emlVersion, |
766 | 483 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
767 | 484 |
false, false, false), null, null, null, null); |
768 |
updateDocid(newdocid + ".10", testdocument, FAILURE, true);
|
|
485 |
updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
|
|
769 | 486 |
// fails to delete the document |
770 |
deleteDocid(newdocid + ".9", FAILURE, true);
|
|
487 |
deleteDocumentId(newdocid + ".9", FAILURE, true);
|
|
771 | 488 |
// logout |
772 | 489 |
debug("logging out"); |
773 | 490 |
m.logout(); |
... | ... | |
793 | 510 |
// login |
794 | 511 |
debug("logging in as: username=" + username + " password=" + password); |
795 | 512 |
m.login(username, password); |
796 |
updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
|
|
513 |
updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
|
|
797 | 514 |
debug("logging out"); |
798 | 515 |
m.logout(); |
799 | 516 |
// login as another user |
... | ... | |
801 | 518 |
+ anotherpassword); |
802 | 519 |
m.login(anotheruser, anotherpassword); |
803 | 520 |
// succeed to read this document |
804 |
readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
521 |
readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
805 | 522 |
// fails to update this document |
806 |
updateDocid(newdocid + ".11", testdocument, FAILURE, true);
|
|
523 |
updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
|
|
807 | 524 |
// fails to update access part |
808 | 525 |
testdocument = getTestEmlDoc( |
809 | 526 |
"Testing user can not read, write and delete a document", emlVersion, |
810 | 527 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
811 | 528 |
false, false, false), null, null, null, null); |
812 |
updateDocid(newdocid + ".11", testdocument, FAILURE, true);
|
|
529 |
updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
|
|
813 | 530 |
// fails to delete the document |
814 |
deleteDocid(newdocid + ".10", FAILURE, true);
|
|
531 |
deleteDocumentId(newdocid + ".10", FAILURE, true);
|
|
815 | 532 |
// logout |
816 | 533 |
debug("logging out"); |
817 | 534 |
m.logout(); |
... | ... | |
837 | 554 |
// login |
838 | 555 |
debug("logging in as: username=" + username + " password=" + password); |
839 | 556 |
m.login(username, password); |
840 |
updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
|
|
557 |
updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
|
|
841 | 558 |
debug("logging out"); |
842 | 559 |
m.logout(); |
843 | 560 |
// login as another user |
... | ... | |
845 | 562 |
+ anotherpassword); |
846 | 563 |
m.login(anotheruser, anotherpassword); |
847 | 564 |
// fails to read this document |
848 |
readDocidWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
|
|
565 |
readDocumentIdWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
|
|
849 | 566 |
// succeed to update this document |
850 |
updateDocid(newdocid + ".12", testdocument, SUCCESS, false);
|
|
567 |
updateDocumentId(newdocid + ".12", testdocument, SUCCESS, false);
|
|
851 | 568 |
// fails to update access part |
852 | 569 |
testdocument = getTestEmlDoc( |
853 | 570 |
"Testing user can not read, write and delete a document", emlVersion, |
854 | 571 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
855 | 572 |
false, false, false), null, null, null, null); |
856 |
updateDocid(newdocid + ".13", testdocument, FAILURE, true);
|
|
573 |
updateDocumentId(newdocid + ".13", testdocument, FAILURE, true);
|
|
857 | 574 |
// fails to delete the document |
858 |
deleteDocid(newdocid + ".12", FAILURE, true);
|
|
575 |
deleteDocumentId(newdocid + ".12", FAILURE, true);
|
|
859 | 576 |
// logout |
860 | 577 |
debug("logging out"); |
861 | 578 |
m.logout(); |
... | ... | |
928 | 645 |
try { |
929 | 646 |
debug("\nRunning: test210AllowFirst test"); |
930 | 647 |
String emlVersion = EML2_1_0; |
931 |
newdocid = generateDocid();
|
|
648 |
newdocid = generateDocumentId();
|
|
932 | 649 |
// ====1 inserts a document with access rules (allowFirst) - allow |
933 | 650 |
// READ rule for another user, |
934 | 651 |
// deny READ rule for public. |
... | ... | |
947 | 664 |
// login |
948 | 665 |
debug("logging in as: username=" + username + " password=" + password); |
949 | 666 |
m.login(username, password); |
950 |
insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
|
|
667 |
insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
|
|
951 | 668 |
debug("logging out"); |
952 | 669 |
m.logout(); |
953 | 670 |
// login as another user |
... | ... | |
955 | 672 |
+ anotherpassword); |
956 | 673 |
m.login(anotheruser, anotherpassword); |
957 | 674 |
// fails to read this document |
958 |
readDocidWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
|
|
675 |
readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
|
|
959 | 676 |
// fails to update this document |
960 |
updateDocid(newdocid + ".2", testdocument, FAILURE, true);
|
|
677 |
updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
|
|
961 | 678 |
// fails to update access part |
962 | 679 |
testdocument = getTestEmlDoc( |
963 | 680 |
"Testing user can not read, write and delete a document", emlVersion, |
964 | 681 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
965 | 682 |
false, false, false), null, null, null, null); |
966 |
updateDocid(newdocid + ".2", testdocument, FAILURE, true);
|
|
683 |
updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
|
|
967 | 684 |
// fails to delete the document |
968 |
deleteDocid(newdocid + ".1", FAILURE, true);
|
|
685 |
deleteDocumentId(newdocid + ".1", FAILURE, true);
|
|
969 | 686 |
// logout |
970 | 687 |
debug("logging out"); |
971 | 688 |
m.logout(); |
... | ... | |
987 | 704 |
// login |
988 | 705 |
debug("logging in as: username=" + username + " password=" + password); |
989 | 706 |
m.login(username, password); |
990 |
updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
|
|
707 |
updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
|
|
991 | 708 |
debug("logging out"); |
992 | 709 |
m.logout(); |
993 | 710 |
// login as another user |
... | ... | |
995 | 712 |
+ anotherpassword); |
996 | 713 |
m.login(anotheruser, anotherpassword); |
997 | 714 |
// fails to read this document |
998 |
readDocidWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
|
|
715 |
readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
|
|
999 | 716 |
// fails to update this document |
1000 |
updateDocid(newdocid + ".3", testdocument, FAILURE, true);
|
|
717 |
updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
|
|
1001 | 718 |
// fails to update access part |
1002 | 719 |
testdocument = getTestEmlDoc( |
1003 | 720 |
"Testing user can not read, write and delete a document", emlVersion, |
1004 | 721 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1005 | 722 |
false, false, false), null, null, null, null); |
1006 |
updateDocid(newdocid + ".3", testdocument, FAILURE, true);
|
|
723 |
updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
|
|
1007 | 724 |
// fails to delete the document |
1008 |
deleteDocid(newdocid + ".2", FAILURE, true);
|
|
725 |
deleteDocumentId(newdocid + ".2", FAILURE, true);
|
|
1009 | 726 |
// logout |
1010 | 727 |
debug("logging out"); |
1011 | 728 |
m.logout(); |
... | ... | |
1026 | 743 |
// login |
1027 | 744 |
debug("logging in as: username=" + username + " password=" + password); |
1028 | 745 |
m.login(username, password); |
1029 |
updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
|
|
746 |
updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
|
|
1030 | 747 |
debug("logging out"); |
1031 | 748 |
m.logout(); |
1032 | 749 |
// login as another user |
... | ... | |
1034 | 751 |
+ anotherpassword); |
1035 | 752 |
m.login(anotheruser, anotherpassword); |
1036 | 753 |
// fails to read this document |
1037 |
readDocidWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
|
|
754 |
readDocumentIdWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
|
|
1038 | 755 |
// fails to update this document |
1039 |
updateDocid(newdocid + ".4", testdocument, FAILURE, true);
|
|
756 |
updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
|
|
1040 | 757 |
// fails to update access part |
1041 | 758 |
testdocument = getTestEmlDoc( |
1042 | 759 |
"Testing user can not read, write and delete a document", emlVersion, |
1043 | 760 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1044 | 761 |
false, false, false), null, null, null, null); |
1045 |
updateDocid(newdocid + ".4", testdocument, FAILURE, true);
|
|
762 |
updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
|
|
1046 | 763 |
// fails to delete the document |
1047 |
deleteDocid(newdocid + ".3", FAILURE, true);
|
|
764 |
deleteDocumentId(newdocid + ".3", FAILURE, true);
|
|
1048 | 765 |
// logout |
1049 | 766 |
debug("logging out"); |
1050 | 767 |
m.logout(); |
... | ... | |
1067 | 784 |
// login |
1068 | 785 |
debug("logging in as: username=" + username + " password=" + password); |
1069 | 786 |
m.login(username, password); |
1070 |
updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
|
|
787 |
updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
|
|
1071 | 788 |
m.logout(); |
1072 | 789 |
debug("logging out"); |
1073 | 790 |
// login as another user |
... | ... | |
1075 | 792 |
+ anotherpassword); |
1076 | 793 |
m.login(anotheruser, anotherpassword); |
1077 | 794 |
// fails to read this document |
1078 |
readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
|
|
795 |
readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
|
|
1079 | 796 |
// fails to update this document |
1080 |
updateDocid(newdocid + ".5", testdocument, FAILURE, true);
|
|
797 |
updateDocumentId(newdocid + ".5", testdocument, FAILURE, true);
|
|
1081 | 798 |
// fails to update access part |
1082 | 799 |
testdocument = getTestEmlDoc( |
1083 | 800 |
"Testing user can not read, write and delete a document", emlVersion, |
1084 | 801 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1085 | 802 |
false, false, false), null, null, null, null); |
1086 |
updateDocid(newdocid + ".5", testdocument, FAILURE, true);
|
|
803 |
updateDocumentId(newdocid + ".5", testdocument, FAILURE, true);
|
|
1087 | 804 |
// fails to delete the document |
1088 |
deleteDocid(newdocid + ".4", FAILURE, true);
|
|
805 |
deleteDocumentId(newdocid + ".4", FAILURE, true);
|
|
1089 | 806 |
// logout |
1090 | 807 |
m.logout(); |
1091 | 808 |
|
... | ... | |
1107 | 824 |
// login |
1108 | 825 |
debug("logging in as: username=" + username + " password=" + password); |
1109 | 826 |
m.login(username, password); |
1110 |
updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
|
|
827 |
updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
|
|
1111 | 828 |
debug("logging out"); |
1112 | 829 |
m.logout(); |
1113 | 830 |
// login as another user |
... | ... | |
1115 | 832 |
+ anotherpassword); |
1116 | 833 |
m.login(anotheruser, anotherpassword); |
1117 | 834 |
// fails to read this document |
1118 |
readDocidWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
|
|
835 |
readDocumentIdWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
|
|
1119 | 836 |
// fails to update this document |
1120 |
updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
|
|
837 |
updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
|
|
1121 | 838 |
// fails to update access part |
1122 | 839 |
testdocument = getTestEmlDoc( |
1123 | 840 |
"Testing user can not read, write and delete a document", emlVersion, |
1124 | 841 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1125 | 842 |
false, false, false), null, null, null, null); |
1126 |
updateDocid(newdocid + ".7", testdocument, FAILURE, true);
|
|
843 |
updateDocumentId(newdocid + ".7", testdocument, FAILURE, true);
|
|
1127 | 844 |
// fails to delete the document |
1128 |
deleteDocid(newdocid + ".6", FAILURE, true);
|
|
845 |
deleteDocumentId(newdocid + ".6", FAILURE, true);
|
|
1129 | 846 |
// logout |
1130 | 847 |
debug("logging out"); |
1131 | 848 |
m.logout(); |
... | ... | |
1151 | 868 |
// login |
1152 | 869 |
debug("logging in as: username=" + username + " password=" + password); |
1153 | 870 |
m.login(username, password); |
1154 |
updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
|
|
871 |
updateDocumentId(newdocid + ".7", testdocument, SUCCESS, false);
|
|
1155 | 872 |
debug("logging out"); |
1156 | 873 |
m.logout(); |
1157 | 874 |
// login as another user |
... | ... | |
1159 | 876 |
+ anotherpassword); |
1160 | 877 |
m.login(anotheruser, anotherpassword); |
1161 | 878 |
// fails to read this document |
1162 |
readDocidWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
|
|
879 |
readDocumentIdWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
|
|
1163 | 880 |
// fails to update this document |
1164 |
updateDocid(newdocid + ".8", testdocument, FAILURE, true);
|
|
881 |
updateDocumentId(newdocid + ".8", testdocument, FAILURE, true);
|
|
1165 | 882 |
// fails to update access part |
1166 | 883 |
testdocument = getTestEmlDoc( |
1167 | 884 |
"Testing user can not read, write and delete a document", emlVersion, |
1168 | 885 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1169 | 886 |
false, false, false), null, null, null, null); |
1170 |
updateDocid(newdocid + ".8", testdocument, FAILURE, true);
|
|
887 |
updateDocumentId(newdocid + ".8", testdocument, FAILURE, true);
|
|
1171 | 888 |
// fails to delete the document |
1172 |
deleteDocid(newdocid + ".7", FAILURE, true);
|
|
889 |
deleteDocumentId(newdocid + ".7", FAILURE, true);
|
|
1173 | 890 |
// logout |
1174 | 891 |
debug("logging out"); |
1175 | 892 |
m.logout(); |
... | ... | |
1195 | 912 |
// login |
1196 | 913 |
debug("logging in as: username=" + username + " password=" + password); |
1197 | 914 |
m.login(username, password); |
1198 |
updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
|
|
915 |
updateDocumentId(newdocid + ".8", testdocument, SUCCESS, false);
|
|
1199 | 916 |
debug("logging out"); |
1200 | 917 |
m.logout(); |
1201 | 918 |
// login as another user |
... | ... | |
1203 | 920 |
+ anotherpassword); |
1204 | 921 |
m.login(anotheruser, anotherpassword); |
1205 | 922 |
// fails to read this document |
1206 |
readDocidWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
|
|
923 |
readDocumentIdWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
|
|
1207 | 924 |
// fails to update this document |
1208 |
updateDocid(newdocid + ".9", testdocument, FAILURE, true);
|
|
925 |
updateDocumentId(newdocid + ".9", testdocument, FAILURE, true);
|
|
1209 | 926 |
// fails to update access part |
1210 | 927 |
testdocument = getTestEmlDoc( |
1211 | 928 |
"Testing user can not read, write and delete a document", emlVersion, |
1212 | 929 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1213 | 930 |
false, false, false), null, null, null, null); |
1214 |
updateDocid(newdocid + ".9", testdocument, FAILURE, true);
|
|
931 |
updateDocumentId(newdocid + ".9", testdocument, FAILURE, true);
|
|
1215 | 932 |
// fails to delete the document |
1216 |
deleteDocid(newdocid + ".8", FAILURE, true);
|
|
933 |
deleteDocumentId(newdocid + ".8", FAILURE, true);
|
|
1217 | 934 |
// logout |
1218 | 935 |
debug("logging out"); |
1219 | 936 |
m.logout(); |
... | ... | |
1238 | 955 |
// login |
1239 | 956 |
debug("logging in as: username=" + username + " password=" + password); |
1240 | 957 |
m.login(username, password); |
1241 |
updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
|
|
958 |
updateDocumentId(newdocid + ".9", testdocument, SUCCESS, false);
|
|
1242 | 959 |
debug("logging out"); |
1243 | 960 |
m.logout(); |
1244 | 961 |
// login as another user |
... | ... | |
1246 | 963 |
+ anotherpassword); |
1247 | 964 |
m.login(anotheruser, anotherpassword); |
1248 | 965 |
// fails to read this document |
1249 |
readDocidWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
|
|
966 |
readDocumentIdWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
|
|
1250 | 967 |
// fails to update this document |
1251 |
updateDocid(newdocid + ".10", testdocument, FAILURE, true);
|
|
968 |
updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
|
|
1252 | 969 |
// fails to update access part |
1253 | 970 |
testdocument = getTestEmlDoc( |
1254 | 971 |
"Testing user can not read, write and delete a document", emlVersion, |
1255 | 972 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1256 | 973 |
false, false, false), null, null, null, null); |
1257 |
updateDocid(newdocid + ".10", testdocument, FAILURE, true);
|
|
974 |
updateDocumentId(newdocid + ".10", testdocument, FAILURE, true);
|
|
1258 | 975 |
// fails to delete the document |
1259 |
deleteDocid(newdocid + ".9", FAILURE, true);
|
|
976 |
deleteDocumentId(newdocid + ".9", FAILURE, true);
|
|
1260 | 977 |
// logout |
1261 | 978 |
debug("logging out"); |
1262 | 979 |
m.logout(); |
... | ... | |
1282 | 999 |
// login |
1283 | 1000 |
debug("logging in as: username=" + username + " password=" + password); |
1284 | 1001 |
m.login(username, password); |
1285 |
updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1002 |
updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1286 | 1003 |
debug("logging out"); |
1287 | 1004 |
m.logout(); |
1288 | 1005 |
// login as another user |
... | ... | |
1290 | 1007 |
+ anotherpassword); |
1291 | 1008 |
m.login(anotheruser, anotherpassword); |
1292 | 1009 |
// succeed to read this document |
1293 |
readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1010 |
readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1294 | 1011 |
// fails to update this document |
1295 |
updateDocid(newdocid + ".11", testdocument, FAILURE, true);
|
|
1012 |
updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
|
|
1296 | 1013 |
// fails to update access part |
1297 | 1014 |
testdocument = getTestEmlDoc( |
1298 | 1015 |
"Testing user can not read, write and delete a document", emlVersion, |
1299 | 1016 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1300 | 1017 |
false, false, false), null, null, null, null); |
1301 |
updateDocid(newdocid + ".11", testdocument, FAILURE, true);
|
|
1018 |
updateDocumentId(newdocid + ".11", testdocument, FAILURE, true);
|
|
1302 | 1019 |
// fails to delete the document |
1303 |
deleteDocid(newdocid + ".10", FAILURE, true);
|
|
1020 |
deleteDocumentId(newdocid + ".10", FAILURE, true);
|
|
1304 | 1021 |
// logout |
1305 | 1022 |
debug("logging out"); |
1306 | 1023 |
m.logout(); |
... | ... | |
1326 | 1043 |
// login |
1327 | 1044 |
debug("logging in as: username=" + username + " password=" + password); |
1328 | 1045 |
m.login(username, password); |
1329 |
updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
|
|
1046 |
updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
|
|
1330 | 1047 |
debug("logging out"); |
1331 | 1048 |
m.logout(); |
1332 | 1049 |
// login as another user |
... | ... | |
1334 | 1051 |
+ anotherpassword); |
1335 | 1052 |
m.login(anotheruser, anotherpassword); |
1336 | 1053 |
// fails to read this document |
1337 |
readDocidWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
|
|
1054 |
readDocumentIdWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
|
|
1338 | 1055 |
// succeed to update this document |
1339 |
updateDocid(newdocid + ".12", testdocument, SUCCESS, false);
|
|
1056 |
updateDocumentId(newdocid + ".12", testdocument, SUCCESS, false);
|
|
1340 | 1057 |
// fails to update access part |
1341 | 1058 |
testdocument = getTestEmlDoc( |
1342 | 1059 |
"Testing user can not read, write and delete a document", emlVersion, |
1343 | 1060 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1344 | 1061 |
false, false, false), null, null, null, null); |
1345 |
updateDocid(newdocid + ".13", testdocument, FAILURE, true);
|
|
1062 |
updateDocumentId(newdocid + ".13", testdocument, FAILURE, true);
|
|
1346 | 1063 |
// fails to delete the document |
1347 |
deleteDocid(newdocid + ".12", FAILURE, true);
|
|
1064 |
deleteDocumentId(newdocid + ".12", FAILURE, true);
|
|
1348 | 1065 |
// logout |
1349 | 1066 |
debug("logging out"); |
1350 | 1067 |
m.logout(); |
... | ... | |
1418 | 1135 |
debug("\nRunning: test201DenyFirst()"); |
1419 | 1136 |
String emlVersion = EML2_0_1; |
1420 | 1137 |
try { |
1421 |
newdocid = generateDocid();
|
|
1138 |
newdocid = generateDocumentId();
|
|
1422 | 1139 |
// ====1 inserts a document with access rules (denyFirst) - allow |
1423 | 1140 |
// READ rule for another user, |
1424 | 1141 |
// deny READ rule for public. |
... | ... | |
1437 | 1154 |
// login |
1438 | 1155 |
debug("logging in as: username=" + username + " password=" + password); |
1439 | 1156 |
m.login(username, password); |
1440 |
insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1157 |
insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1441 | 1158 |
debug("logging out"); |
1442 | 1159 |
m.logout(); |
1443 | 1160 |
// login as another user |
... | ... | |
1445 | 1162 |
+ anotherpassword); |
1446 | 1163 |
m.login(anotheruser, anotherpassword); |
1447 | 1164 |
// succeeds to read this document |
1448 |
readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1165 |
readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1449 | 1166 |
// fails to update this document |
1450 |
updateDocid(newdocid + ".2", testdocument, FAILURE, true);
|
|
1167 |
updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
|
|
1451 | 1168 |
// fails to update access part |
1452 | 1169 |
testdocument = getTestEmlDoc( |
1453 | 1170 |
"Testing user can not read, write and delete a document", emlVersion, |
1454 | 1171 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1455 | 1172 |
false, false, false), null, null, null, null); |
1456 |
updateDocid(newdocid + ".2", testdocument, FAILURE, true);
|
|
1173 |
updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
|
|
1457 | 1174 |
// fails to delete the document |
1458 |
deleteDocid(newdocid + ".1", FAILURE, true);
|
|
1175 |
deleteDocumentId(newdocid + ".1", FAILURE, true);
|
|
1459 | 1176 |
// logout |
1460 | 1177 |
debug("logging out"); |
1461 | 1178 |
m.logout(); |
... | ... | |
1477 | 1194 |
// login |
1478 | 1195 |
debug("logging in as: username=" + username + " password=" + password); |
1479 | 1196 |
m.login(username, password); |
1480 |
updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1197 |
updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1481 | 1198 |
debug("logging out"); |
1482 | 1199 |
m.logout(); |
1483 | 1200 |
// login as another user |
... | ... | |
1485 | 1202 |
+ anotherpassword); |
1486 | 1203 |
m.login(anotheruser, anotherpassword); |
1487 | 1204 |
// succeeds to read this document |
1488 |
readDocidWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1205 |
readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1489 | 1206 |
// succeeds to update this document |
1490 |
updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
|
|
1207 |
updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
|
|
1491 | 1208 |
// fails to update access part |
1492 | 1209 |
testdocument = getTestEmlDoc( |
1493 | 1210 |
"Testing user can not read, write and delete a document", emlVersion, |
1494 | 1211 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1495 | 1212 |
false, false, false), null, null, null, null); |
1496 |
updateDocid(newdocid + ".4", testdocument, FAILURE, true);
|
|
1213 |
updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
|
|
1497 | 1214 |
// fails to delete the document |
1498 |
deleteDocid(newdocid + ".3", FAILURE, true);
|
|
1215 |
deleteDocumentId(newdocid + ".3", FAILURE, true);
|
|
1499 | 1216 |
// logout |
1500 | 1217 |
debug("logging out"); |
1501 | 1218 |
m.logout(); |
... | ... | |
1516 | 1233 |
// login |
1517 | 1234 |
debug("logging in as: username=" + username + " password=" + password); |
1518 | 1235 |
m.login(username, password); |
1519 |
updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
|
|
1236 |
updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
|
|
1520 | 1237 |
debug("logging out"); |
1521 | 1238 |
m.logout(); |
1522 | 1239 |
// login as another user |
... | ... | |
1524 | 1241 |
+ anotherpassword); |
1525 | 1242 |
m.login(anotheruser, anotherpassword); |
1526 | 1243 |
// succeeds to read this document |
1527 |
readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
|
|
1244 |
readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
|
|
1528 | 1245 |
// succeeds to update this document |
1529 |
updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
|
|
1246 |
updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
|
|
1530 | 1247 |
// succeed to update access part |
1531 | 1248 |
testdocument = getTestEmlDoc( |
1532 | 1249 |
"Testing user can not read, write and delete a document", emlVersion, |
1533 | 1250 |
null, null, null, null, getAccessBlock(anotheruser, true, true, true, |
1534 | 1251 |
true, true), null, null, null, null); |
1535 |
updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
|
|
1252 |
updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
|
|
1536 | 1253 |
// succeeds to delete the document |
1537 |
deleteDocid(newdocid + ".6", SUCCESS, false);
|
|
1254 |
deleteDocumentId(newdocid + ".6", SUCCESS, false);
|
|
1538 | 1255 |
// logout |
1539 | 1256 |
debug("logging out"); |
1540 | 1257 |
m.logout(); |
1541 | 1258 |
|
1542 |
newdocid = generateDocid();
|
|
1259 |
newdocid = generateDocumentId();
|
|
1543 | 1260 |
// ====4 The user updates this documents with access rules |
1544 | 1261 |
// (denyFirst) - allow READ and WRITE |
1545 | 1262 |
// rule for another user, deny WRITE rule for public. |
... | ... | |
1558 | 1275 |
// login |
1559 | 1276 |
debug("logging in as: username=" + username + " password=" + password); |
1560 | 1277 |
m.login(username, password); |
1561 |
insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1278 |
insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1562 | 1279 |
debug("logging out"); |
1563 | 1280 |
m.logout(); |
1564 | 1281 |
// login as another user |
... | ... | |
1566 | 1283 |
+ anotherpassword); |
1567 | 1284 |
m.login(anotheruser, anotherpassword); |
1568 | 1285 |
// succeeds to read this document |
1569 |
readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1286 |
readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1570 | 1287 |
// succeeds to update this document |
1571 |
updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1288 |
updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1572 | 1289 |
// fails to update access part |
1573 | 1290 |
testdocument = getTestEmlDoc( |
1574 | 1291 |
"Testing user can not read, write and delete a document", emlVersion, |
1575 | 1292 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1576 | 1293 |
false, false, false), null, null, null, null); |
1577 |
updateDocid(newdocid + ".3", testdocument, FAILURE, true);
|
|
1294 |
updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
|
|
1578 | 1295 |
// fails to delete the document |
1579 |
deleteDocid(newdocid + ".2", FAILURE, true);
|
|
1296 |
deleteDocumentId(newdocid + ".2", FAILURE, true);
|
|
1580 | 1297 |
// logout |
1581 | 1298 |
debug("logging out"); |
1582 | 1299 |
m.logout(); |
... | ... | |
1599 | 1316 |
// login |
1600 | 1317 |
debug("logging in as: username=" + username + " password=" + password); |
1601 | 1318 |
m.login(username, password); |
1602 |
updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1319 |
updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1603 | 1320 |
debug("logging out"); |
1604 | 1321 |
m.logout(); |
1605 | 1322 |
// login as another user |
... | ... | |
1607 | 1324 |
+ anotherpassword); |
1608 | 1325 |
m.login(anotheruser, anotherpassword); |
1609 | 1326 |
// succeeds to read this document |
1610 |
readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1327 |
readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1611 | 1328 |
// succeed to update this document |
1612 |
updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
|
|
1329 |
updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
|
|
1613 | 1330 |
// fails to update access part |
1614 | 1331 |
testdocument = getTestEmlDoc( |
1615 | 1332 |
"Testing user can not read, write and delete a document", emlVersion, |
1616 | 1333 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1617 | 1334 |
false, false, false), null, null, null, null); |
1618 |
updateDocid(newdocid + ".12", testdocument, FAILURE, true);
|
|
1335 |
updateDocumentId(newdocid + ".12", testdocument, FAILURE, true);
|
|
1619 | 1336 |
// fails to delete the document |
1620 |
deleteDocid(newdocid + ".12", FAILURE, true);
|
|
1337 |
deleteDocumentId(newdocid + ".12", FAILURE, true);
|
|
1621 | 1338 |
// logout |
1622 | 1339 |
debug("logging out"); |
1623 | 1340 |
m.logout(); |
... | ... | |
1643 | 1360 |
// login |
1644 | 1361 |
debug("logging in as: username=" + username + " password=" + password); |
1645 | 1362 |
m.login(username, password); |
1646 |
updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
|
|
1363 |
updateDocumentId(newdocid + ".13", testdocument, SUCCESS, false);
|
|
1647 | 1364 |
debug("logging out"); |
1648 | 1365 |
m.logout(); |
1649 | 1366 |
// login as another user |
... | ... | |
1651 | 1368 |
+ anotherpassword); |
1652 | 1369 |
m.login(anotheruser, anotherpassword); |
1653 | 1370 |
// succeeds to read this document |
1654 |
readDocidWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
|
|
1371 |
readDocumentIdWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
|
|
1655 | 1372 |
// fails to update this document |
1656 |
updateDocid(newdocid + ".14", testdocument, FAILURE, true);
|
|
1373 |
updateDocumentId(newdocid + ".14", testdocument, FAILURE, true);
|
|
1657 | 1374 |
// fails to update access part |
1658 | 1375 |
testdocument = getTestEmlDoc( |
1659 | 1376 |
"Testing user can not read, write and delete a document", emlVersion, |
1660 | 1377 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1661 | 1378 |
false, false, false), null, null, null, null); |
1662 |
updateDocid(newdocid + ".14", testdocument, FAILURE, true);
|
|
1379 |
updateDocumentId(newdocid + ".14", testdocument, FAILURE, true);
|
|
1663 | 1380 |
// fails to delete the document |
1664 |
deleteDocid(newdocid + ".13", FAILURE, true);
|
|
1381 |
deleteDocumentId(newdocid + ".13", FAILURE, true);
|
|
1665 | 1382 |
// logout |
1666 | 1383 |
debug("logging out"); |
1667 | 1384 |
m.logout(); |
... | ... | |
1687 | 1404 |
// login |
1688 | 1405 |
debug("logging in as: username=" + username + " password=" + password); |
1689 | 1406 |
m.login(username, password); |
1690 |
updateDocid(newdocid + ".14", testdocument, SUCCESS, false);
|
|
1407 |
updateDocumentId(newdocid + ".14", testdocument, SUCCESS, false);
|
|
1691 | 1408 |
debug("logging out"); |
1692 | 1409 |
m.logout(); |
1693 | 1410 |
// login as another user |
... | ... | |
1695 | 1412 |
+ anotherpassword); |
1696 | 1413 |
m.login(anotheruser, anotherpassword); |
1697 | 1414 |
// succeeds to read this document |
1698 |
readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
|
|
1415 |
readDocumentIdWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
|
|
1699 | 1416 |
// succeeds to update this document |
1700 |
updateDocid(newdocid + ".15", testdocument, SUCCESS, false);
|
|
1417 |
updateDocumentId(newdocid + ".15", testdocument, SUCCESS, false);
|
|
1701 | 1418 |
// fails to update access part |
1702 | 1419 |
testdocument = getTestEmlDoc( |
1703 | 1420 |
"Testing user can not read, write and delete a document", emlVersion, |
1704 | 1421 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1705 | 1422 |
false, false, false), null, null, null, null); |
1706 |
updateDocid(newdocid + ".16", testdocument, FAILURE, true);
|
|
1423 |
updateDocumentId(newdocid + ".16", testdocument, FAILURE, true);
|
|
1707 | 1424 |
// fails to delete the document |
1708 |
deleteDocid(newdocid + ".15", FAILURE, true);
|
|
1425 |
deleteDocumentId(newdocid + ".15", FAILURE, true);
|
|
1709 | 1426 |
// logout |
1710 | 1427 |
debug("logging out"); |
1711 | 1428 |
m.logout(); |
... | ... | |
1730 | 1447 |
// login |
1731 | 1448 |
debug("logging in as: username=" + username + " password=" + password); |
1732 | 1449 |
m.login(username, password); |
1733 |
updateDocid(newdocid + ".16", testdocument, SUCCESS, false);
|
|
1450 |
updateDocumentId(newdocid + ".16", testdocument, SUCCESS, false);
|
|
1734 | 1451 |
debug("logging out"); |
1735 | 1452 |
m.logout(); |
1736 | 1453 |
// login as another user |
... | ... | |
1738 | 1455 |
+ anotherpassword); |
1739 | 1456 |
m.login(anotheruser, anotherpassword); |
1740 | 1457 |
// succeeds to read this document |
1741 |
readDocidWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
|
|
1458 |
readDocumentIdWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
|
|
1742 | 1459 |
// succeeds to update this document |
1743 |
updateDocid(newdocid + ".17", testdocument, SUCCESS, false);
|
|
1460 |
updateDocumentId(newdocid + ".17", testdocument, SUCCESS, false);
|
|
1744 | 1461 |
// succeeds to update access part |
1745 | 1462 |
testdocument = getTestEmlDoc( |
1746 | 1463 |
"Testing user can not read, write and delete a document", emlVersion, |
1747 | 1464 |
null, null, null, null, getAccessBlock(anotheruser, true, true, true, |
1748 | 1465 |
true, true), null, null, null, null); |
1749 |
updateDocid(newdocid + ".18", testdocument, SUCCESS, false);
|
|
1466 |
updateDocumentId(newdocid + ".18", testdocument, SUCCESS, false);
|
|
1750 | 1467 |
// succeeds to delete the document |
1751 |
deleteDocid(newdocid + ".18", SUCCESS, false);
|
|
1468 |
deleteDocumentId(newdocid + ".18", SUCCESS, false);
|
|
1752 | 1469 |
// logout |
1753 | 1470 |
debug("logging out"); |
1754 | 1471 |
m.logout(); |
1755 | 1472 |
|
1756 |
newdocid = generateDocid();
|
|
1473 |
newdocid = generateDocumentId();
|
|
1757 | 1474 |
// ====9 The user updates this documents with access rules |
1758 | 1475 |
// (denyFirst) - allow READ and WRITE |
1759 | 1476 |
// rule for another user, deny WRITE rule for a group |
... | ... | |
1775 | 1492 |
// login |
1776 | 1493 |
debug("logging in as: username=" + username + " password=" + password); |
1777 | 1494 |
m.login(username, password); |
1778 |
insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1495 |
insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1779 | 1496 |
debug("logging out"); |
1780 | 1497 |
m.logout(); |
1781 | 1498 |
// login as another user |
... | ... | |
1783 | 1500 |
+ anotherpassword); |
1784 | 1501 |
m.login(anotheruser, anotherpassword); |
1785 | 1502 |
// succeed to read this document |
1786 |
readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1503 |
readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1787 | 1504 |
// succeeds to update this document |
1788 |
updateDocid(newdocid + ".20", testdocument, SUCCESS, false);
|
|
1505 |
updateDocumentId(newdocid + ".20", testdocument, SUCCESS, false);
|
|
1789 | 1506 |
// fails to update access part |
1790 | 1507 |
testdocument = getTestEmlDoc( |
1791 | 1508 |
"Testing user can not read, write and delete a document", emlVersion, |
1792 | 1509 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1793 | 1510 |
false, false, false), null, null, null, null); |
1794 |
updateDocid(newdocid + ".21", testdocument, FAILURE, true);
|
|
1511 |
updateDocumentId(newdocid + ".21", testdocument, FAILURE, true);
|
|
1795 | 1512 |
// fails to delete the document |
1796 |
deleteDocid(newdocid + ".20", FAILURE, true);
|
|
1513 |
deleteDocumentId(newdocid + ".20", FAILURE, true);
|
|
1797 | 1514 |
// logout |
1798 | 1515 |
debug("logging out"); |
1799 | 1516 |
m.logout(); |
... | ... | |
1819 | 1536 |
// login |
1820 | 1537 |
debug("logging in as: username=" + username + " password=" + password); |
1821 | 1538 |
m.login(username, password); |
1822 |
updateDocid(newdocid + ".21", testdocument, SUCCESS, false);
|
|
1539 |
updateDocumentId(newdocid + ".21", testdocument, SUCCESS, false);
|
|
1823 | 1540 |
debug("logging out"); |
1824 | 1541 |
m.logout(); |
1825 | 1542 |
// login as another user |
... | ... | |
1827 | 1544 |
+ anotherpassword); |
1828 | 1545 |
m.login(anotheruser, anotherpassword); |
1829 | 1546 |
// succeeds to read this document |
1830 |
readDocidWhichEqualsDoc(newdocid + ".21", testdocument, SUCCESS, false);
|
|
1547 |
readDocumentIdWhichEqualsDoc(newdocid + ".21", testdocument, SUCCESS, false);
|
|
1831 | 1548 |
// succeeds to update this document |
1832 |
updateDocid(newdocid + ".22", testdocument, SUCCESS, false);
|
|
1549 |
updateDocumentId(newdocid + ".22", testdocument, SUCCESS, false);
|
|
1833 | 1550 |
// fails to update access part |
1834 | 1551 |
testdocument = getTestEmlDoc( |
1835 | 1552 |
"Testing user can not read, write and delete a document", emlVersion, |
1836 | 1553 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1837 | 1554 |
false, false, false), null, null, null, null); |
1838 |
updateDocid(newdocid + ".23", testdocument, FAILURE, true);
|
|
1555 |
updateDocumentId(newdocid + ".23", testdocument, FAILURE, true);
|
|
1839 | 1556 |
// fails to delete the document |
1840 |
deleteDocid(newdocid + ".22", FAILURE, true);
|
|
1557 |
deleteDocumentId(newdocid + ".22", FAILURE, true);
|
|
1841 | 1558 |
// logout |
1842 | 1559 |
debug("logging out"); |
1843 | 1560 |
m.logout(); |
... | ... | |
1911 | 1628 |
debug("\nRunning: test210DenyFirst()"); |
1912 | 1629 |
String emlVersion = EML2_1_0; |
1913 | 1630 |
try { |
1914 |
newdocid = generateDocid();
|
|
1631 |
newdocid = generateDocumentId();
|
|
1915 | 1632 |
// ====1 inserts a document with access rules (denyFirst) - allow |
1916 | 1633 |
// READ rule for another user, |
1917 | 1634 |
// deny READ rule for public. |
... | ... | |
1930 | 1647 |
// login |
1931 | 1648 |
debug("logging in as: username=" + username + " password=" + password); |
1932 | 1649 |
m.login(username, password); |
1933 |
insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1650 |
insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1934 | 1651 |
debug("logging out"); |
1935 | 1652 |
m.logout(); |
1936 | 1653 |
// login as another user |
... | ... | |
1938 | 1655 |
+ anotherpassword); |
1939 | 1656 |
m.login(anotheruser, anotherpassword); |
1940 | 1657 |
// succeeds to read this document |
1941 |
readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1658 |
readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1942 | 1659 |
// fails to update this document |
1943 |
updateDocid(newdocid + ".2", testdocument, FAILURE, true);
|
|
1660 |
updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
|
|
1944 | 1661 |
// fails to update access part |
1945 | 1662 |
testdocument = getTestEmlDoc( |
1946 | 1663 |
"Testing user can not read, write and delete a document", emlVersion, |
1947 | 1664 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1948 | 1665 |
false, false, false), null, null, null, null); |
1949 |
updateDocid(newdocid + ".2", testdocument, FAILURE, true);
|
|
1666 |
updateDocumentId(newdocid + ".2", testdocument, FAILURE, true);
|
|
1950 | 1667 |
// fails to delete the document |
1951 |
deleteDocid(newdocid + ".1", FAILURE, true);
|
|
1668 |
deleteDocumentId(newdocid + ".1", FAILURE, true);
|
|
1952 | 1669 |
// logout |
1953 | 1670 |
debug("logging out"); |
1954 | 1671 |
m.logout(); |
... | ... | |
1970 | 1687 |
// login |
1971 | 1688 |
debug("logging in as: username=" + username + " password=" + password); |
1972 | 1689 |
m.login(username, password); |
1973 |
updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1690 |
updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1974 | 1691 |
debug("logging out"); |
1975 | 1692 |
m.logout(); |
1976 | 1693 |
// login as another user |
... | ... | |
1978 | 1695 |
+ anotherpassword); |
1979 | 1696 |
m.login(anotheruser, anotherpassword); |
1980 | 1697 |
// succeeds to read this document |
1981 |
readDocidWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1698 |
readDocumentIdWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1982 | 1699 |
// succeeds to update this document |
1983 |
updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
|
|
1700 |
updateDocumentId(newdocid + ".3", testdocument, SUCCESS, false);
|
|
1984 | 1701 |
// fails to update access part |
1985 | 1702 |
testdocument = getTestEmlDoc( |
1986 | 1703 |
"Testing user can not read, write and delete a document", emlVersion, |
1987 | 1704 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
1988 | 1705 |
false, false, false), null, null, null, null); |
1989 |
updateDocid(newdocid + ".4", testdocument, FAILURE, true);
|
|
1706 |
updateDocumentId(newdocid + ".4", testdocument, FAILURE, true);
|
|
1990 | 1707 |
// fails to delete the document |
1991 |
deleteDocid(newdocid + ".3", FAILURE, true);
|
|
1708 |
deleteDocumentId(newdocid + ".3", FAILURE, true);
|
|
1992 | 1709 |
// logout |
1993 | 1710 |
debug("logging out"); |
1994 | 1711 |
m.logout(); |
... | ... | |
2009 | 1726 |
// login |
2010 | 1727 |
debug("logging in as: username=" + username + " password=" + password); |
2011 | 1728 |
m.login(username, password); |
2012 |
updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
|
|
1729 |
updateDocumentId(newdocid + ".4", testdocument, SUCCESS, false);
|
|
2013 | 1730 |
debug("logging out"); |
2014 | 1731 |
m.logout(); |
2015 | 1732 |
// login as another user |
... | ... | |
2017 | 1734 |
+ anotherpassword); |
2018 | 1735 |
m.login(anotheruser, anotherpassword); |
2019 | 1736 |
// succeeds to read this document |
2020 |
readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
|
|
1737 |
readDocumentIdWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
|
|
2021 | 1738 |
// succeeds to update this document |
2022 |
updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
|
|
1739 |
updateDocumentId(newdocid + ".5", testdocument, SUCCESS, false);
|
|
2023 | 1740 |
// succeed to update access part |
2024 | 1741 |
testdocument = getTestEmlDoc( |
2025 | 1742 |
"Testing user can not read, write and delete a document", emlVersion, |
2026 | 1743 |
null, null, null, null, getAccessBlock(anotheruser, true, true, true, |
2027 | 1744 |
true, true), null, null, null, null); |
2028 |
updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
|
|
1745 |
updateDocumentId(newdocid + ".6", testdocument, SUCCESS, false);
|
|
2029 | 1746 |
// succeeds to delete the document |
2030 |
deleteDocid(newdocid + ".6", SUCCESS, false);
|
|
1747 |
deleteDocumentId(newdocid + ".6", SUCCESS, false);
|
|
2031 | 1748 |
// logout |
2032 | 1749 |
debug("logging out"); |
2033 | 1750 |
m.logout(); |
2034 | 1751 |
|
2035 |
newdocid = generateDocid();
|
|
1752 |
newdocid = generateDocumentId();
|
|
2036 | 1753 |
// ====4 The user updates this documents with access rules |
2037 | 1754 |
// (denyFirst) - allow READ and WRITE |
2038 | 1755 |
// rule for another user, deny WRITE rule for public. |
... | ... | |
2051 | 1768 |
// login |
2052 | 1769 |
debug("logging in as: username=" + username + " password=" + password); |
2053 | 1770 |
m.login(username, password); |
2054 |
insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1771 |
insertDocumentId(newdocid + ".1", testdocument, SUCCESS, false);
|
|
2055 | 1772 |
debug("logging out"); |
2056 | 1773 |
m.logout(); |
2057 | 1774 |
// login as another user |
... | ... | |
2059 | 1776 |
+ anotherpassword); |
2060 | 1777 |
m.login(anotheruser, anotherpassword); |
2061 | 1778 |
// succeeds to read this document |
2062 |
readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
1779 |
readDocumentIdWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
|
|
2063 | 1780 |
// succeeds to update this document |
2064 |
updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
|
|
1781 |
updateDocumentId(newdocid + ".2", testdocument, SUCCESS, false);
|
|
2065 | 1782 |
// fails to update access part |
2066 | 1783 |
testdocument = getTestEmlDoc( |
2067 | 1784 |
"Testing user can not read, write and delete a document", emlVersion, |
2068 | 1785 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
2069 | 1786 |
false, false, false), null, null, null, null); |
2070 |
updateDocid(newdocid + ".3", testdocument, FAILURE, true);
|
|
1787 |
updateDocumentId(newdocid + ".3", testdocument, FAILURE, true);
|
|
2071 | 1788 |
// fails to delete the document |
2072 |
deleteDocid(newdocid + ".2", FAILURE, true);
|
|
1789 |
deleteDocumentId(newdocid + ".2", FAILURE, true);
|
|
2073 | 1790 |
// logout |
2074 | 1791 |
debug("logging out"); |
2075 | 1792 |
m.logout(); |
... | ... | |
2092 | 1809 |
// login |
2093 | 1810 |
debug("logging in as: username=" + username + " password=" + password); |
2094 | 1811 |
m.login(username, password); |
2095 |
updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1812 |
updateDocumentId(newdocid + ".10", testdocument, SUCCESS, false);
|
|
2096 | 1813 |
debug("logging out"); |
2097 | 1814 |
m.logout(); |
2098 | 1815 |
// login as another user |
... | ... | |
2100 | 1817 |
+ anotherpassword); |
2101 | 1818 |
m.login(anotheruser, anotherpassword); |
2102 | 1819 |
// succeeds to read this document |
2103 |
readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
1820 |
readDocumentIdWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
|
|
2104 | 1821 |
// succeed to update this document |
2105 |
updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
|
|
1822 |
updateDocumentId(newdocid + ".11", testdocument, SUCCESS, false);
|
|
2106 | 1823 |
// fails to update access part |
2107 | 1824 |
testdocument = getTestEmlDoc( |
2108 | 1825 |
"Testing user can not read, write and delete a document", emlVersion, |
2109 | 1826 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
2110 | 1827 |
false, false, false), null, null, null, null); |
2111 |
updateDocid(newdocid + ".12", testdocument, FAILURE, true);
|
|
1828 |
updateDocumentId(newdocid + ".12", testdocument, FAILURE, true);
|
|
2112 | 1829 |
// fails to delete the document |
2113 |
deleteDocid(newdocid + ".12", FAILURE, true);
|
|
1830 |
deleteDocumentId(newdocid + ".12", FAILURE, true);
|
|
2114 | 1831 |
// logout |
2115 | 1832 |
debug("logging out"); |
2116 | 1833 |
m.logout(); |
... | ... | |
2136 | 1853 |
// login |
2137 | 1854 |
debug("logging in as: username=" + username + " password=" + password); |
2138 | 1855 |
m.login(username, password); |
2139 |
updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
|
|
1856 |
updateDocumentId(newdocid + ".13", testdocument, SUCCESS, false);
|
|
2140 | 1857 |
debug("logging out"); |
2141 | 1858 |
m.logout(); |
2142 | 1859 |
// login as another user |
... | ... | |
2144 | 1861 |
+ anotherpassword); |
2145 | 1862 |
m.login(anotheruser, anotherpassword); |
2146 | 1863 |
// succeeds to read this document |
2147 |
readDocidWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
|
|
1864 |
readDocumentIdWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
|
|
2148 | 1865 |
// fails to update this document |
2149 |
updateDocid(newdocid + ".14", testdocument, FAILURE, true);
|
|
1866 |
updateDocumentId(newdocid + ".14", testdocument, FAILURE, true);
|
|
2150 | 1867 |
// fails to update access part |
2151 | 1868 |
testdocument = getTestEmlDoc( |
2152 | 1869 |
"Testing user can not read, write and delete a document", emlVersion, |
2153 | 1870 |
null, null, null, null, getAccessBlock(anotheruser, true, true, |
2154 | 1871 |
false, false, false), null, null, null, null); |
2155 |
updateDocid(newdocid + ".14", testdocument, FAILURE, true);
|
|
1872 |
updateDocumentId(newdocid + ".14", testdocument, FAILURE, true);
|
|
2156 | 1873 |
// fails to delete the document |
Also available in: Unified diff
Stripped out common eml document creation elements and put into the MCTestCase base class