Support_TestWebDatapublic class Support_TestWebData extends Object Represents test data used by the Request API tests |
Fields Summary |
---|
public static final byte[] | test1 | public static final byte[] | test2 | public static final String | postContent | public static final byte[] | tests | public static Support_TestWebData[] | testParamsList of static test cases for use with test server | public static String[] | testServerResponseList of response strings for use by the test server | public static final int | REDIRECT_301 | public static final int | REDIRECT_302 | public static final int | REDIRECT_303 | public static final int | REDIRECT_307 | public long | testLength | public long | testLastModified | public String | testName | public String | testType | public long | testExp | public boolean | testDir | public static boolean | test0DataAvailable | public static byte[] | test0Data | public static Support_TestWebData | test0Params |
Constructors Summary |
---|
Support_TestWebData(int length, int lastModified, String name, String type, boolean isDir, long expDate)Creates a data package with information used by the server when responding
to requests
testLength = length;
testLastModified = lastModified;
testName = name;
testType = type;
testDir = isDir;
testExp = expDate;
| private Support_TestWebData(String path, String type)Creates a data package with information used by the server when responding
to requests
File file = new File(path);
testLength = file.length();
testLastModified = file.lastModified();
testName = file.getName();
testType = type;
testDir = file.isDirectory();
ByteArrayOutputStream out = new ByteArrayOutputStream();
FileInputStream in = null;
try {
in = new FileInputStream(file);
while (in.available() > 0) {
out.write(in.read());
}
in.close();
out.flush();
test0Data = out.toByteArray();
out.close();
test0DataAvailable = true;
return;
} catch (Exception e) {
// ignore
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
} catch (IOException e) {
// ignore
}
}
|
|