Project

General

Profile

« Previous | Next » 

Revision 2448

Added by sgarg over 19 years ago

Fixed a bug in previous commit and added a test for characters like mu.

View differences:

test/edu/ucsb/nceas/metacattest/NonAsciiCharacterTest.java
199 199
        suite.addTest(new NonAsciiCharacterTest("nonAsciiTest_2"));
200 200
        suite.addTest(new NonAsciiCharacterTest("nonAsciiTest_3"));
201 201
        suite.addTest(new NonAsciiCharacterTest("nonAsciiTest_4"));
202
        suite.addTest(new NonAsciiCharacterTest("nonAsciiTest_5"));
202 203

  
203 204
        return suite;
204 205
    }
......
244 245
        try {
245 246
            newdocid = generateDocid();
246 247
            m.login(username, password);
247
            testdocument = getTestEmlDoc("Checking > $amp; <");
248
            insertDocid(newdocid + ".1", testdocument, FAILURE, true);
248
            testdocument = getTestEmlDoc("Checking > & <");
249
            insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
250
            readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
249 251
            m.logout();
250 252
        }
251 253
        catch (MetacatAuthException mae) {
......
310 312
        }
311 313
    }
312 314

  
315

  
316
    /** *********
317
     * Test inserting document with characters like µ
318
     * should fail because this means an invalid xml document is being inserted
319
     */
320
    public void nonAsciiTest_5() {
321
        try {
322
            int i = 0x03bc;
323
            newdocid = generateDocid();
324
            m.login(username, password);
325
            testdocument = getTestEmlDoc("Checking charcters like µ");
326
            insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
327
            readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, true);
328
            m.logout();
329
        }
330
        catch (MetacatAuthException mae) {
331
            fail("Authorization failed:\n" + mae.getMessage());
332
        }
333
        catch (MetacatInaccessibleException mie) {
334
            fail("Metacat Inaccessible:\n" + mie.getMessage());
335
        }
336
        catch (Exception e) {
337
            fail("General exception:\n" + e.getMessage());
338
        }
339
    }
340

  
313 341
    /**
314 342
     * Insert a document into metacat. The expected result is passed as result
315 343
     */

Also available in: Unified diff