Search in sources :

Example 6 with FileInterface

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);
}
Also used : FileInterface(org.gridlab.gat.io.FileInterface) GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) GATInvocationException(org.gridlab.gat.GATInvocationException)

Example 7 with FileInterface

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);
}
Also used : FileInterface(org.gridlab.gat.io.FileInterface) GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) GATInvocationException(org.gridlab.gat.GATInvocationException)

Example 8 with FileInterface

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);
}
Also used : FileInterface(org.gridlab.gat.io.FileInterface) GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) GATInvocationException(org.gridlab.gat.GATInvocationException)

Example 9 with FileInterface

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);
}
Also used : FileInterface(org.gridlab.gat.io.FileInterface) GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) GATInvocationException(org.gridlab.gat.GATInvocationException)

Example 10 with FileInterface

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);
}
Also used : FileInterface(org.gridlab.gat.io.FileInterface) GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) GATInvocationException(org.gridlab.gat.GATInvocationException)

Aggregations

GATInvocationException (org.gridlab.gat.GATInvocationException)14 GATObjectCreationException (org.gridlab.gat.GATObjectCreationException)14 FileInterface (org.gridlab.gat.io.FileInterface)14 GATCopyException (es.bsc.compss.gat.master.exceptions.GATCopyException)1 WorkersDebugInfoCopyTransferable (es.bsc.compss.types.data.transferable.WorkersDebugInfoCopyTransferable)1 File (java.io.File)1 URISyntaxException (java.net.URISyntaxException)1 URI (org.gridlab.gat.URI)1