Fixed the test setup

This commit is contained in:
Marcin Grzejszczak
2016-03-25 11:30:18 +01:00
parent 502ed3719f
commit 2f35d53859
5 changed files with 39 additions and 2 deletions

View File

@@ -74,8 +74,15 @@
<configuration>
<useFile>false</useFile>
<includes>
<include>**/*Spec.java</include>
<include>**/*Spec.*</include>
<include>**/*Tests.*</include>
<include>**/*Test.*</include>
</includes>
<excludes>
<exclude>**/Abstract*Spec.*</exclude>
<exclude>**/Abstract*Tests.*</exclude>
<exclude>**/Abstract*Test.*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>

View File

@@ -60,7 +60,6 @@
<artifactId>curator-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -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>

View File

@@ -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();
}
}

View File

@@ -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() {
}
}