2015-02-04 12:35:43 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.vremanagement.executor;
|
|
|
|
|
2015-07-28 15:41:35 +02:00
|
|
|
|
|
|
|
import java.util.HashMap;
|
2015-02-04 12:35:43 +01:00
|
|
|
import java.util.Map;
|
|
|
|
|
2015-07-28 15:41:35 +02:00
|
|
|
import org.acme.HelloWorldPlugin;
|
2015-02-04 12:35:43 +01:00
|
|
|
import org.acme.HelloWorldPluginDeclaration;
|
2015-07-28 15:41:35 +02:00
|
|
|
import org.gcube.vremanagement.executor.persistence.JDBCPersistenceConnector;
|
2015-08-26 14:29:00 +02:00
|
|
|
import org.gcube.vremanagement.executor.persistence.SmartExecutorPersistenceConnector;
|
2015-07-28 15:41:35 +02:00
|
|
|
import org.gcube.vremanagement.executor.plugin.Plugin;
|
|
|
|
import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
|
|
|
|
import org.gcube.vremanagement.executor.pluginmanager.PluginManager;
|
2015-02-04 12:35:43 +01:00
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class ExecutorImplTest {
|
|
|
|
|
2015-07-28 15:41:35 +02:00
|
|
|
/*
|
|
|
|
@Test
|
2015-02-04 12:35:43 +01:00
|
|
|
public void createServiceEndpointTest() {
|
2015-07-28 15:41:35 +02:00
|
|
|
TODO Redesign this test
|
2015-02-11 17:19:45 +01:00
|
|
|
ServiceEndpoint serviceEndpoint = SmartExecutorInitalizator.createServiceEndpoint();
|
2015-02-04 12:35:43 +01:00
|
|
|
|
|
|
|
Profile profile = serviceEndpoint.profile();
|
2015-02-11 17:19:45 +01:00
|
|
|
Assert.assertEquals(SmartExecutor.WEB_SERVICE_SERVICE_NAME, profile.category());
|
|
|
|
Assert.assertEquals(SmartExecutor.class.getSimpleName(), profile.name());
|
2015-02-04 12:35:43 +01:00
|
|
|
Group<AccessPoint> accessPoints = profile.accessPoints();
|
|
|
|
Assert.assertEquals(1, accessPoints.size());
|
|
|
|
HelloWorldPluginDeclaration hwpd = new HelloWorldPluginDeclaration();
|
|
|
|
Map<String, String> supportedCapabilities = hwpd.getSupportedCapabilities();
|
|
|
|
for(AccessPoint accessPoint : accessPoints){
|
|
|
|
Assert.assertEquals(hwpd.getName(),accessPoint.name());
|
|
|
|
Group<Property> properties = accessPoint.properties();
|
|
|
|
Assert.assertEquals(supportedCapabilities.size(), properties.size());
|
|
|
|
for(Property property : properties){
|
|
|
|
String propertyName = property.name();
|
|
|
|
Assert.assertTrue(supportedCapabilities.containsKey(propertyName));
|
|
|
|
Assert.assertEquals(supportedCapabilities.get(propertyName), property.value());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2015-07-28 15:41:35 +02:00
|
|
|
*/
|
2015-02-04 12:35:43 +01:00
|
|
|
|
2015-02-06 17:01:31 +01:00
|
|
|
@Test
|
2015-07-28 15:41:35 +02:00
|
|
|
public void myJavaTest() throws Exception{
|
|
|
|
|
2015-08-26 14:29:00 +02:00
|
|
|
JDBCPersistenceConnector jdbcPersistenceConnector = new JDBCPersistenceConnector(".");
|
|
|
|
SmartExecutorPersistenceConnector.setPersistenceConnector(jdbcPersistenceConnector);
|
2015-07-28 15:41:35 +02:00
|
|
|
|
|
|
|
Map<String, Object> inputs = new HashMap<String, Object>();
|
|
|
|
long sleepTime = 10000;
|
|
|
|
inputs.put(HelloWorldPlugin.SLEEP_TIME, sleepTime);
|
|
|
|
Plugin<? extends PluginDeclaration> runnablePlugin = PluginManager.instantiatePlugin(HelloWorldPluginDeclaration.NAME);
|
|
|
|
runnablePlugin.launch(inputs);
|
2015-02-06 17:01:31 +01:00
|
|
|
}
|
|
|
|
|
2015-02-04 12:35:43 +01:00
|
|
|
}
|