Integrate PR#94 comments from @Kehrlann
* move bindings to src/test/resources * get rid of unused / duplicate annotations * move all dependencies to test scope for test projects
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bindings-parent</artifactId>
|
||||
<version>1.13.0-SNAPSHOT</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Spring Cloud Cloud Native Buildpacks Bindings Parent</name>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bindings-parent</artifactId>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-bindings-tests-boot-2</artifactId>
|
||||
@@ -21,16 +21,19 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bindings</artifactId>
|
||||
<version>${version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -62,7 +65,7 @@
|
||||
<reuseForks>false</reuseForks>
|
||||
<environmentVariables>
|
||||
<JAVA_TOOL_OPTIONS>-Dorg.springframework.cloud.bindings.boot.enable=true</JAVA_TOOL_OPTIONS>
|
||||
<SERVICE_BINDING_ROOT>${basedir}/bindings</SERVICE_BINDING_ROOT>
|
||||
<SERVICE_BINDING_ROOT>${basedir}/src/test/resources/bindings</SERVICE_BINDING_ROOT>
|
||||
</environmentVariables>
|
||||
<argLine>-Xmx1024m</argLine>
|
||||
</configuration>
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
package org.springframework.cloud;
|
||||
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import redis.embedded.RedisServer;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.IOException;
|
||||
import java.util.Scanner;
|
||||
|
||||
@TestConfiguration
|
||||
public class RedisServerTestConfiguration {
|
||||
|
||||
private RedisServer redisServer;
|
||||
private final RedisServer redisServer;
|
||||
|
||||
public RedisServerTestConfiguration() throws IOException {
|
||||
//this value should be set as well under bindings/redis/port so that the client configuration matches the server
|
||||
this.redisServer = new RedisServer(4242);
|
||||
try (Scanner scanner = new Scanner(new ClassPathResource("bindings/redis/port").getInputStream())) {
|
||||
int port = scanner.nextInt();
|
||||
this.redisServer = new RedisServer(port);
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package org.springframework.cloud;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
|
||||
|
||||
@SpringBootApplication
|
||||
@Configuration
|
||||
@EnableRedisRepositories
|
||||
public class SpringBoot2Application {
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bindings-parent</artifactId>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>spring-cloud-bindings-tests-boot-3</artifactId>
|
||||
@@ -21,21 +21,25 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bindings</artifactId>
|
||||
<version>${version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -67,7 +71,7 @@
|
||||
<reuseForks>false</reuseForks>
|
||||
<environmentVariables>
|
||||
<JAVA_TOOL_OPTIONS>-Dorg.springframework.cloud.bindings.boot.enable=true</JAVA_TOOL_OPTIONS>
|
||||
<SERVICE_BINDING_ROOT>${basedir}/bindings</SERVICE_BINDING_ROOT>
|
||||
<SERVICE_BINDING_ROOT>${basedir}/src/test/resources/bindings</SERVICE_BINDING_ROOT>
|
||||
</environmentVariables>
|
||||
<argLine>-Xmx1024m</argLine>
|
||||
</configuration>
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
package org.springframework.cloud;
|
||||
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import redis.embedded.RedisServer;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.IOException;
|
||||
import java.util.Scanner;
|
||||
|
||||
@TestConfiguration
|
||||
public class RedisServerTestConfiguration {
|
||||
|
||||
private RedisServer redisServer;
|
||||
private final RedisServer redisServer;
|
||||
|
||||
public RedisServerTestConfiguration() throws IOException {
|
||||
//this value should be set as well under bindings/redis/port so that the client configuration matches the server
|
||||
this.redisServer = new RedisServer(4343);
|
||||
try (Scanner scanner = new Scanner(new ClassPathResource("bindings/redis/port").getInputStream())) {
|
||||
int port = scanner.nextInt();
|
||||
this.redisServer = new RedisServer(port);
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package org.springframework.cloud;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
|
||||
|
||||
@SpringBootApplication
|
||||
@Configuration
|
||||
@EnableRedisRepositories
|
||||
public class SpringBoot3Application {
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-bindings-parent</artifactId>
|
||||
<version>1.12.0-SNAPSHOT</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@ package org.springframework.cloud.bindings.boot;
|
||||
|
||||
import org.springframework.boot.SpringBootVersion;
|
||||
|
||||
/**
|
||||
* This class is used to allow, in unit tests for example,
|
||||
* to fake the resolution of which major version of spring boot is used
|
||||
*/
|
||||
class SpringBootVersionResolver {
|
||||
|
||||
private int forcedVersion = -1;
|
||||
|
||||
Reference in New Issue
Block a user