Project

General

Profile

« Previous | Next » 

Revision 1825

Fixed the sessionId handling code to now properly return the sessionId
in the login response message. Updated junit tests to test this issue.

View differences:

test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java
152 152
            assertTrue(response.indexOf("<login>") != -1);
153 153
            String sessionId = m.getSessionId();
154 154
            System.err.println("Session ID: " + m.getSessionId());
155
            //assertTrue(sessionId != null);
156
            //assertTrue(response.indexOf(m.getSessionId()) != -1);
155
            assertTrue(sessionId != null);
156
            assertTrue(response.indexOf(m.getSessionId()) != -1);
157 157
        } catch (MetacatAuthException mae) {
158 158
            fail("Authorization failed:\n" + mae.getMessage());
159 159
        } catch (MetacatInaccessibleException mie) {
src/edu/ucsb/nceas/metacat/AuthSession.java
166 166
    out.append("<" + tag + ">");
167 167
    out.append("\n  <message>" + message + "</message>\n");
168 168
    if (sessionId != null) {
169
        out.append("\n  <sessionId>" + message + "</sessionId>\n");
169
        out.append("\n  <sessionId>" + sessionId + "</sessionId>\n");
170 170
    }
171 171
    out.append("</" + tag + ">");
172 172
    
src/edu/ucsb/nceas/metacat/client/MetacatClient.java
93 93
            HttpMessage.setCookie(null);
94 94
            throw new MetacatAuthException(response);
95 95
        } else {
96
            int start = response.indexOf("<sessionId>");
96
            int start = response.indexOf("<sessionId>") + 11;
97 97
            int end = response.indexOf("</sessionId>");
98 98
            if ((start != -1) && (end != -1)) {
99 99
                sessionId = response.substring(start,end);

Also available in: Unified diff