Upgrade to Reactor 3.0 and start building against SI 5.0 snapshots

Closes gh-7301
See gh-7029
pull/7306/head
Andy Wilkinson 8 years ago
parent f7618cb421
commit 4486d2d209

@ -105,11 +105,6 @@
<artifactId>cache-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.projectreactor.spring</groupId>
<artifactId>reactor-spring-context</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.searchbox</groupId>
<artifactId>jest</artifactId>
@ -645,6 +640,11 @@
<artifactId>transactions-jms</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>

@ -1,54 +0,0 @@
/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.reactor;
import reactor.Environment;
import reactor.bus.EventBus;
import reactor.spring.context.config.EnableReactor;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Reactor.
*
* @author Dave Syer
*/
@Configuration
@ConditionalOnClass({ EnableReactor.class, Environment.class })
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
public class ReactorAutoConfiguration {
@Bean
@ConditionalOnMissingBean(EventBus.class)
public EventBus eventBus(Environment environment) {
return EventBus.create(environment);
}
@Configuration
@ConditionalOnMissingBean(Environment.class)
@EnableReactor
protected static class ReactorConfiguration {
}
}

@ -1,20 +0,0 @@
/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Auto-configuration for Project Reactor.
*/
package org.springframework.boot.autoconfigure.reactor;

@ -72,7 +72,6 @@ org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfigura
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\
org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration,\
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\
org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration,\
org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration,\
org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfiguration,\
org.springframework.boot.autoconfigure.security.FallbackWebSecurityAutoConfiguration,\

@ -1,73 +0,0 @@
/*
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.reactor;
import org.junit.Test;
import reactor.bus.EventBus;
import reactor.core.Dispatcher;
import reactor.core.dispatch.MpscDispatcher;
import reactor.core.dispatch.RingBufferDispatcher;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link ReactorAutoConfiguration}.
*
* @author Dave Syer
* @author Andy Wilkinson
*/
public class ReactorAutoConfigurationTests {
private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@Test
public void eventBusIsAvailable() {
this.context.register(ReactorAutoConfiguration.class);
this.context.refresh();
EventBus eventBus = this.context.getBean(EventBus.class);
assertThat(eventBus.getDispatcher()).isInstanceOf(RingBufferDispatcher.class);
this.context.close();
}
@Test
public void customEventBus() {
this.context.register(TestConfiguration.class, ReactorAutoConfiguration.class);
this.context.refresh();
EventBus eventBus = this.context.getBean(EventBus.class);
assertThat(eventBus.getDispatcher()).isInstanceOf(MpscDispatcher.class);
this.context.close();
}
@Configuration
protected static class TestConfiguration {
@Bean(destroyMethod = "shutdown")
public Dispatcher dispatcher() {
return new MpscDispatcher("test");
}
@Bean
public EventBus customEventBus() {
return EventBus.create(dispatcher());
}
}
}

@ -1,48 +0,0 @@
package org.test
import java.util.concurrent.CountDownLatch
@EnableReactor
@Log
class Runner implements CommandLineRunner {
@Autowired
EventBus eventBus
private CountDownLatch latch = new CountDownLatch(1)
@PostConstruct
void init() {
log.info "Registering consumer"
}
void run(String... args) {
eventBus.notify("hello", Event.wrap("Phil"))
log.info "Notified Phil"
latch.await()
}
@Bean
CountDownLatch latch() {
latch
}
}
@Consumer
@Log
class Greeter {
@Autowired
EventBus eventBus
@Autowired
private CountDownLatch latch
@Selector(value="hello")
void receive(String data) {
log.info "Hello ${data}"
latch.countDown()
}
}

