Commit ee7c86a0 authored by Andy Wilkinson's avatar Andy Wilkinson

Start building against Reactor 2.0.1 snapshots

See gh-2719
parent 681894a1
...@@ -80,6 +80,11 @@ ...@@ -80,6 +80,11 @@
<artifactId>cache-api</artifactId> <artifactId>cache-api</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>io.projectreactor.spring</groupId>
<artifactId>reactor-spring-context</artifactId>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>org.flywaydb</groupId> <groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId> <artifactId>flyway-core</artifactId>
...@@ -415,11 +420,6 @@ ...@@ -415,11 +420,6 @@
<artifactId>thymeleaf-extras-springsecurity4</artifactId> <artifactId>thymeleaf-extras-springsecurity4</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>org.projectreactor.spring</groupId>
<artifactId>reactor-spring-context</artifactId>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>javax.jms</groupId> <groupId>javax.jms</groupId>
<artifactId>jms-api</artifactId> <artifactId>jms-api</artifactId>
......
...@@ -24,8 +24,8 @@ import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; ...@@ -24,8 +24,8 @@ import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import reactor.core.Environment; import reactor.Environment;
import reactor.core.Reactor; import reactor.bus.EventBus;
import reactor.spring.context.config.EnableReactor; import reactor.spring.context.config.EnableReactor;
/** /**
...@@ -39,15 +39,16 @@ import reactor.spring.context.config.EnableReactor; ...@@ -39,15 +39,16 @@ import reactor.spring.context.config.EnableReactor;
public class ReactorAutoConfiguration { public class ReactorAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(Reactor.class) @ConditionalOnMissingBean(EventBus.class)
public Reactor rootReactor(Environment environment) { public EventBus eventBus(Environment environment) {
return environment.getRootReactor(); return EventBus.create(environment);
} }
@Configuration @Configuration
@ConditionalOnMissingBean(Environment.class) @ConditionalOnMissingBean(Environment.class)
@EnableReactor @EnableReactor
protected static class ReactorConfiguration { protected static class ReactorConfiguration {
} }
} }
/* /*
* Copyright 2012-2014 the original author or authors. * Copyright 2012-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -21,43 +21,53 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext ...@@ -21,43 +21,53 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import reactor.core.Environment; import reactor.bus.EventBus;
import reactor.core.Reactor; import reactor.core.Dispatcher;
import reactor.core.spec.Reactors; import reactor.core.dispatch.MpscDispatcher;
import reactor.core.dispatch.RingBufferDispatcher;
import static org.junit.Assert.assertNotNull; import static org.hamcrest.Matchers.instanceOf;
import static org.junit.Assert.assertThat;
/** /**
* Tests for {@link ReactorAutoConfiguration}. * Tests for {@link ReactorAutoConfiguration}.
* *
* @author Dave Syer * @author Dave Syer
* @author Andy Wilkinson
*/ */
public class ReactorAutoConfigurationTests { public class ReactorAutoConfigurationTests {
private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
@Test @Test
public void reactorIsAvailable() { public void eventBusIsAvailable() {
this.context.register(ReactorAutoConfiguration.class); this.context.register(ReactorAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertNotNull(this.context.getBean(Reactor.class)); EventBus eventBus = this.context.getBean(EventBus.class);
assertThat(eventBus.getDispatcher(), instanceOf(RingBufferDispatcher.class));
this.context.close(); this.context.close();
} }
@Test @Test
public void customReactor() { public void customEventBus() {
this.context.register(TestConfiguration.class, ReactorAutoConfiguration.class); this.context.register(TestConfiguration.class, ReactorAutoConfiguration.class);
this.context.refresh(); this.context.refresh();
assertNotNull(this.context.getBean(Reactor.class)); EventBus eventBus = this.context.getBean(EventBus.class);
assertThat(eventBus.getDispatcher(), instanceOf(MpscDispatcher.class));
this.context.close(); this.context.close();
} }
@Configuration @Configuration
protected static class TestConfiguration { protected static class TestConfiguration {
@Bean(destroyMethod = "shutdown")
public Dispatcher dispatcher() {
return new MpscDispatcher("test");
}
@Bean @Bean
public Reactor reactor(Environment env) { public EventBus customEventBus() {
return Reactors.reactor().env(env).dispatcher(Environment.RING_BUFFER).get(); return EventBus.create(dispatcher());
} }
} }
......
...@@ -7,7 +7,7 @@ import java.util.concurrent.CountDownLatch ...@@ -7,7 +7,7 @@ import java.util.concurrent.CountDownLatch
class Runner implements CommandLineRunner { class Runner implements CommandLineRunner {
@Autowired @Autowired
Reactor reactor EventBus eventBus
private CountDownLatch latch = new CountDownLatch(1) private CountDownLatch latch = new CountDownLatch(1)
...@@ -17,7 +17,7 @@ class Runner implements CommandLineRunner { ...@@ -17,7 +17,7 @@ class Runner implements CommandLineRunner {
} }
void run(String... args) { void run(String... args) {
reactor.notify("hello", Event.wrap("Phil")) eventBus.notify("hello", Event.wrap("Phil"))
log.info "Notified Phil" log.info "Notified Phil"
latch.await() latch.await()
} }
...@@ -34,7 +34,7 @@ class Runner implements CommandLineRunner { ...@@ -34,7 +34,7 @@ class Runner implements CommandLineRunner {
class Greeter { class Greeter {
@Autowired @Autowired
Reactor reactor EventBus eventBus
@Autowired @Autowired
private CountDownLatch latch private CountDownLatch latch
......
...@@ -32,29 +32,28 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration ...@@ -32,29 +32,28 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration
@Override @Override
public boolean matches(ClassNode classNode) { public boolean matches(ClassNode classNode) {
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableReactor") return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableReactor")
|| AstUtils.hasAtLeastOneFieldOrMethod(classNode, "Reactor"); || AstUtils.hasAtLeastOneFieldOrMethod(classNode, "EventBus");
} }
@Override @Override
public void applyDependencies(DependencyCustomizer dependencies) { public void applyDependencies(DependencyCustomizer dependencies) {
dependencies.ifAnyMissingClasses("reactor.core.Reactor") dependencies.ifAnyMissingClasses("reactor.bus.EventBus")
.add("reactor-spring-context", false).add("reactor-spring-core", false) .add("reactor-spring-context", false).add("reactor-spring-core", false)
.add("reactor-core"); .add("reactor-bus").add("reactor-stream");
} }
@Override @Override
public void applyImports(ImportCustomizer imports) { public void applyImports(ImportCustomizer imports) {
imports.addImports("reactor.core.Reactor", "reactor.core.spec.Reactors", imports.addImports("reactor.bus.Bus", "reactor.bus.Event",
"reactor.core.Observable", "reactor.event.Event", "reactor.bus.EventBus", "reactor.fn.Function", "reactor.fn.Functions",
"reactor.function.Functions", "reactor.function.Predicates", "reactor.fn.Predicate", "reactor.fn.Predicates", "reactor.fn.Supplier",
"reactor.function.Suppliers", "reactor.fn.Suppliers", "reactor.spring.context.annotation.Consumer",
"reactor.spring.context.annotation.Consumer", "reactor.spring.context.annotation.ReplyTo",
"reactor.spring.context.annotation.Selector", "reactor.spring.context.annotation.Selector",
"reactor.spring.context.annotation.SelectorType", "reactor.spring.context.annotation.SelectorType",
"reactor.spring.context.annotation.ReplyTo",
"reactor.spring.context.config.EnableReactor") "reactor.spring.context.config.EnableReactor")
.addStarImports("reactor.event.selector.Selectors") .addStarImports("reactor.bus.selector.Selectors")
.addImport("ReactorEnvironment", "reactor.core.Environment"); .addImport("ReactorEnvironment", "reactor.Environment");
} }
} }
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
class RestTests { class RestTests {
@Autowired @Autowired
Reactor reactor EventBus eventBus
@Test @Test
void test() { void test() {
assertNotNull(reactor) assertNotNull(eventBus)
} }
} }
...@@ -110,8 +110,8 @@ ...@@ -110,8 +110,8 @@
<mysql.version>5.1.34</mysql.version> <mysql.version>5.1.34</mysql.version>
<nekohtml.version>1.9.21</nekohtml.version> <nekohtml.version>1.9.21</nekohtml.version>
<postgresql.version>9.4-1201-jdbc41</postgresql.version> <postgresql.version>9.4-1201-jdbc41</postgresql.version>
<reactor.version>1.1.6.RELEASE</reactor.version> <reactor.version>2.0.1.BUILD-SNAPSHOT</reactor.version>
<reactor-spring.version>1.1.3.RELEASE</reactor-spring.version> <reactor-spring.version>2.0.1.BUILD-SNAPSHOT</reactor-spring.version>
<sendgrid.version>2.1.0</sendgrid.version> <sendgrid.version>2.1.0</sendgrid.version>
<servlet-api.version>3.1.0</servlet-api.version> <servlet-api.version>3.1.0</servlet-api.version>
<simple-json.version>1.1.1</simple-json.version> <simple-json.version>1.1.1</simple-json.version>
...@@ -624,6 +624,61 @@ ...@@ -624,6 +624,61 @@
<artifactId>metrics-servlets</artifactId> <artifactId>metrics-servlets</artifactId>
<version>${dropwizard-metrics.version}</version> <version>${dropwizard-metrics.version}</version>
</dependency> </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> <dependency>
<groupId>io.undertow</groupId> <groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId> <artifactId>undertow-core</artifactId>
...@@ -1250,51 +1305,6 @@ ...@@ -1250,51 +1305,6 @@
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>${postgresql.version}</version> <version>${postgresql.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>org.projectreactor</groupId>
<artifactId>reactor-groovy</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>org.projectreactor</groupId>
<artifactId>reactor-groovy-extensions</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>org.projectreactor</groupId>
<artifactId>reactor-logback</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>org.projectreactor</groupId>
<artifactId>reactor-net</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>org.projectreactor.spring</groupId>
<artifactId>reactor-spring-context</artifactId>
<version>${reactor-spring.version}</version>
</dependency>
<dependency>
<groupId>org.projectreactor.spring</groupId>
<artifactId>reactor-spring-core</artifactId>
<version>${reactor-spring.version}</version>
</dependency>
<dependency>
<groupId>org.projectreactor.spring</groupId>
<artifactId>reactor-spring-messaging</artifactId>
<version>${reactor-spring.version}</version>
</dependency>
<dependency>
<groupId>org.projectreactor.spring</groupId>
<artifactId>reactor-spring-webmvc</artifactId>
<version>${reactor-spring.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId> <artifactId>jcl-over-slf4j</artifactId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment