Project

General

Profile

« Previous | Next » 

Revision 7843

add Metacat servlet action to force the reindexing of one or more or all pids in the system. https://projects.ecoinformatics.org/ecoinfo/issues/5945

View differences:

MetaCatServletTest.java
27 27
package edu.ucsb.nceas.metacattest;
28 28

  
29 29
import edu.ucsb.nceas.MCTestCase;
30
import edu.ucsb.nceas.metacat.IdentifierManager;
30 31
import edu.ucsb.nceas.metacat.properties.PropertyService;
31 32
import edu.ucsb.nceas.utilities.HttpMessage;
32 33
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
......
133 134
						serial));
134 135

  
135 136
		suite.addTest(new MetaCatServletTest("testLogOut"));
137
		
138
		suite.addTest(new MetaCatServletTest("testReindexFail"));
136 139

  
137 140
		return suite;
138 141
	}
......
419 422
		assertTrue(handleLogOut());
420 423

  
421 424
	}
425
	
426
	public void testReindexFail() {
422 427

  
428
		// find a pid to reindex
429
		String identifier = null;
430
		List<String> ids = IdentifierManager.getInstance().getAllSystemMetadataGUIDs();
431
		if (ids != null && !ids.isEmpty()) {
432
			identifier = ids.get(0);
433
		}
434
		Properties prop = new Properties();
435
		prop.put("action", "reindex");
436
		prop.put("pid", identifier);
437

  
438
		String message = getMetacatString(prop);
439
		debug("Reindex Message: " + message);
440
		if (message.indexOf("<error>") != -1) {// there was an error
441
			assertTrue(true);
442
		} else if (message.indexOf("<success>") != -1) {
443
			fail("Unauthenticated user should not be able to invoke this action: " + message);
444
		} else {// something weird happened.
445
			fail("There was an unexpected error reindexing pid: " + message);
446
		}
447
	}
448

  
423 449
	/**
424 450
	 * Method to hanld login action
425 451
	 * 

Also available in: Unified diff