@ -1,60 +0,0 @@
/*
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.cli.compiler.autoconfigure;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.control.customizers.ImportCustomizer;
import org.springframework.boot.cli.compiler.AstUtils;
import org.springframework.boot.cli.compiler.CompilerAutoConfiguration;
import org.springframework.boot.cli.compiler.DependencyCustomizer;
/**
* {@link CompilerAutoConfiguration} for the Reactor.
*
* @author Dave Syer
*/
public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration {
@Override
public boolean matches(ClassNode classNode) {
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableReactor")
|| AstUtils.hasAtLeastOneFieldOrMethod(classNode, "EventBus");
}
@Override
public void applyDependencies(DependencyCustomizer dependencies) {
dependencies.ifAnyMissingClasses("reactor.bus.EventBus")
.add("reactor-spring-context", false).add("reactor-spring-core", false)
.add("reactor-bus").add("reactor-stream");
}
@Override
public void applyImports(ImportCustomizer imports) {
imports.addImports("reactor.bus.Bus", "reactor.bus.Event", "reactor.bus.EventBus",
"reactor.fn.Function", "reactor.fn.Functions", "reactor.fn.Predicate",
"reactor.fn.Predicates", "reactor.fn.Supplier", "reactor.fn.Suppliers",
"reactor.spring.context.annotation.Consumer",
"reactor.spring.context.annotation.ReplyTo",
"reactor.spring.context.annotation.Selector",
"reactor.spring.context.annotation.SelectorType",
"reactor.spring.context.config.EnableReactor")
.addStarImports("reactor.bus.selector.Selectors")
.addImport("ReactorEnvironment", "reactor.Environment");
}
}

@ -3,7 +3,6 @@ org.springframework.boot.cli.compiler.autoconfigure.GroovyTemplatesCompilerAutoC
org.springframework.boot.cli.compiler.autoconfigure.SpringMvcCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.SpringBatchCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.RabbitCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.ReactorCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.CachingCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.JdbcCompilerAutoConfiguration
org.springframework.boot.cli.compiler.autoconfigure.JmsCompilerAutoConfiguration

