Fix tests

parent 302f8052
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<jackson.version>2.7.3</jackson.version> <jackson.version>2.7.3</jackson.version>
<spring-cloud-commons.version>2.0.0.BUILD-SNAPSHOT</spring-cloud-commons.version> <spring-cloud-commons.version>2.0.0.BUILD-SNAPSHOT</spring-cloud-commons.version>
<spring-cloud-config.version>2.0.0.BUILD-SNAPSHOT</spring-cloud-config.version> <spring-cloud-config.version>2.0.0.BUILD-SNAPSHOT</spring-cloud-config.version>
<spring-cloud-stream.version>Chelsea.BUILD-SNAPSHOT</spring-cloud-stream.version> <spring-cloud-stream.version>Elmhurst.BUILD-SNAPSHOT</spring-cloud-stream.version>
<!-- Sonar --> <!-- Sonar -->
<surefire.plugin.version>2.19.1</surefire.plugin.version> <surefire.plugin.version>2.19.1</surefire.plugin.version>
......
...@@ -75,6 +75,11 @@ ...@@ -75,6 +75,11 @@
<artifactId>commons-configuration</artifactId> <artifactId>commons-configuration</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<optional>true</optional>
</dependency>
<!-- end archaius deps --> <!-- end archaius deps -->
<dependency> <dependency>
<groupId>com.netflix.servo</groupId> <groupId>com.netflix.servo</groupId>
......
...@@ -51,7 +51,7 @@ public class AtlasExporterTests { ...@@ -51,7 +51,7 @@ public class AtlasExporterTests {
MockRestServiceServer mockServer = MockRestServiceServer MockRestServiceServer mockServer = MockRestServiceServer
.createServer(this.restTemplate); .createServer(this.restTemplate);
mockServer.expect(MockRestRequestMatchers.requestTo("atlas/api/v1/publish")) mockServer.expect(MockRestRequestMatchers.requestTo("/atlas/api/v1/publish"))
.andExpect(MockRestRequestMatchers.method(HttpMethod.POST)) .andExpect(MockRestRequestMatchers.method(HttpMethod.POST))
.andRespond(MockRestResponseCreators.withSuccess("{\"status\" : \"OK\"}", .andRespond(MockRestResponseCreators.withSuccess("{\"status\" : \"OK\"}",
MediaType.APPLICATION_JSON)); MediaType.APPLICATION_JSON));
......
...@@ -53,7 +53,7 @@ import com.netflix.zuul.context.RequestContext; ...@@ -53,7 +53,7 @@ import com.netflix.zuul.context.RequestContext;
@SpringBootTest( @SpringBootTest(
classes = ServletPathZuulProxyApplicationTests.ServletPathZuulProxyApplication.class, classes = ServletPathZuulProxyApplicationTests.ServletPathZuulProxyApplication.class,
webEnvironment = WebEnvironment.RANDOM_PORT, webEnvironment = WebEnvironment.RANDOM_PORT,
value = {"server.servletPath: /app"}) properties = {"server.servlet.path: /app"})
@DirtiesContext @DirtiesContext
public class ServletPathZuulProxyApplicationTests { public class ServletPathZuulProxyApplicationTests {
......
...@@ -78,7 +78,8 @@ import com.netflix.loadbalancer.ServerList; ...@@ -78,7 +78,8 @@ import com.netflix.loadbalancer.ServerList;
@SpringBootTest(classes = HttpClientRibbonCommandIntegrationTests.TestConfig.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { @SpringBootTest(classes = HttpClientRibbonCommandIntegrationTests.TestConfig.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
"zuul.routes.other: /test/**=http://localhost:7777/local", "zuul.routes.other: /test/**=http://localhost:7777/local",
"zuul.routes.another: /another/twolevel/**", "zuul.routes.simple: /simple/**", "zuul.routes.another: /another/twolevel/**", "zuul.routes.simple: /simple/**",
"zuul.routes.singleton: /singleton/**", "zuul.routes.singleton.id: singleton",
"zuul.routes.singleton.path: /singleton/**",
"zuul.routes.singleton.sensitiveHeaders: " }) "zuul.routes.singleton.sensitiveHeaders: " })
@DirtiesContext @DirtiesContext
public class HttpClientRibbonCommandIntegrationTests extends ZuulProxyTestBase { public class HttpClientRibbonCommandIntegrationTests extends ZuulProxyTestBase {
......
...@@ -35,16 +35,19 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen ...@@ -35,16 +35,19 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
"zuul.retryable: false", /* Disable retry by default, have each route enable it */ "zuul.retryable: false", /* Disable retry by default, have each route enable it */
"hystrix.command.default.execution.timeout.enabled: false", /* Disable hystrix so its timeout doesnt get in the way */ "hystrix.command.default.execution.timeout.enabled: false", /* Disable hystrix so its timeout doesnt get in the way */
"ribbon.ReadTimeout: 1000", /* Make sure ribbon will timeout before the thread is done sleeping */ "ribbon.ReadTimeout: 1000", /* Make sure ribbon will timeout before the thread is done sleeping */
"zuul.routes.retryable: /retryable/**", "zuul.routes.retryable.id: retryable",
"zuul.routes.retryable.path: /retryable/**",
"zuul.routes.retryable.retryable: true", "zuul.routes.retryable.retryable: true",
"retryable.ribbon.OkToRetryOnAllOperations: true", "retryable.ribbon.OkToRetryOnAllOperations: true",
"retryable.ribbon.MaxAutoRetries: 1", "retryable.ribbon.MaxAutoRetries: 1",
"retryable.ribbon.MaxAutoRetriesNextServer: 1", "retryable.ribbon.MaxAutoRetriesNextServer: 1",
"zuul.routes.getretryable: /getretryable/**", "zuul.routes.getretryable.id: getretryable",
"zuul.routes.getretryable.path: /getretryable/**",
"zuul.routes.getretryable.retryable: true", "zuul.routes.getretryable.retryable: true",
"getretryable.ribbon.MaxAutoRetries: 1", "getretryable.ribbon.MaxAutoRetries: 1",
"getretryable.ribbon.MaxAutoRetriesNextServer: 1", "getretryable.ribbon.MaxAutoRetriesNextServer: 1",
"zuul.routes.disableretry: /disableretry/**", "zuul.routes.disableretry.id: disableretry",
"zuul.routes.disableretry.path: /disableretry/**",
"zuul.routes.disableretry.retryable: false", /* This will override the global */ "zuul.routes.disableretry.retryable: false", /* This will override the global */
"disableretry.ribbon.MaxAutoRetries: 1", "disableretry.ribbon.MaxAutoRetries: 1",
"disableretry.ribbon.MaxAutoRetriesNextServer: 1", "disableretry.ribbon.MaxAutoRetriesNextServer: 1",
......
...@@ -33,17 +33,20 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; ...@@ -33,17 +33,20 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
"ribbon.okhttp.enabled: true", "ribbon.okhttp.enabled: true",
"hystrix.command.default.execution.timeout.enabled: false", /* Disable hystrix so its timeout doesnt get in the way */ "hystrix.command.default.execution.timeout.enabled: false", /* Disable hystrix so its timeout doesnt get in the way */
"ribbon.ReadTimeout: 1000", /* Make sure ribbon will timeout before the thread is done sleeping */ "ribbon.ReadTimeout: 1000", /* Make sure ribbon will timeout before the thread is done sleeping */
"zuul.routes.retryable: /retryable/**", "zuul.routes.retryable.id: retryable",
"zuul.routes.retryable.path: /retryable/**",
"zuul.routes.retryable.retryable: true", "zuul.routes.retryable.retryable: true",
"retryable.ribbon.OkToRetryOnAllOperations: true", "retryable.ribbon.OkToRetryOnAllOperations: true",
"retryable.ribbon.retryableStatusCodes: 404", "retryable.ribbon.retryableStatusCodes: 404",
"retryable.ribbon.MaxAutoRetries: 1", "retryable.ribbon.MaxAutoRetries: 1",
"retryable.ribbon.MaxAutoRetriesNextServer: 1", "retryable.ribbon.MaxAutoRetriesNextServer: 1",
"zuul.routes.getretryable: /getretryable/**", "zuul.routes.getretryable.id: getretryable",
"zuul.routes.getretryable.path: /getretryable/**",
"zuul.routes.getretryable.retryable: true", "zuul.routes.getretryable.retryable: true",
"getretryable.ribbon.MaxAutoRetries: 1", "getretryable.ribbon.MaxAutoRetries: 1",
"getretryable.ribbon.MaxAutoRetriesNextServer: 1", "getretryable.ribbon.MaxAutoRetriesNextServer: 1",
"zuul.routes.disableretry: /disableretry/**", "zuul.routes.disableretry.path: /disableretry/**",
"zuul.routes.disableretry.path: /disableretry/**",
"zuul.routes.disableretry.retryable: false", /* This will override the global */ "zuul.routes.disableretry.retryable: false", /* This will override the global */
"disableretry.ribbon.MaxAutoRetries: 1", "disableretry.ribbon.MaxAutoRetries: 1",
"disableretry.ribbon.MaxAutoRetriesNextServer: 1", "disableretry.ribbon.MaxAutoRetriesNextServer: 1",
......
...@@ -173,6 +173,11 @@ ...@@ -173,6 +173,11 @@
<artifactId>commons-configuration</artifactId> <artifactId>commons-configuration</artifactId>
<version>1.8</version> <version>1.8</version>
</dependency> </dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- end archaius deps --> <!-- end archaius deps -->
<dependency> <dependency>
<groupId>com.sun.jersey</groupId> <groupId>com.sun.jersey</groupId>
......
...@@ -17,20 +17,17 @@ ...@@ -17,20 +17,17 @@
package org.springframework.cloud.netflix.eureka.server; package org.springframework.cloud.netflix.eureka.server;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.netflix.eureka.server.ApplicationContextTests.Application; import org.springframework.cloud.netflix.eureka.server.ApplicationContextTests.Application;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
...@@ -39,15 +36,18 @@ import org.springframework.http.HttpMethod; ...@@ -39,15 +36,18 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
"spring.application.name=eureka", "server.servlet.contextPath=/context", properties = {"spring.application.name=eureka", "server.servlet.context-path=/context",
"management.security.enabled=false" }) "management.security.enabled=false" })
public class ApplicationContextTests { public class ApplicationContextTests {
@Value("${local.server.port}") @LocalServerPort
private int port = 0; private int port = 0;
@Test @Test
...@@ -95,7 +95,7 @@ public class ApplicationContextTests { ...@@ -95,7 +95,7 @@ public class ApplicationContextTests {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate().exchange( ResponseEntity<Map> entity = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/context/env", HttpMethod.GET, "http://localhost:" + this.port + "/context/application/env", HttpMethod.GET,
new HttpEntity<>("parameters", headers), Map.class); new HttpEntity<>("parameters", headers), Map.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals(HttpStatus.OK, entity.getStatusCode());
} }
......
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
package org.springframework.cloud.netflix.eureka.server; package org.springframework.cloud.netflix.eureka.server;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
...@@ -26,10 +23,9 @@ import org.junit.Test; ...@@ -26,10 +23,9 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.netflix.eureka.server.ApplicationServletPathTests.Application; import org.springframework.cloud.netflix.eureka.server.ApplicationServletPathTests.Application;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
...@@ -38,11 +34,15 @@ import org.springframework.http.HttpMethod; ...@@ -38,11 +34,15 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { @SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=eureka", "server.servletPath=/servlet", "spring.application.name=eureka", "server.servlet.path=/servlet",
"management.security.enabled=false" }) "management.security.enabled=false" })
public class ApplicationServletPathTests { public class ApplicationServletPathTests {
...@@ -56,7 +56,7 @@ public class ApplicationServletPathTests { ...@@ -56,7 +56,7 @@ public class ApplicationServletPathTests {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(Application.class) new SpringApplicationBuilder(Application.class)
.properties("spring.application.name=eureka", .properties("spring.application.name=eureka",
"server.servletPath=/servlet") "server.servlet.path=/servlet")
.run(args); .run(args);
} }
} }
...@@ -106,7 +106,7 @@ public class ApplicationServletPathTests { ...@@ -106,7 +106,7 @@ public class ApplicationServletPathTests {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate().exchange( ResponseEntity<Map> entity = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/servlet/env", HttpMethod.GET, "http://localhost:" + this.port + "/servlet/application/env", HttpMethod.GET,
new HttpEntity<>("parameters", headers), Map.class); new HttpEntity<>("parameters", headers), Map.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals(HttpStatus.OK, entity.getStatusCode());
} }
......
...@@ -16,14 +16,6 @@ ...@@ -16,14 +16,6 @@
package org.springframework.cloud.netflix.eureka.server; package org.springframework.cloud.netflix.eureka.server;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
...@@ -32,10 +24,9 @@ import org.junit.runner.RunWith; ...@@ -32,10 +24,9 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.netflix.eureka.server.ApplicationTests.Application; import org.springframework.cloud.netflix.eureka.server.ApplicationTests.Application;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
...@@ -44,14 +35,23 @@ import org.springframework.http.HttpMethod; ...@@ -44,14 +35,23 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringRunner;
import com.netflix.appinfo.InstanceInfo; import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.converters.wrappers.CodecWrapper; import com.netflix.discovery.converters.wrappers.CodecWrapper;
import com.netflix.eureka.resources.ServerCodecs; import com.netflix.eureka.resources.ServerCodecs;
@RunWith(SpringJUnit4ClassRunner.class) import static org.hamcrest.Matchers.instanceOf;
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = {
"spring.jmx.enabled=true", "management.security.enabled=false" }) "spring.jmx.enabled=true", "management.security.enabled=false" })
public class ApplicationTests { public class ApplicationTests {
...@@ -76,7 +76,7 @@ public class ApplicationTests { ...@@ -76,7 +76,7 @@ public class ApplicationTests {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate().exchange( ResponseEntity<Map> entity = new TestRestTemplate().exchange(
"http://localhost:" + this.port + "/env", HttpMethod.GET, "http://localhost:" + this.port + "/application/env", HttpMethod.GET,
new HttpEntity<>("parameters", headers), Map.class); new HttpEntity<>("parameters", headers), Map.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertEquals(HttpStatus.OK, entity.getStatusCode());
} }
......
...@@ -64,6 +64,11 @@ ...@@ -64,6 +64,11 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
......
...@@ -17,34 +17,35 @@ ...@@ -17,34 +17,35 @@
package org.springframework.cloud.netflix.hystrix.dashboard; package org.springframework.cloud.netflix.hystrix.dashboard;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardContextTests.Application; import org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardContextTests.Application;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/** /**
* @author Dave Syer * @author Dave Syer
* *
*/ */
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { "spring.application.name=hystrix-dashboard", @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
"server.servlet.contextPath=/context" }) properties = { "spring.application.name=hystrix-dashboard",
"server.servlet.context-path=/context" })
public class HystrixDashboardContextTests { public class HystrixDashboardContextTests {
public static final String JQUERY_PATH = "/context/webjars/jquery/2.1.1/jquery.min.js"; public static final String JQUERY_PATH = "/context/webjars/jquery/2.1.1/jquery.min.js";
@Value("${local.server.port}") @LocalServerPort
private int port = 0; private int port = 0;
@Test @Test
...@@ -100,7 +101,7 @@ public class HystrixDashboardContextTests { ...@@ -100,7 +101,7 @@ public class HystrixDashboardContextTests {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).properties( new SpringApplicationBuilder(Application.class).properties(
"spring.application.name=hystrix-dashboard", "spring.application.name=hystrix-dashboard",
"server.servlet.contextPath=/context").run(); "server.servlet.context-path=/context").run();
} }
} }
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
<artifactId>hystrix-core</artifactId> <artifactId>hystrix-core</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId> <groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-metrics-event-stream</artifactId> <artifactId>hystrix-metrics-event-stream</artifactId>
<scope>test</scope> <scope>test</scope>
......
...@@ -35,8 +35,8 @@ import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; ...@@ -35,8 +35,8 @@ import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
* @author Spencer Gibb * @author Spencer Gibb
*/ */
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = HystrixStreamTests.Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { @SpringBootTest(classes = HystrixStreamTests.Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
"server.port=0", "spring.jmx.enabled=true" }) properties = { "spring.jmx.enabled=true" })
@DirtiesContext @DirtiesContext
public class HystrixStreamTests { public class HystrixStreamTests {
......
...@@ -97,6 +97,11 @@ ...@@ -97,6 +97,11 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
......
...@@ -20,19 +20,19 @@ import org.junit.Test; ...@@ -20,19 +20,19 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean; import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
public class SidecarApplicationTests { public class SidecarApplicationTests {
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { @SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost", "spring.application.instance_id=1", "spring.application.name=mytest", "spring.cloud.client.hostname=mhhost", "spring.application.instance_id=1",
"eureka.instance.hostname=mhhost", "sidecar.port=7000", "sidecar.ipAddress=127.0.0.1" }) "eureka.instance.hostname=mhhost", "sidecar.port=7000", "sidecar.ip-address=127.0.0.1" })
public static class EurekaTestConfigBeanTest { public static class EurekaTestConfigBeanTest {
@Autowired @Autowired
EurekaInstanceConfigBean config; EurekaInstanceConfigBean config;
...@@ -46,10 +46,10 @@ public class SidecarApplicationTests { ...@@ -46,10 +46,10 @@ public class SidecarApplicationTests {
} }
} }
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { @SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost", "spring.application.instance_id=1", "spring.application.name=mytest", "spring.cloud.client.hostname=mhhost", "spring.application.instance_id=1",
"sidecar.hostname=mhhost", "sidecar.port=7000", "sidecar.ipAddress=127.0.0.1" }) "sidecar.hostname=mhhost", "sidecar.port=7000", "sidecar.ip-address=127.0.0.1" })
public static class NewPropertyEurekaTestConfigBeanTest { public static class NewPropertyEurekaTestConfigBeanTest {
@Autowired @Autowired
EurekaInstanceConfigBean config; EurekaInstanceConfigBean config;
...@@ -63,10 +63,10 @@ public class SidecarApplicationTests { ...@@ -63,10 +63,10 @@ public class SidecarApplicationTests {
} }
} }
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { @SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=mytest", "spring.cloud.client.hostname=mhhost", "spring.application.instance_id=1", "spring.application.name=mytest", "spring.cloud.client.hostname=mhhost", "spring.application.instance_id=1",
"eureka.instance.hostname=mhhost1", "sidecar.hostname=mhhost2", "sidecar.port=7000", "sidecar.ipAddress=127.0.0.1" }) "eureka.instance.hostname=mhhost1", "sidecar.hostname=mhhost2", "sidecar.port=7000", "sidecar.ip-address=127.0.0.1" })
public static class BothPropertiesEurekaTestConfigBeanTest { public static class BothPropertiesEurekaTestConfigBeanTest {
@Autowired @Autowired
EurekaInstanceConfigBean config; EurekaInstanceConfigBean config;
......
...@@ -97,6 +97,11 @@ ...@@ -97,6 +97,11 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
......
...@@ -36,12 +36,6 @@ ...@@ -36,12 +36,6 @@
<dependency> <dependency>
<groupId>commons-configuration</groupId> <groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId> <artifactId>commons-configuration</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment