Fixed the test setup
This commit is contained in:
@@ -49,6 +49,11 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -24,9 +24,11 @@ import org.springframework.boot.bind.RelaxedPropertyResolver;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
import org.springframework.cloud.netflix.feign.EnableFeignClients;
|
||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -96,4 +98,11 @@ public class SampleZookeeperApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SampleZookeeperApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@LoadBalanced
|
||||
RestTemplate loadBalancedRestTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@
|
||||
|
||||
package org.springframework.cloud.zookeeper.sample;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.curator.test.TestingServer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
@@ -25,6 +30,18 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@SpringApplicationConfiguration(classes = SampleZookeeperApplication.class)
|
||||
public class SampleApplicationTests {
|
||||
|
||||
static TestingServer testingServer;
|
||||
|
||||
@BeforeClass
|
||||
public static void before() throws Exception {
|
||||
testingServer = new TestingServer(2181);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void clean() throws IOException {
|
||||
testingServer.close();
|
||||
}
|
||||
|
||||
@Test public void contextLoads() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user