use of org.olat.restapi.system.vo.RuntimeStatisticsVO in project OpenOLAT by OpenOLAT.
the class SystemTest method testRuntimeStatisticsInfos.
@Test
public void testRuntimeStatisticsInfos() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("runtime").build();
RuntimeStatisticsVO runtimeStats = conn.get(systemUri, RuntimeStatisticsVO.class);
assertNotNull(runtimeStats);
assertNotNull(runtimeStats.getClasses());
assertNotNull(runtimeStats.getMemory());
assertNotNull(runtimeStats.getThreads());
conn.shutdown();
}
use of org.olat.restapi.system.vo.RuntimeStatisticsVO in project openolat by klemens.
the class SystemTest method testRuntimeStatsSystem.
@Test
public void testRuntimeStatsSystem() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("runtime").build();
RuntimeStatisticsVO runInfos = conn.get(systemUri, RuntimeStatisticsVO.class);
assertNotNull(runInfos);
assertNotNull(runInfos.getStartTime());
assertNotNull(runInfos.getClasses());
assertNotNull(runInfos.getMemory());
assertNotNull(runInfos.getThreads());
assertTrue(runInfos.getSystemLoadAverage() > 0.0d);
assertTrue(runInfos.getUpTime() > 0);
conn.shutdown();
}
use of org.olat.restapi.system.vo.RuntimeStatisticsVO in project openolat by klemens.
the class RuntimeWebService method getSystemSummaryVO.
/**
* Return the statistics about runtime: uptime, classes loaded, memory
* summary, threads count...
*
* @response.representation.200.qname {http://www.example.com}runtimeVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc The version of the instance
* @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RUNTIMEVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @param request The HTTP request
* @return The informations about runtime, uptime, classes loaded, memory summary...
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getSystemSummaryVO() {
RuntimeStatisticsVO stats = new RuntimeStatisticsVO();
stats.setMemory(getMemoryStatisticsVO());
stats.setThreads(getThreadStatisticsVO());
stats.setClasses(getClasseStatisticsVO());
OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
stats.setSystemLoadAverage(os.getSystemLoadAverage());
stats.setStartTime(new Date(runtime.getStartTime()));
stats.setUpTime(runtime.getUptime());
return Response.ok(stats).build();
}
use of org.olat.restapi.system.vo.RuntimeStatisticsVO in project OpenOLAT by OpenOLAT.
the class RuntimeWebService method getSystemSummaryVO.
/**
* Return the statistics about runtime: uptime, classes loaded, memory
* summary, threads count...
*
* @response.representation.200.qname {http://www.example.com}runtimeVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc The version of the instance
* @response.representation.200.example {@link org.olat.restapi.system.vo.Examples#SAMPLE_RUNTIMEVO}
* @response.representation.401.doc The roles of the authenticated user are not sufficient
* @param request The HTTP request
* @return The informations about runtime, uptime, classes loaded, memory summary...
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getSystemSummaryVO() {
RuntimeStatisticsVO stats = new RuntimeStatisticsVO();
stats.setMemory(getMemoryStatisticsVO());
stats.setThreads(getThreadStatisticsVO());
stats.setClasses(getClasseStatisticsVO());
OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
stats.setSystemLoadAverage(os.getSystemLoadAverage());
stats.setStartTime(new Date(runtime.getStartTime()));
stats.setUpTime(runtime.getUptime());
return Response.ok(stats).build();
}
use of org.olat.restapi.system.vo.RuntimeStatisticsVO in project OpenOLAT by OpenOLAT.
the class SystemTest method testRuntimeStatsSystem.
@Test
public void testRuntimeStatsSystem() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("runtime").build();
RuntimeStatisticsVO runInfos = conn.get(systemUri, RuntimeStatisticsVO.class);
assertNotNull(runInfos);
assertNotNull(runInfos.getStartTime());
assertNotNull(runInfos.getClasses());
assertNotNull(runInfos.getMemory());
assertNotNull(runInfos.getThreads());
assertTrue(runInfos.getSystemLoadAverage() > 0.0d);
assertTrue(runInfos.getUpTime() > 0);
conn.shutdown();
}
Aggregations