/** * */ package org.gcube.vremanagement.executor.soap.client; import org.gcube.testutility.ContextTest; /** * @author Luca Frosini (ISTI - CNR) */ public class QueriedClientTest extends ContextTest { // private static Logger logger = LoggerFactory.getLogger(QueriedClientTest.class); // // private void launchTest(SmartExecutorProxy proxy) throws Exception { // Map inputs = new HashMap(); // inputs.put("Hello", "World"); // long sleepTime = 10000; // inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime); // LaunchParameter launchParameter = new LaunchParameter(HelloWorldPluginDeclaration.NAME, inputs); // try { // String executionIdentifier = proxy.launch(launchParameter); // proxy.getStateEvolution(executionIdentifier); // } catch (Exception e) { // throw e; // } // } // // @Test // public void testNoConditions() throws Exception { // SmartExecutorProxy proxy = ExecutorPlugin.getExecutorProxy(HelloWorldPluginDeclaration.NAME).build(); // Assert.assertNotNull(proxy); // // try { // launchTest(proxy); // } catch (Exception e) { // logger.error("testNoConditions Exception", e); // throw e; // } // // } // // @Test // public void testWithSingleRightConditions() throws Exception { // HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration(); // Map map = helloWorldPluginDeclaration.getSupportedCapabilities(); // Tuple tuple = new Tuple(); // for(String key : map.keySet()){ // tuple = new Tuple(key, map.get(key)); // break; // Get only the first // } // SmartExecutorProxy proxy = ExecutorPlugin.getExecutorProxy(HelloWorldPluginDeclaration.NAME, tuple).build(); // Assert.assertNotNull(proxy); // // try { // launchTest(proxy); // } catch (Exception e) { // logger.error("testWithSingleRighConditions Exception", e); // throw e; // } // } // // @Test // public void testWithMultipleRightConditions() throws Exception { // HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration(); // Map map = helloWorldPluginDeclaration.getSupportedCapabilities(); // // @SuppressWarnings("unchecked") // Tuple[] tuples = new Tuple[map.size()+1]; // int i = 0; // for(String key : map.keySet()){ // tuples[i] = new Tuple(key, map.get(key)); // ++i; // } // // tuples[i] = new Tuple("Version", helloWorldPluginDeclaration.getVersion()); // // SmartExecutorProxy proxy = ExecutorPlugin.getExecutorProxy(HelloWorldPluginDeclaration.NAME, tuples).build(); // Assert.assertNotNull(proxy); // // try { // launchTest(proxy); // } catch (Exception e) { // logger.error("testWithMultipleRighConditions Exception", e); // throw e; // } // } // // @Test // public void testWithUnsatisfiedConditions() { // Tuple tuple = new Tuple("Unsatisfied", "Condition"); // SmartExecutorProxy proxy = ExecutorPlugin.getExecutorProxy(HelloWorldPluginDeclaration.NAME, tuple).build(); // Assert.assertNotNull(proxy); // try { // launchTest(proxy); // } catch (Exception e) { // Assert.assertEquals(DiscoveryException.class, e.getClass()); // } // } // // @SuppressWarnings("unchecked") // @Test // public void testWithPersonalfilters() throws Exception { // ExecutorPlugin executorPlugin = new ExecutorPlugin(); // SmartExecutorPluginQuery query = new SmartExecutorPluginQuery(executorPlugin); // HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration(); // Map map = helloWorldPluginDeclaration.getSupportedCapabilities(); // Tuple tuple = new Tuple(); // for(String key : map.keySet()){ // tuple = new Tuple(key, map.get(key)); // break; // Get only the first // } // // query.addConditions(HelloWorldPluginDeclaration.NAME, tuple); // query.setServiceEndpointQueryFilter(null); // query.setEndpointDiscoveryFilter(null); // // SmartExecutorProxy proxy = new ProxyBuilderImpl(executorPlugin, query).build(); // // try { // launchTest(proxy); // } catch (Exception e) { // logger.error("testWithPersonalfilters Exception", e); // throw e; // } // } // // @Test // public void testManagedPersonalfilters() throws Exception { // HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration(); // Map map = helloWorldPluginDeclaration.getSupportedCapabilities(); // @SuppressWarnings("unchecked") // Tuple[] tuples = new Tuple[map.size()]; // int i = 0; // for(String key : map.keySet()){ // tuples[i] = new Tuple(key, map.get(key)); // ++i; // } // // SmartExecutorProxy proxy = ExecutorPlugin.getExecutorProxy(HelloWorldPluginDeclaration.NAME, tuples, null, new RandomEndpointDiscoveryFilter()).build(); // Assert.assertNotNull(proxy); // // try { // launchTest(proxy); // } catch (Exception e) { // logger.error("testManagedPersonalfilters Exception", e); // throw e; // } // } // // @SuppressWarnings("unchecked") // @Test // public void testWithListfilters() throws Exception { // ExecutorPlugin executorPlugin = new ExecutorPlugin(); // SmartExecutorPluginQuery query = new SmartExecutorPluginQuery(executorPlugin); // HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration(); // Map map = helloWorldPluginDeclaration.getSupportedCapabilities(); // Tuple tuple = new Tuple(); // for(String key : map.keySet()){ // tuple = new Tuple(key, map.get(key)); // break; // Get only the first // } // // query.addConditions(HelloWorldPluginDeclaration.NAME, tuple); // query.setServiceEndpointQueryFilter(null); // query.setEndpointDiscoveryFilter(new ListEndpointDiscoveryFilter()); // // SmartExecutorProxy proxy = new ProxyBuilderImpl(executorPlugin, query).build(); // // try { // launchTest(proxy); // } catch (Exception e) { // logger.error("testWithListfilters Exception", e); // throw e; // } // } // // // // // @SuppressWarnings("unchecked") // @Test // public void testWithSpecificSelection() throws Exception { // ExecutorPlugin executorPlugin = new ExecutorPlugin(); // SmartExecutorPluginQuery query = new SmartExecutorPluginQuery(executorPlugin); // HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration(); // Map map = helloWorldPluginDeclaration.getSupportedCapabilities(); // Tuple tuple = new Tuple(); // for(String key : map.keySet()){ // tuple = new Tuple(key, map.get(key)); // break; // Get only the first // } // // query.addConditions(HelloWorldPluginDeclaration.NAME, tuple); // query.setServiceEndpointQueryFilter(null); // List endpoints = query.discoverEndpoints(new ListEndpointDiscoveryFilter()); // // for(String endpoint : endpoints){ // // ExecutorPlugin runExecutorPlugin = new ExecutorPlugin(); // SmartExecutorPluginQuery runQuery = new SmartExecutorPluginQuery(runExecutorPlugin); // runQuery.addConditions(HelloWorldPluginDeclaration.NAME, tuple); // // SpecificEndpointDiscoveryFilter sedf = new SpecificEndpointDiscoveryFilter(endpoint); // runQuery.setEndpointDiscoveryFilter(sedf); // SmartExecutorProxy proxy = new ProxyBuilderImpl(runExecutorPlugin, runQuery).build(); // // try { // launchTest(proxy); // } catch (Exception e) { // logger.error("testWithSpecificSelection Exception", e); // throw e; // } // } // } }