use of org.gridlab.gat.advert.MetaData in project compss by bsc-wdc.
the class AdvertServiceAdaptorTest method test.
public AdaptorTestResult test(String adaptor, String host) {
AdaptorTestResult adaptorTestResult = new AdaptorTestResult(adaptor, host);
Preferences preferences = new Preferences();
preferences.put("advertservice.adaptor.name", adaptor);
AdvertService advertService = null;
try {
advertService = GAT.createAdvertService(preferences);
} catch (GATObjectCreationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MetaData meta = new MetaData();
meta.put("version", "5.0");
meta.put("price", "2000");
adaptorTestResult.put("put object '1' at path 'a'", addTest(advertService, "1", meta, "a"));
adaptorTestResult.put("getMetaData 'a' ", getMetaDataTest(advertService, "a", meta));
meta = new MetaData();
meta.put("version", "5.0");
meta.put("price", "50");
adaptorTestResult.put("put object '2' at path 'b'", addTest(advertService, "2", meta, "b"));
adaptorTestResult.put("test path 'a' (CORRECT) ", getAdvertisableTest(advertService, "a", "1", true));
adaptorTestResult.put("test path 'a' (INCORRECT) ", getAdvertisableTest(advertService, "a", "2", false));
adaptorTestResult.put("test path 'b' (CORRECT) ", getAdvertisableTest(advertService, "b", "2", true));
adaptorTestResult.put("export ", exportTest(advertService, "any://" + host + "/exported-advert-database"));
meta = new MetaData();
meta.put("version", "9.1");
meta.put("price", "50");
adaptorTestResult.put("put object '3' at path 'c'", addTest(advertService, "3", meta, "c"));
adaptorTestResult.put("test path 'c' (CORRECT) ", getAdvertisableTest(advertService, "c", "3", true));
adaptorTestResult.put("import ", importTest(advertService, "any://" + host + "/exported-advert-database"));
adaptorTestResult.put("test path 'c' (INCORRECT) ", getAdvertisableTest(advertService, "c", null, true));
meta = new MetaData();
meta.put("price", "50");
adaptorTestResult.put("find price=50 ", findTest(advertService, meta, new String[] { "/b" }, true));
meta = new MetaData();
meta.put("version", "5.0");
adaptorTestResult.put("find version=5.0 ", findTest(advertService, meta, new String[] { "/b", "/a" }, true));
adaptorTestResult.put("delete 'b' ", deleteTest(advertService, "b"));
adaptorTestResult.put("setPWD 'test' ", setPWDTest(advertService, "/test"));
adaptorTestResult.put("getPWD 'test' ", getPWDTest(advertService, "/test"));
return adaptorTestResult;
}
use of org.gridlab.gat.advert.MetaData in project compss by bsc-wdc.
the class AdvertServiceAdaptorTest method getMetaDataTest.
private AdaptorTestResultEntry getMetaDataTest(AdvertService advert, String path, MetaData meta) {
long start = System.currentTimeMillis();
boolean result = false;
try {
MetaData metaData = advert.getMetaData(path);
result = metaData.equals(meta);
} catch (GATInvocationException e) {
return new AdaptorTestResultEntry(false, 0, e);
}
long stop = System.currentTimeMillis();
return new AdaptorTestResultEntry(result, (stop - start), null);
}
use of org.gridlab.gat.advert.MetaData in project compss by bsc-wdc.
the class AdvertJob method main.
public static void main(String[] args) throws Exception {
try {
GATContext c = new GATContext();
Preferences prefs = new Preferences();
prefs.put("File.adaptor.name", "local,commandlinessh");
prefs.put("job.stop.on.exit", "false");
c.addPreferences(prefs);
SoftwareDescription sd = new SoftwareDescription();
sd.setExecutable("/bin/sleep");
sd.setArguments("100");
// stdout & stderr
File stdout = GAT.createFile(c, "std.out");
File stderr = GAT.createFile(c, "std.err");
sd.setStderr(stderr);
sd.setStdout(stdout);
ResourceDescription rd = new HardwareResourceDescription();
JobDescription jd = new JobDescription(sd, rd);
ResourceBroker broker = GAT.createResourceBroker(c, new URI("sshsge://fs0.das3.cs.vu.nl"));
Job job = broker.submitJob(jd);
AdvertService a = GAT.createAdvertService(c);
MetaData m = new MetaData();
m.put("name", "testJob");
a.add(job, m, "/rob/testJob");
a.exportDataBase(new URI("file:///mydb"));
GAT.end();
System.exit(0);
} catch (Throwable e) {
e.printStackTrace();
}
}
Aggregations