Project

General

Profile

« Previous | Next » 

Revision 3169

Added by Jing Tao about 17 years ago

Removed the debugMessage method which was removed from MetacatUtil class.

View differences:

MetaCatServletNetTest.java
37 37
import java.net.*;
38 38
import java.util.*;
39 39

  
40
import org.apache.log4j.Logger;
40 41

  
42

  
41 43
/**
42 44
 * A JUnit test for testing Step class processing
43 45
 */
......
45 47
{
46 48
  private String metacatURL=MetaCatUtil.getOption("junittesturl");
47 49
  private String serialNumber;
50
  private static Logger logMetacat = Logger.getLogger(DocumentImpl.class);
48 51
  /**
49 52
   * Constructor to build the test
50 53
   *
......
103 106
    //create random number for docid, so it can void repeat
104 107
    number = Math.random()*100000;
105 108
    serial = Integer.toString(((new Double(number)).intValue()));
106
    MetaCatUtil.debugMessage("serial: "+serial, 1);
109
    logMetacat.info("serial: "+serial);
107 110
    suite.addTest(new MetaCatServletNetTest("testInsertXMLDocument", serial));
108 111
    suite.addTest(new MetaCatServletNetTest("testReadXMLDocumentXMLFormat", 
109 112
                                                        serial));
......
219 222
  {
220 223
    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
221 224
                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
222
    MetaCatUtil.debugMessage("insert docid: "+name, 20);
225
    logMetacat.info("insert docid: "+name);
223 226
    String content="<?xml version=\"1.0\"?>"
224 227
                   +"<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
225 228
                   +"eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
......
235 238
                   +"<permission>read</permission>"
236 239
                   +"</allow>"
237 240
                   +"</acl>";
238
     MetaCatUtil.debugMessage("xml document: "+content, 55);
241
    logMetacat.info("xml document: "+content);
239 242
     assertTrue(handleXMLDocument(content, name, "insert"));
240 243
   
241 244
  }
......
248 251
  {
249 252
    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
250 253
                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
251
    MetaCatUtil.debugMessage("insert docid: "+name, 20);
254
    logMetacat.info("insert docid: "+name);
252 255
    String content="<?xml version=\"1.0\"?>"
253 256
                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
254 257
                   +"<identifier>"+name+"</identifier>"
......
261 264
                   +"<permission>read</permission>"
262 265
                   +"</allow>"
263 266
                   +"</acl>";
264
     MetaCatUtil.debugMessage("xml document: "+content, 55);
267
    logMetacat.info("xml document: "+content);
265 268
     assertTrue(handleXMLDocument(content, name, "insert"));
266 269
  }
267 270
  
......
273 276
  {
274 277
    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
275 278
                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
276
    MetaCatUtil.debugMessage("insert non well-formed docid: "+name, 20);
279
    logMetacat.info("insert non well-formed docid: "+name);
277 280
    String content="<?xml version=\"1.0\"?>"
278 281
                   +"<acl authSystem=\"knb\" order=\"allowFirst\">"
279 282
                   +"<identifier>"+name+"</identifier>"
......
286 289
                   +"<permission>read</permission>"
287 290
                   +"</allow>";
288 291
  
289
     MetaCatUtil.debugMessage("xml document: "+content, 55);
292
     logMetacat.info("xml document: "+content);
290 293
     assertTrue(!handleXMLDocument(content, name, "insert"));
291 294
  } 
292 295

  
......
331 334
  {
332 335
    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
333 336
                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"2";
334
    MetaCatUtil.debugMessage("update docid: "+name, 20);
337
    logMetacat.info("update docid: "+name);
335 338
    String content="<?xml version=\"1.0\"?>"
336 339
                   +"<!DOCTYPE acl PUBLIC \"-//ecoinformatics.org//"
337 340
                   +"eml-access-2.0.0beta6//EN\" \"http://pine.nceas.ucsb."
......
347 350
                   +"<permission>read</permission>"
348 351
                   +"</allow>"
349 352
                   +"</acl>";
350
     MetaCatUtil.debugMessage("xml document: "+content, 55);
353
     logMetacat.info("xml document: "+content);
351 354
     assertTrue(handleXMLDocument(content, name, "update"));
352 355
   
353 356
  }
......
359 362
  {
360 363
    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
361 364
                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"1";
362
    MetaCatUtil.debugMessage("insert data file docid: "+name, 20);
363
    MetaCatUtil.debugMessage("insert data file ", 55);
365
    logMetacat.info("insert data file docid: "+name);
366
    logMetacat.info("insert data file ");
364 367
    File hello = new File("test/edu/ucsb/nceas/metacatnettest/hello.txt");
365 368
   
366 369
    assertTrue(insertDataFile(name, hello));
......
373 376
  {
374 377
    String name = "john"+MetaCatUtil.getOption("accNumSeparator")
375 378
                     +serialNumber+MetaCatUtil.getOption("accNumSeparator")+"2";
376
    MetaCatUtil.debugMessage("delete docid: "+name, 20);
379
    logMetacat.info("delete docid: "+name);
377 380
    assertTrue(handleDeleteFile(name));
378 381
   
379 382
  }
......
407 410

  
408 411
    // Now contact metacat
409 412
    String response = getMetacatString(prop);
410
    MetaCatUtil.debugMessage("Login Message: "+response, 55);
413
    logMetacat.info("Login Message: "+response);
411 414
    boolean connected = false;
412 415
    if (response.indexOf("<login>") != -1) {
413 416
      connected = true;
......
434 437
    prop.put("qformat", "xml");
435 438
  
436 439
    String response = getMetacatString(prop);
437
    MetaCatUtil.debugMessage("Logout Message: "+response, 55);
440
    logMetacat.info("Logout Message: "+response);
438 441
    edu.ucsb.nceas.morpho.framework.HttpMessage.setCookie(null);
439 442
     
440 443
    if (response.indexOf("<logout>") != -1) 
......
501 504
    prop.put("docid", docid);
502 505
    
503 506
    String message = getMetacatString(prop);
504
    MetaCatUtil.debugMessage("Insert or Update Message: "+message, 55);
507
    logMetacat.info("Insert or Update Message: "+message);
505 508
    if(message.indexOf("<error>") != -1)
506 509
    {//there was an error
507 510
      
......
529 532
    prop.put("docid", name);
530 533
 
531 534
    String message = getMetacatString(prop);
532
    MetaCatUtil.debugMessage("Delete Message: "+message, 55);
535
    logMetacat.info("Delete Message: "+message);
533 536
    if(message.indexOf("<error>") != -1)
534 537
    {//there was an error
535 538
      

Also available in: Unified diff