use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method canReadTest.
private AdaptorTestResultEntry canReadTest(GATContext gatContext, Preferences preferences, String host, String filename, int tabs, boolean correctValue) {
FileInterface file = null;
try {
file = GAT.createFile(gatContext, preferences, "any://" + host + "/" + filename).getFileInterface();
} catch (GATObjectCreationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long start = System.currentTimeMillis();
boolean readable;
try {
readable = file.canRead();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(readable == correctValue, (stop - start), null);
}
use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method listTest.
private AdaptorTestResultEntry listTest(GATContext gatContext, Preferences preferences, String host, String filename, int tabs, String... correctValue) {
FileInterface file = null;
try {
file = GAT.createFile(gatContext, preferences, "any://" + host + "/" + filename).getFileInterface();
} catch (GATObjectCreationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long start = System.currentTimeMillis();
String[] list;
try {
list = file.list();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(isCorrect(list, correctValue), (stop - start), null);
}
use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method lastModifiedTest.
private AdaptorTestResultEntry lastModifiedTest(GATContext gatContext, Preferences preferences, String host, String filename, int tabs, long correctValue) {
FileInterface file = null;
try {
file = GAT.createFile(gatContext, preferences, "any://" + host + "/" + filename).getFileInterface();
} catch (GATObjectCreationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long start = System.currentTimeMillis();
long time;
try {
time = file.lastModified();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(time == correctValue, (stop - start), null);
}
use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method mkdirsTest.
private AdaptorTestResultEntry mkdirsTest(GATContext gatContext, Preferences preferences, String host, String filename, int tabs, boolean correctValue) {
FileInterface file = null;
try {
file = GAT.createFile(gatContext, preferences, "any://" + host + "/" + filename).getFileInterface();
} catch (GATObjectCreationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long start = System.currentTimeMillis();
boolean mkdirs;
try {
mkdirs = file.mkdirs();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(mkdirs == correctValue, (stop - start), null);
}
Aggregations