Search in sources :

Example 11 with FileInterface

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

Example 12 with FileInterface

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

Example 13 with FileInterface

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

Example 14 with FileInterface

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);
}
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