use of org.olat.restapi.system.vo.ThreadVOes in project OpenOLAT by OpenOLAT.
the class ThreadsWebService method getThreadsCpu.
@GET
@Path("cpu")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public synchronized Response getThreadsCpu() {
List<ThreadView> threadViews = CoreSpringFactory.getImpl(ThreadInfosManager.class).getThreadViews();
List<ThreadVO> threads = new ArrayList<ThreadVO>(threadViews.size());
for (ThreadView view : threadViews) {
threads.add(new ThreadVO(view));
}
Collections.sort(threads);
ThreadVO[] threadVos = threads.toArray(new ThreadVO[threads.size()]);
ThreadVOes voes = new ThreadVOes();
voes.setThreads(threadVos);
voes.setTotalCount(threadVos.length);
return Response.ok(voes).build();
}
use of org.olat.restapi.system.vo.ThreadVOes in project OpenOLAT by OpenOLAT.
the class SystemTest method testSystemThreadDetails.
@Test
public void testSystemThreadDetails() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("threads").path("cpu").build();
ThreadVOes threadInfos = conn.get(systemUri, ThreadVOes.class);
Assert.assertNotNull(threadInfos);
Assert.assertNotNull(threadInfos.getThreads());
Assert.assertTrue(threadInfos.getTotalCount() > 0);
Assert.assertEquals(threadInfos.getTotalCount(), threadInfos.getThreads().length);
ThreadVO threadVo = threadInfos.getThreads()[0];
Assert.assertNotNull(threadVo.getName());
Assert.assertTrue(threadVo.getCpuTime() >= 0);
Assert.assertTrue(threadVo.getCpuUsage() >= 0.0f);
Assert.assertTrue(threadVo.getId() > 0l);
conn.shutdown();
}
use of org.olat.restapi.system.vo.ThreadVOes in project openolat by klemens.
the class ThreadsWebService method getThreadsCpu.
@GET
@Path("cpu")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public synchronized Response getThreadsCpu() {
List<ThreadView> threadViews = CoreSpringFactory.getImpl(ThreadInfosManager.class).getThreadViews();
List<ThreadVO> threads = new ArrayList<ThreadVO>(threadViews.size());
for (ThreadView view : threadViews) {
threads.add(new ThreadVO(view));
}
Collections.sort(threads);
ThreadVO[] threadVos = threads.toArray(new ThreadVO[threads.size()]);
ThreadVOes voes = new ThreadVOes();
voes.setThreads(threadVos);
voes.setTotalCount(threadVos.length);
return Response.ok(voes).build();
}
use of org.olat.restapi.system.vo.ThreadVOes in project openolat by klemens.
the class SystemTest method testSystemThreadDetails.
@Test
public void testSystemThreadDetails() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("threads").path("cpu").build();
ThreadVOes threadInfos = conn.get(systemUri, ThreadVOes.class);
Assert.assertNotNull(threadInfos);
Assert.assertNotNull(threadInfos.getThreads());
Assert.assertTrue(threadInfos.getTotalCount() > 0);
Assert.assertEquals(threadInfos.getTotalCount(), threadInfos.getThreads().length);
ThreadVO threadVo = threadInfos.getThreads()[0];
Assert.assertNotNull(threadVo.getName());
Assert.assertTrue(threadVo.getCpuTime() >= 0);
Assert.assertTrue(threadVo.getCpuUsage() >= 0.0f);
Assert.assertTrue(threadVo.getId() > 0l);
conn.shutdown();
}
Aggregations