use of org.gridlab.gat.GATObjectCreationException in project compss by bsc-wdc.
the class FileAdaptorTest method createNewFileTest.
private AdaptorTestResultEntry createNewFileTest(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 created;
try {
created = file.createNewFile();
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(created == correctValue, (stop - start), null);
}
use of org.gridlab.gat.GATObjectCreationException in project compss by bsc-wdc.
the class FileAdaptorTest method copyFileTest.
private AdaptorTestResultEntry copyFileTest(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();
try {
file.copy(new URI("any:///" + filename + ".copy"));
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
} catch (URISyntaxException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
boolean exists = new java.io.File(filename + ".copy").exists();
if (exists) {
new java.io.File(filename + ".copy").delete();
}
return new AdaptorTestResultEntry(exists == correctValue, (stop - start), null);
}
use of org.gridlab.gat.GATObjectCreationException 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.GATObjectCreationException 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.GATObjectCreationException 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);
}
Aggregations