Added test
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor-client@119753 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0cbb5d9e0b
commit
9d5e6c17fa
7
pom.xml
7
pom.xml
|
@ -57,6 +57,13 @@
|
|||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.0.13</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.acme</groupId>
|
||||
<artifactId>HelloWorldPlugin</artifactId>
|
||||
|
|
|
@ -19,6 +19,8 @@ import org.gcube.vremanagement.executor.plugin.PluginState;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
|
@ -26,6 +28,8 @@ import org.junit.Test;
|
|||
*/
|
||||
public class DefaultExecutorTest {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DefaultExecutorTest.class);
|
||||
|
||||
private SmartExecutorProxy proxy;
|
||||
|
||||
@Before
|
||||
|
@ -59,7 +63,7 @@ public class DefaultExecutorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testOk() {
|
||||
public void testOk() throws Exception {
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put("Hello", "World");
|
||||
long sleepTime = 10000;
|
||||
|
@ -78,7 +82,8 @@ public class DefaultExecutorTest {
|
|||
Assert.assertEquals(PluginState.DONE, proxy.getState(executionIdentifier));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("testOk Exception", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.gcube.vremanagement.executor.client.proxies.SmartExecutorProxy;
|
|||
import org.gcube.vremanagement.executor.client.util.Tuple;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
|
@ -29,7 +31,9 @@ import org.junit.Test;
|
|||
*/
|
||||
public class QueriedClientTest {
|
||||
|
||||
private void lauchTest(SmartExecutorProxy proxy) throws Exception {
|
||||
private static Logger logger = LoggerFactory.getLogger(QueriedClientTest.class);
|
||||
|
||||
private void launchTest(SmartExecutorProxy proxy) throws Exception {
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
inputs.put("Hello", "World");
|
||||
LaunchParameter launchParameter = new LaunchParameter(HelloWorldPluginDeclaration.NAME, inputs);
|
||||
|
@ -42,21 +46,22 @@ public class QueriedClientTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNoConditions() {
|
||||
public void testNoConditions() throws Exception {
|
||||
ScopeProvider.instance.set("/gcube");
|
||||
SmartExecutorProxy proxy = ExecutorPlugin.getExecutorProxy(HelloWorldPluginDeclaration.NAME).build();
|
||||
Assert.assertNotNull(proxy);
|
||||
|
||||
try {
|
||||
lauchTest(proxy);
|
||||
launchTest(proxy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("testNoConditions Exception", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithSingleRighConditions() {
|
||||
public void testWithSingleRighConditions() throws Exception {
|
||||
ScopeProvider.instance.set("/gcube");
|
||||
HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration();
|
||||
Map<String,String> map = helloWorldPluginDeclaration.getSupportedCapabilities();
|
||||
|
@ -69,14 +74,15 @@ public class QueriedClientTest {
|
|||
Assert.assertNotNull(proxy);
|
||||
|
||||
try {
|
||||
lauchTest(proxy);
|
||||
launchTest(proxy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("testWithSingleRighConditions Exception", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithMultipleRighConditions() {
|
||||
public void testWithMultipleRighConditions() throws Exception {
|
||||
ScopeProvider.instance.set("/gcube");
|
||||
HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration();
|
||||
Map<String,String> map = helloWorldPluginDeclaration.getSupportedCapabilities();
|
||||
|
@ -95,9 +101,10 @@ public class QueriedClientTest {
|
|||
Assert.assertNotNull(proxy);
|
||||
|
||||
try {
|
||||
lauchTest(proxy);
|
||||
launchTest(proxy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("testWithMultipleRighConditions Exception", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +115,7 @@ public class QueriedClientTest {
|
|||
SmartExecutorProxy proxy = ExecutorPlugin.getExecutorProxy(HelloWorldPluginDeclaration.NAME, tuple).build();
|
||||
Assert.assertNotNull(proxy);
|
||||
try {
|
||||
lauchTest(proxy);
|
||||
launchTest(proxy);
|
||||
} catch (Exception e) {
|
||||
Assert.assertEquals(DiscoveryException.class, e.getClass());
|
||||
}
|
||||
|
@ -116,7 +123,7 @@ public class QueriedClientTest {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testWithPersonalfilters() {
|
||||
public void testWithPersonalfilters() throws Exception {
|
||||
ScopeProvider.instance.set("/gcube");
|
||||
|
||||
ExecutorPlugin executorPlugin = new ExecutorPlugin();
|
||||
|
@ -136,14 +143,15 @@ public class QueriedClientTest {
|
|||
SmartExecutorProxy proxy = new ProxyBuilderImpl<SmartExecutor, SmartExecutorProxy>(executorPlugin, query).build();
|
||||
|
||||
try {
|
||||
lauchTest(proxy);
|
||||
launchTest(proxy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("testWithPersonalfilters Exception", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManagedPersonalfilters() {
|
||||
public void testManagedPersonalfilters() throws Exception {
|
||||
ScopeProvider.instance.set("/gcube");
|
||||
HelloWorldPluginDeclaration helloWorldPluginDeclaration = new HelloWorldPluginDeclaration();
|
||||
Map<String,String> map = helloWorldPluginDeclaration.getSupportedCapabilities();
|
||||
|
@ -159,15 +167,16 @@ public class QueriedClientTest {
|
|||
Assert.assertNotNull(proxy);
|
||||
|
||||
try {
|
||||
lauchTest(proxy);
|
||||
launchTest(proxy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("testManagedPersonalfilters Exception", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testWithListfilters() {
|
||||
public void testWithListfilters() throws Exception {
|
||||
ScopeProvider.instance.set("/gcube");
|
||||
|
||||
ExecutorPlugin executorPlugin = new ExecutorPlugin();
|
||||
|
@ -187,9 +196,10 @@ public class QueriedClientTest {
|
|||
SmartExecutorProxy proxy = new ProxyBuilderImpl<SmartExecutor, SmartExecutorProxy>(executorPlugin, query).build();
|
||||
|
||||
try {
|
||||
lauchTest(proxy);
|
||||
launchTest(proxy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("testWithListfilters Exception", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +208,7 @@ public class QueriedClientTest {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testWithSpecificSelection() {
|
||||
public void testWithSpecificSelection() throws Exception {
|
||||
ScopeProvider.instance.set("/gcube");
|
||||
|
||||
ExecutorPlugin executorPlugin = new ExecutorPlugin();
|
||||
|
@ -226,9 +236,10 @@ public class QueriedClientTest {
|
|||
SmartExecutorProxy proxy = new ProxyBuilderImpl<SmartExecutor, SmartExecutorProxy>(runExecutorPlugin, runQuery).build();
|
||||
|
||||
try {
|
||||
lauchTest(proxy);
|
||||
launchTest(proxy);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("testWithSpecificSelection Exception", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="org.gcube" level="TRACE" />
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
Loading…
Reference in New Issue