Project

General

Profile

« Previous | Next » 

Revision 7352

sleep before updating and deleting test documents - otherwise their index entries may not be fully written and this causes errors (update and delete first attempt to remove index references, but if they are not in the DB yet then they are not removed but then they do get added and the FK constraints make the delete fail). Since we know indexing occurs in a separate thread with a configured delay, we just use this same delay in our testing.

View differences:

test/edu/ucsb/nceas/metacatnettest/MetaCatServletNetTest.java
307 307
				+ "<principal>public</principal>" + "<permission>read</permission>"
308 308
				+ "</allow>" + "</acl>";
309 309
		debug("xml document: " + content);
310
		
311
		//sleep to make sure  the original document was indexed
312
		try {
313
			String indexDelay = PropertyService.getProperty("database.maximumIndexDelay");
314
			Thread.sleep(Integer.parseInt(indexDelay));
315
		} catch (Exception e) {
316
			fail(e.getMessage());
317
		}
310 318
		assertTrue(handleXMLDocument(content, name, "update"));
311 319

  
312 320
	}
......
333 341
		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
334 342
				+ PropertyService.getProperty("document.accNumSeparator") + "2";
335 343
		debug("delete docid: " + name);
344
		//sleep to make sure  the original document was indexed
345
		try {
346
			String indexDelay = PropertyService.getProperty("database.maximumIndexDelay");
347
			Thread.sleep(Integer.parseInt(indexDelay));
348
		} catch (Exception e) {
349
			fail(e.getMessage());
350
		}
336 351
		assertTrue(handleDeleteFile(name));
337 352
	}
338 353

  

Also available in: Unified diff