本文整理了Java中com.enioka.jqm.api.Query.addSortAsc
方法的一些代码示例,展示了Query.addSortAsc
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.addSortAsc
方法的具体详情如下:
包路径:com.enioka.jqm.api.Query
类名称:Query
方法名:addSortAsc
[英]Adds a new column a the end of the sorting clause.
[中]在排序子句的末尾添加一个新列a。
代码示例来源:origin: enioka/jqm
@Override
public List<com.enioka.jqm.api.JobInstance> getActiveJobs()
{
return Query.create().setQueryHistoryInstances(false).setQueryLiveInstances(true).addSortAsc(Sort.ID).run();
}
代码示例来源:origin: enioka/jqm
@Override
public List<com.enioka.jqm.api.JobInstance> getUserActiveJobs(String user)
{
if (user == null || user.isEmpty())
{
throw new JqmInvalidRequestException("user cannot be null or empty");
}
return Query.create().setUser(user).setQueryHistoryInstances(false).setQueryLiveInstances(true).addSortAsc(Sort.ID).run();
}
代码示例来源:origin: enioka/jqm
/**
* A parent job can wait for all its children - then its end date should be after the end date of the children.
*/
@Test
public void testWaitChildren() throws Exception
{
JqmSimpleTest.create(cnx, "pyl.EngineApiWaitAll").expectOk(6).run(this);
List<JobInstance> jj = Query.create().addSortAsc(Sort.ID).addStatusFilter(State.ENDED).run();
Calendar parentEnd = jj.get(0).getEndDate();
for (int i = 1; i < 6; i++)
{
Assert.assertTrue(parentEnd.after(jj.get(i).getEndDate()));
}
}
代码示例来源:origin: enioka/jqm
@Test
public void testRunnableInject() throws Exception
{
JqmSimpleTest.create(cnx, "pyl.EngineApiInjectThread").expectOk(3).run(this);
Assert.assertEquals(3, (int) cnx.runSelectSingle("message_select_count_all", Integer.class));
Assert.assertEquals(100, (int) Query.create().addSortAsc(Sort.ID).run().get(0).getProgress());
}
代码示例来源:origin: enioka/jqm
@Test
public void testPauseInQueue() throws Exception
{
CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42,
"MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx);
int i = JobRequest.create("MarsuApplication", "TestUser").submit();
JqmClientFactory.getClient().pauseQueuedJob(i);
JobRequest.create("MarsuApplication", "TestUser").submit();
addAndStartEngine();
TestHelpers.waitFor(1, 5000, cnx);
List<JobInstance> res1 = Query.create().addSortAsc(Sort.DATEENQUEUE).run();
List<JobInstance> res2 = Query.create().addSortAsc(Sort.DATEENQUEUE).setQueryHistoryInstances(false).setQueryLiveInstances(true)
.run();
Assert.assertEquals(1, res1.size());
Assert.assertEquals(1, res2.size());
Assert.assertEquals(State.HOLDED, res2.get(0).getState());
Assert.assertEquals(State.ENDED, res1.get(0).getState());
}
代码示例来源:origin: enioka/jqm
@Test
public void testChangeQueue() throws Exception
{
CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42,
"MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx);
int i = JobRequest.create("MarsuApplication", "TestUser").submit();
JqmClientFactory.getClient().setJobQueue(i, TestHelpers.qSlow);
addAndStartEngine();
TestHelpers.waitFor(1, 10000, cnx);
List<JobInstance> res = Query.create().addSortAsc(Sort.DATEENQUEUE).run();
Assert.assertEquals(1, res.size());
Assert.assertEquals(State.ENDED, res.get(0).getState());
Assert.assertEquals("SlowQueue", res.get(0).getQueue().getName());
}
代码示例来源:origin: enioka/jqm
@Test
public void testHighlanderEngineRunning() throws Exception
{
// This test launches an infinite loop as Highlander, checks if no other job can launch. Job is killed at the end - which allows a
// second one to run, which also has to be killed.
CreationTools.createJobDef(null, true, "pyl.KillMe", null, "jqm-tests/jqm-test-pyl/target/test.jar", TestHelpers.qVip, 42, "kill",
null, "Franquin", "ModuleMachin", "other", "other", true, cnx);
addAndStartEngine();
int firstJob = JobRequest.create("kill", "TestUser").submit();
for (int i = 0; i < 100; i++)
{
JobRequest.create("kill", "TestUser").submit();
}
Thread.sleep(3000);
Calendar killTime1 = Calendar.getInstance();
JqmClientFactory.getClient().killJob(firstJob);
Thread.sleep(3000);
JqmClientFactory.getClient().killJob(JqmClientFactory.getClient().getUserActiveJobs("TestUser").get(0).getId());
TestHelpers.waitFor(2, 10000, cnx);
List<com.enioka.jqm.api.JobInstance> res = Query.create().addSortAsc(Sort.ID).run();
Assert.assertEquals(2, res.size());
Assert.assertEquals(State.CRASHED, res.get(0).getState());
Assert.assertEquals(State.CRASHED, res.get(1).getState());
Assert.assertTrue(killTime1.compareTo(res.get(1).getBeganRunningDate()) <= 0);
}
代码示例来源:origin: enioka/jqm
@Test
public void testCancelJob() throws Exception
{
CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42,
"MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", false, cnx);
int i = JobRequest.create("MarsuApplication", "TestUser").submit();
JqmClientFactory.getClient().cancelJob(i);
JobRequest.create("MarsuApplication", "TestUser").submit();
addAndStartEngine();
TestHelpers.waitFor(2, 5000, cnx);
List<JobInstance> res = Query.create().addSortAsc(Sort.DATEENQUEUE).run();
Assert.assertEquals(2, res.size());
Assert.assertEquals(State.CANCELLED, res.get(0).getState());
Assert.assertEquals(State.ENDED, res.get(1).getState());
}
代码示例来源:origin: enioka/jqm
@Test
public void testRestartJob() throws Exception
{
CreationTools.createJobDef(null, true, "App", null, "jqm-tests/jqm-test-datetimemaven/target/test.jar", TestHelpers.qVip, 42,
"MarsuApplication", null, "Franquin", "ModuleMachin", "other", "other", true, cnx);
int i = JobRequest.create("MarsuApplication", "TestUser").submit();
addAndStartEngine();
TestHelpers.waitFor(1, 10000, cnx);
JqmClientFactory.getClient().enqueueFromHistory(i);
TestHelpers.waitFor(2, 10000, cnx);
Assert.assertEquals(2, TestHelpers.getOkCount(cnx));
Assert.assertEquals(0, TestHelpers.getNonOkCount(cnx));
List<JobInstance> res = Query.create().addSortAsc(Sort.DATEENQUEUE).run();
Assert.assertEquals(2, res.size());
Assert.assertEquals("MarsuApplication", res.get(0).getApplicationName());
Assert.assertEquals("MarsuApplication", res.get(1).getApplicationName());
}
代码示例来源:origin: enioka/jqm
List<com.enioka.jqm.api.JobInstance> res = Query.create().addSortAsc(Sort.ID).run();
代码示例来源:origin: enioka/jqm
.addSortAsc(Sort.ID).run();
代码示例来源:origin: enioka/jqm
@Test
public void testEnqueueSynchronously() throws Exception
{
JqmSimpleTest.create(cnx, "pyl.StressFiboSync").addRuntimeParameter("p1", "34").addRuntimeParameter("p2", "55").expectOk(4)
.run(this);
List<JobInstance> res = Query.create().addSortAsc(Sort.ID).run();
JobInstance h1, h2 = null;
for (JobInstance h : res)
{
h1 = h2;
h2 = h;
if (h1 == null)
{
continue;
}
Assert.assertEquals(h2.getParent(), h1.getId());
Assert.assertTrue(h2.getEndDate().compareTo(h1.getEndDate()) <= 0);
Assert.assertTrue(h2.getEndDate().compareTo(h1.getBeganRunningDate()) > 0);
}
}
内容来源于网络,如有侵权,请联系作者删除!