Fixing tests
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@111667 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
bd00ebddf8
commit
82725241a1
|
@ -61,7 +61,7 @@ public class JDBCPersistenceConnector extends PersistenceConnector {
|
|||
Path currentAbsolutePath = Paths.get(".").toAbsolutePath().normalize();
|
||||
logger.debug(String.format("Current Absolute Path : %s",currentAbsolutePath));
|
||||
String effectiveJDBCURL = String.format("%s%s/%s", jdbcURL, currentAbsolutePath.toString(), dbName);
|
||||
connection = DriverManager.getConnection(effectiveJDBCURL,username, password);
|
||||
connection = DriverManager.getConnection(effectiveJDBCURL, username, password);
|
||||
} catch (SQLException e) {
|
||||
logger.error(String.format("Unable to connect to JDBC URL : %s", jdbcURL));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ExecutorImplTest {
|
|||
try {
|
||||
ExecutorImpl.init();
|
||||
} catch(Exception e) {
|
||||
// OK
|
||||
// :(
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,21 +18,18 @@ import org.junit.Test;
|
|||
*/
|
||||
public class JDBCPersistenceConnectorTest {
|
||||
|
||||
private JDBCPersistenceConnector jdbcPersistenceConnector;
|
||||
|
||||
public JDBCPersistenceConnectorTest() throws Exception{
|
||||
jdbcPersistenceConnector = new JDBCPersistenceConnector();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getConnectionTest() {
|
||||
Assert.assertNotNull(jdbcPersistenceConnector.getConnection());;
|
||||
public void getConnectionTest() throws Exception {
|
||||
JDBCPersistenceConnector jdbcPersistenceConnector = new JDBCPersistenceConnector();
|
||||
Assert.assertNotNull(jdbcPersistenceConnector.getConnection());
|
||||
jdbcPersistenceConnector.close();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPluginInstanceStateTest() throws Exception {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
JDBCPersistenceConnector jdbcPersistenceConnector = new JDBCPersistenceConnector();
|
||||
JDBCPersistence jdbcPersistence = new JDBCPersistence(jdbcPersistenceConnector, HelloWorldPluginDeclaration.name, uuid);
|
||||
|
||||
PluginState[] states = PluginState.values();
|
||||
|
@ -42,8 +39,8 @@ public class JDBCPersistenceConnectorTest {
|
|||
PluginState ps = jdbcPersistenceConnector.getPluginInstanceState(uuid);
|
||||
Assert.assertEquals(states[i], ps);
|
||||
}
|
||||
|
||||
jdbcPersistenceConnector.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -24,19 +24,13 @@ public class PluginThreadTest {
|
|||
* Logger
|
||||
*/
|
||||
private static Logger logger = LoggerFactory.getLogger(PluginThreadTest.class);
|
||||
|
||||
private HelloWorldPluginDeclaration hwpd;
|
||||
private JDBCPersistenceConnector jdbcPersistenceConnector;
|
||||
|
||||
public PluginThreadTest() throws Exception{
|
||||
this.hwpd = new HelloWorldPluginDeclaration();
|
||||
this.jdbcPersistenceConnector = new JDBCPersistenceConnector();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void launchNullInputsTest() throws Exception {
|
||||
logger.debug("Testing Null inputs");
|
||||
UUID uuid = UUID.randomUUID();
|
||||
HelloWorldPluginDeclaration hwpd = new HelloWorldPluginDeclaration();
|
||||
JDBCPersistenceConnector jdbcPersistenceConnector = new JDBCPersistenceConnector();
|
||||
JDBCPersistence jdbcPersistence = new JDBCPersistence(jdbcPersistenceConnector, hwpd.getName(), uuid);
|
||||
HelloWorldPlugin helloWorldPlugin = new HelloWorldPlugin(hwpd, jdbcPersistence);
|
||||
try {
|
||||
|
@ -44,7 +38,7 @@ public class PluginThreadTest {
|
|||
} catch(Exception e){
|
||||
Assert.assertEquals(NullPointerException.class, e.getClass());
|
||||
}
|
||||
|
||||
jdbcPersistenceConnector.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -52,12 +46,15 @@ public class PluginThreadTest {
|
|||
logger.debug("Testing Empty inputs");
|
||||
Map<String, Object> inputs = new HashMap<String, Object>();
|
||||
UUID uuid = UUID.randomUUID();
|
||||
HelloWorldPluginDeclaration hwpd = new HelloWorldPluginDeclaration();
|
||||
JDBCPersistenceConnector jdbcPersistenceConnector = new JDBCPersistenceConnector();
|
||||
JDBCPersistence jdbcPersistence = new JDBCPersistence(jdbcPersistenceConnector, hwpd.getName(), uuid);
|
||||
HelloWorldPlugin helloWorldPlugin = new HelloWorldPlugin(hwpd, jdbcPersistence);
|
||||
PluginThread<HelloWorldPlugin> pt = new PluginThread<HelloWorldPlugin>(helloWorldPlugin, inputs, uuid);
|
||||
pt.start();
|
||||
Thread.sleep(1000);
|
||||
Assert.assertEquals(PluginState.FAILED, jdbcPersistence.getState());
|
||||
jdbcPersistenceConnector.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -67,6 +64,8 @@ public class PluginThreadTest {
|
|||
inputs.put("Test", "Test");
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
HelloWorldPluginDeclaration hwpd = new HelloWorldPluginDeclaration();
|
||||
JDBCPersistenceConnector jdbcPersistenceConnector = new JDBCPersistenceConnector();
|
||||
JDBCPersistence jdbcPersistence = new JDBCPersistence(jdbcPersistenceConnector, hwpd.getName(), uuid);
|
||||
HelloWorldPlugin helloWorldPlugin = new HelloWorldPlugin(hwpd, jdbcPersistence);
|
||||
PluginThread<HelloWorldPlugin> pt = new PluginThread<HelloWorldPlugin>(helloWorldPlugin, inputs, uuid);
|
||||
|
@ -83,6 +82,7 @@ public class PluginThreadTest {
|
|||
Thread.sleep(6000);
|
||||
Assert.assertEquals(PluginState.DONE, jdbcPersistence.getState());
|
||||
|
||||
jdbcPersistenceConnector.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue