Pull request changes done

This commit is contained in:
Jose Carvajal 2017-10-11 12:11:38 +02:00
parent 57a993de64
commit e8979a4033
5 changed files with 70 additions and 75 deletions

View File

@ -1,70 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.baeldung</groupId> <groupId>org.baeldung</groupId>
<artifactId>spring-cloud-stream</artifactId> <artifactId>spring-cloud-stream</artifactId>
<modules> <modules>
<module>spring-cloud-stream-rabbit</module> <module>spring-cloud-stream-rabbit</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>spring-cloud-stream</name> <name>spring-cloud-stream</name>
<parent> <parent>
<groupId>com.baeldung.spring.cloud</groupId> <groupId>com.baeldung.spring.cloud</groupId>
<artifactId>spring-cloud</artifactId> <artifactId>spring-cloud</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
</parent> </parent>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version> <maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId> <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
<version>${spring-cloud-stream.version}</version> <version>${spring-cloud-stream.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId> <artifactId>spring-cloud-stream</artifactId>
<version>${spring-cloud-stream.version}</version> <version>${spring-cloud-stream.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-test-support</artifactId> <artifactId>spring-cloud-stream-test-support</artifactId>
<version>${spring-cloud-stream.version}</version> <version>${spring-cloud-stream.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<build> <build>
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version> <version>${maven-compiler-plugin.version}</version>
<configuration> <configuration>
<source>1.8</source> <source>1.8</source>
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot-maven-plugin.version}</version> <version>${spring-boot-maven-plugin.version}</version>
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
</project> </project>

View File

@ -17,17 +17,16 @@
</parent> </parent>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-stream-rabbit</artifactId> <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-test-support</artifactId> <artifactId>spring-cloud-stream-test-support</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -26,13 +26,13 @@ public class MultipleOutputsServiceApplicationTests {
private MessageCollector messageCollector; private MessageCollector messageCollector;
@Test @Test
public void shouldReceiveMessageInAnOutput() { public void whenSendMessage_thenResponseIsInAOutput() {
whenSendMessage(1); whenSendMessage(1);
thenPayloadInChannelIs(pipe.anOutput(), 1); thenPayloadInChannelIs(pipe.anOutput(), 1);
} }
@Test @Test
public void shouldReceiveMessageInAnAnotherOutput() { public void whenSendMessage_thenResponseIsInAnotherOutput() {
whenSendMessage(11); whenSendMessage(11);
thenPayloadInChannelIs(pipe.anotherOutput(), 11); thenPayloadInChannelIs(pipe.anotherOutput(), 11);
} }

View File

@ -26,13 +26,13 @@ public class MultipleOutputsWithConditionsServiceApplicationTests {
private MessageCollector messageCollector; private MessageCollector messageCollector;
@Test @Test
public void shouldReceiveMessageInAnOutput() { public void whenSendMessage_thenResponseIsInAOutput() {
whenSendMessage(1); whenSendMessage(1);
thenPayloadInChannelIs(pipe.anotherOutput(), 1); thenPayloadInChannelIs(pipe.anotherOutput(), 1);
} }
@Test @Test
public void shouldReceiveMessageInAnAnotherOutput() { public void whenSendMessage_thenResponseIsInAnotherOutput() {
whenSendMessage(11); whenSendMessage(11);
thenPayloadInChannelIs(pipe.anotherOutput(), 11); thenPayloadInChannelIs(pipe.anotherOutput(), 11);
} }

View File

@ -12,7 +12,6 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.baeldung.spring.cloud.stream.rabbit.MyLoggerServiceApplication;
import com.baeldung.spring.cloud.stream.rabbit.model.LogMessage; import com.baeldung.spring.cloud.stream.rabbit.model.LogMessage;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ -27,18 +26,15 @@ public class MyLoggerApplicationTests {
private MessageCollector messageCollector; private MessageCollector messageCollector;
@Test @Test
public void shouldEnrichMessage() { public void whenSendMessage_thenResponseShouldUpdateText() {
// Send message
pipe.input() pipe.input()
.send(MessageBuilder.withPayload(new LogMessage("This is my message")) .send(MessageBuilder.withPayload(new LogMessage("This is my message"))
.build()); .build());
// Get response from the service
Object payload = messageCollector.forChannel(pipe.output()) Object payload = messageCollector.forChannel(pipe.output())
.poll() .poll()
.getPayload(); .getPayload();
// Assert
assertEquals("[1]: This is my message", payload.toString()); assertEquals("[1]: This is my message", payload.toString());
} }
} }