/** * This is {@link #resetClient(String)} with name = null. */ public static void resetClient() { resetClient(null); }
private void close() { s.stop(); s.shutdown(); cnx.close(); JqmClientFactory.resetClient(); JqmClientFactory.setProperties(new Properties()); }
private void close() { s.stop(); s.shutdown(); cnx.close(); JqmClientFactory.resetClient(); JqmClientFactory.setProperties(new Properties()); }
/** * Stops all engines. Only returns when engines are fully stopped. */ public void stop() { if (!hasStarted) { throw new IllegalStateException("cannot stop a tester which has not started"); } for (JqmEngineOperations op : this.engines.values()) { op.stop(); } JqmClientFactory.resetClient(); cnx.close(); s.stop(); waitDbStop(); s = null; hasStarted = false; this.engines.clear(); }
/** * Stops all engines. Only returns when engines are fully stopped. */ public void stop() { if (!hasStarted) { throw new IllegalStateException("cannot stop a tester which has not started"); } for (JqmEngineOperations op : this.engines.values()) { op.stop(); } JqmClientFactory.resetClient(); cnx.close(); s.stop(); waitDbStop(); s = null; hasStarted = false; this.engines.clear(); }
@Before public void beforeTest() { jqmlogger.debug("**********************************************************"); jqmlogger.debug("Starting test " + testName.getMethodName()); try { ((JndiContext) NamingManager.getInitialContext(null)).resetSingletons(); } catch (NamingException e) { jqmlogger.warn("Could not purge test JNDI context", e); } JqmClientFactory.resetClient(null); cnx = getNewDbSession(); TestHelpers.cleanup(cnx); TestHelpers.createTestData(cnx); cnx.commit(); }
/** * Retrieve a remote file with authentication, with SSL. */ @Test public void testGetOneDeliverableWithAuthWithSsl() throws Exception { Helpers.setSingleParam("disableWsApi", "false", cnx); Helpers.setSingleParam("enableWsApiAuth", "true", cnx); Helpers.setSingleParam("enableWsApiSsl", "true", cnx); JqmClientFactory.resetClient(null); JqmClientFactory.setProperty("com.enioka.jqm.ws.truststoreFile", "./conf/trusted.jks"); JqmClientFactory.setProperty("com.enioka.jqm.ws.truststorePass", "SuperPassword"); int jobId = JqmSimpleTest.create(cnx, "pyl.EngineApiSendDeliverable").addDefParameter("filepath", TestHelpers.node.getDlRepo()) .addDefParameter("fileName", "jqm-test-deliverable4.txt").run(this); File f = new File(TestHelpers.node.getDlRepo() + "jqm-test-deliverable4.txt"); Assert.assertEquals(false, f.exists()); // file should have been moved List<com.enioka.jqm.api.Deliverable> files = JqmClientFactory.getClient().getJobDeliverables(jobId); Assert.assertEquals(1, files.size()); InputStream tmp = JqmClientFactory.getClient().getDeliverableContent(files.get(0)); Assert.assertTrue(tmp.available() > 0); String res = IOUtils.toString(tmp, Charset.defaultCharset()); Assert.assertTrue(res.startsWith("Hello World!")); tmp.close(); }