Project

General

Profile

« Previous | Next » 

Revision 6052

Added by rnahf over 13 years ago

removed newline addition to test doc now that the newline problem is fixed in utilities project. Small adjustments to comments and debug statements to aid in debugging. Reordered tests to remove possible insertion between read and getLastDocid test.

View differences:

test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java
49 49
import junit.framework.TestSuite;
50 50
import java.io.FileInputStream;
51 51

  
52

  
52 53
/**
53 54
 * A JUnit test for testing Step class processing
54 55
 */
......
95 96
    public MetacatClientTest(String name)
96 97
    {
97 98
        super(name);
99
        // prefix is a generalization of the term 'scope' which is the beginning part of an identifier
100
        // because of the getLatestDocid() test, we need to make sure that prefix (which is used as scope)
101
        // is specific to these tests, and that docids are sequentially assigned.
102
        // (so keep this value for prefix, or make it more specific!)
98 103
        prefix = "metacatClientTest";
99 104
        newdocid = generateDocumentId();
100 105
    }
......
132 137
     */
133 138
    public static Test suite()
134 139
    {
135
      TestSuite suite = new TestSuite();
140
      TestSuite suite = new TestSuite();     
136 141
      suite.addTest(new MetacatClientTest("initialize"));
137 142
      suite.addTest(new MetacatClientTest("invalidLogin"));
138 143
      suite.addTest(new MetacatClientTest("logoutAndInvalidInsert"));
139 144
      suite.addTest(new MetacatClientTest("login"));
140 145
      suite.addTest(new MetacatClientTest("insert"));
141
      suite.addTest(new MetacatClientTest("getNewestDocRevision"));
142
      suite.addTest(new MetacatClientTest("getLastDocid"));
146
      suite.addTest(new MetacatClientTest("getLastDocid"));  // needs to directly follow insert test!!
147
      suite.addTest(new MetacatClientTest("getNewestDocRevision"));  // (also tries to insert)
143 148
      suite.addTest(new MetacatClientTest("upload"));
144 149
      suite.addTest(new MetacatClientTest("upload_stream"));
145 150
      suite.addTest(new MetacatClientTest("invalidRead"));
......
248 253
            String docid = readIdFromFile(DOCID);
249 254
            Reader r = new InputStreamReader(m.read(docid+".1"));
250 255
            String doc = IOUtil.getAsString(r, true);
251
            doc = doc +"\n";
256
            // why oh why were we adding a newline??
257
            //doc = doc +"\n";
252 258
            if (!doc.equals(testdocument)) {
253
                debug("doc         :" + doc);
254
                debug("testdocument:" + testdocument);
259
                debug("doc         :" + doc + "EOF");
260
                debug("testdocument:" + testdocument + "EOF");
255 261
            }
256 262
            assertTrue(doc.equals(testdocument));
257 263
        } catch (MetacatAuthException mae) {
......
702 708
   /**
703 709
    * Get the most recent document id for a given scope and be sure
704 710
    * that it matches the one we last inserted. Assumes this test is run
705
    * immediately following a successful insert() test.
711
    * immediately following a successful insert() test, AND that the docid
712
    * inserted has the maximal numerical value.
706 713
    */
707 714
   public void getLastDocid()
708 715
   {
......
716 723
               fail("Metacat connection failed." + mie.getMessage());
717 724
           }
718 725
           String lastId = m3.getLastDocid(prefix);
719
           debug("getLastDocid(): Last Id = " + lastId);
720 726
           
727
           debug("getLastDocid(): Scope = '"+ prefix + "', Last Id = " + lastId);
728
           
721 729
           //get docid from file
722 730
           String docid = readIdFromFile(DOCID);
723 731
           debug("getLastDocid(): File Id = " + docid + ".1");

Also available in: Unified diff