Fix tests

parent 302f8052
......@@ -26,7 +26,7 @@
<jackson.version>2.7.3</jackson.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-stream.version>Chelsea.BUILD-SNAPSHOT</spring-cloud-stream.version>
<spring-cloud-stream.version>Elmhurst.BUILD-SNAPSHOT</spring-cloud-stream.version>
<!-- Sonar -->
<surefire.plugin.version>2.19.1</surefire.plugin.version>
......
......@@ -75,6 +75,11 @@
<artifactId>commons-configuration</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<optional>true</optional>
</dependency>
<!-- end archaius deps -->
<dependency>
<groupId>com.netflix.servo</groupId>
......
......@@ -51,7 +51,7 @@ public class AtlasExporterTests {
MockRestServiceServer mockServer = MockRestServiceServer
.createServer(this.restTemplate);
mockServer.expect(MockRestRequestMatchers.requestTo("atlas/api/v1/publish"))
mockServer.expect(MockRestRequestMatchers.requestTo("/atlas/api/v1/publish"))
.andExpect(MockRestRequestMatchers.method(HttpMethod.POST))
.andRespond(MockRestResponseCreators.withSuccess("{\"status\" : \"OK\"}",
MediaType.APPLICATION_JSON));
......
......@@ -53,7 +53,7 @@ import com.netflix.zuul.context.RequestContext;
@SpringBootTest(
classes = ServletPathZuulProxyApplicationTests.ServletPathZuulProxyApplication.class,
webEnvironment = WebEnvironment.RANDOM_PORT,
value = {"server.servletPath: /app"})
properties = {"server.servlet.path: /app"})
@DirtiesContext
public class ServletPathZuulProxyApplicationTests {
......
......@@ -78,7 +78,8 @@ import com.netflix.loadbalancer.ServerList;
@SpringBootTest(classes = HttpClientRibbonCommandIntegrationTests.TestConfig.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
"zuul.routes.other: /test/**=http://localhost:7777/local",
"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: " })
@DirtiesContext
public class HttpClientRibbonCommandIntegrationTests extends ZuulProxyTestBase {
......
......@@ -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 */
"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 */
"zuul.routes.retryable: /retryable/**",
"zuul.routes.retryable.id: retryable",
"zuul.routes.retryable.path: /retryable/**",
"zuul.routes.retryable.retryable: true",
"retryable.ribbon.OkToRetryOnAllOperations: true",
"retryable.ribbon.MaxAutoRetries: 1",
"retryable.ribbon.MaxAutoRetriesNextServer: 1",
"zuul.routes.getretryable: /getretryable/**",
"zuul.routes.getretryable.id: getretryable",
"zuul.routes.getretryable.path: /getretryable/**",
"zuul.routes.getretryable.retryable: true",
"getretryable.ribbon.MaxAutoRetries: 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 */
"disableretry.ribbon.MaxAutoRetries: 1",
"disableretry.ribbon.MaxAutoRetriesNextServer: 1",
......
......@@ -33,17 +33,20 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
"ribbon.okhttp.enabled: true",
"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 */
"zuul.routes.retryable: /retryable/**",
"zuul.routes.retryable.id: retryable",
"zuul.routes.retryable.path: /retryable/**",
"zuul.routes.retryable.retryable: true",
"retryable.ribbon.OkToRetryOnAllOperations: true",
"retryable.ribbon.retryableStatusCodes: 404",
"retryable.ribbon.MaxAutoRetries: 1",
"retryable.ribbon.MaxAutoRetriesNextServer: 1",
"zuul.routes.getretryable: /getretryable/**",
"zuul.routes.getretryable.id: getretryable",
"zuul.routes.getretryable.path: /getretryable/**",
"zuul.routes.getretryable.retryable: true",
"getretryable.ribbon.MaxAutoRetries: 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 */
"disableretry.ribbon.MaxAutoRetries: 1",
"disableretry.ribbon.MaxAutoRetriesNextServer: 1",
......
......@@ -173,6 +173,11 @@
<artifactId>commons-configuration</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- end archaius deps -->
<dependency>
<groupId>com.sun.jersey</groupId>
......
......@@ -17,20 +17,17 @@
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.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
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.web.server.LocalServerPort;
import org.springframework.cloud.netflix.eureka.server.ApplicationContextTests.Application;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpEntity;
......@@ -39,15 +36,18 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
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)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
"spring.application.name=eureka", "server.servlet.contextPath=/context",
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
properties = {"spring.application.name=eureka", "server.servlet.context-path=/context",
"management.security.enabled=false" })
public class ApplicationContextTests {
@Value("${local.server.port}")
@LocalServerPort
private int port = 0;
@Test
......@@ -95,7 +95,7 @@ public class ApplicationContextTests {
@SuppressWarnings("rawtypes")
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);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
......
......@@ -16,9 +16,6 @@
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.Map;
......@@ -26,10 +23,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
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.WebEnvironment;
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.context.annotation.Configuration;
import org.springframework.http.HttpEntity;
......@@ -38,11 +34,15 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
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)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
"spring.application.name=eureka", "server.servletPath=/servlet",
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=eureka", "server.servlet.path=/servlet",
"management.security.enabled=false" })
public class ApplicationServletPathTests {
......@@ -56,7 +56,7 @@ public class ApplicationServletPathTests {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class)
.properties("spring.application.name=eureka",
"server.servletPath=/servlet")
"server.servlet.path=/servlet")
.run(args);
}
}
......@@ -106,7 +106,7 @@ public class ApplicationServletPathTests {
@SuppressWarnings("rawtypes")
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);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
......
......@@ -16,14 +16,6 @@
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.Map;
......@@ -32,10 +24,9 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
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.WebEnvironment;
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.context.annotation.Configuration;
import org.springframework.http.HttpEntity;
......@@ -44,14 +35,23 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
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.discovery.converters.wrappers.CodecWrapper;
import com.netflix.eureka.resources.ServerCodecs;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
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 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" })
public class ApplicationTests {
......@@ -76,7 +76,7 @@ public class ApplicationTests {
@SuppressWarnings("rawtypes")
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);
assertEquals(HttpStatus.OK, entity.getStatusCode());
}
......
......@@ -64,6 +64,11 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
......
......@@ -17,34 +17,35 @@
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.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
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.web.server.LocalServerPort;
import org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardContextTests.Application;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
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
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { "spring.application.name=hystrix-dashboard",
"server.servlet.contextPath=/context" })
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
properties = { "spring.application.name=hystrix-dashboard",
"server.servlet.context-path=/context" })
public class HystrixDashboardContextTests {
public static final String JQUERY_PATH = "/context/webjars/jquery/2.1.1/jquery.min.js";
@Value("${local.server.port}")
@LocalServerPort
private int port = 0;
@Test
......@@ -100,7 +101,7 @@ public class HystrixDashboardContextTests {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).properties(
"spring.application.name=hystrix-dashboard",
"server.servlet.contextPath=/context").run();
"server.servlet.context-path=/context").run();
}
}
......
......@@ -46,6 +46,11 @@
<artifactId>hystrix-core</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-metrics-event-stream</artifactId>
<scope>test</scope>
......
......@@ -35,8 +35,8 @@ import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
* @author Spencer Gibb
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = HystrixStreamTests.Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
"server.port=0", "spring.jmx.enabled=true" })
@SpringBootTest(classes = HystrixStreamTests.Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
properties = { "spring.jmx.enabled=true" })
@DirtiesContext
public class HystrixStreamTests {
......
......@@ -97,6 +97,11 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
......
......@@ -20,19 +20,19 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
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.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
public class SidecarApplicationTests {
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"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 {
@Autowired
EurekaInstanceConfigBean config;
......@@ -46,10 +46,10 @@ public class SidecarApplicationTests {
}
}
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"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 {
@Autowired
EurekaInstanceConfigBean config;
......@@ -63,10 +63,10 @@ public class SidecarApplicationTests {
}
}
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SidecarApplication.class, webEnvironment = RANDOM_PORT, properties = {
"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 {
@Autowired
EurekaInstanceConfigBean config;
......
......@@ -97,6 +97,11 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
......
......@@ -36,12 +36,6 @@
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<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