Project

General

Profile

« Previous | Next » 

Revision 1822

Added by Matt Jones over 20 years ago

Modified metacat to now provide the session identifier in the response
xml message when a login is called. This has not been fully tested.
I removed the HttpMessage class from metacat in favor of using the version
of that class that is found in the utilities module. This may cause some
unforeseen problems. We'll see.

View differences:

MetacatClientTest.java
26 26
package edu.ucsb.nceas.metacattest.client;
27 27

  
28 28
import edu.ucsb.nceas.metacat.client.*;
29
import edu.ucsb.nceas.utilities.HttpMessage;
29 30
import edu.ucsb.nceas.utilities.IOUtil;
30 31

  
31 32
import java.io.FileReader;
......
52 53
public class MetacatClientTest extends TestCase
53 54
{
54 55
    private String metacatUrl = 
55
         "http://dev.nceas.ucsb.edu:8091/tao/servlet/metacat";
56
         "http://dev.nceas.ucsb.edu/tao/servlet/metacat";
56 57
        //"http://knb.ecoinformatics.org/knb/servlet/metacat";
57 58
    private String wrongMetacatUrl=
58 59
                    "http://somepalce.somewhere.com/some/servlet/metacat";
......
95 96
        try {
96 97
            m = MetacatFactory.createMetacatConnection(metacatUrl);
97 98
        } catch (MetacatInaccessibleException mie) {
99
            System.err.println("Metacat is: " + metacatUrl);
98 100
            fail("Metacat connection failed." + mie.getMessage());
99 101
        }
100 102
    }
......
122 124
        suite.addTest(new MetacatClientTest("query"));
123 125
        suite.addTest(new MetacatClientTest("invalidUpdate"));
124 126
        suite.addTest(new MetacatClientTest("update"));
125
         suite.addTest(new MetacatClientTest("invalidDelete"));
127
        suite.addTest(new MetacatClientTest("invalidDelete"));
126 128
        suite.addTest(new MetacatClientTest("delete"));
127 129
        suite.addTest(new MetacatClientTest("inaccessiblemetacat"));
128 130
        return suite;
......
144 146
    {
145 147
        // Try a valid login
146 148
        try {
147
            m.login(username, password);
149
            String response = m.login(username, password);
150
            System.err.println("Login response: " + response);
151
            assertTrue(response != null);
152
            assertTrue(response.indexOf("<login>") != -1);
153
            String sessionId = m.getSessionId();
154
            System.err.println("Session ID: " + m.getSessionId());
155
            //assertTrue(sessionId != null);
156
            //assertTrue(response.indexOf(m.getSessionId()) != -1);
148 157
        } catch (MetacatAuthException mae) {
149 158
            fail("Authorization failed:\n" + mae.getMessage());
150 159
        } catch (MetacatInaccessibleException mie) {
......
180 189
            m.logout();
181 190
            String response = m.insert(identifier, 
182 191
                    new StringReader(testdocument), null);
183
            System.out.println("response in logout: "+response);
192
            System.err.println("Response in logout: "+response);
184 193
            assertTrue(response.indexOf("<success>") == -1);
185 194
        } catch (MetacatAuthException mae) {
186 195
            fail("Authorization failed:\n" + mae.getMessage());

Also available in: Unified diff