@ -78,17 +78,6 @@ public class SampleIntegrationTests {
assertThat(output).contains("security.oauth2.client.secret =");
}
@Test
public void reactorSample() throws Exception {
String output = this.cli.run("reactor.groovy", "Phil");
int count = 0;
while (!output.contains("Hello Phil") && count++ < 5) {
Thread.sleep(200);
output = this.cli.getOutput();
}
assertThat(output).contains("Hello Phil");
}
@Test
public void jobWebSample() throws Exception {
String output = this.cli.run("job.groovy", "web.groovy", "foo=bar");

@ -96,7 +96,7 @@ public class TestCommandIntegrationTests {
@Test
public void integrationAutoConfigTest() throws Exception {
String output = this.cli.test("integration_auto_test.groovy", "reactor.groovy");
String output = this.cli.test("integration_auto_test.groovy", "jms.groovy");
assertThat(output).contains("OK (1 test)");
}

@ -1,12 +1,14 @@
@SpringBootTest(classes=ReactorApplication, webEnvironment=WebEnvironment.RANDOM_PORT)
class RestTests {
import org.springframework.jms.core.JmsTemplate
@SpringBootTest(classes=JmsExample)
class JmsTests {
@Autowired
EventBus eventBus
JmsTemplate jmsTemplate
@Test
void test() {
assertNotNull(eventBus)
assertNotNull(jmsTemplate)
}
}

@ -0,0 +1,31 @@
@Grab("spring-boot-starter-artemis")
@Grab("artemis-jms-server")
import java.util.concurrent.CountDownLatch
@Log
@Configuration
@EnableJms
class JmsExample implements CommandLineRunner {
private CountDownLatch latch = new CountDownLatch(1)
@Autowired
JmsTemplate jmsTemplate
void run(String... args) {
def messageCreator = { session ->
session.createObjectMessage("Greetings from Spring Boot via Artemis")
} as MessageCreator
log.info "Sending JMS message..."
jmsTemplate.send("spring-boot", messageCreator)
log.info "Send JMS message, waiting..."
latch.await()
}
@JmsListener(destination = 'spring-boot')
def receive(String message) {
log.info "Received ${message}"
latch.countDown()
}
}

@ -1,4 +0,0 @@
@Configuration
@EnableReactor
class ReactorApplication {
}

@ -134,8 +134,7 @@
<neo4j-ogm.version>2.0.5</neo4j-ogm.version>
<postgresql.version>9.4.1212.jre7</postgresql.version>
<querydsl.version>4.1.4</querydsl.version>
<reactor.version>2.0.8.RELEASE</reactor.version>
<reactor-spring.version>2.0.7.RELEASE</reactor-spring.version>
<reactor.version>3.0.3.RELEASE</reactor.version>
<selenium.version>2.53.1</selenium.version>
<sendgrid.version>2.2.2</sendgrid.version>
<servlet-api.version>3.1.0</servlet-api.version>
@ -150,8 +149,7 @@
<spring-batch.version>3.0.7.RELEASE</spring-batch.version>
<spring-data-releasetrain.version>Ingalls-M1</spring-data-releasetrain.version>
<spring-hateoas.version>0.21.0.RELEASE</spring-hateoas.version>
<spring-integration.version>4.3.5.BUILD-SNAPSHOT</spring-integration.version>
<spring-integration-java-dsl.version>1.2.0.RELEASE</spring-integration-java-dsl.version>
<spring-integration.version>5.0.0.BUILD-SNAPSHOT</spring-integration.version>
<spring-loaded.version>1.2.6.RELEASE</spring-loaded.version>
<spring-mobile.version>1.1.5.RELEASE</spring-mobile.version>
<spring-plugin.version>1.2.0.RELEASE</spring-plugin.version>
@ -862,61 +860,11 @@
<artifactId>metrics-servlets</artifactId>
<version>${dropwizard-metrics.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-bus</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-groovy</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-groovy-extensions</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-logback</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-net</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-stream</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor.spring</groupId>
<artifactId>reactor-spring-context</artifactId>
<version>${reactor-spring.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor.spring</groupId>
<artifactId>reactor-spring-core</artifactId>
<version>${reactor-spring.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor.spring</groupId>
<artifactId>reactor-spring-messaging</artifactId>
<version>${reactor-spring.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor.spring</groupId>
<artifactId>reactor-spring-webmvc</artifactId>
<version>${reactor-spring.version}</version>
</dependency>
<dependency>
<groupId>io.searchbox</groupId>
<artifactId>jest</artifactId>
@ -2088,11 +2036,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-java-dsl</artifactId>
<version>${spring-integration-java-dsl.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.mobile</groupId>
<artifactId>spring-mobile-device</artifactId>

@ -162,11 +162,6 @@
<artifactId>metrics-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.projectreactor.spring</groupId>
<artifactId>reactor-spring-context</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-servlet</artifactId>

@ -17,6 +17,7 @@
package sample.integration;
import java.io.File;
import java.util.function.Consumer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -25,9 +26,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.Pollers;
import org.springframework.integration.dsl.SourcePollingChannelAdapterSpec;
import org.springframework.integration.dsl.core.Pollers;
import org.springframework.integration.dsl.support.Consumer;
import org.springframework.integration.file.FileReadingMessageSource;
import org.springframework.integration.file.FileWritingMessageHandler;

@ -17,6 +17,7 @@
package sample.parent;
import java.io.File;
import java.util.function.Consumer;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -26,9 +27,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.Pollers;
import org.springframework.integration.dsl.SourcePollingChannelAdapterSpec;
import org.springframework.integration.dsl.core.Pollers;
import org.springframework.integration.dsl.support.Consumer;
import org.springframework.integration.file.FileReadingMessageSource;
import org.springframework.integration.file.FileWritingMessageHandler;

@ -88,7 +88,7 @@ public class SampleIntegrationParentApplicationTests {
private Resource[] findResources() throws IOException {
return ResourcePatternUtils
.getResourcePatternResolver(new DefaultResourceLoader())
.getResources("file:target/output/**/*.msg");
.getResources("file:target/output/*.txt");
}
private String readResources(Resource[] resources) throws IOException {

@ -30,10 +30,6 @@
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-java-dsl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jmx</artifactId>

Loading…
Cancel
Save