This commit is contained in:
Phillip Webb
2014-03-14 16:17:08 -07:00
parent bb3ea39d80
commit 80ac1fb0cd
50 changed files with 469 additions and 366 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
package sample.actuator.ui;
import static org.junit.Assert.assertEquals;
import java.util.Map;
import org.junit.Test;
@@ -35,13 +33,15 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.junit.Assert.assertEquals;
/**
* Integration tests for separate management and main service ports.
*
* @author Dave Syer
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes=SampleActuatorUiApplication.class)
@SpringApplicationConfiguration(classes = SampleActuatorUiApplication.class)
@WebAppConfiguration
@IntegrationTest
@DirtiesContext
@@ -60,7 +60,7 @@ public class SampleActuatorUiApplicationPortTests {
@Test
public void testHome() throws Exception {
ResponseEntity<String> entity = RestTemplates.get().getForEntity(
"http://localhost:" + port, String.class);
"http://localhost:" + this.port, String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
@@ -68,14 +68,14 @@ public class SampleActuatorUiApplicationPortTests {
public void testMetrics() throws Exception {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = RestTemplates.get().getForEntity(
"http://localhost:" + managementPort + "/metrics", Map.class);
"http://localhost:" + this.managementPort + "/metrics", Map.class);
assertEquals(HttpStatus.UNAUTHORIZED, entity.getStatusCode());
}
@Test
public void testHealth() throws Exception {
ResponseEntity<String> entity = RestTemplates.get().getForEntity(
"http://localhost:" + managementPort + "/health", String.class);
"http://localhost:" + this.managementPort + "/health", String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode());
assertEquals("ok", entity.getBody());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2013 the original author or authors.
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +16,6 @@
package sample.actuator.ui;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.Map;
@@ -37,13 +34,16 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Basic integration tests for demo application.
*
* @author Dave Syer
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes=SampleActuatorUiApplication.class)
@SpringApplicationConfiguration(classes = SampleActuatorUiApplication.class)
@WebAppConfiguration
@IntegrationTest
@DirtiesContext