Project

General

Profile

« Previous | Next » 

Revision 5311

Added by daigle over 14 years ago

Merge 1.9.2 changes back into the trunk

View differences:

MetaCatServletNetTest.java
58 58
	}
59 59

  
60 60
	private String serialNumber;
61
	private static Logger logMetacat = Logger.getLogger(DocumentImpl.class);
62 61

  
63 62
	/**
64 63
	 * Constructor to build the test
......
109 108
		//create random number for docid, so it can void repeat
110 109
		number = Math.random() * 100000;
111 110
		serial = Integer.toString(((new Double(number)).intValue()));
112
		logMetacat.debug("serial: " + serial);
111
		debug("serial: " + serial);
113 112
		suite.addTest(new MetaCatServletNetTest("testInsertXMLDocument", serial));
114 113
		suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentXMLFormat", serial));
115 114
		suite.addTest(new MetaCatServletNetTest("testUpdateXMLDocument", serial));
......
145 144
	}
146 145

  
147 146
	/**
148
	 * Test the login to neceas succesfully
147
	 * Test the login to nceas succesfully
149 148
	 */
150 149
	public void testNCEASLogin() {
151 150
		debug("\nRunning: testNCEASLogin test");
......
156 155
	}
157 156

  
158 157
	/**
159
	 * Test the login to neceas failed
158
	 * Test the login to nceas failed
160 159
	 */
161 160
	public void testNCEASLoginFail() {
162 161
		debug("\nRunning: testNCEASLoginFail test");
......
184 183
		debug("\nRunning: testInsertXMLDocument test");
185 184
		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
186 185
				+ PropertyService.getProperty("document.accNumSeparator") + "1";
187
		logMetacat.debug("insert docid: " + name);
186
		debug("insert docid: " + name);
188 187
		String content = "<?xml version=\"1.0\"?>"
189 188
				+ "<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
190 189
				+ "eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
......
195 194
				+ "<permission>all</permission>" + "</allow>" + "<allow>"
196 195
				+ "<principal>public</principal>" + "<permission>read</permission>"
197 196
				+ "</allow>" + "</acl>";
198
		logMetacat.debug("xml document: " + content);
197
		debug("xml document: " + content);
199 198
		assertTrue(handleXMLDocument(content, name, "insert"));
200 199

  
201 200
	}
......
208 207
		debug("\nRunning: testInsertInvalidateXMLDocument test");
209 208
		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
210 209
				+ PropertyService.getProperty("document.accNumSeparator") + "1";
211
		logMetacat.debug("insert docid: " + name);
210
		debug("insert docid: " + name);
212 211
		String content = "<?xml version=\"1.0\"?>"
213 212
				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
214 213
				+ "</identifier>" + "<allow>"
......
216 215
				+ "<permission>all</permission>" + "</allow>" + "<allow>"
217 216
				+ "<principal>public</principal>" + "<permission>read</permission>"
218 217
				+ "</allow>" + "</acl>";
219
		logMetacat.debug("xml document: " + content);
218
		debug("xml document: " + content);
220 219
		assertTrue(handleXMLDocument(content, name, "insert"));
221 220
	}
222 221

  
......
228 227
		debug("\nRunning: testInsertNonWellFormedXMLDocument test");
229 228
		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
230 229
				+ PropertyService.getProperty("document.accNumSeparator") + "1";
231
		logMetacat.debug("insert non well-formed docid: " + name);
230
		debug("insert non well-formed docid: " + name);
232 231
		String content = "<?xml version=\"1.0\"?>"
233 232
				+ "<acl authSystem=\"knb\" order=\"allowFirst\">" + "<identifier>" + name
234 233
				+ "</identifier>" + "<allow>"
......
237 236
				+ "<principal>public</principal>" + "<permission>read</permission>"
238 237
				+ "</allow>";
239 238

  
240
		logMetacat.debug("xml document: " + content);
239
		debug("xml document: " + content);
241 240
		assertTrue(!handleXMLDocument(content, name, "insert"));
242 241
	}
243 242

  
......
281 280
		debug("\nRunning: testUpdateXMLDocument test");
282 281
		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
283 282
				+ PropertyService.getProperty("document.accNumSeparator") + "2";
284
		logMetacat.debug("update docid: " + name);
283
		debug("update docid: " + name);
285 284
		String content = "<?xml version=\"1.0\"?>"
286 285
				+ "<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
287 286
				+ "eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
......
292 291
				+ "<permission>all</permission>" + "</allow>" + "<allow>"
293 292
				+ "<principal>public</principal>" + "<permission>read</permission>"
294 293
				+ "</allow>" + "</acl>";
295
		logMetacat.debug("xml document: " + content);
294
		debug("xml document: " + content);
296 295
		assertTrue(handleXMLDocument(content, name, "update"));
297 296

  
298 297
	}
......
304 303
		debug("\nRunning: testInertDataFile test");
305 304
		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
306 305
				+ PropertyService.getProperty("document.accNumSeparator") + "1";
307
		logMetacat.debug("insert data file docid: " + name);
308
		logMetacat.debug("insert data file ");
306
		debug("insert data file docid: " + name);
307
		debug("insert data file ");
309 308
		File hello = new File("test/jones.204.22.xml");
310 309

  
311 310
		assertTrue(insertDataFile(name, hello));
......
318 317
		debug("\nRunning: testDeleteXMLDocument test");
319 318
		String name = "john" + PropertyService.getProperty("document.accNumSeparator") + serialNumber
320 319
				+ PropertyService.getProperty("document.accNumSeparator") + "2";
321
		logMetacat.debug("delete docid: " + name);
320
		debug("delete docid: " + name);
322 321
		assertTrue(handleDeleteFile(name));
323

  
324 322
	}
325 323

  
326 324
	/**
......
348 346

  
349 347
		// Now contact metacat
350 348
		String response = getMetacatString(prop);
351
		logMetacat.debug("Login Message: " + response);
349
		debug("Login Message: " + response);
352 350
		boolean connected = false;
353 351
		if (response.indexOf("<login>") != -1) {
354 352
			connected = true;
......
374 372
		prop.put("qformat", "xml");
375 373

  
376 374
		String response = getMetacatString(prop);
377
		logMetacat.debug("Logout Message: " + response);
375
		debug("Logout Message: " + response);
378 376
		edu.ucsb.nceas.morpho.framework.HttpMessage.setCookie(null);
379 377

  
380 378
		if (response.indexOf("<logout>") != -1) {
......
432 430
		prop.put("docid", docid);
433 431

  
434 432
		String message = getMetacatString(prop);
435
		logMetacat.debug("Insert or Update Message: " + message);
433
		debug("Insert or Update Message: " + message);
436 434
		if (message.indexOf("<error>") != -1) {//there was an error
437 435

  
438 436
			return false;
......
453 451
		prop.put("docid", name);
454 452

  
455 453
		String message = getMetacatString(prop);
456
		logMetacat.debug("Delete Message: " + message);
454
		debug("Delete Message: " + message);
457 455
		if (message.indexOf("<error>") != -1) {//there was an error
458 456

  
459 457
			return false;

Also available in: Unified diff