Fix some tests that fail

This commit is contained in:
Dave Syer
2016-08-27 14:25:10 +01:00
parent 0a61633d65
commit 1eb0561d74
3 changed files with 25 additions and 11 deletions

View File

@@ -21,6 +21,8 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import test.FeignClientWithServerListApplicationTests;
/**
* A test suite for probing weird ordering problems in the tests.
*

View File

@@ -1,4 +1,4 @@
package demo;
package test;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -16,20 +16,22 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import demo.FeignClientWithServerListApplicationTests.TestApplication;
import test.FeignClientWithServerListApplicationTests.TestApplication;
import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = TestApplication.class)
//Increase hystrix timeout or else requests timeout on CI server
@WebIntegrationTest(randomPort = true, value = {"myexample.ribbon.listOfServers:example.com", "hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 60000"})
// Increase hystrix timeout or else requests timeout on CI server
@WebIntegrationTest(randomPort = true, value = {
"myexample.ribbon.listOfServers:example.com",
"hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 60000" })
@DirtiesContext
public class FeignClientWithServerListApplicationTests {
@Autowired
private RestClient client;
@Test
public void clientConnects() {
assertTrue(client.hello().contains("<html"));
@@ -44,15 +46,15 @@ public class FeignClientWithServerListApplicationTests {
public FallbackRestClient fallbackRestClient() {
return new FallbackRestClient();
}
public static void main(String[] args) {
SpringApplication.run(FeignClientApplication.class, args);
}
SpringApplication.run(TestApplication.class, args);
}
}
@FeignClient(value = "myexample", fallback = FallbackRestClient.class)
static interface RestClient {
@RequestMapping(value="/", method=RequestMethod.GET)
@RequestMapping(value = "/", method = RequestMethod.GET)
String hello();
}
@@ -63,5 +65,5 @@ public class FeignClientWithServerListApplicationTests {
return "fallback";
}
}
}

View File

@@ -15,7 +15,7 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependencyManagement>
@@ -42,6 +42,16 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine-amqp</artifactId>
</dependency>
<dependency>
<!-- Shouldn't be necessary -->
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<!-- Shouldn't be necessary -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>