Use Spring Cloud Stream Parent directly
Since the intent for `spring-cloud-stream-dependencies` to become the user-facing dependency management BOM, binder implementations should switch to the Spring Cloud Stream parent for version management. This also ensures that they inherit the build lifecycle of Spring Cloud Stream - e.g. checkstyle validation.
This commit is contained in:
14
pom.xml
14
pom.xml
@@ -6,22 +6,12 @@
|
||||
<packaging>pom</packaging>
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-build</artifactId>
|
||||
<version>1.1.1.RELEASE</version>
|
||||
<artifactId>spring-cloud-stream-parent</artifactId>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<properties>
|
||||
<spring-boot.version>1.4.0.BUILD-SNAPSHOT</spring-boot.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-dependencies</artifactId>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
|
||||
|
||||
@@ -39,128 +39,127 @@ import org.springframework.cloud.stream.test.junit.AbstractExternalResourceTestS
|
||||
*/
|
||||
public class RabbitTestSupport extends AbstractExternalResourceTestSupport<CachingConnectionFactory> {
|
||||
|
||||
private final boolean management;
|
||||
private final boolean management;
|
||||
|
||||
public RabbitTestSupport() {
|
||||
this(false);
|
||||
}
|
||||
public RabbitTestSupport() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public RabbitTestSupport(boolean management) {
|
||||
super("RABBIT");
|
||||
this.management = management;
|
||||
}
|
||||
public RabbitTestSupport(boolean management) {
|
||||
super("RABBIT");
|
||||
this.management = management;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void obtainResource() throws Exception {
|
||||
resource = new CachingConnectionFactory("localhost");
|
||||
resource.createConnection().close();
|
||||
if (management) {
|
||||
Socket socket = SocketFactory.getDefault().createSocket("localhost", 15672);
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void obtainResource() throws Exception {
|
||||
resource = new CachingConnectionFactory("localhost");
|
||||
resource.createConnection().close();
|
||||
if (management) {
|
||||
Socket socket = SocketFactory.getDefault().createSocket("localhost", 15672);
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanupResource() throws Exception {
|
||||
resource.destroy();
|
||||
}
|
||||
@Override
|
||||
protected void cleanupResource() throws Exception {
|
||||
resource.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test class to allow testing deferred entity declarations when RabbitMQ is down.
|
||||
*
|
||||
*/
|
||||
public static class RabbitProxy {
|
||||
/**
|
||||
* Test class to allow testing deferred entity declarations when RabbitMQ is down.
|
||||
*/
|
||||
public static class RabbitProxy {
|
||||
|
||||
private final int port;
|
||||
private final int port;
|
||||
|
||||
private final ExecutorService serverExec = Executors.newSingleThreadExecutor();
|
||||
private final ExecutorService serverExec = Executors.newSingleThreadExecutor();
|
||||
|
||||
private final ExecutorService socketExec = Executors.newCachedThreadPool();
|
||||
private final ExecutorService socketExec = Executors.newCachedThreadPool();
|
||||
|
||||
private volatile ServerSocket serverSocket;
|
||||
private volatile ServerSocket serverSocket;
|
||||
|
||||
public RabbitProxy() throws IOException {
|
||||
ServerSocket serverSocket = ServerSocketFactory.getDefault().createServerSocket(0);
|
||||
this.port = serverSocket.getLocalPort();
|
||||
serverSocket.close();
|
||||
}
|
||||
public RabbitProxy() throws IOException {
|
||||
ServerSocket serverSocket = ServerSocketFactory.getDefault().createServerSocket(0);
|
||||
this.port = serverSocket.getLocalPort();
|
||||
serverSocket.close();
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return this.port;
|
||||
}
|
||||
public int getPort() {
|
||||
return this.port;
|
||||
}
|
||||
|
||||
public void start() throws IOException {
|
||||
this.serverSocket = ServerSocketFactory.getDefault().createServerSocket(this.port);
|
||||
this.serverExec.execute(new Runnable() {
|
||||
public void start() throws IOException {
|
||||
this.serverSocket = ServerSocketFactory.getDefault().createServerSocket(this.port);
|
||||
this.serverExec.execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
while (true) {
|
||||
final Socket socket = serverSocket.accept();
|
||||
socketExec.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
while (true) {
|
||||
final Socket socket = serverSocket.accept();
|
||||
socketExec.execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final Socket rabbitSocket = SocketFactory.getDefault().createSocket("localhost",
|
||||
5672);
|
||||
socketExec.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final Socket rabbitSocket = SocketFactory.getDefault().createSocket("localhost",
|
||||
5672);
|
||||
socketExec.execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
InputStream is = rabbitSocket.getInputStream();
|
||||
OutputStream os = socket.getOutputStream();
|
||||
int c;
|
||||
while ((c = is.read()) >= 0) {
|
||||
os.write(c);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
try {
|
||||
socket.close();
|
||||
rabbitSocket.close();
|
||||
}
|
||||
catch (IOException e1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
InputStream is = socket.getInputStream();
|
||||
OutputStream os = rabbitSocket.getOutputStream();
|
||||
int c;
|
||||
while ((c = is.read()) >= 0) {
|
||||
os.write(c);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
try {
|
||||
socket.close();
|
||||
}
|
||||
catch (IOException e1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
InputStream is = rabbitSocket.getInputStream();
|
||||
OutputStream os = socket.getOutputStream();
|
||||
int c;
|
||||
while ((c = is.read()) >= 0) {
|
||||
os.write(c);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
try {
|
||||
socket.close();
|
||||
rabbitSocket.close();
|
||||
}
|
||||
catch (IOException e1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
InputStream is = socket.getInputStream();
|
||||
OutputStream os = rabbitSocket.getOutputStream();
|
||||
int c;
|
||||
while ((c = is.read()) >= 0) {
|
||||
os.write(c);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
try {
|
||||
socket.close();
|
||||
}
|
||||
catch (IOException e1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
try {
|
||||
serverSocket.close();
|
||||
}
|
||||
catch (IOException e1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
try {
|
||||
serverSocket.close();
|
||||
}
|
||||
catch (IOException e1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void stop() throws IOException {
|
||||
this.serverSocket.close();
|
||||
}
|
||||
public void stop() throws IOException {
|
||||
this.serverSocket.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user