Revision 6695
Added by ben leinfelder about 13 years ago
test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java | ||
---|---|---|
28 | 28 |
import java.io.File; |
29 | 29 |
import java.io.FileReader; |
30 | 30 |
import java.io.FileWriter; |
31 |
import java.io.InputStream; |
|
31 | 32 |
import java.io.InputStreamReader; |
32 | 33 |
import java.io.IOException; |
33 | 34 |
import java.io.Reader; |
... | ... | |
49 | 50 |
import junit.framework.TestSuite; |
50 | 51 |
import java.io.FileInputStream; |
51 | 52 |
|
53 |
import org.apache.commons.io.IOUtils; |
|
52 | 54 |
|
55 |
|
|
53 | 56 |
/** |
54 | 57 |
* A JUnit test for testing Step class processing |
55 | 58 |
*/ |
... | ... | |
110 | 113 |
public void setUp() |
111 | 114 |
{ |
112 | 115 |
try { |
113 |
FileReader fr = new FileReader(testfile);
|
|
114 |
testdocument = IOUtil.getAsString(fr, true);
|
|
116 |
FileInputStream fis = new FileInputStream(testfile);
|
|
117 |
testdocument = IOUtils.toString(fis);
|
|
115 | 118 |
} catch (IOException ioe) { |
116 | 119 |
fail("Can't read test data to run the test: " + testfile); |
117 | 120 |
} |
... | ... | |
251 | 254 |
try { |
252 | 255 |
m.login(username, password); |
253 | 256 |
String docid = readIdFromFile(DOCID); |
254 |
Reader r = new InputStreamReader(m.read(docid+".1")); |
|
255 |
String doc = IOUtil.getAsString(r, true); |
|
257 |
debug("docid=" + docid); |
|
258 |
InputStream is = m.read(docid+".1"); |
|
259 |
String doc = IOUtils.toString(is); |
|
256 | 260 |
// why oh why were we adding a newline?? |
257 | 261 |
//doc = doc +"\n"; |
258 | 262 |
if (!doc.equals(testdocument)) { |
Also available in: Unified diff
use IOUtils for testing read/write of XML strings. This goes along with the utilities project change to use the same apache commons IO library. Be sure to clean the utilities checkout in order to catch the right utilities svn tag when building!