Updated samples to use latest boot

Update integration tests to use latest stream paradigm
Update tests to be in compliance with 1.5.2.

resolves #289
This commit is contained in:
Glenn Renfro
2017-03-03 16:04:56 -05:00
committed by Michael Minella
parent 4dbc256a4c
commit 4e68adf5fa
13 changed files with 21 additions and 23 deletions

View File

@@ -27,6 +27,7 @@ import org.junit.After;
import org.junit.ClassRule;
import org.junit.Test;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.stream.annotation.EnableBinding;
@@ -189,7 +190,7 @@ public class BatchExecutionEventTests {
public static class ItemProcessListenerBinding {
@StreamListener(Sink.INPUT)
public void receive(Object object) {
public void receive(String object) {
itemProcessLatch.countDown();
}
}
@@ -200,7 +201,7 @@ public class BatchExecutionEventTests {
public static class ChunkEventsListenerBinding {
@StreamListener(Sink.INPUT)
public void receive(Object chunkContext) {
public void receive(ChunkContext chunkContext) {
chunkEventsLatch.countDown();
}
}
@@ -223,7 +224,7 @@ public class BatchExecutionEventTests {
private static final String SKIPPING_READ_MESSAGE = "Skipped when reading.";
private static final String SKIPPING_WRITE_CONTENT = "-1";
@StreamListener(Sink.INPUT)
public void receive(Object exceptionMessage) {
public void receive(String exceptionMessage) {
if(exceptionMessage.toString().equals(SKIPPING_READ_MESSAGE)){
readSkipCount++;
}
@@ -240,7 +241,7 @@ public class BatchExecutionEventTests {
public static class ItemWriteEventsListenerBinding {
@StreamListener(Sink.INPUT)
public void receive(Object itemWrite) {
public void receive(String itemWrite) {
assertTrue("Message should start with '3 items'", itemWrite.toString().startsWith("3 items "));
assertTrue("Message should end with ' written.'", itemWrite.toString().endsWith(" written."));
itemWriteEventsLatch.countDown();

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.5.2.RELEASE</version>
<relativePath />
</parent>

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.5.2.RELEASE</version>
<relativePath />
</parent>

View File

@@ -12,7 +12,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.5.2.RELEASE</version>
<relativePath />
</parent>

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.5.2.RELEASE</version>
<relativePath />
</parent>

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.5.2.RELEASE</version>
<relativePath />
</parent>

View File

@@ -23,14 +23,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.cloud.stream.test.binder.MessageCollector;
import org.springframework.cloud.task.launcher.TaskLaunchRequest;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import static org.hamcrest.CoreMatchers.is;
@@ -47,7 +44,6 @@ public class TaskProcessorApplicationTests {
private static final String DEFAULT_PAYLOAD = "hello";
@Autowired
@Bindings(TaskProcessor.class)
protected Processor channels;
@Autowired

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.5.2.RELEASE</version>
<relativePath />
</parent>

View File

@@ -24,16 +24,12 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.deployer.spi.task.LaunchState;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.task.launcher.TaskLaunchRequest;
import org.springframework.cloud.task.launcher.TaskLauncherSink;
import org.springframework.context.ApplicationContext;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.assertEquals;
@@ -50,7 +46,6 @@ public class TaskSinkApplicationTests {
ApplicationContext context;
@Autowired
@Bindings(TaskLauncherSink.class)
private Sink sink;
@Test
@@ -58,7 +53,7 @@ public class TaskSinkApplicationTests {
assertNotNull(this.sink.input());
TaskSinkConfiguration.TestTaskLauncher testTaskLauncher =
(TaskSinkConfiguration.TestTaskLauncher) context.getBean(TaskSinkConfiguration.TestTaskLauncher.class);
context.getBean(TaskSinkConfiguration.TestTaskLauncher.class);
Map<String, String> properties = new HashMap();
properties.put("server.port", "0");

View File

@@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.5.2.RELEASE</version>
<relativePath />
</parent>

View File

@@ -23,7 +23,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.OutputCapture;
import org.springframework.boot.test.rule.OutputCapture;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

View File

@@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.EnvironmentTestUtils;
import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;

View File

@@ -19,6 +19,7 @@ package org.springframework.cloud.task.launcher.configuration;
import java.util.List;
import org.springframework.cloud.deployer.spi.core.AppDeploymentRequest;
import org.springframework.cloud.deployer.spi.core.RuntimeEnvironmentInfo;
import org.springframework.cloud.deployer.spi.task.LaunchState;
import org.springframework.cloud.deployer.spi.task.TaskLauncher;
import org.springframework.cloud.deployer.spi.task.TaskStatus;
@@ -75,6 +76,11 @@ public class TaskConfiguration {
throw new UnsupportedOperationException("Destroy is not supported");
}
@Override
public RuntimeEnvironmentInfo environmentInfo() {
throw new UnsupportedOperationException("environmentInfo is not supported");
}
public List<String> getCommandlineArguments() {
return commandlineArguments;
}