use of org.activiti.spring.boot.actuate.endpoint.ProcessEngineEndpoint in project Activiti by Activiti.
the class EndpointAutoConfigurationTest method mvcEndpoint.
@Test
public void mvcEndpoint() throws Throwable {
AnnotationConfigEmbeddedWebApplicationContext applicationContext = new AnnotationConfigEmbeddedWebApplicationContext(CallbackEmbeddedContainerCustomizer.class, EmbeddedContainerConfiguration.class, EndpointConfiguration.class);
ProcessEngine processEngine = applicationContext.getBean(ProcessEngine.class);
org.junit.Assert.assertNotNull("the processEngine should not be null", processEngine);
ProcessEngineEndpoint processEngineEndpoint = applicationContext.getBean(ProcessEngineEndpoint.class);
org.junit.Assert.assertNotNull("the processEngineEndpoint should not be null", processEngineEndpoint);
RestTemplate restTemplate = applicationContext.getBean(RestTemplate.class);
ResponseEntity<Map> mapResponseEntity = restTemplate.getForEntity("http://localhost:9091/activiti/", Map.class);
Map map = mapResponseEntity.getBody();
String[] criticalKeys = { "completedTaskCount", "openTaskCount", "cachedProcessDefinitionCount" };
Map<?, ?> invokedResults = processEngineEndpoint.invoke();
for (String k : criticalKeys) {
org.junit.Assert.assertTrue(map.containsKey(k));
org.junit.Assert.assertEquals(((Number) map.get(k)).longValue(), ((Number) invokedResults.get(k)).longValue());
}
}
Aggregations