use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method deleteTest.
private AdaptorTestResultEntry deleteTest(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 delete;
try {
delete = file.delete();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(delete == correctValue, (stop - start), null);
}
use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method existTest.
private AdaptorTestResultEntry existTest(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 exists;
try {
exists = file.exists();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(exists == correctValue, (stop - start), null);
}
use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method isFileTest.
private AdaptorTestResultEntry isFileTest(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);
}
boolean isFile = false;
long start = System.currentTimeMillis();
try {
isFile = file.isFile();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(isFile == correctValue, (stop - start), null);
}
use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method isDirectoryTest.
private AdaptorTestResultEntry isDirectoryTest(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);
}
boolean isDir = false;
long start = System.currentTimeMillis();
try {
isDir = file.isDirectory();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(isDir == correctValue, (stop - start), null);
}
use of org.gridlab.gat.io.FileInterface in project compss by bsc-wdc.
the class FileAdaptorTest method lengthTest.
private AdaptorTestResultEntry lengthTest(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 length;
try {
length = file.length();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(length == correctValue, (stop - start), null);
}
Aggregations