Project

General

Profile

« Previous | Next » 

Revision 1829

Added by Matt Jones over 21 years ago

Added more debugging messgaes to the test in an attempt to find out
what is wrong with the cookies.

View differences:

test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java
474 474

  
475 475
    /**
476 476
     * Try to perform an action that requires a session to be valid without
477
     * having logged in first by setting the sessionId from a previous
478
     * session.  Then insert a document.
477
     * having logged in first, but use an invalid session identifier. 
478
     * Then insert a document, which should fail.
479 479
     */
480 480
    public void reuseInvalidSession()
481 481
    {
482
        System.err.println("Starting resuseInvalidSession test...");
482 483
        String oldSessionId = "foobar";
483 484
        try {
484 485
            String identifier = generateDocid() + ".1";
485
            Metacat m2 = null;
486
            Metacat m3 = null;
486 487
            try {
487
                m2 = MetacatFactory.createMetacatConnection(metacatUrl);
488
                m3 = MetacatFactory.createMetacatConnection(metacatUrl);
488 489
            } catch (MetacatInaccessibleException mie) {
489 490
                System.err.println("Metacat is: " + metacatUrl);
490 491
                fail("Metacat connection failed." + mie.getMessage());
491 492
            }
492
            System.err.println("SessionId (m2): " + m2.getSessionId());
493
            m2.setSessionId(oldSessionId);
494
            System.err.println("SessionId (m2 after set): " + m2.getSessionId());
495
            String response = m2.insert(identifier, 
493
            System.err.println("SessionId (m3): " + m3.getSessionId());
494
            m3.setSessionId(oldSessionId);
495
            System.err.println("SessionId (m3 after set): " + m3.getSessionId());
496
            System.err.println("Performing resuseInvalidSession insert: " +
497
                    identifier);
498
            String response = m3.insert(identifier, 
496 499
                    new StringReader(testdocument), null);
497
            System.err.println("Reuse Insert response: " + response);
500
            System.err.println("ReuseInvalid Insert response: " + response);
498 501
            assertTrue(response.indexOf("<success>") == -1);
499 502
        } catch (MetacatInaccessibleException mie) {
500 503
            fail("Metacat Inaccessible:\n" + mie.getMessage());

Also available in: Unified diff