use of org.olat.restapi.system.vo.DatabaseVO in project OpenOLAT by OpenOLAT.
the class SystemTest method testDatabase.
@Test
public void testDatabase() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("database").build();
DatabaseVO databaseInfos = conn.get(systemUri, DatabaseVO.class);
assertNotNull(databaseInfos);
assertNotNull(databaseInfos.getConnectionInfos());
assertNotNull(databaseInfos.getHibernateStatistics());
// connections
assertTrue(databaseInfos.getConnectionInfos().getActiveConnectionCount() >= 0);
assertTrue(databaseInfos.getConnectionInfos().getCurrentConnectionCount() > 0);
// hibernate
assertTrue(databaseInfos.getHibernateStatistics().getFailedTransactionsCount() >= 0);
assertTrue(databaseInfos.getHibernateStatistics().getOpenSessionsCount() >= 0);
assertTrue(databaseInfos.getHibernateStatistics().getOptimisticFailureCount() >= 0);
assertTrue(databaseInfos.getHibernateStatistics().getQueryExecutionCount() > 0);
assertTrue(databaseInfos.getHibernateStatistics().getQueryExecutionMaxTime() > 0);
assertNotNull(databaseInfos.getHibernateStatistics().getQueryExecutionMaxTimeQueryString());
assertTrue(databaseInfos.getHibernateStatistics().getSuccessfulTransactionCount() > 0);
assertTrue(databaseInfos.getHibernateStatistics().getTransactionsCount() > 0);
conn.shutdown();
}
use of org.olat.restapi.system.vo.DatabaseVO in project OpenOLAT by OpenOLAT.
the class DatabaseWebService method getDatabaseStatistics.
/**
* Return the statistics about database and hibernate
*
* @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_DATABASEVO}
* @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 getDatabaseStatistics() {
DatabaseConnectionVO connections = CoreSpringFactory.getImpl(DatabaseStatsManager.class).getConnectionInfos();
HibernateStatisticsVO hibernateStats = getHibernateStatistics();
DatabaseVO vo = new DatabaseVO();
vo.setConnectionInfos(connections);
vo.setHibernateStatistics(hibernateStats);
return Response.ok(vo).build();
}
use of org.olat.restapi.system.vo.DatabaseVO in project openolat by klemens.
the class DatabaseWebService method getDatabaseStatistics.
/**
* Return the statistics about database and hibernate
*
* @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_DATABASEVO}
* @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 getDatabaseStatistics() {
DatabaseConnectionVO connections = CoreSpringFactory.getImpl(DatabaseStatsManager.class).getConnectionInfos();
HibernateStatisticsVO hibernateStats = getHibernateStatistics();
DatabaseVO vo = new DatabaseVO();
vo.setConnectionInfos(connections);
vo.setHibernateStatistics(hibernateStats);
return Response.ok(vo).build();
}
use of org.olat.restapi.system.vo.DatabaseVO in project openolat by klemens.
the class SystemTest method testDatabase.
@Test
public void testDatabase() throws IOException, URISyntaxException {
RestConnection conn = new RestConnection();
assertTrue(conn.login("administrator", "openolat"));
URI systemUri = conn.getContextURI().path("system").path("monitoring").path("database").build();
DatabaseVO databaseInfos = conn.get(systemUri, DatabaseVO.class);
assertNotNull(databaseInfos);
assertNotNull(databaseInfos.getConnectionInfos());
assertNotNull(databaseInfos.getHibernateStatistics());
// connections
assertTrue(databaseInfos.getConnectionInfos().getActiveConnectionCount() >= 0);
assertTrue(databaseInfos.getConnectionInfos().getCurrentConnectionCount() > 0);
// hibernate
assertTrue(databaseInfos.getHibernateStatistics().getFailedTransactionsCount() >= 0);
assertTrue(databaseInfos.getHibernateStatistics().getOpenSessionsCount() >= 0);
assertTrue(databaseInfos.getHibernateStatistics().getOptimisticFailureCount() >= 0);
assertTrue(databaseInfos.getHibernateStatistics().getQueryExecutionCount() > 0);
assertTrue(databaseInfos.getHibernateStatistics().getQueryExecutionMaxTime() > 0);
assertNotNull(databaseInfos.getHibernateStatistics().getQueryExecutionMaxTimeQueryString());
assertTrue(databaseInfos.getHibernateStatistics().getSuccessfulTransactionCount() > 0);
assertTrue(databaseInfos.getHibernateStatistics().getTransactionsCount() > 0);
conn.shutdown();
}
Aggregations