Search in sources :

Example 1 with RuntimeStatisticsVO

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();
}
Also used : RuntimeStatisticsVO(org.olat.restapi.system.vo.RuntimeStatisticsVO) URI(java.net.URI) Test(org.junit.Test)

Example 2 with RuntimeStatisticsVO

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();
}
Also used : RuntimeStatisticsVO(org.olat.restapi.system.vo.RuntimeStatisticsVO) URI(java.net.URI) Test(org.junit.Test)

Example 3 with RuntimeStatisticsVO

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();
}
Also used : RuntimeStatisticsVO(org.olat.restapi.system.vo.RuntimeStatisticsVO) RuntimeMXBean(java.lang.management.RuntimeMXBean) OperatingSystemMXBean(java.lang.management.OperatingSystemMXBean) Date(java.util.Date) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 4 with RuntimeStatisticsVO

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();
}
Also used : RuntimeStatisticsVO(org.olat.restapi.system.vo.RuntimeStatisticsVO) RuntimeMXBean(java.lang.management.RuntimeMXBean) OperatingSystemMXBean(java.lang.management.OperatingSystemMXBean) Date(java.util.Date) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 5 with RuntimeStatisticsVO

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();
}
Also used : RuntimeStatisticsVO(org.olat.restapi.system.vo.RuntimeStatisticsVO) URI(java.net.URI) Test(org.junit.Test)

Aggregations

RuntimeStatisticsVO (org.olat.restapi.system.vo.RuntimeStatisticsVO)6 URI (java.net.URI)4 Test (org.junit.Test)4 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)2 RuntimeMXBean (java.lang.management.RuntimeMXBean)2 Date (java.util.Date)2 GET (javax.ws.rs.GET)2 Produces (javax.ws.rs.Produces)2