@Test public void testGetMsg() throws Exception { boolean success = false; boolean success2 = false; boolean success3 = false; int i = JqmSimpleTest.create(cnx, "pyl.EngineApiSend3Msg").run(this); List<String> ress = JqmClientFactory.getClient().getJobMessages(i); Assert.assertEquals(3, ress.size()); for (int k = 0; k < ress.size(); k++) { if (ress.get(k).equals("Les marsus sont nos amis, il faut les aimer aussi!")) { success = true; } if (ress.get(k).equals("Les marsus sont nos amis, il faut les aimer aussi!2")) { success2 = true; } if (ress.get(k).equals("Les marsus sont nos amis, il faut les aimer aussi!3")) { success3 = true; } } Assert.assertEquals(true, success); Assert.assertEquals(true, success2); Assert.assertEquals(true, success3); }
@Test public void testPauseResumeRunning() throws Exception { CreationTools.createJobDef(null, true, "pyl.CallYieldAtOnce", null, "jqm-tests/jqm-test-pyl/target/test.jar", TestHelpers.qVip, 42, "MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx); int i = JobRequest.create("MarsuApplication", "TestUser").submit(); // Pause the JI in advance, so that it will receive the instruction on startup. JqmClientFactory.getClient().pauseRunningJob(i); addAndStartEngine(); TestHelpers.waitForRunning(1, 10000, cnx); Thread.sleep(2000); Assert.assertEquals(0, TestHelpers.getHistoryAllCount(cnx)); // Still running. // Pause should leave a message. List<String> msgs = JqmClientFactory.getClient().getJobMessages(i); Assert.assertEquals(1, msgs.size()); Assert.assertTrue(msgs.get(0).toLowerCase().contains("pause")); // Now resume. JqmClientFactory.getClient().resumeRunningJob(i); TestHelpers.waitFor(1, 10000, cnx); msgs = JqmClientFactory.getClient().getJobMessages(i); Assert.assertEquals(2, msgs.size()); Assert.assertEquals(1, TestHelpers.getOkCount(cnx)); }
Assert.assertEquals(1, JqmClientFactory.getClient().getJobMessages(i).size());