org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext Java Examples
The following examples show how to use
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EndpointAutoConfigurationTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@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()); } }
Example #2
Source File: TestEnvironment.java From moserp with Apache License 2.0 | 4 votes |
public int getPort() { return ((AnnotationConfigEmbeddedWebApplicationContext)context).getEmbeddedServletContainer().getPort(); }