added some tests

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@74596 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Federico De Faveri 2013-05-07 09:27:17 +00:00
parent 7e83ce39ae
commit 7d2e123bb4
2 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,37 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client;
import static org.gcube.data.spd.client.plugins.AbstractPlugin.manager;
import java.net.URI;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.spd.client.proxies.Manager;
import org.gcube.data.spd.model.PluginDescription;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class ListPlugins {
/**
* @param args
*/
public static void main(String[] args) {
String scope = "/gcube/devsec";
ScopeProvider.instance.set(scope);
Manager call = manager().at(URI.create("http://node24.d.d4science.research-infrastructures.eu:9000")).withTimeout(3, TimeUnit.MINUTES).build();
//Manager call = manager().withTimeout(3, TimeUnit.MINUTES).build();
List<PluginDescription> plugins = call.getPluginsDescription();
for (PluginDescription plugin:plugins) System.out.println(plugin.getName());
}
}

View File

@ -0,0 +1,44 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client;
import static org.gcube.data.spd.client.plugins.AbstractPlugin.manager;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.data.spd.client.proxies.Manager;
import org.gcube.data.spd.model.exceptions.InvalidQueryException;
import org.gcube.data.spd.model.products.ResultElement;
import org.gcube.data.spd.stubs.exceptions.UnsupportedPluginException;
import org.gcube.data.streams.Stream;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class ServiceQuery {
/**
* @param args
* @throws UnsupportedPluginException
* @throws InvalidQueryException
*/
public static void main(String[] args) throws InvalidQueryException, UnsupportedPluginException {
String scope = "/gcube/devsec";
ScopeProvider.instance.set(scope);
Manager call = manager().at(URI.create("http://node24.d.d4science.research-infrastructures.eu:9000")).withTimeout(3, TimeUnit.MINUTES).build();
//Stream<ResultElement> results = call.search("SEARCH BY CN 'shark' RESOLVE WITH OBIS EXPAND WITH ITIS RETURN Product");
Stream<ResultElement> results = call.search("SEARCH BY CN 'shark' RESOLVE WITH OBIS EXPAND WITH ITIS WHERE coordinate <= 15.12, 16.12 RETURN Product");
if (results.hasNext()) results.next();
results.close();
System.out.println("DONE");
}
}