Added test to find generic worker instances
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor-client@119819 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
27e48061b0
commit
0c28d569e7
6
pom.xml
6
pom.xml
|
@ -70,6 +70,12 @@
|
|||
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dataanalysis</groupId>
|
||||
<artifactId>smart-generic-worker</artifactId>
|
||||
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.vremanagement.executor.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.dataanalysis.executor.plugin.GenericWorkerPluginDeclaration;
|
||||
import org.gcube.vremanagement.executor.client.plugins.ExecutorPlugin;
|
||||
import org.gcube.vremanagement.executor.client.plugins.query.SmartExecutorPluginQuery;
|
||||
import org.gcube.vremanagement.executor.client.plugins.query.filter.ListEndpointDiscoveryFilter;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*
|
||||
*/
|
||||
public class SmartGenericWorkerDiscoveryQuery {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(SmartGenericWorkerDiscoveryQuery.class);
|
||||
|
||||
@Test
|
||||
public void testGenericWorkerDiscoveryQuery() throws Exception {
|
||||
GenericWorkerPluginDeclaration gwpd = new GenericWorkerPluginDeclaration();
|
||||
|
||||
ScopeProvider.instance.set("/gcube");
|
||||
|
||||
ExecutorPlugin executorPlugin = new ExecutorPlugin();
|
||||
SmartExecutorPluginQuery query = new SmartExecutorPluginQuery(executorPlugin);
|
||||
|
||||
/*
|
||||
add key_value filter here
|
||||
* Tuple<String, String>[] tuples = new Tuple[n];
|
||||
*
|
||||
* runQuery.addConditions(pluginName, tuples);
|
||||
*/
|
||||
|
||||
query.addConditions(gwpd.getName());
|
||||
|
||||
/* Used to add extra filter to ServiceEndpoint discovery */
|
||||
query.setServiceEndpointQueryFilter(null);
|
||||
List<String> nodes = query.discoverEndpoints(new ListEndpointDiscoveryFilter());
|
||||
logger.debug("Found the following nodes: "+nodes+" in scope "+ScopeProvider.instance.get());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue